:root {
  --ink: #30323a;
  --muted: #70727b;
  --line: #eadfe4;
  --paper: #fffdfb;
  --aqua: #cef4f8;
  --aqua-strong: #55b9c7;
  --rose: #fed3d9;
  --rose-strong: #d66d86;
  --amber: #fdf0d7;
  --amber-strong: #d5a642;
  --green: #c5ebd5;
  --green-strong: #4da875;
  --violet: #d1cceb;
  --violet-strong: #8177bd;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background: linear-gradient(145deg, #fff8f7 0%, #f7fcfc 48%, #fffaf0 100%); color: var(--ink); font-family: "Source Sans 3", sans-serif; margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.topbar { align-items: center; background: rgba(255,253,251,.92); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; padding: 12px clamp(18px,4vw,52px); position: relative; z-index: 20; }
.brand { align-items: center; color: inherit; display: flex; gap: 11px; text-decoration: none; }
.brand > span:last-child { display: flex; flex-direction: column; }
.brand strong { font: 900 21px/1 Nunito,sans-serif; }
.brand small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.back-link { background: var(--amber); border: 1px solid #eadbbd; border-radius: 999px; color: var(--ink); font: 900 13px Nunito,sans-serif; padding: 9px 15px; text-decoration: none; }

main { padding: 42px clamp(14px,4vw,52px) 58px; }
.hero { margin: 0 auto 25px; max-width: 1050px; text-align: center; }
.eyebrow, .modal-kicker, .mission-kind { color: #8a6924; font: 900 12px Nunito,sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.hero h1 { font: 900 clamp(34px,5vw,61px)/1.05 Nunito,sans-serif; letter-spacing: -.035em; margin: 8px 0 13px; }
.hero h1 em { color: var(--rose-strong); font-style: normal; }
.hero > p { color: var(--muted); font-size: clamp(16px,2vw,20px); margin: 0 auto; max-width: 760px; }
.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.hero-pills span { background: rgba(255,255,255,.76); border: 1px solid var(--line); border-radius: 999px; font: 800 13px Nunito,sans-serif; padding: 7px 12px; }

.game-shell { background: rgba(255,255,255,.85); border: 1px solid var(--line); border-radius: 25px; box-shadow: 0 24px 65px rgba(66,52,60,.12); margin: 0 auto; max-width: 1120px; overflow: hidden; position: relative; }
main > .teacher-guide { max-width: 1120px; }
.toolbar { align-items: center; background: rgba(255,255,255,.96); display: flex; gap: 18px; justify-content: space-between; padding: 13px 17px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stats span { background: #fff; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font: 900 9px Nunito,sans-serif; letter-spacing: .08em; min-width: 72px; padding: 7px 10px; text-align: left; }
.stats strong { color: var(--ink); display: block; font-size: 17px; letter-spacing: 0; margin-top: 1px; }
#livesStat { color: var(--rose-strong); letter-spacing: .08em; }
.tools { display: flex; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.tools button { background: #fff; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); font: 900 12px Nunito,sans-serif; padding: 9px 11px; }
.tools button:hover { background: var(--aqua); border-color: #acdce2; }
.round-progress { background: #f1ecee; height: 5px; }
.round-progress span { background: linear-gradient(90deg,var(--aqua-strong),var(--violet-strong),var(--rose-strong)); display: block; height: 100%; transition: width .35s ease; width: 0; }

.mission-panel { background: linear-gradient(110deg,rgba(206,244,248,.72),rgba(255,255,255,.88),rgba(253,240,215,.72)); padding: 20px 22px 14px; text-align: center; }
.mission-panel h2 { font: 900 clamp(23px,3.3vw,37px)/1.12 Nunito,sans-serif; margin: 5px 0 4px; }
.mission-panel p { color: var(--muted); font-weight: 700; margin: 0; min-height: 24px; }
.timer-track { background: rgba(255,255,255,.8); border-radius: 999px; height: 7px; margin: 13px auto 0; max-width: 520px; overflow: hidden; }
.timer-track span { background: linear-gradient(90deg,var(--green-strong),var(--aqua-strong)); border-radius: inherit; display: block; height: 100%; transition: width .05s linear; width: 100%; }
.timer-track span.urgent { background: linear-gradient(90deg,var(--amber-strong),var(--rose-strong)); }

.arena { background: linear-gradient(180deg,#f9fdfe 0%,#eef8f8 63%,#e3f1ed 100%); height: 510px; overflow: hidden; position: relative; touch-action: manipulation; }
.arena::before { background: radial-gradient(ellipse at center,rgba(255,255,255,.85),rgba(255,255,255,0) 67%); content: ""; inset: 0; position: absolute; }
.stars { background-image: radial-gradient(circle,#d8b55f 0 1px,transparent 1.5px),radial-gradient(circle,#91cdd5 0 1.5px,transparent 2px); background-position: 0 0,30px 35px; background-size: 64px 64px,90px 90px; inset: 0; opacity: .38; position: absolute; }
.target-field { inset: 0; position: absolute; }
.number-target { animation: targetStream var(--stream-time,14s) linear infinite; background: transparent; border: 0; color: var(--ink); height: clamp(92px,11vw,116px); left: 112%; padding: 0; position: absolute; top: var(--y); width: clamp(92px,11vw,116px); z-index: 3; }
.number-target:hover { filter: drop-shadow(0 12px 13px rgba(54,72,77,.22)); }
.number-target:focus-visible { border-radius: 45%; outline: 4px solid rgba(85,185,199,.38); outline-offset: 3px; }
.target-alien { display: block; filter: drop-shadow(0 9px 9px rgba(54,72,77,.16)); height: 100%; object-fit: contain; pointer-events: none; width: 100%; }
.number-target b { left: 50%; position: absolute; top: 61%; transform: translate(-50%,-50%); font: 900 clamp(24px,3.5vw,34px)/1 Nunito,sans-serif; text-shadow: 0 1px 0 rgba(255,255,255,.9); z-index: 2; }
.number-target.correct-hit { animation: correctPop .46s ease forwards; border-color: var(--green-strong); }
.number-target.wrong-hit { animation: wrongShake .48s ease forwards; pointer-events: none; }
.number-target.wrong-hit::after { content: ""; background: url("assets/games/target-hunt/mathlooq-wrong-hit-cross.png?v=20260917-2") center / contain no-repeat; height: 64%; width: 64%; left: 50%; position: absolute; top: 50%; transform: translate(-50%,-50%); pointer-events: none; z-index: 4; }
.number-target:disabled { cursor: default; }
@keyframes targetStream {
  0% { left: 112%; transform: translate(-50%,-50%) translateY(0) rotate(2deg); }
  25% { transform: translate(-50%,-50%) translateY(-7px) rotate(-1deg); }
  50% { transform: translate(-50%,-50%) translateY(3px) rotate(2deg); }
  75% { transform: translate(-50%,-50%) translateY(-5px) rotate(-2deg); }
  100% { left: -12%; transform: translate(-50%,-50%) translateY(0) rotate(1deg); }
}
@keyframes correctPop { 0% { transform: translate(-50%,-50%) scale(1); } 45% { transform: translate(-50%,-50%) scale(1.22); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(.4); } }
@keyframes wrongShake { 0% { opacity: 1; transform: translate(-50%,-50%); } 20% { transform: translate(calc(-50% - 8px),-50%) rotate(-5deg); } 40% { opacity: 1; transform: translate(calc(-50% + 8px),-50%) rotate(5deg); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(.4); } }

.launcher { animation: roverPatrol 5.8s ease-in-out infinite; bottom: -17px; height: 170px; left: 50%; pointer-events: none; position: absolute; transform: translateX(-50%); width: 170px; z-index: 5; }
.launcher img { display: block; filter: drop-shadow(0 9px 11px rgba(48,50,58,.18)); height: 100%; object-fit: contain; width: 100%; }
.launcher-origin { height: 4px; left: 50%; position: absolute; top: 8px; transform: translateX(-50%); width: 4px; }
@keyframes roverPatrol {
  0%,100% { transform: translateX(calc(-50% - 48px)) translateY(1px) rotate(-1deg); }
  50% { transform: translateX(calc(-50% + 48px)) translateY(-2px) rotate(1deg); }
}
.beam { background: linear-gradient(180deg,rgba(255,255,255,0),#f3b4c3 45%,#d66d86); border-radius: 999px; box-shadow: 0 0 10px #f2b2c1,0 0 20px rgba(214,109,134,.45); display: none; left: 50%; pointer-events: none; position: absolute; top: calc(100% - 145px); transform-origin: 50% 100%; width: 5px; z-index: 4; }
.beam.fire { animation: beamFlash .28s ease-out forwards; display: block; }
@keyframes beamFlash { 0% { opacity: 0; } 22% { opacity: 1; } 100% { opacity: 0; } }

.layer { align-items: center; background: rgba(255,250,248,.97); display: none; inset: 0; justify-content: center; overflow-y: auto; padding: 22px; position: absolute; z-index: 30; }
.layer.show { display: flex; }
.modal { background: #fffaf8; border: 1px solid #fff; border-radius: 25px; box-shadow: 0 28px 80px rgba(26,27,32,.28); max-width: 670px; padding: 29px; text-align: center; width: 100%; }
.modal h2 { font: 900 clamp(27px,4vw,38px)/1.12 Nunito,sans-serif; margin: 6px 0 8px; }
.modal > p { color: var(--muted); font-size: 16px; line-height: 1.45; margin: 0 auto 19px; max-width: 520px; }
.modal-orb { align-items: center; background: linear-gradient(145deg,#fff,#dff4f6); border: 2px solid #badcdf; border-radius: 50%; box-shadow: 0 9px 20px rgba(56,96,103,.14); display: flex; height: 67px; justify-content: center; margin: 0 auto 10px; position: relative; width: 67px; }
.modal-orb span { background: #666872; border: 3px solid #fff; border-radius: 50%; height: 14px; margin: -15px 3px 0; width: 14px; }
.modal-orb b { bottom: 8px; color: var(--rose-strong); font: 900 22px Nunito,sans-serif; left: 0; position: absolute; right: 0; }
.choice-set { border: 0; margin: 13px 0 0; padding: 0; text-align: left; }
.choice-set legend { color: var(--muted); font: 900 12px Nunito,sans-serif; letter-spacing: .08em; margin-bottom: 7px; text-transform: uppercase; }
.segmented { display: grid; gap: 8px; grid-template-columns: repeat(3,1fr); }
.segmented label { cursor: pointer; position: relative; }
.segmented input { height: 1px; opacity: 0; position: absolute; width: 1px; }
.segmented span { background: #fff; border: 1px solid var(--line); border-radius: 13px; display: flex; flex-direction: column; min-height: 67px; padding: 10px 11px; transition: .18s ease; }
.segmented b { font: 900 15px Nunito,sans-serif; }
.segmented small { color: var(--muted); font-size: 12px; line-height: 1.2; margin-top: 2px; }
.segmented input:checked + span { background: linear-gradient(135deg,var(--aqua),#fff,var(--amber)); border-color: #93cdd5; box-shadow: 0 5px 14px rgba(64,150,162,.13); }
.segmented input:focus-visible + span { outline: 4px solid rgba(85,185,199,.3); }
.primary-action,.secondary-action { border: 0; border-radius: 13px; font: 900 15px Nunito,sans-serif; padding: 12px 19px; }
.primary-action { background: linear-gradient(135deg,#bfeaf0,#f6e7c9); color: #24484d; }
.setup-modal > .primary-action { margin-top: 20px; width: 100%; }
.secondary-action { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.celebration { color: var(--amber-strong); font-size: 38px; }
.final-stats { display: flex; gap: 8px; justify-content: center; margin: 18px 0; }
.final-stats span { background: #fff; border: 1px solid var(--line); border-radius: 13px; min-width: 96px; padding: 9px 13px; }
.final-stats b { display: block; font: 900 21px Nunito,sans-serif; }
.final-stats small { color: var(--muted); }
.finish-actions { display: flex; gap: 9px; justify-content: center; }

.sr-only { clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }
footer { border-top: 1px solid var(--line); color: var(--muted); display: flex; flex-wrap: wrap; font-size: 13px; gap: 14px 22px; justify-content: center; padding: 17px; }
footer a { color: inherit; text-decoration: none; }

.game-shell:fullscreen,
.game-shell:-webkit-full-screen {
  background: #fffdfb;
  border: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  overflow: hidden;
}
.game-shell:fullscreen .toolbar,
.game-shell:fullscreen .round-progress,
.game-shell:fullscreen .mission-panel,
.game-shell:-webkit-full-screen .toolbar,
.game-shell:-webkit-full-screen .round-progress,
.game-shell:-webkit-full-screen .mission-panel { flex: 0 0 auto; }
.game-shell:fullscreen .arena,
.game-shell:-webkit-full-screen .arena { flex: 1 1 auto; height: auto; min-height: 0; }

@media (max-width:760px) {
  main { padding: 28px 10px 40px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .tools { justify-content: center; }
  .stats { justify-content: center; }
  .stats span { flex: 1; max-width: 110px; }
  .arena { height: 480px; }
  .number-target { height: 92px; width: 92px; }
  .mission-panel { padding-left: 10px; padding-right: 10px; }
  .layer { padding: 12px; }
  .modal { padding: 23px 16px; }
}
@media (max-width:560px) {
  .brand small { display: none; }
  .back-link { font-size: 12px; padding: 8px 11px; }
  .hero { margin-bottom: 18px; }
  .hero h1 { font-size: 35px; }
  .hero > p { font-size: 16px; }
  .game-shell { border-radius: 19px; }
  .stats { display: grid; grid-template-columns: repeat(4,1fr); }
  .stats span { min-width: 0; padding: 7px 6px; }
  .stats strong { font-size: 15px; }
  .tools button { flex: 1; padding: 8px 5px; }
  .segmented { gap: 6px; }
  .segmented span { min-height: 63px; padding: 9px 7px; }
  .segmented b { font-size: 13px; }
  .segmented small { font-size: 10px; }
  .finish-actions { flex-direction: column; }
  .final-stats span { min-width: 0; padding: 8px; }
  .launcher { bottom: -13px; height: 145px; width: 145px; }
  @keyframes roverPatrol {
    0%,100% { transform: translateX(calc(-50% - 28px)) translateY(1px) rotate(-1deg); }
    50% { transform: translateX(calc(-50% + 28px)) translateY(-2px) rotate(1deg); }
  }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation-duration:.01ms!important; transition-duration:.01ms!important; }
}
