:root {
  color-scheme: dark;
  --ink: #f4f8ff;
  --muted: #afc2d9;
  --navy: #071426;
  --panel: #10243f;
  --panel-2: #163353;
  --cyan: #41e0d0;
  --cyan-strong: #1bb9c8;
  --orange: #ffb547;
  --gold: #ffd36a;
  --line: rgba(164, 210, 231, 0.18);
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.34);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--navy);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--navy); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 18%, rgba(26, 160, 181, 0.18), transparent 34%),
    radial-gradient(circle at 10% 85%, rgba(255, 181, 71, 0.08), transparent 31%),
    linear-gradient(145deg, #06101f 0%, #0a1b31 55%, #071426 100%);
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image: linear-gradient(rgba(65, 224, 208, .04) 1px, transparent 1px), linear-gradient(90deg, rgba(65, 224, 208, .04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}
button { font: inherit; }
button:not(:disabled) { cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.skip-link { position: fixed; z-index: 50; left: 16px; top: -60px; padding: 10px 14px; border-radius: 10px; color: #071426; background: var(--gold); }
.skip-link:focus { top: 12px; }
#app { min-height: 100vh; }

.home-shell {
  position: relative;
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 76px 0 42px;
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  grid-template-rows: 1fr auto;
  align-items: center;
  gap: 20px 44px;
}
.hero-copy { position: relative; z-index: 2; }
.eyebrow { margin: 0 0 14px; color: var(--cyan); font-size: 13px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.hero-copy h1, .complete-screen > h1 { margin: 0; font-size: clamp(46px, 6vw, 82px); line-height: .98; letter-spacing: -.055em; }
.hero-copy h1 span, .complete-screen h1 span, .reward-screen h1 span { display: block; color: var(--cyan); }
.lead { max-width: 440px; margin: 24px 0 30px; color: var(--muted); font-size: clamp(18px, 2vw, 22px); line-height: 1.65; }
.home-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.primary-button, .secondary-button {
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  color: #06101f;
  background: linear-gradient(135deg, #65f0df, var(--cyan));
  box-shadow: 0 12px 30px rgba(65, 224, 208, .22);
  font-size: 18px;
  font-weight: 850;
  transition: transform .2s ease, box-shadow .2s ease;
}
.primary-button:hover { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(65, 224, 208, .3); }
.secondary-button { color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); box-shadow: none; }
.text-button { border: 0; padding: 12px; color: var(--muted); background: transparent; text-decoration: underline; text-underline-offset: 4px; }
.sound-toggle { position: absolute; right: 0; top: 28px; z-index: 5; min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); background: rgba(8, 24, 43, .74); backdrop-filter: blur(10px); }

.robot-stage { position: relative; min-height: 560px; display: grid; place-items: center; }
.robot-stage img { position: relative; z-index: 2; width: min(600px, 100%); height: auto; filter: drop-shadow(0 30px 34px rgba(0,0,0,.45)); animation: robot-float 4s ease-in-out infinite; }
.energy-ring { position: absolute; width: 72%; aspect-ratio: 1; border: 1px solid rgba(65,224,208,.36); border-radius: 50%; box-shadow: inset 0 0 70px rgba(65,224,208,.08), 0 0 70px rgba(65,224,208,.06); }
.energy-ring::before, .energy-ring::after { content: ""; position: absolute; inset: 10%; border: 1px dashed rgba(255,255,255,.18); border-radius: inherit; }
.energy-ring::after { inset: 22%; border-style: solid; border-color: rgba(255,181,71,.2); }
.robot-name { position: absolute; z-index: 3; right: 10%; bottom: 14%; padding: 7px 12px; border-radius: 9px; color: var(--navy); background: var(--orange); font-weight: 900; letter-spacing: .08em; transform: rotate(-3deg); }
.mission-list { grid-column: 1 / -1; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); list-style: none; border-top: 1px solid var(--line); }
.mission-list li { padding: 20px 10px; display: flex; align-items: center; gap: 12px; color: var(--muted); }
.mission-list b { color: var(--cyan); font-family: ui-monospace, monospace; font-size: 12px; }

.game-card { width: min(760px, calc(100% - 28px)); min-height: 100vh; margin: 0 auto; padding: 30px 0 50px; }
.game-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.game-header .eyebrow { margin-bottom: 4px; }
.counter { margin: 0; color: var(--muted); font-size: 14px; }
.icon-button { width: 50px; height: 50px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--panel); font-size: 21px; }
.progress-track { height: 7px; margin: 22px 0 12px; overflow: hidden; border-radius: 20px; background: rgba(255,255,255,.08); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan-strong), var(--cyan)); transition: width .35s ease; }
.parts-strip { display: flex; justify-content: flex-end; gap: 8px; }
.part-dot { color: rgba(175,194,217,.38); font-size: 18px; }
.part-dot.is-on { color: var(--orange); filter: drop-shadow(0 0 7px rgba(255,181,71,.5)); }
.task-panel { margin-top: 25px; padding: clamp(24px, 5vw, 50px); border: 1px solid var(--line); border-radius: 28px; background: linear-gradient(150deg, rgba(18,47,78,.96), rgba(11,30,52,.98)); box-shadow: var(--shadow); }
.listen-button { min-height: 52px; padding: 0 20px; border: 1px solid rgba(65,224,208,.35); border-radius: 99px; color: var(--cyan); background: rgba(65,224,208,.08); font-weight: 800; }
.listen-button span { display: inline-grid; width: 26px; height: 26px; margin-right: 5px; place-items: center; border-radius: 50%; color: var(--navy); background: var(--cyan); font-size: 11px; }
.spoken-fallback { padding: 12px 16px; border-radius: 12px; color: var(--ink); background: rgba(65,224,208,.08); line-height: 1.6; }
.task-panel h1 { margin: 28px 0 30px; font-size: clamp(25px, 4vw, 38px); line-height: 1.35; letter-spacing: -.025em; }
.answers { display: grid; gap: 12px; }
.answer-button { min-height: 64px; padding: 12px 16px; display: grid; grid-template-columns: 32px auto 1fr; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: rgba(255,255,255,.045); text-align: left; font-size: 18px; transition: border-color .2s ease, transform .2s ease, background .2s ease; }
.answer-button:hover { transform: translateX(3px); border-color: rgba(65,224,208,.7); background: rgba(65,224,208,.09); }
.answer-key { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: var(--muted); background: rgba(255,255,255,.08); font-size: 13px; font-weight: 800; }
.answer-icon { font-size: 25px; }
.hint-card { margin-top: 20px; padding: 14px 16px; display: flex; gap: 12px; border-radius: 14px; color: #ffe6a5; background: rgba(255, 211, 106, .1); border: 1px solid rgba(255,211,106,.25); line-height: 1.55; }
.hint-card b { flex: 0 0 auto; }
.feedback { min-height: 24px; margin-top: 12px; color: var(--gold); }

.help-screen .parts-strip { margin-top: 8px; }
.explain-card { margin-top: 30px; padding: clamp(30px, 6vw, 60px); border: 1px solid rgba(255,211,106,.25); border-radius: 28px; background: linear-gradient(155deg, rgba(50,48,58,.96), rgba(17,31,49,.98)); text-align: center; box-shadow: var(--shadow); }
.helper-orb { width: 58px; height: 58px; margin: 0 auto 18px; display: grid; place-items: center; border: 2px solid var(--gold); border-radius: 50%; color: var(--gold); font-family: Georgia, serif; font-size: 30px; }
.overline { color: var(--gold); font-weight: 800; letter-spacing: .12em; }
.explain-card h1 { font-size: clamp(24px, 4vw, 36px); line-height: 1.4; }
.correct-answer { color: var(--muted); }
.correct-answer strong { color: var(--cyan); font-size: 1.2em; }
.explanation { margin: 25px auto 30px; max-width: 500px; padding: 15px; border-radius: 12px; color: #ffe8b7; background: rgba(255,181,71,.08); line-height: 1.65; }

.reward-screen, .complete-screen { position: relative; min-height: 100vh; padding: 60px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.reward-screen h1 { margin: 10px 0; font-size: clamp(38px, 7vw, 68px); }
.reward-screen > p:not(.eyebrow) { color: var(--muted); font-size: 19px; }
.reward-burst { width: 110px; height: 110px; display: grid; place-items: center; border-radius: 32px; color: var(--navy); background: var(--orange); box-shadow: 0 0 70px rgba(255,181,71,.28); font-size: 55px; animation: reward-in .5s ease both; }
.reward-screen .parts-strip, .complete-screen > .parts-strip { margin: 22px 0 28px; }
.complete-screen > h1 span { font-size: .7em; margin-top: 8px; }
.complete-robot { position: relative; width: min(390px, 80vw); display: grid; place-items: center; isolation: isolate; }
.complete-robot::before { content: ""; position: absolute; z-index: 0; width: 74%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(65,224,208,.28), rgba(65,224,208,.06) 52%, transparent 72%); filter: blur(4px); }
.complete-robot img { position: relative; z-index: 2; width: 100%; height: auto; opacity: 1; filter: brightness(1.14) drop-shadow(0 20px 32px rgba(0,0,0,.5)); animation: robot-start 1.4s ease both; }
.complete-robot .energy-ring { width: 90%; }
.celebrate-line { color: var(--muted); font-size: 18px; }
.color-picker { display: flex; gap: 10px; margin: 10px 0 22px; }
.color-picker button { width: 32px; height: 32px; border: 3px solid rgba(255,255,255,.7); border-radius: 50%; background: #41e0d0; }
.color-picker button:nth-child(2) { background: #75e57c; }
.color-picker button:nth-child(3) { background: #9f7aea; }
.color-green .complete-robot img { filter: brightness(1.14) hue-rotate(70deg) drop-shadow(0 20px 32px rgba(0,0,0,.5)); }
.color-purple .complete-robot img { filter: brightness(1.14) hue-rotate(140deg) drop-shadow(0 20px 32px rgba(0,0,0,.5)); }
.parent-report { width: min(680px, 100%); margin-top: 22px; padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); text-align: left; }
.report-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.report-grid div { padding: 14px; border-radius: 14px; background: rgba(255,255,255,.05); }
.report-grid span, .report-grid strong { display: block; }
.report-grid span { color: var(--muted); font-size: 13px; }
.report-grid strong { margin-top: 6px; }
.parent-report h2 { margin-top: 24px; font-size: 18px; }
.review-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.review-tags span { padding: 8px 11px; border-radius: 99px; color: #ffe8b7; background: rgba(255,181,71,.1); }
.parent-report .text-button { display: block; margin-top: 10px; }

@keyframes robot-float { 50% { transform: translateY(-10px) rotate(1deg); } }
@keyframes reward-in { from { opacity: 0; transform: scale(.65) rotate(-12deg); } }
@keyframes robot-start {
  from { opacity: 0; transform: translateY(30px) scale(.88); filter: brightness(2) drop-shadow(0 0 30px var(--cyan)); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: brightness(1.14) drop-shadow(0 20px 32px rgba(0,0,0,.5)); }
}

@media (max-width: 820px) {
  .home-shell { width: min(620px, calc(100% - 28px)); padding-top: 64px; grid-template-columns: 1fr; grid-template-rows: auto auto auto; text-align: center; }
  .hero-copy { order: 1; }
  .robot-stage { order: 2; min-height: auto; }
  .robot-stage img { width: min(430px, 84vw); }
  .robot-name { right: 16%; bottom: 10%; }
  .mission-list { order: 3; grid-template-columns: 1fr 1fr; text-align: left; }
  .lead { margin-left: auto; margin-right: auto; }
  .home-actions { justify-content: center; }
}

@media (max-width: 480px) {
  .home-shell { padding-top: 70px; }
  .hero-copy h1 { font-size: 46px; }
  .robot-stage img { width: 88vw; }
  .mission-list li { padding: 14px 5px; font-size: 13px; }
  .game-card { width: min(100% - 20px, 760px); padding-top: 18px; }
  .task-panel { padding: 25px 16px; border-radius: 22px; }
  .task-panel h1 { font-size: 25px; }
  .answer-button { min-height: 58px; font-size: 17px; }
  .hint-card { flex-direction: column; gap: 4px; }
  .report-grid { grid-template-columns: 1fr; }
  .complete-screen { padding-left: 12px; padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
