:root {
  --bg: #0d1030;
  --panel: #1b1f4b;
  --panel-edge: #3a3f8f;
  --text: #f4f6ff;
  --muted: #a9b0e8;
  --yellow: #ffd23f;
  --orange: #ff8c1a;
  --green: #4be36b;
  --red: #ff4d6d;
  --blue: #4fc3ff;
  --purple: #b86bff;
  --font: "Baloo 2", "Trebuchet MS", "Segoe UI Rounded", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

canvas#game {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
}

.hidden { display: none !important; }

button {
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

/* ---------- Panels & buttons ---------- */
.panel {
  background: linear-gradient(180deg, #232864, var(--panel));
  border: 3px solid var(--panel-edge);
  border-radius: 22px;
  padding: 22px 26px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
  max-width: min(94vw, 520px);
  width: 100%;
}

.big-btn {
  display: block;
  width: 100%;
  margin: 12px auto 0;
  padding: 14px 18px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #2a1600;
  background: linear-gradient(180deg, #ffe066, var(--yellow) 50%, var(--orange));
  border: none;
  border-radius: 16px;
  box-shadow: 0 5px 0 #b35c00, 0 8px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.08s;
}
.big-btn:hover { filter: brightness(1.08); }
.big-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #b35c00; }
.big-btn.secondary {
  color: var(--text);
  background: linear-gradient(180deg, #4a50a8, #343a86);
  box-shadow: 0 5px 0 #20245a, 0 8px 18px rgba(0, 0, 0, 0.35);
  font-size: 1.1rem;
}

/* The way back, the same on every screen: always the top-left corner.
   "← Back" goes one step back, "🏠 Home" goes to the title screen, and on
   the title screen itself it's "👤 Change player" (the player picker). */
.nav-back {
  position: fixed; top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); z-index: 40;
  min-height: 44px; padding: 8px 16px; border-radius: 22px; cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(10, 12, 40, 0.8); color: #fff;
  font: inherit; font-weight: 800; font-size: 1rem; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.nav-back:hover, .nav-back:focus-visible { border-color: #ffd23f; outline: none; }
.nav-back.hidden { display: none; }
/* Popups also close with a ✕ in the top-right corner (js/close-x.js); it
   does the same as that popup's Back and hides when Back is hidden. */
.close-x {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 40;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(10, 12, 40, 0.8); color: #fff;
  font: inherit; font-weight: 900; font-size: 1.2rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.close-x:hover, .close-x:focus-visible { border-color: #ffd23f; outline: none; }
.nav-back.hidden + .close-x { display: none; }
.close-x.hidden { display: none; }
/* The same ✕ inside a box that isn't a full-screen popup (the "You fainted"
   box), in the box's own corner. */
.box-x, .rpg-down .box-x {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3); background: rgba(10, 12, 40, 0.6); color: #fff;
  font: inherit; font-weight: 900; font-size: 0.95rem; line-height: 1; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.box-x:hover, .box-x:focus-visible, .rpg-down .box-x:hover { border-color: #ffd23f; outline: none; }
#rpgDownText { padding: 0 26px; }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  font-size: 0.9rem;
}

/* ---------- Screens ---------- */
.screen, .modal {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  z-index: 10;
}
.modal { background: rgba(6, 8, 28, 0.62); backdrop-filter: blur(3px); z-index: 20; }
/* Leave room so the top-left Back button never covers a screen's own top. */
.screen, .modal { padding-top: 68px; }

.logo {
  margin: 0;
  font-size: clamp(2.6rem, 9vw, 5rem);
  font-weight: 900;
  line-height: 1;
  color: var(--blue);
  text-shadow: 0 4px 0 #1b5f99, 0 0 30px rgba(79, 195, 255, 0.5);
  letter-spacing: 0.02em;
}
.logo span {
  color: var(--yellow);
  text-shadow: 0 4px 0 #b35c00, 0 0 30px rgba(255, 210, 63, 0.5);
  margin-left: 0.15em;
}
.tagline { margin: 8px 0 18px; color: var(--muted); font-size: 1.15rem; }

.skill-now { min-height: 1.4em; color: var(--muted); font-size: 1.05rem; line-height: 1.5; }
.skill-now b { color: var(--yellow); }

.howto {
  margin-top: 18px;
  max-width: 520px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
  text-align: left;
}
.howto b { color: var(--text); }
.small-links { margin-top: 12px; display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 0.9rem; }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.hud-left { position: absolute; top: 12px; left: 12px; width: min(46vw, 320px); }
.hud-right { position: absolute; top: 10px; right: 12px; text-align: right; }
.bar {
  position: relative;
  height: 22px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 6px;
}
.bar .fill { height: 100%; width: 0; transition: width 0.12s; }
.bar.hp .fill { background: linear-gradient(90deg, #ff4d6d, #ff8fa3); }
.bar.xp .fill { background: linear-gradient(90deg, #36b9ff, #7fe3ff); }
.bar.boss .fill { background: linear-gradient(90deg, #8b3dff, #d38bff); }
.bar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  /* A dark outline keeps white text readable over the light fill. */
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000, 0 1px 3px #000;
}
.skill-pill {
  display: inline-block;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--muted);
}
.stat { font-size: 1.6rem; font-weight: 900; text-shadow: 0 2px 3px #000; }
.stat.small { font-size: 0.95rem; font-weight: 700; color: var(--muted); }
.hud-buttons { margin-top: 6px; display: flex; gap: 6px; justify-content: flex-end; pointer-events: auto; }
/* The sound button's panel: music and sounds sliders (js/game.js paintSound). */
.sound-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; pointer-events: auto;
  display: flex; flex-direction: column; gap: 10px; min-width: 230px; padding: 12px 14px;
  background: rgba(15, 17, 48, 0.95); border: 2px solid rgba(255, 255, 255, 0.25); border-radius: 12px;
  text-align: left; font-size: 0.95rem; font-weight: 700; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.cd-top { position: relative; }
.cd-top .sound-panel { top: calc(100% + 4px); right: 8px; z-index: 40; }
.sound-panel label { display: grid; grid-template-columns: 6.2em 1fr 3em; align-items: center; gap: 8px; white-space: nowrap; }
.sound-panel input[type=range] { width: 100%; min-width: 110px; accent-color: #7fe3ff; }
.sound-panel .sound-credits { font-size: 0.8rem; color: var(--muted); text-align: center; }
.sound-panel span { text-align: right; color: var(--muted); font-size: 0.85rem; }
.icon-btn {
  width: 42px; height: 42px;
  font-size: 1.2rem;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
}
/* The boss's health bar is at the top, in the middle: between the health
   bars and the wave counter when there's room, otherwise just below them
   (js/game.js placeBossBar sets top and width). Never near the bottom
   buttons. */
#bossBar {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: min(40vw, 440px);
  text-align: center;
}
.boss-name { font-weight: 900; color: #e4c2ff; text-shadow: 0 2px 3px #000; margin-bottom: 4px; }

/* ---------- Math panel ---------- */
.math-panel { max-width: min(94vw, 420px); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 18px 20px; }
.math-title {
  font-size: 2rem;
  font-weight: 900;
  color: var(--yellow);
  text-shadow: 0 3px 0 #b35c00;
  line-height: 1.1;
}
.math-sub { color: var(--muted); margin: 4px 0 8px; }
.skill-tag {
  display: inline-block;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 10px;
  background: #2d3380;
  color: #c8ceff;
}
.question {
  font-size: clamp(2.2rem, 10vw, 3.2rem);
  font-weight: 900;
  margin: 10px 0 2px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.prompt { color: var(--muted); min-height: 1.4em; }
.prompt.hint { color: #ffe680; }
.answer-box {
  margin: 8px auto 12px;
  width: 70%;
  min-height: 62px;
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 58px;
  background: #0b0e2a;
  border: 3px solid var(--blue);
  border-radius: 16px;
  color: #fff;
}
.answer-box.empty { border-style: dashed; }
.answer-box.shake { animation: shake 0.3s; }
@keyframes shake {
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.keypad button {
  padding: 10px 0;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  background: linear-gradient(180deg, #3d439c, #2d3380);
  border: none;
  border-radius: 14px;
  box-shadow: 0 4px 0 #1a1e55;
}
.keypad button:active { transform: translateY(3px); box-shadow: 0 1px 0 #1a1e55; }
.keypad button.soft { background: linear-gradient(180deg, #2a2f70, #22265e); }
.keypad .hint-btn { font-size: 1.1rem; background: linear-gradient(180deg, #6d5a12, #4f4110); }
.keypad .hint-btn:disabled { opacity: 0.4; }
.keypad .go-btn {
  grid-column: span 2;
  font-size: 1.3rem;
  color: #0b3315;
  background: linear-gradient(180deg, #8dffa4, var(--green));
  box-shadow: 0 4px 0 #1f8a37;
}

/* A repeating decimal's bar (MathPanel.bars): a real overline over the digits that repeat. */
.rep { text-decoration: overline; text-decoration-thickness: 0.08em; text-underline-offset: 0; text-decoration-skip-ink: none; }

.feedback { margin-top: 10px; }
.fb-title { font-size: 1.8rem; font-weight: 900; }
.feedback.good .fb-title { color: var(--green); }
.feedback.bad .fb-title { color: #ffb36b; }
.fb-body { margin-top: 6px; font-size: 1.08rem; line-height: 1.45; }
.fb-body .eq { font-size: 1.6rem; font-weight: 900; display: block; margin: 4px 0; overflow-wrap: anywhere; }
.fb-body .note { display: block; margin-top: 8px; color: var(--yellow); font-weight: 700; }
/* After a wrong answer only the right answer is big; the rest is small. */
.fb-body .fb-small { display: block; margin-top: 8px; font-size: 0.85rem; line-height: 1.35; color: var(--muted); }
.feedback.bad .fb-body .eq { font-size: 2rem; }
.feedback.bad .fb-body .note { font-size: 0.85rem; font-weight: 600; margin-top: 6px; }
/* Arena level-ups: right or wrong, and the right answer, both big and bold. */
.feedback.big .fb-title { font-size: clamp(2.4rem, 8vw, 3.4rem); line-height: 1.05; letter-spacing: 0.01em; }
.feedback.big.bad .fb-title { color: #ff8a6b; }
.fb-body .fb-answer { display: block; margin: 10px 0 4px; font-size: clamp(1.4rem, 4.5vw, 1.8rem); font-weight: 800; color: #fff; }
.fb-body .fb-answer b { display: block; font-size: clamp(2.2rem, 7.5vw, 3.2rem); font-weight: 900; line-height: 1.1; color: var(--yellow); overflow-wrap: anywhere; }
.feedback.big .fb-body .note { font-size: 1rem; }

/* ---------- Upgrade cards ---------- */
.up-panel { max-width: min(96vw, 760px); }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.card {
  position: relative;
  padding: 14px 10px 12px;
  background: linear-gradient(180deg, #2f3590, #252a72);
  border: 3px solid #5960c9;
  border-radius: 18px;
  color: var(--text);
  text-align: center;
  transition: transform 0.1s, border-color 0.1s;
  animation: pop 0.25s ease-out backwards;
}
.card:hover, .card:focus { transform: translateY(-4px) scale(1.03); border-color: var(--yellow); outline: none; }
.card .icon { font-size: 2.4rem; }
.card .name { font-size: 1.15rem; font-weight: 900; margin-top: 4px; }
.card .lvl { font-size: 0.8rem; color: var(--yellow); font-weight: 800; }
.card .desc { font-size: 0.92rem; color: #cfd4ff; margin-top: 6px; }
.card .key {
  position: absolute; top: 6px; left: 8px;
  font-size: 0.75rem; color: var(--muted);
}
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }

.pause-powers, .go-stats { margin: 10px 0 4px; line-height: 1.6; }
.go-stats { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; text-align: left; font-size: 1.1rem; }
.go-stats .v { font-weight: 900; color: var(--yellow); text-align: right; }
.go-stats .full { grid-column: span 2; text-align: center; margin-top: 8px; color: var(--green); font-weight: 800; }
.pause-powers span {
  display: inline-block;
  margin: 3px;
  padding: 3px 9px;
  border-radius: 10px;
  background: #2d3380;
  font-size: 0.9rem;
}

/* ---------- Power Check ---------- */
.check-progress {
  height: 8px;
  margin: 6px auto 4px;
  width: 70%;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 6px;
  overflow: hidden;
}
.check-progress div { height: 100%; background: linear-gradient(90deg, var(--green), #b9ffc6); transition: width 0.2s; }
.keypad .skip-btn { font-size: 0.95rem; background: linear-gradient(180deg, #4a5068, #363b52); }

/* ---------- Parent panel ---------- */
.parent-panel { max-width: min(96vw, 980px); max-height: 94vh; overflow-y: auto; text-align: left; user-select: text; }
.pin-gate { text-align: center; max-width: 340px; margin: 0 auto; }
/* A recurring survey due after the PIN (js/parent.js), drawn by js/survey-questions.js. */
.survey-gate { max-width: 640px; margin: 0 auto; }
.survey-gate .math-title { text-align: center; }
.sg-step { text-align: center; margin: 4px 0 0; color: #c9d0ff; font-size: .9rem; }
.sg-step:empty { display: none; }
.sg-intro { text-align: center; color: #dfe3ff; margin: 6px 0 12px; }
.sg-section { border: 0; margin: 0; padding: 0; }
.sg-section legend { font-weight: 800; font-size: 1.05rem; padding: 0; margin-bottom: 4px; color: #ffd84a; }
.sg-note { margin: 0 0 6px; color: #c9d0ff; font-size: .92rem; }
.survey-gate .hs-q { display: block; padding: 14px 0; border-top: 1px solid rgba(255,255,255,.12); transition: background .3s, box-shadow .3s; }
.survey-gate .sg-section legend + .hs-q, .survey-gate .sg-note + .hs-q { border-top: 0; }
.survey-gate .hs-q.hs-missing { background: rgba(255, 196, 0, .18); box-shadow: 0 0 0 8px rgba(255, 196, 0, .18); border-radius: 8px; }
.survey-gate .hs-label { display: block; font-weight: 700; margin-bottom: 8px; line-height: 1.4; }
.survey-gate .hs-howto { display: block; margin-top: 2px; font-size: .82rem; font-weight: 400; color: #c9d0ff; }
.survey-gate .hs-howto.inline { display: inline; margin-left: 6px; }
.survey-gate .req { color: #ff8a80; }
.survey-gate .hs-opts.list { display: flex; flex-direction: column; gap: 6px; }
.survey-gate .hs-opts.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.survey-gate .hs-opt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1.5px solid rgba(255,255,255,.2); border-radius: 10px; background: rgba(255,255,255,.05); cursor: pointer; }
.survey-gate .hs-opt:hover { border-color: #9fb3ea; }
.survey-gate .hs-opt:has(input:checked) { border-color: #ffd84a; background: rgba(255, 216, 74, .14); }
.survey-gate .hs-opt input, .survey-gate .hs-rate input { width: 18px; height: 18px; margin: 0; accent-color: #ffd84a; cursor: pointer; }
.survey-gate textarea, .survey-gate select, .survey-gate input[type=number] { width: 100%; font: inherit; padding: 8px 10px; border-radius: 9px; border: 1.5px solid rgba(255,255,255,.25); background: #151a4a; color: #fff; box-sizing: border-box; }
.survey-gate textarea { min-height: 72px; }
.survey-gate .hs-short { width: 10em; }
.survey-gate .hs-rate { width: 100%; border-collapse: separate; border-spacing: 0 5px; }
.survey-gate .hs-rate th, .survey-gate .hs-rate td { padding: 7px 4px; }
.survey-gate .hs-rate thead th { text-align: center; font-size: .85em; color: #c9d0ff; }
.survey-gate .hs-rate .hs-rate-q { text-align: left; font-size: 1rem; color: #fff; }
.survey-gate .hs-rate tbody tr { background: rgba(255,255,255,.06); }
.survey-gate .hs-rate tbody th { text-align: left; font-weight: 500; padding-left: 10px; border-radius: 10px 0 0 10px; }
.survey-gate .hs-rate tbody td:last-child { border-radius: 0 10px 10px 0; }
.survey-gate .hs-rate td { text-align: center; width: 2.6em; }
.survey-gate .hs-scale { display: flex; justify-content: space-between; color: #c9d0ff; font-size: .82rem; }
.sg-why { text-align: center; color: #aab2e6; font-size: .82rem; margin: 10px 0 0; }
.sg-thanks { margin: 0 0 10px; padding: 10px 14px; border-radius: 12px; background: rgba(76, 175, 80, .2); border: 1px solid rgba(76, 175, 80, .6); text-align: center; font-weight: 700; }
@media (max-width: 600px) { .survey-gate .hs-rate tbody th { font-size: .88em; padding-left: 6px; } .survey-gate .hs-rate td { width: 2em; padding: 7px 1px; } }
.pin-gate input {
  font-family: inherit;
  font-size: 2rem;
  letter-spacing: 0.5em;
  text-align: center;
  width: 190px;
  padding: 8px 0 8px 0.5em;
  border-radius: 14px;
  border: 3px solid var(--blue);
  background: #0b0e2a;
  color: #fff;
}
.pin-error { color: var(--red); min-height: 1.3em; margin-top: 6px; }
.pin-error .member-note { color: var(--text, #fff); font-weight: 600; }
.parent-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sum-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 12px 0; }
.sum-card { background: #2a2f78; border-radius: 12px; padding: 8px; text-align: center; }
.sum-v { font-size: 1.5rem; font-weight: 900; color: var(--yellow); }
.sum-k { font-size: 0.8rem; color: var(--muted); }
.parent-help { color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.parent-help b { color: var(--text); }
.strand h3 { margin: 16px 0 4px; color: var(--blue); }
.strand-note { color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
.table-wrap { overflow-x: auto; }
.strand table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 640px; }
.strand th { text-align: left; color: var(--muted); font-weight: 700; font-size: 0.78rem; padding: 4px 6px; }
.strand td { padding: 7px 6px; border-top: 1px solid rgba(255, 255, 255, 0.08); vertical-align: top; }
.st { font-weight: 800; }
.st-mastered { color: var(--yellow); }
.st-ready { color: var(--green); }
.st-notyet { color: #ffb36b; }
.st-unassessed { color: var(--muted); }
.st-placed { color: #8ac6ff; }
.st-sub { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
.st-sub.force { color: var(--blue); font-weight: 700; }
.dots { white-space: nowrap; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 2px; }
.dot.y { background: var(--green); }
.dot.n { background: var(--red); }
.strand select {
  font-family: inherit;
  background: #2d3380;
  color: var(--text);
  border: 2px solid #444bb0;
  border-radius: 8px;
  padding: 3px 4px;
}
.mini-btn {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid #5960c9;
  background: transparent;
  color: var(--text);
}
.link-btn.danger { color: #ff8fa3; }

@media (max-height: 640px) {
  .question { margin: 4px 0 0; }
  .answer-box { min-height: 48px; line-height: 44px; font-size: 2rem; margin: 4px auto 8px; }
  .keypad button { padding: 6px 0; font-size: 1.3rem; }
  .howto { display: none; }
}

/* ---------- Accounts & players ---------- */
.auth-panel, .kid-panel { max-width: min(94vw, 460px); }
.kid-panel { max-width: min(96vw, 640px); }
.auth-note { color: var(--muted); line-height: 1.45; margin: 6px 0 12px; }
.auth-panel input:not([type="checkbox"]), .add-kid input:not([type="checkbox"]), .delete-form input {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: 1.15rem;
  margin: 8px 0;
  padding: 10px 14px;
  border-radius: 12px;
  border: 3px solid var(--panel-edge);
  background: #0b0e2a;
  color: #fff;
  user-select: text;
}
.auth-panel input:focus, .add-kid input:focus { outline: none; border-color: var(--blue); }
.auth-panel .link-btn { margin-top: 10px; }
.kid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-top: 10px; }
.kid-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 8px; border-radius: 18px; border: 3px solid var(--panel-edge);
  background: #2a2f78; color: var(--text); transition: transform 0.1s, border-color 0.1s;
}
.kid-card:hover, .kid-card:focus { transform: translateY(-3px); border-color: var(--yellow); outline: none; }
.kid-card.add { background: transparent; border-style: dashed; }
.kid-face {
  width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center;
  font-size: 2rem; font-weight: 900; color: #1b1f4b; background: #3a3f8f;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2);
}
.kid-card.add .kid-face { color: var(--muted); }
.kid-name { font-size: 1.15rem; font-weight: 900; }
.kid-sub { font-size: 0.8rem; color: var(--muted); }
.kid-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.who-row { margin-bottom: 6px; font-size: 1.1rem; }
.who-row .link-btn { font-size: 0.9rem; }

/* ---------- Live co-op games ---------- */
.live-games { margin-top: 12px; text-align: left; }
.live-head { color: var(--muted); font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.live-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: #2a2f78; border-radius: 12px; padding: 8px 12px; margin-top: 6px;
}
.live-row small { color: var(--muted); }
.join-btn { font-size: 1rem; padding: 6px 16px; }
.wait-panel { max-width: min(94vw, 420px); }
.wait-text { font-size: 1.15rem; line-height: 1.5; }
.wait-dots { display: flex; gap: 8px; justify-content: center; }
.wait-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--blue); animation: blink 1.2s infinite; }
.wait-dots i:nth-child(2) { animation-delay: 0.2s; }
.wait-dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
.team-list { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.mate { font-size: 0.85rem; font-weight: 800; text-shadow: 0 1px 2px #000; display: flex; align-items: center; gap: 4px; }
.mate small { color: #ffb36b; }
.mate-bar { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.5); overflow: hidden; margin-left: 4px; }
.mate-bar span { display: block; height: 100%; background: #ff4d6d; }
.go-stats .note-line { color: #ffb36b; margin: 0 0 8px; }

/* ---------- Grown-ups: family view ---------- */
.parent-account { color: var(--muted); font-size: 0.9rem; margin: 4px 0 8px; }
.parent-panel h3 { margin: 16px 0 6px; }
.family-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 640px; }
.family-table th { text-align: left; color: var(--muted); font-weight: 700; font-size: 0.78rem; padding: 4px 6px; }
.family-table td { padding: 7px 6px; border-top: 1px solid rgba(255, 255, 255, 0.08); cursor: pointer; }
.family-table tr.on td { background: rgba(79, 195, 255, 0.12); }
.kid-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 4px; }
.kid-tab {
  border: 2px solid var(--panel-edge); background: #22265e; color: var(--text);
  border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 0.95rem;
}
.kid-tab.on { border-color: var(--yellow); background: #2a2f78; }
.kid-tab.add { border-style: dashed; color: var(--muted); }
.add-kid { max-width: 420px; margin: 8px auto; text-align: center; }
.kid-colors { display: flex; gap: 10px; justify-content: center; margin: 8px 0; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25); }
.import-row { display: block; color: var(--muted); font-size: 0.9rem; margin: 6px 0; }

/* ---------- Skill trees (tabbed talent view) ---------- */
.tree-panel { max-width: min(98vw, 860px); max-height: 96vh; overflow-y: auto; padding: 14px 16px; }
.tree-panel .cards { display: block; }
.tree-tabs { display: flex; gap: 6px; border-bottom: 3px solid #3a3f8f; margin-bottom: 8px; }
.tree-tab {
  position: relative; flex: 1; padding: 8px 6px 6px; border-radius: 12px 12px 0 0; border: 3px solid #3a3f8f; border-bottom: 0;
  background: #1c2050; color: var(--muted); display: flex; flex-direction: column; align-items: center; margin-bottom: -3px;
}
.tree-tab.active { background: #2f3590; color: var(--text); border-color: var(--yellow); }
.tree-tab .tt-icon { font-size: 1.5rem; }
.tree-tab .tt-name { font-weight: 900; }
.tree-tab .tt-role { font-size: 0.72rem; }
.tree-tab .tt-pts { font-size: 0.75rem; color: var(--yellow); font-weight: 800; }
.tree-tab .tt-dot { position: absolute; top: 6px; right: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.tree-mastery { font-size: 0.85rem; color: #cfd4ff; margin: 4px 0 8px; }
.tree-mastery b { color: var(--blue); }
.talent { position: relative; display: flex; flex-direction: column; gap: 22px; padding: 4px 0 8px; }
.talent-lines { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.talent-lines path { fill: none; stroke-width: 3; }
.talent-lines path.on { stroke: #ffd23f; }
.talent-lines path.off { stroke: #4a4f8f; stroke-dasharray: 5 4; }
.talent-lines text { font-size: 11px; font-weight: 900; }
.talent-lines text.on { fill: #ffd23f; } .talent-lines text.off { fill: #7d84c9; }
.t-row { display: grid; grid-template-columns: 58px repeat(4, 1fr); gap: 10px; align-items: stretch; position: relative; }
.t-row.closed .t-label { color: #5a5fa0; }
.t-label {
  font-size: 0.7rem; font-weight: 800; color: var(--muted); text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border-right: 2px dashed #3a3f8f;
}
.t-label small { text-transform: none; font-size: 0.68rem; }
.t-cell.empty { min-height: 10px; }
.node {
  position: relative; z-index: 1; padding: 6px 5px; border-radius: 12px; text-align: center;
  border: 3px solid #3a3f8f; background: #22265e; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 1px; transition: transform 0.1s;
}
.node.primary { border-style: double; border-width: 4px; }
.node.available { border-color: var(--yellow); background: #2f3590; box-shadow: 0 0 14px rgba(255, 210, 63, 0.3); cursor: pointer; }
.node.available:hover, .node.available:focus { transform: translateY(-3px) scale(1.04); outline: none; }
.node.locked { opacity: 0.5; cursor: default; }
.node.locked.owned { opacity: 0.85; }
.node.maxed { border-color: var(--green); cursor: default; }
.node .n-icon { font-size: 1.5rem; }
.node .n-name { font-weight: 900; font-size: 0.82rem; line-height: 1.1; }
.node .n-lvl { font-size: 0.7rem; color: var(--yellow); font-weight: 800; }
.node.maxed .n-lvl { color: var(--green); }
.node .n-desc { font-size: 0.68rem; color: #cfd4ff; line-height: 1.2; }
.node .needs { font-size: 0.64rem; color: #ffb36b; margin-top: 2px; }
.node .key {
  position: absolute; top: 3px; left: 5px; font-size: 0.66rem; color: var(--muted);
  border: 1px solid var(--muted); border-radius: 5px; padding: 0 3px;
}
/* A skill's tooltip (hover, or a long press on a touchscreen) */
.node { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.talent-tip {
  position: fixed; z-index: 60; max-width: min(280px, 92vw); padding: 9px 11px; border-radius: 12px; pointer-events: none;
  background: #14173f; border: 2px solid var(--yellow); color: var(--text); box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55); font-size: 0.85rem; line-height: 1.3;
}
.talent-tip[hidden] { display: none; }
.talent-tip .tt-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 3px; }
.talent-tip .tt-ic { font-size: 1.2rem; }
.talent-tip .tt-lv { margin-left: auto; font-size: 0.75rem; color: var(--yellow); font-weight: 800; }
.talent-tip .tt-desc { color: #dfe3ff; }
.talent-tip .tt-needs { margin-top: 4px; color: #ffb36b; font-size: 0.78rem; }
.talent-tip .tt-state { margin-top: 4px; color: var(--green); font-size: 0.78rem; font-weight: 800; }
.tree-snack { margin-top: 8px; display: flex; gap: 10px; align-items: center; justify-content: center; }
.tree-snack .node { width: 160px; }
.last-game { margin-top: 6px; font-size: 0.92rem; color: var(--muted); }
.pause-class { font-size: 1.15rem; font-weight: 900; margin-bottom: 6px; }
@media (max-width: 640px) {
  .t-row { grid-template-columns: 34px repeat(4, 1fr); gap: 5px; }
  .t-label small { display: none; }
  .node .n-desc { display: none; }
  .node .n-name { font-size: 0.7rem; }
  .tree-tab .tt-role { display: none; }
}

/* ---------- Boss word problems ---------- */
.question-pic { display: flex; justify-content: center; margin: 6px 0 0; }
.question-pic .qpic { margin: 0 !important; }
.question-pic svg { max-width: 100%; height: auto; }
.question.word.with-pic { text-align: center; margin-top: 4px; }
.prompt.example .qpic { margin: 6px 0 !important; }
.question.word { white-space: normal; letter-spacing: 0; font-size: 1.2rem; font-weight: 700; line-height: 1.45; text-align: left; margin: 8px 0; }
.math-panel.boss { border-color: #b86bff; box-shadow: 0 0 30px rgba(184, 107, 255, 0.45), 0 12px 40px rgba(0, 0, 0, 0.5); }
.math-panel.boss .math-title { color: #d9b8ff; }

/* ---------- Wardrobe ---------- */
.ward-panel { max-width: min(96vw, 720px); max-height: 94vh; overflow-y: auto; }
.ward-top { display: flex; gap: 14px; align-items: center; margin: 6px 0 10px; text-align: left; }
#wardPreview { background: radial-gradient(circle, #2f3590, #1c2050); border-radius: 16px; flex: 0 0 auto; }
.ward-count { font-weight: 900; font-size: 1.1rem; color: var(--yellow); }
.ward-slot { margin-bottom: 10px; text-align: left; }
.ward-slot-name { font-size: 0.75rem; font-weight: 800; color: var(--muted); text-transform: uppercase; margin-bottom: 4px; }
.ward-items { display: flex; flex-wrap: wrap; gap: 8px; }
.ward-item { width: 112px; padding: 6px; border-radius: 12px; border: 3px solid #3a3f8f; background: #22265e; color: var(--text); display: flex; flex-direction: column; align-items: center; }
.ward-item.owned { cursor: pointer; border-color: #6f78d8; }
.ward-item.owned:hover { transform: translateY(-2px); }
.ward-item.worn { border-color: var(--yellow); background: #2f3590; box-shadow: 0 0 12px rgba(255, 210, 63, 0.3); }
.ward-item.locked { opacity: 0.5; }
.ward-item .wi-icon { font-size: 1.7rem; }
.ward-item .wi-name { font-weight: 900; font-size: 0.8rem; }
.ward-item .wi-how { font-size: 0.66rem; color: #cfd4ff; }
.ward-item.worn .wi-how { color: var(--yellow); font-weight: 800; }

/* ---------- Parent progress charts ---------- */
.pc-title { margin: 18px 0 6px; color: var(--blue); font-size: 1.05rem; }
.pc-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.pc-filters label { font-size: 0.8rem; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.pc-filters select { font: inherit; font-size: 0.92rem; padding: 5px 8px; border-radius: 8px; background: #22265e; color: var(--text); border: 2px solid var(--panel-edge); }
.pc-card { background: #1a1d4a; border: 2px solid #2c3175; border-radius: 14px; padding: 10px 12px; margin: 10px 0; }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pc-sub { font-size: 0.78rem; color: var(--muted); }
.pc-tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.pc-plot { position: relative; margin-top: 8px; }
.pc-svg { width: 100%; height: auto; display: block; }
.pc-grid { stroke: rgba(255, 255, 255, 0.08); stroke-width: 1; }
.pc-tick { fill: #9aa0d8; font-size: 11px; }
.pc-axis { fill: #9aa0d8; font-size: 11px; }
.pc-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pc-dot { stroke: #1a1d4a; stroke-width: 2; }
.pc-bar { fill: #3987e5; }
.pc-cross { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1; }
.pc-tip { position: absolute; pointer-events: none; background: #0f1130; border: 1px solid #3a3f8f; border-radius: 8px; padding: 6px 9px; font-size: 0.8rem; min-width: 130px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }
.pc-tip div { display: flex; align-items: center; gap: 2px; }
.pc-tip span { margin-left: auto; padding-left: 10px; font-weight: 800; }
.pc-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.pc-table th, .pc-table td { padding: 4px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); text-align: right; }
.pc-table th:first-child, .pc-table td:first-child { text-align: left; }
.pc-empty { color: var(--muted); padding: 14px 0; }

/* ---------- Level-up skill pick (3 random skills) ---------- */
.pick-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.pick-card {
  position: relative; flex: 1 1 200px; max-width: 250px; padding: 14px 12px 12px; border-radius: 18px; text-align: center;
  border: 3px solid var(--yellow); background: #2a2f78; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px; transition: transform 0.1s;
  box-shadow: 0 0 16px rgba(255, 210, 63, 0.2);
}
.pick-card:hover, .pick-card:focus { transform: translateY(-4px) scale(1.03); outline: none; }
.pick-card.primary { border-style: double; border-width: 5px; }
.pick-card.master { background: linear-gradient(180deg, #4a3a8f, #2a2f78); box-shadow: 0 0 22px rgba(255, 210, 63, 0.45); }
.pick-card[data-tree="sharp"] .pk-tree { background: #1f4f7a; }
.pick-card[data-tree="storm"] .pk-tree { background: #4b2f86; }
.pick-card[data-tree="guard"] .pk-tree { background: #2f6b46; }
.pick-card .pk-tree { font-size: 0.75rem; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: #3a3f8f; }
.pick-card .pk-icon { font-size: 2.4rem; margin-top: 4px; }
.pick-card .pk-name { font-size: 1.15rem; font-weight: 900; }
.pick-card .pk-lvl { font-size: 0.78rem; color: var(--yellow); font-weight: 800; }
.pick-card .pk-desc { font-size: 0.86rem; color: #cfd4ff; line-height: 1.3; }
.pick-card .key { position: absolute; top: 8px; left: 10px; font-size: 0.75rem; color: var(--muted); border: 1px solid var(--muted); border-radius: 6px; padding: 0 5px; }
.pick-foot { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.pick-foot b { color: var(--yellow); }

/* ---------- Jokes and boss cut scenes ---------- */
/* Jokes always sit at the bottom middle (status lives at the top), the same
   place while you play and while a question or the skill pick is open. */
.joke-box {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 30; pointer-events: none;
  width: min(92vw, 520px); padding: 10px 16px 11px; border-radius: 18px; text-align: center;
  background: #ffd23f; color: #1b1f4b; border: 3px solid #1b1f4b; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s, transform 0.3s;
}
.joke-box.hidden { display: block; opacity: 0; transform: translate(-50%, 12px); }
.joke-box .jk-q { font-weight: 800; font-size: 1rem; }
.joke-box .jk-q::before { content: "😄 "; }
.joke-box .jk-a { font-weight: 900; font-size: 1.05rem; color: #a8256a; margin-top: 4px; opacity: 0; max-height: 0; transition: opacity 0.4s; }
.joke-box .jk-a.show { opacity: 1; max-height: 4em; }
body.cutscene #hud, body.cutscene .joke-box { opacity: 0; }
@media (max-width: 640px) { .joke-box .jk-q { font-size: 0.9rem; } }
/* Knowledge Knights: just above the button bar (and above the Shoot button on narrow screens). */
body.rpg .joke-box { bottom: 86px; }
@media (max-width: 700px) { body.rpg .joke-box { bottom: 182px; } }
/* A popup open while a joke shows leaves room at the bottom, so the joke never covers it. */
body:has(.joke-box.show) .modal { padding-bottom: 130px; }

/* ---------- Multiple-choice answers (civics) ---------- */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.choices button {
  display: flex; align-items: center; gap: 8px; text-align: left; padding: 10px 12px; min-height: 52px; border-radius: 14px;
  border: 3px solid var(--panel-edge); background: #2a2f78; color: var(--text); font: inherit; font-weight: 800; font-size: 0.98rem; cursor: pointer;
}
.choices button:hover, .choices button:focus { border-color: var(--yellow); outline: none; transform: translateY(-2px); }
.choices .ck { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; background: var(--yellow); color: #1b1f4b; display: grid; place-items: center; font-weight: 900; font-size: 0.85rem; }
#choiceWrap .hint-btn, #choiceWrap .skip-btn { width: 100%; padding: 10px; border-radius: 12px; border: 0; color: var(--text); font: inherit; font-weight: 800; background: linear-gradient(180deg, #6d5a12, #4f4110); }
#choiceWrap .skip-btn { background: linear-gradient(180deg, #4a5068, #363b52); }
#choiceWrap .hint-btn:disabled { opacity: 0.4; }
@media (max-width: 520px) { .choices { grid-template-columns: 1fr; } }

/* ---------- World picker ---------- */
.world-pick { display: flex; gap: 10px; margin: 10px 0 6px; }
.world-card {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px; border-radius: 16px; cursor: pointer;
  border: 3px solid var(--panel-edge); background: #22265e; color: var(--text); font: inherit; transition: transform 0.1s;
}
.world-card:hover { transform: translateY(-2px); }
.world-card.on { border-color: var(--yellow); background: #2f3590; box-shadow: 0 0 14px rgba(255, 210, 63, 0.3); }
.world-card .wc-icon { font-size: 1.8rem; }
.world-card .wc-name { font-weight: 900; font-size: 1.05rem; }
.world-card .wc-tag { font-size: 0.75rem; color: #cfd4ff; line-height: 1.25; }
.world-card .wc-best { font-size: 0.72rem; color: var(--yellow); font-weight: 800; }
@media (max-width: 520px) { .world-card .wc-tag { display: none; } }

/* ---------- Knowledge Knights ---------- */
.rpg-panel { max-width: min(96vw, 860px); max-height: 92vh; overflow-y: auto; text-align: left; }
.rpg-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rpg-head .math-title { font-size: 1.5rem; }
.rpg-panel h4 { margin: 14px 0 6px; color: var(--blue); }
.rpg-help, .rpg-hello { color: #cfd4ff; line-height: 1.45; }
.rpg-hello { font-size: 1.05rem; font-style: italic; }
.rpg-dim { color: var(--muted); font-size: 0.82rem; }
.rpg-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.rpg-note { min-height: 1.3em; margin-top: 8px; color: var(--green); font-weight: 800; }
/* Key items (bag) and a gatekeeper's checklist */
.rpg-keys { display: flex; flex-wrap: wrap; gap: 6px; }
/* The quest log's boss items table: a grid on wide screens, cards on phones. */
.rpg-boss-table { display: grid; gap: 4px; margin: 6px 0 12px; }
.rpg-boss-row { display: grid; grid-template-columns: 1.3fr 1.6fr 0.8fr 1.6fr; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: #22265e; border: 2px solid transparent; }
.rpg-boss-row.head { background: none; padding: 0 10px; font-size: 0.8rem; font-weight: 800; color: #9fa6e8; text-transform: uppercase; letter-spacing: 0.04em; }
.rpg-boss-row.got { background: rgba(75, 227, 107, 0.12); }
.rpg-boss-row.next { border-color: var(--yellow); background: rgba(255, 210, 63, 0.12); }
.rpg-boss-row > div { display: flex; flex-direction: column; min-width: 0; }
.rpg-boss-row small { color: #cfd4ff; font-size: 0.8rem; }
.rpg-boss-row .bi-item { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
.rpg-boss-row .bi-icon { font-size: 1.5rem; }
.rpg-boss-row .bi-next { width: 100%; color: var(--yellow); font-weight: 800; }
.rpg-boss-row .bi-yes { color: #7be37b; font-weight: 800; }
.rpg-boss-row .bi-no { color: #ff8fa3; font-weight: 800; }
@media (max-width: 620px) {
  .rpg-boss-row { grid-template-columns: 1fr 1fr; gap: 6px 10px; }
  .rpg-boss-row.head { display: none; }
  .rpg-boss-row > div::before { content: attr(data-label); font-size: 0.7rem; font-weight: 800; color: #9fa6e8; text-transform: uppercase; }
  .rpg-boss-row .bi-item::before { width: 100%; }
}
.rpg-key { padding: 5px 10px; border-radius: 999px; background: #2a2f78; border: 2px solid var(--yellow); font-weight: 800; font-size: 0.85rem; }
.rpg-needs { display: grid; gap: 8px; margin: 10px 0; }
.rpg-need { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255, 77, 109, 0.12); border: 2px solid rgba(255, 77, 109, 0.5); }
.rpg-need.ok { background: rgba(75, 227, 107, 0.12); border-color: rgba(75, 227, 107, 0.6); }
.rpg-need > b { font-size: 1.4rem; width: 1.4em; text-align: center; color: #ff8fa3; }
.rpg-need.ok > b { color: #7be37b; }
.rpg-need span { display: flex; flex-direction: column; font-weight: 800; }
.rpg-need small { font-weight: 400; color: #cfd4ff; font-size: 0.85rem; margin-top: 2px; }
.rpg-note.bad { color: #ff8fa3; }
.rpg-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.rpg-item { display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto auto; column-gap: 8px; padding: 8px; border-radius: 12px; background: #22265e; border: 2px solid var(--panel-edge); }
.rpg-item.rare { border-color: var(--yellow); }
.rpg-item.eq { background: #2a2f78; }
.rpg-item .ri-icon { grid-row: 1 / span 3; font-size: 1.6rem; display: grid; place-items: center; }
/* Pixel-art item icons (js/pixel-items.js): crisp, never smoothed. */
.px-icon { image-rendering: pixelated; image-rendering: crisp-edges; vertical-align: middle; }
.rpg-item .ri-icon .px-icon { width: 36px; height: 36px; }
.rpg-reward .px-icon { width: 18px; height: 18px; }   /* drawn at 1x */
.rpg-item .ri-slot { grid-column: 2; font-size: 0.68rem; color: var(--muted); text-transform: uppercase; font-weight: 800; }
.rpg-item .ri-name { grid-column: 2; font-weight: 900; font-size: 0.9rem; }
.rpg-item .ri-desc { grid-column: 2; font-size: 0.75rem; color: #cfd4ff; }
/* Tailor Tess (Knowledge Knights): shapes and color swatches */
.tailor-preview { display: flex; align-items: center; gap: 14px; margin: 4px 0 8px; }
.tailor-preview .px-icon { width: 72px; height: 72px; image-rendering: pixelated; }
.tailor-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tailor-pick { display: grid; place-items: center; gap: 2px; min-width: 64px; padding: 6px; border-radius: 10px; background: #22265e; border: 2px solid var(--panel-edge); color: inherit; cursor: pointer; font: inherit; }
.tailor-pick small { font-size: 0.68rem; }
.tailor-pick.on, .tailor-dye.on { border-color: var(--yellow); box-shadow: 0 0 0 2px var(--yellow); }
.tailor-dye { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--panel-edge); background: var(--dye, #22265e); color: #fff; font-weight: 900; cursor: pointer; }
.tailor-dye:disabled { opacity: 0.3; cursor: default; }
.rpg-item .mini-btn { grid-column: 2; justify-self: start; margin-top: 4px; }
/* Drop sits in the card's top-right corner, apart from Wear / Drink. */
.rpg-item:has(.drop-btn) { position: relative; }
.rpg-item:has(.drop-btn) .ri-name { padding-right: 48px; }
.rpg-item .drop-btn { position: absolute; top: 6px; right: 6px; margin: 0; background: transparent; color: var(--muted); border-color: #444bb0; }
.rpg-item .drop-btn:hover { color: #ff8fa3; border-color: #ff8fa3; }
.rpg-doll { display: flex; justify-content: center; align-items: flex-end; gap: 18px; margin: 10px 0 2px; padding: 8px; border-radius: 12px; background: radial-gradient(ellipse at 50% 90%, #2a2f6a, #14163a); }
.rpg-doll img { image-rendering: pixelated; height: 99px; width: auto; }
.rpg-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 10px; border-radius: 12px; background: #1a1d4a; font-weight: 800; font-size: 0.9rem; }
.rpg-quest { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: #22265e; margin: 6px 0; }
.rpg-reward { font-size: 0.8rem; color: var(--yellow); margin-top: 3px; }
.rpg-prog { font-weight: 900; color: var(--blue); white-space: nowrap; }
.rpg-done { color: var(--green); font-weight: 900; white-space: nowrap; }
.rpg-ready { color: var(--yellow); font-weight: 800; margin: -2px 0 6px 10px; }
.mini-btn.go { border-color: var(--yellow); }
.rpg-item.better { box-shadow: 0 0 0 2px #7be37b inset; }
.ri-up { color: #7be37b; font-size: 0.78rem; }
.rpg-choice { margin: 4px 0 12px; }
.rpg-choice-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.rpg-choice-btns .mini-btn { font-size: 1rem; padding: 9px 16px; margin: 0; }
.mini-btn.danger { border-color: #ff4d6d; color: #ff8fa3; }
.rpg-chars, .rpg-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.rpg-char { display: flex; flex-direction: column; gap: 4px; }
.rpg-char-main, .rpg-class {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px; border-radius: 16px; cursor: pointer; text-align: center;
  border: 3px solid var(--panel-edge); background: #22265e; color: var(--text); font: inherit;
}
.rpg-char-main:hover, .rpg-class:hover { border-color: var(--yellow); transform: translateY(-2px); }
.rc-icon { font-size: 2rem; }
.rc-name { font-weight: 900; font-size: 1.1rem; }
.rc-sub { font-size: 0.78rem; color: #cfd4ff; }
.rpg-class span { font-size: 0.82rem; color: #cfd4ff; }
.rc-del { align-self: center; font-size: 0.8rem; }
#rpgNewName { font: inherit; font-size: 1rem; padding: 8px 10px; border-radius: 10px; border: 2px solid var(--panel-edge); background: #1a1d4a; color: var(--text); margin-bottom: 10px; width: min(100%, 280px); }
.rpg-prompt {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%); z-index: 7; padding: 10px 18px; border-radius: 14px;
  background: #ffd23f; color: #1b1f4b; font: inherit; font-weight: 900; border: 3px solid #1b1f4b; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
/* Knowledge Knights: fainted (what can happen, and the button to go back). */
.rpg-down {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 8; width: min(92vw, 460px); padding: 12px 16px; border-radius: 16px;
  background: rgba(27,31,75,0.94); border: 3px solid #ff8fa3; color: var(--text); text-align: center; box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}
body:not(.rpg) .rpg-down, body.cutscene .rpg-down { display: none; }
.rpg-down p { margin: 0 0 10px; font-weight: 700; line-height: 1.35; }
.rpg-down button { padding: 10px 18px; border-radius: 14px; border: 3px solid #1b1f4b; background: #ffd23f; color: #1b1f4b; font: inherit; font-weight: 900; cursor: pointer; }
.rpg-bar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 7; display: none; gap: 8px; }
body.rpg .rpg-bar { display: flex; }
body.rpg.cutscene .rpg-bar, body.cutscene .rpg-prompt { display: none; }
.rpg-bar button { width: 58px; height: 58px; border-radius: 16px; border: 3px solid var(--panel-edge); background: rgba(27,31,75,0.9); color: var(--text); font-size: 1.5rem; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.rpg-bar button small { font-size: 0.62rem; color: var(--muted); font-weight: 800; }
.rpg-bar button.hidden { display: none; }
/* Grown-ups: the log of topic changes scrolls in its own box. */
/* Categories and grades fold up (<details>): a ▸/▾ before each title. */
details.strand > summary, details.grade-fold > summary { cursor: pointer; list-style: none; }
details.strand > summary::-webkit-details-marker, details.grade-fold > summary::-webkit-details-marker { display: none; }
details.strand > summary h4 { display: inline; }
details.strand > summary h4::before, details.grade-fold > summary::before { content: '▸ '; color: var(--muted); }
details.strand[open] > summary h4::before, details.grade-fold[open] > summary::before { content: '▾ '; }
details.strand > summary { display: block; margin: 14px 0 4px; }
details.grade-fold { margin: 2px 0 6px 10px; }
details.grade-fold > summary { font-weight: 800; font-size: 0.9rem; padding: 4px 0; color: var(--text); }
details.grade-fold > summary span { color: var(--muted); font-weight: 700; font-size: 0.78rem; margin-left: 8px; }
.topics-head #topicsGroupBy { margin-left: auto; }

/* ---- Tables as cards. On a narrow screen a table with class "card-table" is a
   stack of cards: one per row, each value labeled with its column (the
   labels come from js/table-cards.js), so nothing scrolls sideways. */
@media (max-width: 700px) {
  .table-wrap { overflow-x: visible; }
  table.card-table, .strand table.card-table, .strand table.topic-table.card-table, .family-table.card-table { min-width: 0; width: 100%; table-layout: auto; display: block; }
  table.card-table colgroup, table.card-table thead { display: none; }
  table.card-table tbody { display: block; }
  table.card-table tr { display: block; padding: 8px 4px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
  table.card-table td { display: block; padding: 2px 2px; border: 0; text-align: right; overflow-wrap: anywhere; }
  table.card-table td::after { content: ''; display: block; clear: both; }
  table.card-table td::before { content: attr(data-label); float: left; max-width: 45%; margin-right: 12px; text-align: left; color: var(--muted); font-size: 0.75rem; font-weight: 700; line-height: 1.6; }
  table.card-table td[data-label=""]::before { display: none; }
  /* The first column (the name of the row) is the card's title. */
  table.card-table td:first-child { display: block; text-align: left; font-size: 1rem; padding-bottom: 4px; }
  table.card-table td:first-child::before { display: none; }
  table.card-table td[colspan] { display: block; text-align: left; }
  table.card-table td.chev { display: none; }
  .adm-table.card-table th { position: static; }
  table.card-table .adm-bar { display: inline-block; vertical-align: middle; }
  .adm-q, .adm-picks { max-width: none; }
  .adm-filters input[type=search], .adm-row input { min-width: 0; width: 100%; }
  .adm-filters label { flex: 1 1 140px; }
  .adm-filters select { width: 100%; }
  .adm { padding-left: 10px; padding-right: 10px; }
  .parent-panel { padding: 16px 12px; }
  details.grade-fold { margin-left: 4px; }
}
.rpg-bar .bag-ico { height: 28px; image-rendering: pixelated; }
.tree-panel-inner .cards { display: block; }

/* ---------- Knowledge Knights: skill buttons ---------- */
.rpg-only { display: none; }
body.rpg .rpg-only { display: block; }
.skill-bar { position: fixed; right: 14px; bottom: 14px; z-index: 7; display: none; gap: 8px; flex-wrap: wrap-reverse; justify-content: flex-end; max-width: 46vw; }
body.rpg .skill-bar { display: flex; }
body.rpg.cutscene .skill-bar { display: none; }
.sk-btn { position: relative; width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--panel-edge); background: rgba(27,31,75,0.92); color: var(--text); overflow: hidden; display: grid; place-items: center; pointer-events: auto; }
.sk-btn.ready { border-color: var(--yellow); box-shadow: 0 0 12px rgba(255, 210, 63, 0.45); }
.sk-icon { font-size: 1.7rem; position: relative; z-index: 1; }
.sk-key { position: absolute; top: 4px; left: 8px; font-size: 0.65rem; font-weight: 900; color: var(--muted); z-index: 3; }
.sk-cd { position: absolute; inset: 0; border-radius: 50%; z-index: 2; display: grid; place-items: center; font-weight: 900; font-size: 1.1rem; color: #fff; text-shadow: 0 1px 3px #000; }
@media (max-width: 640px) { .sk-btn { width: 56px; height: 56px; } .rpg-bar button { width: 48px; height: 48px; } .rpg-bar { left: 12px; transform: none; } }

/* ---------- Knowledge Knights: the world map ---------- */
.map-modal { position: fixed; inset: 0; z-index: 30; background: #0b0d24; padding: 0; }
.map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; display: block; }
.map-canvas:active { cursor: grabbing; }
.map-modal .nav-back { position: absolute; z-index: 2; }
.map-tools { position: absolute; right: 16px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 2; }
.map-tools button { width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--panel-edge); background: rgba(27,31,75,0.92); color: var(--text); font-size: 1.6rem; font-weight: 900; cursor: pointer; }
.map-tools button:active { transform: scale(0.94); }
.map-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 2; background: rgba(11,13,36,0.8); color: var(--muted); font-size: 0.8rem; padding: 6px 12px; border-radius: 999px; pointer-events: none; white-space: nowrap; }
@media (max-width: 640px) { .map-hint { bottom: auto; top: 64px; font-size: 0.72rem; } }

/* ---------- Knowledge Knights: shoot button ---------- */
.shoot-btn { position: fixed; right: 14px; bottom: 92px; z-index: 7; display: none; width: 78px; height: 78px; border-radius: 50%; border: 3px solid #ff4d6d; background: rgba(120,20,40,0.85); color: #fff; font-size: 1.9rem; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; touch-action: none; user-select: none; }
.shoot-btn small { font-size: 0.62rem; font-weight: 900; }
.shoot-btn:active { transform: scale(0.94); background: rgba(160,30,60,0.95); }
body.rpg .shoot-btn { display: flex; }
body.rpg.cutscene .shoot-btn { display: none; }
body.rpg canvas { cursor: crosshair; }

/* Knowledge Knights: the game draws a big reticle, so hide the small cursor over the game */
body.aiming canvas { cursor: none; }

.rpg-bar button.on { border-color: #4be36b; background: rgba(30,90,50,0.92); box-shadow: 0 0 12px rgba(75,227,107,0.45); }
.rpg-bar button.on small { color: #7be37b; }

/* Friends (parents add other families so kids can join each other's games) */
.friends-box { margin-top: 14px; }
.friend-form { display: flex; gap: 8px; flex-wrap: wrap; }
.friend-form input { flex: 1 1 220px; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 2px solid #2c3550;
  background: rgba(0,0,0,0.25); color: var(--text); font: inherit; }
.friend-form input:focus { outline: none; border-color: var(--blue); }
.friend-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06); }
.friend-row small { color: var(--muted); }
.friend-row { flex-wrap: wrap; }
.friend-row > span:last-child { display: flex; gap: 6px; margin-left: auto; }
.friend-row > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.friends-box .live-head { margin-top: 10px; }
.friend-row .mini-btn, .friend-form .mini-btn { display: inline-block; margin-top: 0; font-size: 0.85rem; padding: 5px 10px; }
.friend-row .mini-btn:not(.secondary), .friend-form .mini-btn { background: #2d3380; }
.friend-row .mini-btn.secondary { border-color: #3a4060; color: var(--muted); }
/* The family's invite link (Grown-ups → Friends) */
.invite-card { padding: 10px 12px; margin-bottom: 12px; border-radius: 10px; border: 2px solid #3a4f8a; background: rgba(75, 120, 255, 0.08); }
.invite-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.invite-row input { flex: 1 1 220px; min-width: 0; padding: 7px 10px; border-radius: 8px; border: 2px solid #2c3550;
  background: rgba(0,0,0,0.25); color: var(--text); font: inherit; font-size: 0.9rem; }
.invite-row .mini-btn { display: inline-block; margin-top: 0; font-size: 0.85rem; padding: 5px 12px; }
.invite-row .mini-btn:not(.secondary) { background: #2d3380; }
.friend-tag { font-style: normal; font-size: 0.72rem; font-weight: 800; color: #10131f; background: #4be36b;
  border-radius: 6px; padding: 1px 6px; vertical-align: 1px; }
.friend-news { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: rgba(75,227,107,0.14);
  border: 1px solid rgba(75,227,107,0.5); font-size: 0.92rem; }

/* Parent report card by grade level */
.report-view { margin: 4px 0 10px; }
.grade-report { width: 100%; }
.grade-report .grade-row th { text-align: left; padding: 12px 6px 6px; color: var(--blue); font-size: 1rem; border-bottom: 1px solid rgba(255,255,255,0.12); }
.grade-report .grade-row th span { float: right; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.grade-report .grade-cell { color: var(--muted); font-weight: 800; white-space: nowrap; }

/* Privacy: consent box, family data */
.consent-row { display: flex; gap: 8px; align-items: flex-start; text-align: left; color: var(--muted); font-size: 0.9rem; line-height: 1.4; margin: 8px 0; }
.consent-row input { margin-top: 3px; flex: none; }
.consent-row a, .auth-note a, .parent-help a { color: var(--text); }
.data-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.delete-form { margin-top: 8px; }
.delete-form input { width: 100%; max-width: 320px; }

/* Knowledge Knights: rolled loot shows its rarity color */
.rpg-item.loot { border-color: var(--rarity); box-shadow: inset 0 0 0 1px var(--rarity); }
.rpg-item.loot .ri-name { color: var(--rarity); }
.rpg-item.loot.rarity-3, .rpg-item.loot.rarity-4 { box-shadow: inset 0 0 0 1px var(--rarity), 0 0 10px var(--rarity); }

/* ---------- Grown-ups dashboard: section tabs, player header, chart compare chips ---------- */
.parent-nav { display: flex; gap: 4px; margin: 12px 0 6px; border-bottom: 2px solid var(--panel-edge); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.parent-nav button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 800; font-size: 0.95rem;
  padding: 8px 12px; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; cursor: pointer;
}
.parent-nav button.on { color: var(--text); border-bottom-color: var(--yellow); }
.nav-badge { display: inline-block; min-width: 1.3em; padding: 0 5px; border-radius: 999px; background: var(--yellow); color: #1b1f4b; font-size: 0.75rem; text-align: center; }
.parent-sec { padding-top: 4px; }
.kid-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.kid-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 1.3rem; }
.kid-head h3 .kid-dot { width: 14px; height: 14px; }
.kid-head .mini-btn { margin: 0; font-size: 0.85rem; padding: 5px 10px; }
.kid-edit { margin: 8px 0; padding: 10px; border: 2px solid var(--panel-edge); border-radius: 12px; max-width: 420px; }
.kid-edit input {
  display: block; width: 100%; font: inherit; font-size: 1.1rem; padding: 8px 12px; border-radius: 10px;
  border: 3px solid var(--panel-edge); background: #0b0e2a; color: #fff; user-select: text;
}
.kid-edit .kid-colors { justify-content: flex-start; }
.grade-pick { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-weight: 700; }
.grade-pick select {
  font: inherit; font-size: 1rem; padding: 7px 10px; border-radius: 10px;
  border: 3px solid var(--panel-edge); background: #0b0e2a; color: #fff;
}
.kid-level { margin: 6px 0 0; font-size: 0.92rem; color: var(--muted); }
.kid-level b { color: #fff; }
.kid-edit .mini-btn, .data-actions .mini-btn { display: inline-block; margin: 0; font-size: 0.85rem; padding: 5px 10px; }
.name-warn { color: #ffb36b; font-size: 0.9rem; margin: 6px 0 0; }
.parent-howto { margin: 8px 0; }
.parent-howto summary { cursor: pointer; color: var(--blue); font-weight: 700; font-size: 0.92rem; }

/* ---------- Short messages ---------- */
.toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 60; max-width: min(92vw, 520px);
  background: #22265e; color: var(--text); border: 2px solid var(--yellow); border-radius: 12px; padding: 10px 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45); font-weight: 700; text-align: center;
}

/* ---------- Accessibility: visible keyboard focus, less motion when asked ---------- */
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--yellow); outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Optional second choice after an answer (e.g. "Leave it for now" on item questions). */
.feedback .fb-alt { display: block; margin: 12px auto 0; font-size: 15px; }
.feedback .fb-alt.hidden { display: none; }

/* The game version, in a corner of every screen outside live games (js/version.js) */
.app-version-tag { position: fixed; left: 8px; bottom: 6px; z-index: 70; pointer-events: none; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.03em; opacity: 0.75; text-shadow: 0 1px 2px #000; }
.app-version-tag.hidden { display: none; }
/* "Report a problem": small, in the bottom-left corner of every screen (just
   above the version label), over popups too. */
.report-btn {
  position: fixed; left: 8px; bottom: 24px; z-index: 75; cursor: pointer;
  padding: 4px 10px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 12, 40, 0.65); color: var(--muted); font: inherit; font-size: 0.75rem; font-weight: 700; opacity: 0.8;
}
.report-btn:hover, .report-btn:focus-visible { opacity: 1; color: #fff; border-color: #ffd23f; outline: none; }
body:has(#hud:not(.hidden)) .report-btn { bottom: 8px; }
/* Knowledge Knights on a phone: the bottom bar starts at the left edge, so the 🐞 sits just above it, never over the bag button. */
@media (max-width: 640px) { body.rpg:has(#hud:not(.hidden)) .report-btn { bottom: 72px; } }
body:has(#hud:not(.hidden)) .report-btn span { display: none; }   /* during play: just the 🐞 */
#reportModal { z-index: 80; }
.report-panel { max-width: min(94vw, 460px); display: flex; flex-direction: column; gap: 8px; text-align: left; }
.report-panel textarea, .report-panel input[type="email"] { width: 100%; box-sizing: border-box; font: inherit; padding: 8px 10px; border-radius: 10px;
  border: 2px solid var(--panel-edge, #3a3f8f); background: #141842; color: #fff; }
.report-panel textarea { resize: vertical; min-height: 90px; }
.report-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.report-kinds-q { width: 100%; font-weight: 800; font-size: 0.92rem; }
.report-kind { cursor: pointer; }
.report-kind input { position: absolute; opacity: 0; pointer-events: none; }
.report-kind span { display: inline-block; padding: 5px 10px; border-radius: 999px; border: 2px solid #3a3f8f; background: #1c2050; font-size: 0.85rem; font-weight: 700; }
.report-kind input:checked + span { border-color: var(--yellow); background: #2f3590; color: var(--yellow); }
.report-kind input:focus-visible + span { outline: 2px solid var(--yellow); outline-offset: 2px; }
.report-panel .hidden { display: none; }
.report-shot img { width: 100%; max-height: 180px; object-fit: contain; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.2); background: #000; }
.report-shot img.off { opacity: 0.25; }

/* ---------- Grown-ups, streamlined: one picker, one Show bar, settings as rows ---------- */
.who-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.who { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 800; font-size: 0.95rem; padding: 6px 14px;
  border-radius: 999px; border: 2px solid var(--panel-edge); background: transparent; color: var(--text); cursor: pointer; }
.who.on { border-color: var(--yellow); background: #2a2f78; }
.who.add { border-style: dashed; color: var(--muted); margin-left: auto; }
.show-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; margin: 14px 0 4px; padding: 10px 12px;
  border-radius: 12px; background: #1a1d4a; border: 2px solid #2c3175; }
.show-label { font-weight: 900; color: var(--yellow); align-self: center; }
.show-bar label { font-size: 0.78rem; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.show-bar select, .pc-range select { font: inherit; font-size: 0.92rem; padding: 5px 8px; border-radius: 8px; background: #22265e; color: var(--text); border: 2px solid var(--panel-edge); }
.seg { display: inline-flex; border: 2px solid var(--panel-edge); border-radius: 10px; overflow: hidden; align-self: center; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 800; font-size: 0.9rem; padding: 6px 14px; cursor: pointer; }
.seg button.on { background: #2a2f78; color: var(--text); }
.show-summary { font-size: 0.85rem; color: var(--muted); margin: 2px 2px 0; }
.show-summary b { color: var(--text); }
.show-summary .link-btn, .parent-help .link-btn { padding: 0 4px; font-size: 0.85rem; }
.sum-v small { font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.manage-box { margin: 8px 0; padding: 10px 12px; border: 2px solid var(--panel-edge); border-radius: 12px; }
.manage-box .kid-edit { border: 0; padding: 0; margin: 0; }
.manage-label { font-weight: 800; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.manage-danger { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.topics-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 18px; }
.topics-head h3 { margin: 0; }
.strand h4 { margin: 14px 0 4px; color: var(--blue); font-size: 1rem; }
.topic-row { cursor: pointer; }
.topic-row:hover td, .topic-row.open td { background: rgba(79, 195, 255, 0.07); }
.topic-row:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.topic-row .chev { color: var(--muted); width: 18px; text-align: center; }
.topic-more td { background: rgba(79, 195, 255, 0.07); border-top: 0 !important; padding: 2px 10px 12px !important; }
.topic-facts { font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; line-height: 1.5; }
/* A topic's questions answered, oldest first (ParentPanel.answersHtml). */
.topic-answers { margin-top: 12px; }
.topic-answers h5 { margin: 0 0 2px; font-size: 0.95rem; }
.topic-answers h5 .st-sub { font-weight: 400; margin-left: 6px; }
.topic-answers > p { margin: 2px 0 6px; }
.topic-answers .table-wrap { max-height: 420px; overflow: auto; }
.topic-more .ans-table td { background: none; padding: 4px 8px !important; border-top: 1px solid rgba(255, 255, 255, 0.07) !important; vertical-align: top; font-size: 0.85rem; }
.topic-more .ans-table th { font-size: 0.72rem; padding: 4px 8px; }
.ans-table tr.ans-w td { background: rgba(255, 77, 109, 0.06); }
.ans-ok { color: var(--green); font-weight: 700; white-space: nowrap; }
#choiceBox.pic-choices button { display: flex; align-items: center; gap: 6px; padding: 6px 8px; min-height: 64px; }
#choiceBox.pic-choices button .qpic { flex: 1; min-width: 0; }
#choiceBox.pic-wide { grid-template-columns: 1fr !important; }
#choiceBox.pic-wide button { min-height: 0; padding: 3px 8px; }
#choiceBox.pic-choices .qpic { margin: 0 !important; }
.qpic svg, .qpic table { max-width: 100%; }
.ans-q { all: unset; cursor: pointer; display: block; }
.ans-q:hover, .ans-q:focus-visible { text-decoration: underline; outline: none; }
.ans-more { font-size: 0.72rem; opacity: 0.7; white-space: nowrap; }
.ans-table tr.ans-open td { border-bottom: none !important; }
.ans-table tr.ans-detail td { background: rgba(255, 255, 255, 0.04); }
.ans-full-q { font-weight: 700; margin: 2px 0 6px; }
.ans-choices { margin: 4px 0 8px 1.4em; padding: 0; }
.ans-choices li { margin: 3px 0; }
.ans-choices li.ans-c-right { font-weight: 700; }
.ans-choices li.ans-c-wrong { text-decoration: line-through; text-decoration-color: rgba(255, 77, 109, 0.7); }
.ans-no { color: #ff8fa3; font-weight: 700; white-space: nowrap; }
.ans-gave { color: var(--muted); font-weight: 700; white-space: nowrap; }
.mode-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-bottom: 8px; }
.mode-pick label { font-size: 0.9rem; cursor: pointer; }
.mode-pick small { color: var(--muted); }
.topic-more .mini-btn { display: inline-block; margin: 0; font-size: 0.85rem; padding: 5px 10px; }
.mode-tag { font-size: 0.72rem; font-weight: 800; color: #ffc46b; border: 1px solid rgba(255, 196, 107, 0.45); border-radius: 999px; padding: 0 6px; margin-left: 4px; white-space: nowrap; }
.family-table tr[data-kid]:hover td { background: rgba(79, 195, 255, 0.07); }
.pc-head .pc-range { font-size: 0.78rem; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.pc-facts { font-size: 0.85rem; color: var(--muted); margin: 8px 0 2px; }
.pc-facts b { color: var(--text); }
.pc-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px; margin-top: 8px; }
.pc-part .pc-head { align-items: baseline; }
.pc-toggle { font-size: 0.8rem; padding: 0; }
.set-list { margin-top: 8px; }
.set-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 12px 2px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.set-row > .mini-btn, .set-actions .mini-btn { display: inline-block; margin: 0; font-size: 0.85rem; padding: 5px 12px; white-space: nowrap; }
.set-actions { display: flex; gap: 6px; flex-shrink: 0; }
.set-k { font-weight: 800; }
.set-v { color: var(--muted); font-size: 0.88rem; line-height: 1.45; margin-top: 2px; max-width: 560px; }
.set-v b { color: var(--text); }
.set-v a { color: var(--text); }
.danger-row .set-k { color: #ff8fa3; }
@media (max-width: 560px) {
  .set-row { flex-direction: column; }
  .who.add { margin-left: 0; }
}
.strand table.topic-table { table-layout: fixed; min-width: 560px; }
.topic-table col.c-topic { width: 38%; } .topic-table col.c-status { width: 24%; } .topic-table col.c-score { width: 14%; }
.topic-table col.c-dots { width: 19%; } .topic-table col.c-chev { width: 5%; }
.topic-table.with-cat col.c-topic { width: 28%; } .topic-table.with-cat col.c-cat { width: 18%; } .topic-table.with-cat col.c-status { width: 20%; } .topic-table.with-cat col.c-score { width: 12%; } .topic-table.with-cat col.c-dots { width: 18%; } .topic-table.with-cat col.c-chev { width: 4%; }
.strand h4 span { color: var(--muted); font-weight: 700; font-size: 0.82rem; margin-left: 8px; }
.set-list > .pin-error:empty { display: none; }
@media (max-width: 560px) {
  .parent-nav button { padding-left: 8px; padding-right: 8px; font-size: 0.9rem; }
  .parent-panel .sum-grid { grid-template-columns: repeat(3, 1fr); }
  .parent-panel .sum-v { font-size: 1.15rem; }
  .parent-panel .sum-k { font-size: 0.72rem; }
  .show-bar label { flex: 1 1 120px; }
  .show-bar select { width: 100%; }
}

/* A world the family hasn't unlocked (payments on) */
.world-card.locked { opacity: 0.7; }
.world-card.locked .wc-tag { color: #ffc46b; }
/* Grown-ups → Membership */
.lp-alt { color: #aab0e6; font-weight: 700; margin: -4px 0 8px; }
/* Membership: what the family has (dates, payments), then the products as a table. */
.mem-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.mem-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 10px; margin: 8px 0 14px; }
.mem-card { border: 2px solid var(--panel-edge); border-radius: 12px; padding: 10px 12px; background: #1a1d4a; }
.mem-card.live { border-color: #ffd23f; box-shadow: 0 0 0 1px rgba(255, 210, 63, 0.25); }
.mem-title { margin-bottom: 6px; }
.mem-row { display: flex; gap: 10px; font-size: 0.92rem; padding: 2px 0; }
.mem-k { min-width: 96px; color: #aab0e6; }
.mem-act { margin-top: 8px; }
.mode-tag.ok { border-color: rgba(75, 227, 107, 0.6); color: #8ff0a4; }
.mode-tag.warn { border-color: rgba(255, 196, 61, 0.7); color: #ffd36b; }
.mem-table-wrap { overflow-x: auto; margin: 6px 0; -webkit-overflow-scrolling: touch; }
.mem-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 0.92rem; }
.mem-table thead th { font-size: 0.78rem; font-weight: 700; color: #aab0e6; padding: 4px 6px; text-align: center; vertical-align: bottom; }
.mem-table thead th:first-child { text-align: left; }
.mem-table tbody th, .mem-table tbody td { background: #1a1d4a; padding: 8px 6px; border-top: 2px solid var(--panel-edge); border-bottom: 2px solid var(--panel-edge); }
.mem-table tbody th { text-align: left; font-weight: 400; min-width: 170px; border-left: 2px solid var(--panel-edge); border-radius: 12px 0 0 12px; }
.mem-table tbody td:last-child { border-right: 2px solid var(--panel-edge); border-radius: 0 12px 12px 0; }
.mem-table tbody tr.mine th, .mem-table tbody tr.mine td { background: #2a2a4a; border-color: #ffd23f; }
.mem-pname { font-weight: 800; color: #ffd23f; }
@media (max-width: 700px) {
  .mem-table thead th:first-child, .mem-table tbody th { position: sticky; left: 0; z-index: 1; }
  .mem-table thead th:first-child { background: var(--panel, #22265e); }
  .mem-table tbody th { min-width: 130px; }
}
.mem-x, .mem-demo, .mem-no { text-align: center; font-weight: 800; }
.mem-x { color: #8ff0a4; }
.mem-demo { color: #ffd36b; font-weight: 600; font-size: 0.85rem; }
.mem-no { color: #6f75a8; }
.mem-buy { text-align: right; white-space: nowrap; }
.mem-buy .plan-buy { font-weight: 800; }
.mem-key { font-size: 0.82rem; }
.mem-ends { color: #ffd36b; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; margin: 14px 0; }
.plan-card { border: 2px solid var(--panel-edge); border-radius: 14px; padding: 12px 14px; background: #1a1d4a; }
.plan-card.owned { border-color: rgba(75, 227, 107, 0.5); }
.plan-name { font-weight: 900; font-size: 1.1rem; color: var(--yellow); }
.plan-buy { margin: 6px 0 0; padding: 8px 12px; font-size: 1rem; }
.plan-buy .was-price { opacity: 0.6; font-weight: 600; margin-right: 4px; }
.code-form { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 4px 0 10px; }
.code-form label { color: var(--muted); font-weight: 700; }
.code-form input { width: 12em; max-width: 100%; text-transform: uppercase; padding: 6px 10px; border-radius: 8px; border: 2px solid #2c3550; background: #151a33; color: var(--text); font: inherit; font-weight: 700; letter-spacing: 0.04em; }
.code-form input:focus { outline: none; border-color: var(--blue); }
.plan-owned { color: var(--green); font-weight: 800; margin-top: 6px; }
.trial-line { margin-top: 6px; font-size: 0.85rem; font-weight: 800; color: #ffc46b; }
.report-note { margin: 8px 0; padding: 8px 12px; border-radius: 10px; background: rgba(255, 196, 107, 0.1); border: 1px solid rgba(255, 196, 107, 0.4); font-size: 0.9rem; }

/* "Get the full game" shortcuts (payments on, not bought yet) */
.promo-btn { display: block; width: 100%; margin-top: 14px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--yellow);
  background: rgba(255, 210, 63, 0.12); color: var(--yellow); font: inherit; font-weight: 900; font-size: 1rem; cursor: pointer; }
.promo-btn small { display: block; font-weight: 700; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.promo-btn:hover { background: rgba(255, 210, 63, 0.2); }
.big-btn.promo { background: transparent; border: 3px solid var(--yellow); color: var(--yellow); box-shadow: none; }
.trial-buy { display: inline; padding: 0; color: var(--yellow); font-weight: 800; font-size: 0.85rem; }
.auth-offer { margin: -4px 0 10px; padding: 8px 12px; border-radius: 10px; background: rgba(255, 210, 63, 0.1); border: 1px solid rgba(255, 210, 63, 0.35);
  font-size: 0.9rem; line-height: 1.45; }

/* Simpler title screen: world cards show icon, name and one small badge */
.world-card .wc-badge { font-size: 0.7rem; font-weight: 800; color: #1b1f4b; background: var(--yellow); border-radius: 999px; padding: 1px 8px; margin-top: 2px; }
.world-card.locked .wc-badge { background: #ffc46b; }
details.howto { cursor: default; }
details.howto summary { cursor: pointer; text-align: center; color: var(--muted); font-weight: 700; list-style: none; }
details.howto summary::-webkit-details-marker { display: none; }
details.howto summary::before { content: '▸ '; }
details.howto[open] summary::before { content: '▾ '; }
details.howto[open] summary { margin-bottom: 6px; }

/* Loading screen (until the first real screen is ready) */
.loading-screen { pointer-events: none; }
.loading-dots { display: flex; gap: 8px; margin-top: 18px; }
.loading-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--yellow); animation: nk-dot 1s infinite ease-in-out; }
.loading-dots i:nth-child(2) { animation-delay: 0.15s; }
.loading-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes nk-dot { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

/* ---------- Home page (visitors who aren't signed in). See js/boot.js ---------- */
html:not(.has-session) #loadingScreen { display: none; }
html.has-session #landing { display: none; }
#landing {
  display: block; padding: 0; z-index: 12; text-align: left; user-select: text;
  background: radial-gradient(1200px 600px at 50% -10%, #2a3190 0%, #141846 55%, #0d1030 100%);
}
#landing.hidden { display: none; }
#landing h2 { margin: 0 0 18px; font-size: clamp(1.5rem, 3.4vw, 2rem); font-weight: 900; text-align: center; }
.land-top { display: flex; align-items: center; justify-content: space-between; max-width: 1080px; margin: 0 auto; padding: 16px 20px; }
.land-brand { font-size: 1.5rem; font-weight: 900; color: var(--blue); letter-spacing: 0.02em; }
.land-brand span { color: var(--yellow); margin-left: 0.15em; }
.land-signin { font: inherit; font-weight: 800; font-size: 0.95rem; padding: 8px 18px; border-radius: 999px; cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.35); background: transparent; color: var(--text); }
.land-signin:hover { border-color: var(--yellow); color: var(--yellow); }
.land-nav { display: flex; align-items: center; gap: 14px; }
.land-link { color: var(--text); font-weight: 800; font-size: 0.95rem; text-decoration: none; opacity: 0.85; }
.land-link:hover { color: var(--yellow); opacity: 1; }
@media (max-width: 560px) { .land-nav .land-link:nth-child(2) { display: none; } .land-nav { gap: 10px; } }
.land-teach { text-align: center; }
.land-teach .lt-sub { color: var(--muted); margin: -6px 0 16px; font-size: 1.05rem; }
.land-teach .land-cards { text-align: left; margin-bottom: 18px; }
a.big-btn { display: inline-block; text-decoration: none; }
.land-teach .lh-note a { color: var(--yellow); font-weight: 800; }
.land-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 36px; align-items: center;
  max-width: 1080px; margin: 0 auto; padding: 28px 20px 56px; }
.land-hero h1 { margin: 0; font-size: clamp(2.2rem, 5.2vw, 3.6rem); line-height: 1.08; font-weight: 900; letter-spacing: -0.01em; }
.land-hero h1 span { color: var(--yellow); }
.lh-sub { margin: 16px 0 22px; font-size: 1.15rem; line-height: 1.55; color: #cfd4ff; max-width: 30em; }
.land-go { width: auto; min-width: 240px; padding: 14px 34px; font-size: 1.3rem; margin: 0; }
.lh-note { margin: 12px 0 0; color: var(--muted); font-size: 0.95rem; }
.lh-art { position: relative; padding-bottom: 8%; }
.shot { display: block; width: 100%; height: auto; border-radius: 16px; border: 3px solid var(--panel-edge); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5); background: #0d1030; }
.shot-card { position: absolute; right: -2%; bottom: 0; width: 38%; border-color: var(--yellow); }
.land-sec { max-width: 1080px; margin: 0 auto; padding: 44px 20px; }
.land-steps, .land-worlds { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 16px; }
.land-step, .land-world, .land-card { background: rgba(27, 31, 75, 0.9); border: 2px solid var(--panel-edge); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.land-step i { width: 34px; height: 34px; border-radius: 50%; background: var(--yellow); color: #1b1f4b; font-style: normal; font-weight: 900; display: grid; place-items: center; }
.land-step b, .land-world b, .land-card b { font-size: 1.12rem; }
.land-step span, .land-world span, .land-card span { color: #c3c8f5; font-size: 0.97rem; line-height: 1.5; }
.lw-icon, .land-card .lc-icon { font-size: 2rem; }
.land-world em { align-self: flex-start; margin-top: auto; font-style: normal; font-weight: 800; font-size: 0.8rem; color: #1b1f4b; background: var(--yellow); border-radius: 999px; padding: 2px 12px; }
.land-lead { max-width: 720px; margin: -6px auto 22px; text-align: center; color: #c3c8f5; font-size: 1.05rem; line-height: 1.5; }
.land-pics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: start; }
.land-pics figure { margin: 0; }
.land-pics img { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.5)); }
.land-pics figcaption { margin-top: 10px; text-align: center; font-weight: 800; }
.land-pics figcaption small { display: block; font-weight: 600; color: var(--muted); font-size: 0.85rem; }
@media (max-width: 860px) { .land-pics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.land-split { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 32px; align-items: center; }
#landing .land-split h2 { text-align: left; }
/* Picture first: the family's week, with the worksheet it makes laid over its corner */
.land-flip { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); }
.land-help-art { padding-bottom: 14%; }
.land-help-art .shot-card { width: 42%; right: auto; left: -3%; }
.shot-paper { background: #fff; }
.land-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.land-list li { position: relative; padding-left: 30px; color: #dfe2ff; font-size: 1.02rem; line-height: 1.45; }
.land-list li::before { content: '✓'; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--green); color: #0d1030; font-weight: 900; font-size: 0.8rem; display: grid; place-items: center; margin-top: 2px; }
.land-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 16px; }
.land-price { max-width: 460px; margin: 0 auto; background: #1b1f4b; border: 3px solid var(--yellow); border-radius: 22px; padding: 26px; display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center;
  box-shadow: 0 0 40px rgba(255, 210, 63, 0.18); }
.lp-amount { font-size: 3rem; font-weight: 900; color: var(--yellow); line-height: 1; }
.lp-amount small { font-size: 1.1rem; color: var(--muted); font-weight: 700; }
.land-price .land-list { text-align: left; }
.land-faq { max-width: 760px; }
.land-faq details { background: rgba(27, 31, 75, 0.9); border: 2px solid var(--panel-edge); border-radius: 14px; padding: 0 18px; margin-bottom: 10px; }
.land-faq summary { cursor: pointer; font-weight: 800; font-size: 1.05rem; padding: 14px 0; }
.land-faq p { margin: 0 0 16px; color: #c3c8f5; line-height: 1.55; }
.land-final { text-align: center; padding-bottom: 60px; }
.land-final .land-go { margin: 0 auto; }
/* The home page is for visitors: no version label or problem-report button there. */
html.home .app-version-tag, html.home .report-btn { display: none; }
.land-foot { display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; padding: 22px 20px 34px; border-top: 1px solid rgba(255, 255, 255, 0.1); color: var(--muted); font-size: 0.92rem; }
.land-foot a { color: var(--muted); }
.land-foot a:hover { color: var(--text); }
@media (max-width: 820px) {
  .land-hero, .land-split { grid-template-columns: 1fr; }
  .land-hero { padding-top: 12px; text-align: center; }
  .lh-sub { margin-left: auto; margin-right: auto; }
  .land-go { width: 100%; }
  #landing .land-split h2 { text-align: center; }
  .land-flip > div:last-child { order: -1; }
  .land-help-art .shot-card { left: 0; }
}

/* Students (class code sign-in): no grown-ups area or buying. */
html.student #parentBtn, html.student #kidParentBtn, html.student #buyPromo, html.student .trial-line { display: none !important; }
/* Manage player: the worlds a player can open. */
.kid-worlds { flex-wrap: wrap; gap: 6px 14px; }
.kid-worlds .world-check { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.kid-worlds .world-check input { display: inline-block; width: auto; margin: 0; }

/* Grown-ups -> Homeschool: date range and worksheet pickers. */
.hs-range { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 8px; }
.hs-range label { display: flex; flex-direction: column; gap: 3px; font-size: 0.85rem; font-weight: 700; }
.hs-range input, .hs-range select { font: inherit; font-size: 0.95rem; padding: 5px 8px; border-radius: 8px; border: 2px solid var(--panel-edge); background: #0b0e2a; color: #fff; }
a.mini-btn { text-decoration: none; }

/* A worked example under the question (second press of Hint). */
.prompt.example { font-size: 0.9rem; line-height: 1.35; white-space: normal; text-align: left; max-height: 9em; overflow-y: auto; }
.prompt.example .ex-k { font-weight: 800; }
.prompt.example .ex-how { display: block; opacity: 0.9; margin-top: 3px; }

/* A newer version is live (js/version.js): the page updates itself; this says so during a game. */
.update-banner { position: fixed; left: 50%; top: 8px; transform: translateX(-50%); z-index: 120; max-width: calc(100% - 24px);
  padding: 8px 14px; border-radius: 12px; background: rgba(10, 12, 40, 0.92); border: 1px solid #ffd23f; color: #fff;
  font-size: 0.85rem; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); }
.update-banner button { margin-left: 8px; padding: 3px 10px; border-radius: 10px; border: 0; background: #ffd23f; color: #222; font: inherit; font-weight: 700; cursor: pointer; }

/* ---------- Castle Defense (js/castle-ui.js) ---------- */
.castle-screen { position: fixed; inset: 0; z-index: 12; display: flex; flex-direction: column; background: #10142e; }
.cd-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: rgba(0, 0, 0, 0.45); }
.cd-stat { font-weight: 800; font-size: 1.15rem; padding: 4px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); }
.cd-wave { font-weight: 700; opacity: 0.9; }
.cd-sp { flex: 1; }
.cd-shield { font: inherit; font-weight: 800; color: #10223a; background: #7fd4ff; border: 0; border-radius: 12px; padding: 8px 14px; cursor: pointer;
  box-shadow: 0 0 0 3px rgba(127, 212, 255, 0.35); animation: cdPulse 1s ease-in-out infinite alternate; }
@keyframes cdPulse { to { box-shadow: 0 0 0 8px rgba(127, 212, 255, 0.1); } }
.cd-field { position: relative; flex: 1; min-height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cd-field canvas { display: block; border-radius: 10px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); cursor: pointer; touch-action: manipulation; }
.cd-tip { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); max-width: min(92%, 640px); text-align: center;
  background: rgba(10, 12, 34, 0.86); border: 2px solid rgba(255, 255, 255, 0.2); border-radius: 12px; padding: 8px 14px; font-weight: 600; pointer-events: none; }
.cd-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: rgba(0, 0, 0, 0.45); }
.cd-towers { display: flex; gap: 6px; overflow-x: auto; max-width: 62vw; scrollbar-width: thin; }
.cd-tower { flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 62px; padding: 3px 5px; font: inherit; color: var(--text);
  background: rgba(255, 255, 255, 0.07); border: 2px solid rgba(255, 255, 255, 0.2); border-radius: 12px; cursor: pointer; }
.cd-tower img { width: 28px; height: 46px; image-rendering: pixelated; object-fit: contain; }
.cd-tower span { font-weight: 800; font-size: 0.85rem; }
.cd-tower small { font-size: 0.78rem; opacity: 0.85; }
.cd-tower.on { border-color: #ffd23f; background: rgba(255, 210, 63, 0.16); }
.cd-tower.poor { opacity: 0.5; }
.cd-info { flex: 1; min-width: 0; font-size: 0.92rem; line-height: 1.35; }
.cd-info small { display: block; opacity: 0.75; }
.cd-acts { display: flex; gap: 8px; margin: 4px 0 2px; flex-wrap: wrap; }
.cd-max { font-weight: 700; color: #ffd23f; }
.cd-go { width: auto; flex: none; margin: 0; min-width: 150px; padding: 12px 18px; font-size: 1.1rem; }
.cd-go:disabled { filter: grayscale(0.6); opacity: 0.8; cursor: default; }
.castle-screen .modal .panel { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
@media (max-width: 760px) {
  .cd-bar { flex-wrap: wrap; gap: 8px; }
  .cd-info { order: 3; flex-basis: 100%; font-size: 0.85rem; }
  .cd-go { flex: 1; min-width: 0; }
  .cd-tower { min-width: 64px; }
  .cd-stat { font-size: 1rem; padding: 3px 8px; }
}
/* While Castle Defense is on: the version tag hides (as in a game) and
   Report a problem moves up into the middle of the top bar, off the tower bar. */
body.castle-on .app-version-tag { display: none; }
/* Knight Rush (js/runner-ui.js): the road fills the screen. */
.kr-field canvas { border-radius: 0; box-shadow: none; cursor: grab; touch-action: none; }
.kr-track { flex: 1; height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.kr-progress { height: 100%; width: 0; background: linear-gradient(90deg, #ffd23f, #ff8a3d); transition: width 0.2s linear; }
.kr-pick { display: flex; gap: 8px; justify-content: center; }
/* The problem-report button goes to the bottom corner, off the question card. */
body.castle-on.runner-on .report-btn { top: auto; bottom: 8px; left: 8px; right: auto; transform: none; }
body.castle-on .report-btn { top: 14px; bottom: auto; left: 50%; right: auto; transform: translateX(-50%); }
#cdSpeed { width: auto; min-width: 42px; padding: 0 8px; }
@media (max-width: 760px) { body.castle-on .report-btn { top: 66px; } }
@media (max-width: 760px) { .cd-tip { top: auto; bottom: 10px; } }
.cd-tower.locked { opacity: 0.45; filter: grayscale(0.8); }
.cd-tower span { white-space: nowrap; }
/* The upgrade tree: three dots, then the two specialties with two dots each. */
.cd-tree { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; vertical-align: middle; }
.cd-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5); }
.cd-dot.on { background: #ffd23f; border-color: #ffd23f; }
.cd-fork { display: inline-flex; flex-direction: column; gap: 1px; margin-left: 4px; padding-left: 6px; border-left: 2px solid rgba(255,255,255,0.35); font-size: 0.75rem; }
.cd-br { display: inline-flex; align-items: center; gap: 3px; }
.cd-br:first-child .cd-dot.on { background: #ff8a9a; border-color: #ff8a9a; }
.cd-br:last-child .cd-dot.on { background: #a6d0ff; border-color: #a6d0ff; }
.cd-br.on { font-weight: 800; }
.cd-br.off { opacity: 0.4; text-decoration: line-through; }
.cd-pick { max-width: 210px; }
@media (max-width: 760px) { .cd-towers { max-width: 100%; } }

/* Title screen: one row per kind of game (arenas, tower defense, adventure). */
.world-pick { flex-direction: column; gap: 8px; }
.wp-row { display: flex; align-items: stretch; gap: 10px; }
.wp-label { width: 128px; flex: none; display: flex; flex-direction: column; justify-content: center; text-align: left; line-height: 1.2; }
.wp-label b { font-size: 1rem; color: var(--yellow); }
.wp-label small { font-size: 0.75rem; color: #cfd4ff; }
/* A row's cards sit side by side where there's room and wrap onto more
   lines where there isn't (the arenas: one per line in the title panel);
   each card: the icon, then its name with the badge under it. */
.wp-cards { flex: 1; display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.wp-cards .world-card { flex: 1 1 220px; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 2px;
  align-items: center; justify-items: start; padding: 8px 12px; text-align: left; }
.wp-cards .world-card .wc-icon { grid-row: span 2; font-size: 1.6rem; }
.wp-cards .world-card .wc-name { min-width: 0; line-height: 1.15; }
.wp-cards .world-card .wc-badge { margin: 0; max-width: 100%; white-space: normal; text-align: left; line-height: 1.25; }
.wp-cards .world-card .wc-name:last-child { grid-row: span 2; }   /* (no badge: the name in the middle) */
@media (max-width: 560px) {
  .wp-row { flex-direction: column; gap: 4px; }
  .wp-label { width: auto; flex-direction: row; gap: 8px; align-items: baseline; }
  .wp-cards .world-card { padding: 8px 10px; }
}
/* Report a problem: while the picture of the screen is being made. */
.report-shot.taking { min-height: 60px; display: flex; align-items: center; justify-content: center; }
.report-shot.taking::after { content: '📸 Taking a picture of the screen…'; color: var(--muted); font-size: 0.9rem; }
/* Phones: room under the title screen so the corner's Report button and version don't cover its last line. */
@media (max-width: 560px) { #title { padding-bottom: 96px; } }

/* Top of a player's page: mastered lately, and topics to help with */
.kid-week { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 12px 0; }
.week-box { padding: 10px 14px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.12); }
.week-box h3 { margin: 0 0 6px; font-size: 1rem; color: var(--blue); }
.week-box h3 .st-sub { font-weight: 700; }
.week-box .parent-help { margin: 4px 0 6px; }
.week-list { margin: 0 0 8px; padding-left: 18px; }
.week-list li { margin: 3px 0; }
.week-list .st-sub { display: block; font-size: 0.82rem; }

/* The board never moves or changes size while playing: the top and bottom
   bars keep one height whatever they say (long text scrolls in its box). */
.cd-top { flex: none; height: 58px; box-sizing: border-box; flex-wrap: nowrap; }
.cd-wave { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-top > button { flex: none; }
.cd-bar { flex: none; height: 130px; box-sizing: border-box; }
.cd-info { align-self: stretch; overflow-y: auto; padding-top: 4px; box-sizing: border-box; }
@media (max-width: 760px) {
  .cd-bar { height: auto; }
  /* three rows that never change: towers, the wave button, then the info box */
  .cd-towers { flex: 0 0 100%; max-width: none; }
  .cd-go { flex: 0 0 100%; }
  .cd-info { flex: 0 0 100%; height: 6.6em; }
}

/* Grown-ups button: how many topics were mastered since a grown-up last looked */
.gu-badge { display: inline-block; min-width: 1.4em; margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: #ff5a5f;
  color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 1.3; text-align: center; vertical-align: middle; box-shadow: 0 0 0 2px rgba(0,0,0,0.25); }
.new-tag { display: inline-block; padding: 0 6px; border-radius: 999px; background: var(--yellow); color: #1b1f4b; font-size: 0.7rem; font-weight: 700; vertical-align: middle; }
.fam-head { margin: 4px 0 0; font-size: 1.05rem; }
/* Everyone: one summary per player under the table */
.family-week { margin-top: 14px; display: grid; gap: 12px; }
.fam-week { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.05); }
.fam-week-name { margin: 0 0 6px; font-size: 1.05rem; display: flex; align-items: center; gap: 6px; }
.fam-week .kid-week { margin: 0; }

/* The question panel's Skip button: quiet, under the answers. */
/* A grown-up's focus topics (js/parent.js focusHtml) */
.focus-bar { margin: 12px 0; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--yellow); background: rgba(255, 210, 63, 0.07); }
.focus-bar h4 { margin: 0 0 4px; }
.focus-bar ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.focus-bar .focus-done { color: var(--muted); }
.focus-pick { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.focus-pick small { color: var(--muted); }
.mode-tag.focus-tag { border-color: var(--yellow); color: var(--yellow); }
.skip-q { display: block; margin: 8px auto 0; background: none; border: 0; color: var(--muted, #aab); font: inherit; font-size: 0.9rem; font-weight: 700; text-decoration: underline; cursor: pointer; }
.skip-q:disabled { text-decoration: none; cursor: default; opacity: 0.7; }
.week-skips { margin-top: 8px; }
/* Membership page: the plans for sale, as cards. */
.plan-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.plan-card { border: 1px solid rgba(255, 255, 255, 0.16); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.plan-card.mine { border-color: rgba(111, 220, 111, 0.6); }
.plan-card .mem-buy { margin-top: auto; padding-top: 6px; }

/* Grown-ups' page: a review of an easier grade, offered (js/parent.js renderReview). */
.review-offer { margin: 8px 0; padding: 10px 12px; border-radius: 10px; background: rgba(120, 180, 255, 0.1); border: 1px solid rgba(120, 180, 255, 0.4); font-size: 0.9rem; line-height: 1.4; }
.review-offer .review-btns { margin-top: 8px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
