* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  color: #e8f6ff;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  /* pegboard dots on top of a dark wall */
  background:
    radial-gradient(circle, #000 2px, transparent 3px) 0 0 / 34px 34px,
    radial-gradient(ellipse at 75% 40%, #2b1b5e 0%, transparent 60%),
    radial-gradient(ellipse at 15% 85%, #07405a 0%, transparent 55%),
    #10101f;
}

[hidden] { display: none !important; }

#menuScreen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tools {
  width: min(620px, 90vw);
  height: auto;
  margin-top: 18px;
  fill: none;
  stroke: #35e0ff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.55;
  filter: drop-shadow(0 0 6px #35e0ff);
}

main {
  flex: 1;
  width: min(1200px, 96vw);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 20px 0 30px;
}

.menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 420px;
  max-width: 100%;
}

h1 { font-size: 76px; letter-spacing: 4px; white-space: nowrap; }
.pink { color: #ffd9f6; text-shadow: 0 0 8px #ff3fd0, 0 0 24px #ff3fd0, 0 0 48px #ff3fd0; }
.blue { color: #dcfaff; text-shadow: 0 0 8px #35e0ff, 0 0 24px #35e0ff, 0 0 48px #35e0ff; }

.tagline { font-size: 20px; color: #ffd48a; margin-bottom: 14px; }

.btn {
  width: 280px;
  padding: 14px;
  font: bold 20px "Trebuchet MS", "Segoe UI", sans-serif;
  color: #e8f6ff;
  background: rgba(16, 16, 40, 0.85);
  border: 3px solid #35e0ff;
  border-radius: 14px;
  box-shadow: 0 0 12px rgba(53, 224, 255, 0.5), inset 0 0 12px rgba(53, 224, 255, 0.2);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.btn:hover, .btn:focus-visible {
  transform: scale(1.06);
  box-shadow: 0 0 24px #35e0ff, inset 0 0 18px rgba(53, 224, 255, 0.4);
  outline: none;
}
.btn:active { transform: scale(0.97); }

.btn.big {
  width: 330px;
  padding: 20px;
  font-size: 26px;
  border-color: #ff3fd0;
  box-shadow: 0 0 16px rgba(255, 63, 208, 0.6), inset 0 0 14px rgba(255, 63, 208, 0.25);
}
.btn.big:hover, .btn.big:focus-visible {
  box-shadow: 0 0 30px #ff3fd0, inset 0 0 20px rgba(255, 63, 208, 0.45);
}

.bench { width: 560px; max-width: 100%; text-align: center; }

#printer { display: block; width: 100%; height: auto; cursor: pointer; }

/* wooden workbench the printer sits on */
.wood {
  height: 34px;
  margin-top: -12px;
  border-radius: 8px;
  background:
    repeating-linear-gradient(92deg, transparent 0 46px, rgba(0, 0, 0, 0.18) 46px 49px),
    linear-gradient(#c98a4b, #8a5528);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6), inset 0 3px 0 #e8b377;
}

.status { margin-top: 14px; font-size: 18px; color: #7dffb2; text-shadow: 0 0 8px #1fd873; }

dialog {
  margin: auto;
  width: min(440px, 92vw);
  padding: 28px;
  text-align: center;
  color: #e8f6ff;
  background: #17172e;
  border: 3px solid #ff3fd0;
  border-radius: 18px;
  box-shadow: 0 0 40px rgba(255, 63, 208, 0.6);
}
dialog::backdrop { background: rgba(5, 5, 15, 0.75); }
dialog h2 { margin-bottom: 14px; color: #ffd48a; }
dialog p, dialog ol { font-size: 18px; line-height: 1.5; margin-bottom: 18px; }
dialog ol { text-align: left; padding-left: 26px; }
dialog .small { font-size: 15px; color: #9fd8ea; }

/* ---------- Design Room ---------- */
#room { height: 100vh; display: flex; flex-direction: column; gap: 12px; padding: 12px; }

.topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.btn.small { width: auto; padding: 10px 22px; font-size: 18px; }
.btn.hot { border-color: #ff3fd0; box-shadow: 0 0 16px rgba(255, 63, 208, 0.7); }
.btn:disabled, .tab:disabled, .chip:disabled { opacity: 0.4; cursor: default; }

.tabs { display: flex; gap: 8px; }
.tab, .chip {
  font: bold 15px "Trebuchet MS", "Segoe UI", sans-serif;
  color: #e8f6ff;
  background: #1c1c38;
  border: 2px solid #55558c;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
}
.tab { font-size: 18px; padding: 10px 20px; }
.tab.on { border-color: #35e0ff; box-shadow: 0 0 14px #35e0ff; }
.chip:hover { border-color: #35e0ff; }
.chip.on { border-color: #ffd93d; box-shadow: 0 0 10px #ffd93d; }
.chip.wide { display: block; width: 100%; margin-top: 10px; }

.workarea { flex: 1; min-height: 0; display: flex; gap: 12px; }

.panel {
  width: 330px;
  overflow-y: auto;
  padding: 14px;
  background: rgba(20, 20, 44, 0.92);
  border: 2px solid #35e0ff;
  border-radius: 14px;
}
.panel p { line-height: 1.4; margin-bottom: 8px; }
.panel label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
.panel input[type="range"] { width: 190px; accent-color: #ff3fd0; }
.panel input[type="text"] { flex: 1; min-width: 0; padding: 8px; font-size: 16px; border-radius: 8px; border: 2px solid #35e0ff; }
.panel .note { color: #ffd48a; }
#message:empty { display: none; }
.panel progress { width: 100%; height: 22px; accent-color: #ff3fd0; }
#printPanel { text-align: center; }
#printPanel h2 { color: #ffd48a; margin-bottom: 12px; }

#profile {
  display: block;
  width: 100%;
  max-width: 290px;
  margin: 0 auto;
  background: #0d0d1d;
  border-radius: 10px;
  cursor: ew-resize;
  touch-action: none;
}

.row { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin: 10px 0; }
.swatch { width: 23px; height: 23px; border: 2px solid #fff; border-radius: 50%; cursor: pointer; }
.swatch:hover { transform: scale(1.2); }

.stage {
  flex: 1;
  min-width: 0;
  position: relative;
  border: 2px solid #ff3fd0;
  border-radius: 14px;
  background: radial-gradient(ellipse at 50% 40%, #35246e, #0d0d1d 75%);
  overflow: hidden;
}
#view { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.stage p { position: absolute; bottom: 8px; width: 100%; text-align: center; font-size: 14px; color: #9fd8ea; pointer-events: none; }

#shelf { width: min(760px, 94vw); }
#shelfList { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 18px; }
.card { width: 200px; display: flex; flex-direction: column; gap: 6px; padding: 10px; background: #1f1f40; border-radius: 12px; border-bottom: 8px solid #a5693a; }
.card img { width: 100%; border-radius: 8px; background: #0d0d1d; }

@media (max-width: 760px) {
  #room { height: auto; }
  .workarea { flex-direction: column-reverse; }
  .panel { width: 100%; }
  .stage { flex: none; height: 60vh; }
}

/* ---------- Shape library and number boxes ---------- */
#adders { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 8px 0; }
.shape { display: flex; flex-direction: column; align-items: center; padding: 3px 0; font: bold 12px "Trebuchet MS", sans-serif; color: #e8f6ff; background: #1c1c38; border: 2px solid #55558c; border-radius: 10px; cursor: pointer; }
.shape:hover { border-color: #35e0ff; box-shadow: 0 0 10px #35e0ff; }
.shape img { width: 52px; height: 43px; pointer-events: none; }
.numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.panel .numbers label { margin: 4px 0; }
.numbers input { width: 76px; padding: 5px; font-size: 15px; color: #e8f6ff; background: #0d0d1d; border: 2px solid #55558c; border-radius: 8px; }

/* ---------- Tinkercad-style handles ---------- */
#handles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.handle { position: absolute; left: 0; top: 0; pointer-events: auto; touch-action: none; cursor: grab; box-shadow: 0 0 6px #000; }
.handle.corner { width: 15px; height: 15px; background: #fff; border: 3px solid #22222c; }
.handle.side { width: 14px; height: 14px; background: #22222c; border: 3px solid #fff; border-radius: 50%; }
.handle.top { width: 17px; height: 17px; background: #fff; border: 4px solid #ff3fd0; border-radius: 50%; cursor: ns-resize; }
.handle.lift { width: 20px; height: 22px; background: #fff; clip-path: polygon(50% 0, 100% 100%, 0 100%); cursor: ns-resize; }
.handle.turn, .handle.tip, .handle.roll { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: bold; color: #10101f; border-radius: 50%; }
.handle.turn { background: #4cd97b; }
.handle.tip { background: #ff7a7a; }
.handle.roll { background: #6fb4ff; }
.handle:hover { filter: brightness(1.2) drop-shadow(0 0 6px #35e0ff); }
#measure { position: absolute; padding: 4px 10px; font-weight: bold; color: #10101f; background: #ffd93d; border-radius: 8px; pointer-events: none; white-space: nowrap; }
.viewbuttons { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; }
.stage.printing .viewbuttons, .stage.printing #stageHint { display: none; }
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---------- Robo Maker ---------- */
.robot { width: 90px; height: 70px; margin: 6px auto 16px; position: relative; background: #35e0ff; border-radius: 18px; box-shadow: 0 0 20px #35e0ff; }
.robot::before { content: ""; position: absolute; left: 42px; top: -14px; width: 6px; height: 14px; background: #ff3fd0; box-shadow: 0 0 10px #ff3fd0; }
.robot i { position: absolute; top: 24px; width: 18px; height: 18px; background: #10101f; border-radius: 50%; animation: blink 3s infinite; }
.robot i:first-child { left: 18px; }
.robot i:last-child { right: 18px; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(0.1); } }
#roboText { width: 100%; padding: 10px; font-size: 16px; border-radius: 8px; border: 2px solid #35e0ff; }
details { margin-top: 12px; color: #9fd8ea; }
summary { cursor: pointer; margin-bottom: 6px; }

/* ---------- Design card ---------- */
#card { width: 150px; margin: 6px auto 10px; padding: 10px 10px 8px; background: linear-gradient(#ffd93d, #ff9f43); color: #10101f; font-weight: bold; border-radius: 8px 28px 8px 8px; box-shadow: 0 0 20px rgba(255, 217, 61, 0.7); cursor: grab; touch-action: none; user-select: none; animation: wiggle 1.6s ease-in-out infinite; }
#card img { display: block; width: 100%; background: #10101f; border-radius: 6px 18px 6px 6px; pointer-events: none; }
#card.held { position: fixed; z-index: 20; margin: 0; cursor: grabbing; animation: none; transform: scale(0.65); opacity: 0.92; }
#card.close { box-shadow: 0 0 30px 8px #4cd97b; }
#card.inserting { transform: scale(0.35, 0.02); opacity: 0.4; transition: all 0.65s ease-in; }
@keyframes wiggle { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg) translateY(-4px); } }

/* ---------- Filament spools ---------- */
#filaments { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.spool { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font: bold 12px "Trebuchet MS", sans-serif; color: #e8f6ff; background: #1c1c38; border: 2px solid #55558c; border-radius: 10px; cursor: pointer; }
.spool i { width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5); }
.spool:hover { border-color: #35e0ff; }
.spool.on { border-color: #ffd93d; box-shadow: 0 0 10px #ffd93d; }

/* ---------- Trophy Room ---------- */
#trophy { position: fixed; inset: 0; }
#trophyView { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#leaveTrophy { position: absolute; top: 14px; left: 14px; }
#trophyCount { position: absolute; top: 22px; right: 20px; font-size: 20px; color: #ffd48a; text-shadow: 0 0 8px #000; }
#nameplate { position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%); padding: 10px 26px; font-size: 24px; font-weight: bold; color: #ffd48a; background: rgba(16, 16, 40, 0.9); border: 3px solid #ff3fd0; border-radius: 14px; white-space: nowrap; }
#trashPanel { position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%); width: min(380px, 92vw); padding: 14px; text-align: center; background: rgba(16, 16, 40, 0.95); border: 3px solid #ff3fd0; border-radius: 14px; }
#trashPanel p { margin-bottom: 12px; font-size: 20px; color: #ffd48a; }
#trashPanel .chip { margin: 0 6px; }
#decorBtn { position: absolute; top: 14px; left: 150px; }
#decorPanel { position: absolute; top: 72px; left: 14px; bottom: 52px; width: min(330px, 92vw); overflow-y: auto; padding: 14px; background: rgba(16, 16, 40, 0.94); border: 3px solid #35e0ff; border-radius: 14px; }
#decorPanel b { display: block; text-align: center; color: #ffd48a; }
#decorPanel .row { margin: 6px 0 12px; }
#decorPanel .chip { padding: 6px 10px; font-size: 14px; }
.walkhint { position: absolute; bottom: 16px; width: 100%; text-align: center; font-size: 15px; text-shadow: 0 0 6px #000; pointer-events: none; }
