:root {
  --ink: #1c1917;
  --muted: #78716c;
  --paper: #fff7ed;
  --card: #fffdf8;
  --line: #f5d0a9;
  --chalk: #14532d;
  --chalk-2: #166534;
  --sun: #f59e0b;
  --coral: #ea580c;
  --sky: #0284c7;
  --rose: #e11d48;
  --good: #15803d;
  --shadow: 0 12px 40px rgba(28, 25, 23, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Nunito, system-ui, sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, #fed7aa 0%, transparent 50%),
    radial-gradient(900px 400px at 100% 0%, #bbf7d0 0%, transparent 45%),
    var(--paper);
  color: var(--ink);
}
h1, h2, h3, .brand { font-family: Fraunces, Georgia, serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: var(--chalk);
  color: #ecfccb;
}
.brand { font-size: 1.25rem; margin: 0; letter-spacing: -0.02em; }
.brand span { color: #fbbf24; }
.who { font-size: 0.9rem; opacity: 0.9; display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.hero { margin: 1.5rem 0 2rem; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); margin: 0 0 0.4rem; }
.hero p { margin: 0; color: var(--muted); font-size: 1.05rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 0.6rem; }
.muted { color: var(--muted); }
.row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 0.7rem; }

label { font-weight: 800; font-size: 0.85rem; }
input, textarea, select {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 3px solid #fdba74;
  border-color: var(--coral);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font-weight: 800;
  background: #e7e5e4;
  color: var(--ink);
}
.btn-primary { background: var(--coral); color: white; }
.btn-teacher { background: var(--chalk-2); color: #ecfccb; }
.btn-student { background: var(--sky); color: white; }
.btn-danger { background: var(--rose); color: white; }
.btn-ghost { background: transparent; border: 2px solid currentColor; }
.btn-sun { background: var(--sun); color: #1c1917; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #ffedd5;
  color: #9a3412;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 800;
}
.pill-live { background: #dcfce7; color: #166534; }
.pill-wait { background: #e0f2fe; color: #075985; }

.class-card { cursor: pointer; transition: transform 0.15s ease; }
.class-card:hover { transform: translateY(-2px); }
.class-card h3 { margin-bottom: 0.25rem; }

.err {
  background: #fff1f2;
  color: #9f1239;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
}
.ok {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
}

.token-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  background: #1c1917;
  color: #fef3c7;
  padding: 0.8rem;
  border-radius: 12px;
  overflow-wrap: anywhere;
  user-select: all;
}

.classroom {
  min-height: 100vh;
  background: #0f172a;
  color: #e2e8f0;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.classroom .topbar { background: #052e16; }
.stage {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 340px);
  min-height: 0;
}
@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; }
}
.main-stage { position: relative; min-height: 420px; padding: 0.75rem; }
.side {
  background: #111827;
  border-left: 1px solid #1f2937;
  padding: 0.9rem;
  overflow: auto;
}
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}
.tile { position: relative; background: #1e293b; border-radius: 12px; overflow: hidden; }
.tile video { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: #0b1220; display: block; }
.tile .label {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(0,0,0,.6); padding: 2px 8px; border-radius: 6px; font-size: 12px;
}

.screen-overlay {
  position: absolute;
  inset: 0.75rem;
  background: #fff7ed;
  color: var(--ink);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
  z-index: 3;
}
.screen-overlay.hidden { display: none; }
.notes-chrome, .game-chrome {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--chalk);
  color: #ecfccb;
}
.notes-page {
  flex: 1;
  margin: 1rem;
  padding: 1.5rem 1.75rem;
  background: #fffef9;
  border-radius: 12px;
  border: 1px solid #fed7aa;
  overflow: auto;
  font-size: 1.25rem;
  line-height: 1.55;
  white-space: pre-wrap;
}
.notes-nav, .game-nav {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.75rem;
  background: #ffedd5;
}
.page-ind { font-weight: 800; color: #fde68a; }

.side h3 { margin: 0 0 0.6rem; color: #fde68a; font-size: 1rem; }
.side .card { background: #1f2937; border-color: #374151; color: #e5e7eb; box-shadow: none; }
.side label { color: #fdba74; }
.tabs { display: flex; gap: 0.35rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.tab {
  background: #1f2937;
  color: #e5e7eb;
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-weight: 800;
}
.tab.on { background: #f59e0b; color: #1c1917; }

.game-root { flex: 1; padding: 1rem; overflow: auto; background: #fff7ed; color: var(--ink); }
.game-hud { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.game-prompt { font-size: 1.4rem; font-weight: 800; margin: 0.4rem 0 1rem; font-family: Fraunces, serif; }
.choices { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; }
.choice {
  min-width: 72px;
  min-height: 72px;
  font-size: 1.4rem;
  font-weight: 800;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 0 #fdba74;
}
.choice:active { transform: translateY(3px); box-shadow: 0 3px 0 #fdba74; }
.choice.correct { background: #bbf7d0; }
.choice.wrong { background: #fecaca; }
.choice.wide {
  min-width: 140px;
  min-height: auto;
  font-size: 1.05rem;
  padding: 0.7rem 1rem;
  line-height: 1.25;
  text-align: center;
}
.game-clues {
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
  background: #fff;
  border-radius: 14px;
  border: 1px dashed #fdba74;
}
.game-clues p { margin: 0.25rem 0; font-weight: 700; }
.pattern-row {
  font-size: 2.1rem;
  letter-spacing: 0.2em;
  text-align: center;
  margin: 0.4rem 0 1rem;
}
.game-picks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}
.game-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  text-align: left;
  padding: 0.85rem 0.9rem;
  border: 0;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 5px 0 #fdba74;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.game-pick:hover { transform: translateY(-2px); }
.game-pick .emoji { font-size: 1.6rem; }
.game-pick strong { font-size: 0.95rem; }
.game-pick span { font-size: 0.78rem; color: var(--muted, #78716c); }
.puzzle-stage {
  position: relative;
  width: min(380px, 94vw);
  margin: 0 auto 1rem;
}
.puzzle-ghost {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  pointer-events: none;
  z-index: 0;
}
.puzzle-ghost svg { width: 100%; height: 100%; display: block; }
.puzzle-board {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  aspect-ratio: 1;
  gap: 4px;
}
.puzzle-slot {
  background: rgba(255, 255, 255, 0.5);
  border: 2px dashed #fdba74;
  border-radius: 6px;
  min-height: 0;
}
.puzzle-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  min-height: 96px;
}
.puzzle-piece {
  width: 72px;
  height: 72px;
  cursor: grab;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 0 #fbbf24;
  background: #fff;
  touch-action: none;
  user-select: none;
}
.puzzle-piece svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.puzzle-piece.dragging,
.stem-part.dragging,
.stem-block.dragging {
  cursor: grabbing;
  z-index: 10000;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.puzzle-piece.picked,
.stem-part.picked,
.stem-block.picked {
  outline: 3px solid #f59e0b;
  outline-offset: 3px;
}
body.hl-dragging {
  user-select: none;
  cursor: grabbing;
  touch-action: none;
}
#game-root { overflow: visible; }
.puzzle-slot .puzzle-piece { width: 100%; height: 100%; box-shadow: none; cursor: default; border-radius: 6px; }
.puzzle-slot.ok { border-style: solid; border-color: #4ade80; background: #fff; }
.puzzle-slot.miss { border-color: #f87171; background: #fee2e2; }

.kit-mat {
  max-width: 480px;
  margin: 0 auto 1rem;
  padding: 10px 10px 12px;
  background:
    repeating-linear-gradient(90deg, #2a2a2e 0 16px, #323236 16px 32px);
  border-radius: 6px;
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.45);
}
.kit-caption {
  margin: 0 0 8px;
  text-align: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a8a29e;
}
.uno-pcb {
  position: relative;
  width: 100%;
  aspect-ratio: 68.6 / 53.4;
  margin: 0 auto 10px;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.14), transparent 28%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0 1px, transparent 1px 7px),
    linear-gradient(160deg, #1aadba 0%, #0e8a96 38%, #0a6b75 100%);
  border: 2px solid #05363c;
  border-radius: 2px 2px 7px 2px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    inset 0 -10px 18px rgba(0, 0, 0, 0.28),
    0 8px 0 #04282d,
    0 12px 22px rgba(0, 0, 0, 0.4);
  font-family: "Lucida Console", "Courier New", ui-monospace, monospace;
}
.uno-hole {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle, #111 38%, #a8a29e 42% 62%, #57534e 64%);
  box-shadow: inset 0 1px 2px #000;
}
.uno-hole.tl { top: 5%; left: 3%; }
.uno-hole.tr { top: 5%; right: 3%; }
.uno-hole.bl { bottom: 6%; left: 3%; }
.uno-hole.br { bottom: 6%; right: 3%; }
.uno-usb {
  position: absolute;
  left: -5px;
  top: 18%;
  width: 26px;
  height: 34px;
  background: linear-gradient(#d1d5db, #6b7280);
  border: 1px solid #111;
  border-radius: 1px 3px 3px 1px;
  box-shadow: inset 0 0 0 3px #4b5563, inset 0 0 0 6px #111827;
}
.uno-usb::after {
  content: "USB";
  position: absolute;
  left: 28px;
  top: 11px;
  font-size: 6px;
  font-weight: 700;
  color: #ecfeff;
  letter-spacing: 0.06em;
}
.uno-dc {
  position: absolute;
  left: -3px;
  top: 58%;
  width: 24px;
  height: 20px;
  background: #1c1917;
  border-radius: 1px 9px 9px 1px;
  box-shadow: inset 0 0 0 2px #44403c;
}
.uno-dc::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 3px solid #57534e;
  background: #0c0a09;
}
.uno-chip {
  position: absolute;
  left: 24%;
  top: 30%;
  width: 34%;
  height: 34%;
  background: linear-gradient(180deg, #3f3f46, #18181b);
  border-radius: 2px;
  color: #d4d4d8;
  font-size: clamp(5px, 1.7vw, 8px);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.15;
  white-space: pre-line;
  box-shadow: 0 2px 0 #000, inset 0 1px 0 #52525b;
}
.uno-chip::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #09090b;
}
.uno-silk {
  position: absolute;
  right: 20%;
  top: 36%;
  color: #f0fdfa;
  font-size: clamp(9px, 2.4vw, 13px);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 0 #05363c;
}
.uno-rev {
  position: absolute;
  right: 21%;
  top: 48%;
  color: #ccfbf1;
  font-size: 7px;
  letter-spacing: 0.14em;
}
.uno-leds {
  position: absolute;
  left: 16%;
  bottom: 26%;
  display: flex;
  gap: 6px;
  align-items: flex-end;
}
.uno-led-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #14532d;
  box-shadow: inset 0 0 0 1px #052e16;
}
.uno-led-dot.l { background: #854d0e; }
.uno-led-dot.tx, .uno-led-dot.rx { background: #1e3a5f; }
.uno-led-dot.on { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.uno-led-cap {
  font-size: 5px;
  color: #ecfeff;
  text-align: center;
  margin-top: 1px;
}
.uno-reset {
  position: absolute;
  right: 9%;
  top: 40%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fef9c3, #ca8a04);
  border: 2px solid #a16207;
  box-shadow: inset 0 -2px 0 #854d0e;
}
.uno-reset span {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 5.5px;
  color: #ecfeff;
  font-weight: 700;
}
.uno-headers {
  position: absolute;
  left: 14%;
  right: 5%;
  display: flex;
  justify-content: space-between;
  gap: 2px;
}
.uno-headers.top { top: 3%; }
.uno-headers.bot { bottom: 3%; align-items: flex-end; }
.uno-group {
  display: flex;
  gap: 2px;
}
.uno-pin {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 14px;
}
.uno-headers.bot .uno-pin { flex-direction: column-reverse; }
.uno-socket {
  width: 8px;
  height: 8px;
  background: radial-gradient(circle at 50% 50%, #0a0a0a 30%, #eab308 34% 50%, #854d0e 54%);
  box-shadow: inset 0 0 1px #000, 0 0 0 1px #713f12;
}
.uno-pin label {
  font-size: 8px;
  color: #f0fdfa;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
  text-shadow: 0 1px 0 #05363c;
  white-space: nowrap;
}
.uno-pin.target .uno-socket {
  box-shadow: 0 0 0 2px #fbbf24, 0 0 8px #f59e0b;
}
.uno-pin.wired .uno-socket {
  box-shadow: 0 0 0 1px #4ade80, 0 0 6px #22c55e;
}
.bb-body {
  background: #f3efe6;
  border-radius: 3px;
  padding: 6px 6px 8px;
  box-shadow: inset 0 0 0 1px #e7e5e4, 0 1px 0 #fff, 0 6px 14px rgba(0, 0, 0, 0.28);
}
.bb-name {
  font-size: 0.62rem;
  font-weight: 800;
  color: #78716c;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 4px;
}
.bb-rail {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 8px;
  margin: 2px 0;
}
.bb-rail.plus { border-top: 2px solid #dc2626; border-bottom: 2px solid #dc2626; }
.bb-rail.minus { border-top: 2px solid #2563eb; border-bottom: 2px solid #2563eb; }
.bb-rail span {
  font-size: 9px;
  font-weight: 800;
}
.bb-rail.plus span { color: #dc2626; }
.bb-rail.minus span { color: #2563eb; }
.bb-holes {
  display: flex;
  gap: 5px;
  flex: 1;
  justify-content: space-evenly;
  padding: 0 8px;
}
.bb-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, #1c1917 46%, #78716c 58%);
}
.bb-letters {
  display: grid;
  grid-template-columns: repeat(5, 1fr) 12px repeat(5, 1fr);
  font-size: 7px;
  font-weight: 800;
  color: #a8a29e;
  text-align: center;
  padding: 0 2px 2px;
  font-family: "Lucida Console", ui-monospace, monospace;
}
.bb-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr) 12px repeat(5, 1fr);
  grid-template-rows: repeat(7, minmax(52px, 1fr));
  min-height: 320px;
  gap: 3px;
  background-color: #faf8f3;
  background-image: radial-gradient(circle, #44403c 1.05px, transparent 1.2px);
  background-size: 8px 8px;
  border-top: 1px solid #e7e5e4;
  border-bottom: 1px solid #e7e5e4;
}
.bb-grid::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  bottom: 3px;
  width: 10px;
  margin-left: -5px;
  background: #ebe6dc;
  border-radius: 2px;
  pointer-events: none;
  z-index: 0;
}
.stem-slot {
  position: relative;
  z-index: 1;
  min-height: 0;
  border: 1px dashed rgba(120, 113, 108, 0.7);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #1c1917;
  text-align: center;
  padding: 4px 3px;
}
.stem-slot.target {
  border-color: #f59e0b;
  background: rgba(251, 191, 36, 0.22);
  box-shadow: 0 0 0 1px #fbbf24;
}
.stem-slot.ok {
  border: 1px solid #4ade80;
  background: #fff;
  color: #1c1917;
}
.stem-slot.miss { border-color: #f87171; background: #fee2e2; }
.kit-fp-pin {
  font-size: 0.72rem;
  color: #0e7490;
  font-weight: 800;
  line-height: 1.15;
}
.kit-fp-name {
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.15;
  color: #1c1917;
}
.stem-slot .kit-face {
  width: 100%;
  height: auto;
  max-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.stem-slot .kit-svg { width: auto; height: 44px; max-height: 44px; }
.kit-face {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.kit-svg { width: 92%; height: 92%; max-height: 70px; display: block; }
.kit-led.on-red { filter: drop-shadow(0 0 6px #ef4444); }
.kit-led.on-yellow { filter: drop-shadow(0 0 6px #facc15); }
.kit-led.on-green { filter: drop-shadow(0 0 6px #22c55e); }
.kit-led.on-lamp, .kit-led.on-white { filter: drop-shadow(0 0 8px #fde68a); }
.kit-led.on-blue { filter: drop-shadow(0 0 6px #3b82f6); }
.kit-buzzer.buzz { animation: kit-buzz 0.12s linear 8; }
.kit-fan.spin { transform-origin: center; transform-box: fill-box; animation: kit-spin 0.35s linear infinite; }
.kit-servo-horn { transform-origin: center; transform-box: fill-box; transition: transform 0.45s ease; }
.kit-servo-horn.wave { transform: rotate(50deg); }
.kit-ping.is-ping { animation: kit-ping 0.9s ease-out 3; }
@keyframes kit-buzz {
  50% { transform: translateX(1px); }
}
@keyframes kit-spin { to { transform: rotate(360deg); } }
@keyframes kit-ping {
  0% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.8); }
}
.stem-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  min-height: 72px;
}
.kit-bag {
  max-width: 520px;
  margin: 0 auto 0.6rem;
  padding: 8px 8px 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
}
.kit-bag-title {
  font-size: 0.95rem;
  font-weight: 800;
  text-align: center;
  margin: 0 0 8px;
  color: #9a3412;
}
.kit-bag-group { margin-bottom: 0.65rem; }
.kit-bag-group:last-child { margin-bottom: 0; }
.kit-bag-group h4 {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: none;
  color: #1c1917;
  font-weight: 800;
}
.kit-bag .stem-part {
  min-width: 108px;
  max-width: 124px;
  padding: 6px 6px 8px;
}
.kit-bag .stem-part .kit-svg { width: 52px; height: 52px; }
.kit-code-tray { max-width: 520px; margin: 0 auto; }
.stem-part {
  min-width: 108px;
  max-width: 124px;
  padding: 6px 6px 8px;
  border: 1px solid #d6d3d1;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
  cursor: grab;
  touch-action: none;
  font-weight: 800;
  font-size: 0.85rem;
  text-align: center;
  user-select: none;
}
.stem-part .kit-svg { width: 52px; height: 58px; margin: 0 auto; }
.stem-part .part-name {
  display: block;
  margin-top: 4px;
  line-height: 1.2;
  color: #1c1917;
  font-size: 0.85rem;
  font-weight: 800;
}
.stem-part.dragging { cursor: grabbing; z-index: 80; box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2); }
.ide-wrap {
  max-width: 480px;
  margin: 0 auto 0.8rem;
  background: #1e1e1e;
  border: 1px solid #3c3c3c;
  border-radius: 4px;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.ide-titlebar {
  background: #323233;
  color: #cccccc;
  font-size: 0.68rem;
  padding: 5px 10px;
}
.ide-body { padding: 8px 10px 10px; }
.ide-line {
  color: #c586c0;
  font-size: 0.72rem;
  margin: 4px 0;
}
.ide-indent {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 6px 14px;
  min-height: 40px;
}
.stem-code-slot {
  min-width: 88px;
  min-height: 36px;
  border: 1px dashed #569cd6;
  border-radius: 2px;
  background: #252526;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 600;
  color: #6a9955;
  padding: 0.2rem 0.35rem;
  font-family: inherit;
}
.stem-code-slot.ok {
  border-style: solid;
  border-color: #4ade80;
  background: #1b2a1f;
  color: #9cdcfe;
}
.stem-code-slot.miss { border-color: #f87171; background: #3f1d1d; }
.stem-block {
  min-width: 88px;
  padding: 0.4rem 0.5rem;
  border: 0;
  border-radius: 2px;
  background: #264f78;
  color: #9cdcfe;
  font-weight: 600;
  font-size: 0.68rem;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  cursor: grab;
  touch-action: none;
  user-select: none;
  text-align: center;
}
.stem-block.dragging { cursor: grabbing; z-index: 80; }
.kit-shop {
  margin: 0.2rem 0 0.7rem;
  text-align: center;
  font-size: 0.75rem;
}
.bot-stage {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  max-width: 420px;
  margin: 0 auto 1rem;
  padding: 0.8rem 1rem 0;
  min-height: 140px;
  background: linear-gradient(#e0f2fe, #bbf7d0);
  border-radius: 16px;
  border: 3px solid #38bdf8;
  position: relative;
  overflow: hidden;
}
.bot-sprite {
  font-size: 2.6rem;
  transition: transform 0.45s ease;
  z-index: 1;
}
.bot-goal { font-size: 2.2rem; }
.bot-path {
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 22px;
  height: 6px;
  background: repeating-linear-gradient(90deg, #f59e0b 0 10px, transparent 10px 18px);
  border-radius: 4px;
}
.cop-wrap { max-width: 420px; margin: 0 auto; }
.cop-help {
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  margin: 0 0 0.8rem;
  min-height: 2.4em;
}
.cop-help.bad { color: #b91c1c; }
.cop-scene {
  display: grid;
  grid-template-columns: 1fr 100px 1fr;
  grid-template-rows: auto 100px auto;
  gap: 8px;
  align-items: stretch;
  justify-items: stretch;
  margin: 0 auto 1rem;
  padding: 10px;
  background: #bbf7d0;
  border: 4px solid #15803d;
  border-radius: 20px;
}
.cop-bay {
  background: #fff;
  border: 3px dashed #a8a29e;
  border-radius: 16px;
  padding: 0.45rem 0.4rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 88px;
}
.cop-bay.waiting {
  border-style: solid;
  border-color: #f59e0b;
  box-shadow: 0 0 0 4px #fde68a;
  background: #fffbeb;
}
.cop-bay.ns { grid-column: 2; grid-row: 1; }
.cop-bay.ew { grid-column: 1; grid-row: 2; }
.cop-bay.walk { grid-column: 3; grid-row: 2; }
.cop-tag { font-size: 0.72rem; font-weight: 800; color: #78716c; text-transform: uppercase; letter-spacing: 0.03em; }
.cop-who { font-size: 2.1rem; line-height: 1; min-height: 1.2em; transition: transform 0.7s ease, opacity 0.7s ease; }
.cop-who.go { transform: scale(0.4); opacity: 0; }
.cop-post {
  display: flex;
  gap: 4px;
  background: #1c1917;
  padding: 4px 6px;
  border-radius: 999px;
}
.cop-bay.walk .cop-post { background: #14532d; }
.cop-bulb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #44403c;
}
.cop-bulb.red.on { background: #ef4444; box-shadow: 0 0 8px #ef4444; }
.cop-bulb.yellow.on { background: #facc15; box-shadow: 0 0 8px #facc15; }
.cop-bulb.green.on { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.cop-walk-lamp {
  font-size: 0.65rem;
  font-weight: 800;
  color: #a8a29e;
}
.cop-walk-lamp.on { color: #4ade80; }
.cop-cross {
  grid-column: 2;
  grid-row: 2;
  background: #57534e;
  border-radius: 10px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}
.cop-cross::before, .cop-cross::after {
  content: "";
  position: absolute;
  background: repeating-linear-gradient(90deg, #fde68a 0 8px, transparent 8px 16px);
}
.cop-cross::before { left: 10%; right: 10%; height: 3px; top: 50%; }
.cop-cross::after {
  top: 10%; bottom: 10%; width: 3px; left: 50%;
  background: repeating-linear-gradient(180deg, #fde68a 0 8px, transparent 8px 16px);
}
.cop-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
.cop-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 0.85rem 1rem;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 0 5px 0 #a8a29e;
  cursor: pointer;
  font-family: inherit;
}
.cop-btn .ico { font-size: 1.5rem; }
.cop-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #a8a29e; }
.cop-btn.ns { background: #bbf7d0; }
.cop-btn.ew { background: #bfdbfe; }
.cop-btn.walk { background: #fde68a; }
.cop-btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.cop-hint { text-align: center; font-size: 0.85rem; margin: 0.6rem 0 0; }
.stars { font-size: 1.2rem; }
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.mem-card {
  aspect-ratio: 1;
  font-size: 2rem;
  border: 0;
  border-radius: 12px;
  background: var(--chalk-2);
  color: transparent;
}
.mem-card.up, .mem-card.done { background: #fff; color: var(--ink); }
.emoji-row { font-size: 2.2rem; letter-spacing: 0.15em; text-align: center; margin: 0.6rem 0 1rem; }
.tiles-letters { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; }
.letter-tile {
  width: 52px; height: 52px;
  border: 0; border-radius: 10px;
  background: #fff; font-size: 1.4rem; font-weight: 800;
  box-shadow: 0 4px 0 #fbbf24;
}
.spell-out {
  min-height: 52px;
  display: flex; gap: 0.35rem; justify-content: center; margin-bottom: 1rem;
  font-size: 1.6rem; font-weight: 800; letter-spacing: 0.2em;
}

.member { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; padding: 0.35rem 0; border-bottom: 1px dashed #374151; }
.actions-bar {
  display: flex; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.75rem 1rem 1rem;
  background: #020617;
}

.linkish { background: none; border: 0; color: #38bdf8; padding: 0; text-decoration: underline; cursor: pointer; }
.hidden { display: none !important; }

/* —— Landing home —— */
body.landing-on {
  background: #04150c;
  color: #ecfccb;
}
body.landing-on .topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, #052e16 78%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(253, 224, 71, 0.12);
}
.landing { position: relative; overflow: clip; }
.ai-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.ai-canvas { display: block; width: 100%; height: 100%; }
.scroll-progress {
  position: fixed;
  top: 0; left: 0; height: 3px; width: calc(var(--scroll-t, 0) * 100%);
  background: linear-gradient(90deg, #f59e0b, #86efac);
  z-index: 40;
  pointer-events: none;
}
.hero-landing {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: grid;
  align-items: center;
  padding: 4rem 1.25rem 5rem;
  overflow: hidden;
}
.hero-landing .inner { max-width: 760px; margin: 0 auto; text-align: center; }
.eyebrow {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fde68a;
  border: 1px solid rgba(253, 224, 71, 0.35);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  background: rgba(4, 21, 12, 0.35);
}
.hero-landing h1 {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 1.05;
  margin: 1rem 0 0.8rem;
  color: #fffbeb;
  text-shadow: 0 10px 40px rgba(0,0,0,.35);
}
.hero-landing .lede {
  font-size: 1.15rem;
  color: #d9f99d;
  max-width: 38rem;
  margin: 0 auto 1.5rem;
}
.hero-landing .row { justify-content: center; }
.scroll-cue {
  margin-top: 3rem;
  color: #bbf7d0;
  font-weight: 800;
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(8px); opacity: 1; }
}
.landing-section {
  position: relative;
  z-index: 1;
  padding: 4.5rem 1.25rem;
}
.landing-section.cream {
  background: linear-gradient(180deg, rgba(255,247,237,0) 0%, #fff7ed 12%, #fff7ed 100%);
  color: var(--ink);
}
.landing-section h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0 0 0.5rem;
}
.narrow { max-width: 1100px; margin: 0 auto; }
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.6rem;
  counter-reset: step;
}
@media (max-width: 800px) {
  .steps { grid-template-columns: 1fr; }
}
.step {
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.3rem 1.2rem 1.2rem;
  box-shadow: var(--shadow);
}
.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 2rem; height: 2rem;
  border-radius: 999px;
  background: var(--chalk-2);
  color: #ecfccb;
  font-weight: 800;
  margin-bottom: 0.7rem;
}
.moments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.5rem;
}
@media (max-width: 800px) {
  .moments { grid-template-columns: 1fr; }
}
.moment {
  min-height: 180px;
  border-radius: 22px;
  padding: 1.3rem;
  color: #fffbeb;
  overflow: hidden;
  position: relative;
}
.moment h3 { margin: 0 0 0.4rem; }
.m1 { background: linear-gradient(160deg, #14532d, #0f172a); }
.m2 { background: linear-gradient(160deg, #9a3412, #431407); }
.m3 { background: linear-gradient(160deg, #0e7490, #164e63); }
.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.reveal {
  opacity: 0;
  transform: translateY(28px) scale(0.98);
  filter: blur(6px);
  transition: opacity 0.7s ease, transform 0.7s ease, filter 0.7s ease;
}
.reveal.in {
  opacity: 1;
  transform: none;
  filter: none;
}
.reveal.d1 { transition-delay: 0.08s; }
.reveal.d2 { transition-delay: 0.16s; }
.reveal.d3 { transition-delay: 0.24s; }
.orbit-glyph {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 1.6rem;
  pointer-events: none;
  animation: orbit 18s linear infinite;
  opacity: 0.9;
}
@keyframes orbit {
  from { transform: rotate(0deg) translateX(var(--r, 34vw)) rotate(0deg); }
  to { transform: rotate(360deg) translateX(var(--r, 34vw)) rotate(-360deg); }
}
.glyph-a { --r: min(32vw, 280px); }
.glyph-b { --r: min(42vw, 360px); animation-duration: 24s; animation-direction: reverse; }
.glyph-c { --r: min(22vw, 180px); animation-duration: 14s; }

.dash-hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  padding: 1.6rem 1.4rem;
  margin-bottom: 1.4rem;
  background: #052e16;
  color: #ecfccb;
  min-height: 180px;
}
.dash-hero .ai-mini {
  position: absolute;
  inset: 0;
  opacity: 0.85;
}
.dash-hero .copy { position: relative; z-index: 1; max-width: 36rem; }
.dash-hero h1 { margin: 0 0 0.35rem; color: #fffbeb; }
.dash-hero p { margin: 0; color: #d9f99d; }

@media (prefers-reduced-motion: reduce) {
  .scroll-cue, .orbit-glyph { animation: none; }
  .reveal { opacity: 1; transform: none; filter: none; }
}

/* ---------------------------------------------------------- dashboards */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.2rem;
}
.stat {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.stat strong { font-family: Fraunces, Georgia, serif; font-size: 1.9rem; line-height: 1; }
.stat span { color: var(--muted); font-size: 0.9rem; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.2rem;
  align-items: start;
}

.class-row, .req {
  border-top: 1px solid var(--line);
  padding: 0.9rem 0;
}
.class-row:first-of-type, .req:first-of-type { border-top: 0; }
.class-row-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  justify-content: space-between;
  flex-wrap: wrap;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0; }
.chip {
  background: #ecfccb;
  color: #365314;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.timeline li:first-child { border-top: 0; }
.timeline .when { font-weight: 700; min-width: 12rem; }
.timeline .what { color: var(--muted); }
.timeline li.cancelled .when { text-decoration: line-through; opacity: 0.6; }

.notif {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}
.notif:first-of-type { border-top: 0; }
.notif.unread { border-left: 4px solid var(--sun); padding-left: 0.7rem; }
.notif p { margin: 0.2rem 0 0; font-size: 0.9rem; }

.input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
label { display: block; font-weight: 700; font-size: 0.9rem; }
label .input { margin-top: 0.3rem; font-weight: 400; }

/* ------------------------------------------------------------- calendar */

.cal-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}
.cal-bar h2 { margin: 0; flex: 1; }

.cal-head, .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.cal-head {
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 4px;
}
.cal-cell {
  min-height: 92px;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.today { border-color: var(--sun); box-shadow: 0 0 0 2px #fde68a inset; }
.cal-day { font-weight: 800; font-size: 0.8rem; color: var(--muted); }

.cal-event {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  background: #dcfce7;
  color: #166534;
  border-radius: 8px;
  padding: 0.15rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event.cancelled { background: #fee2e2; color: #991b1b; text-decoration: line-through; }
.cal-event.moved { background: #e0f2fe; color: #075985; }
.cal-x {
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 900;
  padding: 0 0.15rem;
  line-height: 1;
}

@media (max-width: 620px) {
  .cal-cell { min-height: 64px; }
  .cal-event { font-size: 0.62rem; }
  .timeline .when { min-width: 100%; }
}

/* -------------------------------------------------------------- profile */

.profile-card { display: flex; align-items: center; gap: 1.1rem; }
.profile-card h1 { margin: 0; }
.profile-card p { margin: 0.2rem 0 0; }
.avatar {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--chalk-2);
  color: #ecfccb;
  display: grid;
  place-items: center;
  font-family: Fraunces, Georgia, serif;
  font-size: 1.8rem;
  flex: none;
}
