/* Mosquito Patrol game styles. The page background follows the time of day (body[data-time]). */
@font-face { font-family: "Fredoka"; font-weight: 500 700; font-display: swap; src: url("../../../assets/fonts/fredoka-latin.woff2") format("woff2"); }
@font-face { font-family: "Lexend"; font-weight: 400 600; font-display: swap; src: url("../../../assets/fonts/lexend-latin.woff2") format("woff2"); }

:root {
  --ink: #102D5A; --ink-soft: #4A5876; --paper: #FFFDF8; --cream: #FFF6E2; --line: #EADFC8;
  --gold: #FFD166; --gold-deep: #E9A91A; --green: #2FA84F; --red: #E8414F; --blue: #2583F5;
  --display: "Fredoka", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif;
  --body: "Lexend", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--body); font-size: 1rem; line-height: 1.5; color: var(--ink);
  background: var(--cream); transition: background-color .4s ease;
}
body[data-time="morning"] { background: linear-gradient(#dff3ff, #fff6e2 60%); }
body[data-time="evening"] { background: linear-gradient(#ffd9a8, #fff1e0 60%); }
body[data-time="night"] { background: #0b1734; }
body[data-time="dawn"] { background: linear-gradient(#ffe2e6, #fff6e2 60%); }
body[data-time="bonus"] { background: linear-gradient(#efe6ff, #fff6e2 60%); }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; }
button { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: 8px max(12px, env(safe-area-inset-left)); background: rgba(255, 253, 248, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.back { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .875rem; padding: 8px 10px; border-radius: 999px; white-space: nowrap; }
.back:hover { background: var(--cream); }
.game-name { appearance: none; border: 0; background: none; font-family: var(--display); font-weight: 700; font-size: 1.125rem; color: var(--ink); cursor: pointer; padding: 6px 8px; border-radius: 10px; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.star-total { font-weight: 600; background: var(--gold); border-radius: 999px; padding: 4px 12px; white-space: nowrap; }
.icon-btn { appearance: none; border: 1px solid var(--line); background: #fff; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; display: grid; place-items: center; }
.icon-btn.off { opacity: .45; }
@media (max-width: 420px) { .back .long { display: none; } .game-name { font-size: 1rem; } }

/* ---------- Layout ---------- */
#app { padding: 16px 16px 48px; }
.screen { max-width: 960px; margin: 0 auto; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 24px; box-shadow: 0 10px 30px rgba(16, 45, 90, .08); max-width: 680px; margin: 0 auto; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.btn {
  appearance: none; border: 2px solid var(--ink); background: #fff; color: var(--ink); border-radius: 999px;
  padding: 11px 20px; font-weight: 600; cursor: pointer; min-height: 46px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--gold); border-color: var(--gold-deep); box-shadow: 0 3px 0 var(--gold-deep); }
.btn.ghost { border-color: var(--line); }
.btn.small { padding: 6px 14px; min-height: 38px; font-size: .875rem; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.link-btn { appearance: none; border: 0; background: none; color: var(--blue); text-decoration: underline; cursor: pointer; padding: 4px; font-weight: 600; }
.disclaimer { text-align: center; color: var(--ink-soft); font-size: .8125rem; margin: 28px auto 0; max-width: 34em; }
body[data-time="night"] .disclaimer { color: #cbd5e1; }

/* ---------- Home ---------- */
.home { text-align: center; padding-top: 12px; }
.hero-bug svg { width: 120px; height: 120px; animation: hover 3s ease-in-out infinite; }
@keyframes hover { 50% { transform: translateY(-8px) rotate(-3deg); } }
.title { font-size: clamp(2.25rem, 7vw, 3.5rem); margin-top: 4px; }
.tagline { color: var(--ink-soft); font-size: 1.125rem; margin: 8px auto 24px; max-width: 30em; }
.pick-title { font-size: 1.25rem; margin-bottom: 12px; }
.tier-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; max-width: 680px; margin: 0 auto; }
.tier-card {
  appearance: none; text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 20px; padding: 18px 20px; cursor: pointer;
  display: grid; gap: 4px; box-shadow: 0 6px 18px rgba(16, 45, 90, .06); transition: transform .15s ease, border-color .15s ease;
}
.tier-card:hover { transform: translateY(-2px); border-color: var(--gold-deep); }
.tier-card.current { border-color: var(--gold-deep); }
.tier-name { font-family: var(--display); font-weight: 700; font-size: 1.375rem; color: var(--ink); }
.tier-years { font-weight: 600; color: var(--green); font-size: .875rem; }
.tier-blurb { color: var(--ink-soft); font-size: .9375rem; }

/* ---------- Map ---------- */
.map-head { text-align: center; margin-bottom: 18px; }
.map-head h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
.map-tier { color: var(--ink-soft); margin: 6px 0 0; }
.day-path { list-style: none; margin: 0 auto; padding: 0; max-width: 620px; display: grid; gap: 14px; position: relative; }
.day-path::before { content: ""; position: absolute; left: 39px; top: 20px; bottom: 20px; border-left: 4px dashed rgba(16, 45, 90, .18); }
.stop-btn {
  appearance: none; width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; position: relative;
  border: 2px solid var(--line); background: #fff; border-radius: 20px; padding: 14px 16px; cursor: pointer; color: var(--ink);
  box-shadow: 0 6px 16px rgba(16, 45, 90, .06); transition: transform .15s ease;
}
.stop-btn:not(:disabled):hover { transform: translateX(4px); border-color: var(--gold-deep); }
.stop-btn:disabled { cursor: not-allowed; background: #f8f5ee; color: var(--ink-soft); }
.stop-icon { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; background: var(--cream); }
.stop-morning .stop-icon { background: #dff3ff; } .stop-evening .stop-icon { background: #ffd9a8; }
.stop-night .stop-icon { background: #0b1734; } .stop-dawn .stop-icon { background: #ffe2e6; } .stop-bonus .stop-icon { background: #efe6ff; }
.stop-text { display: grid; flex: 1; min-width: 0; }
.stop-clock { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.stop-title { font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
.stop-short { color: var(--ink-soft); font-size: .875rem; }
.stars { color: var(--gold-deep); font-size: 1.25rem; letter-spacing: 2px; white-space: nowrap; }
.stars .off, .big-stars .off { color: #e5e7eb; }
.lock { font-size: 1.25rem; }
.captain-strip { display: flex; align-items: center; gap: 12px; max-width: 620px; margin: 0 auto 16px; background: var(--ink); color: #fff; border-radius: 18px; padding: 10px 14px; }
.captain-strip > span:nth-child(2) { flex: 1; font-size: .9rem; }
.mini-badge svg { width: 44px; height: 44px; display: block; }

/* ---------- Intro and results ---------- */
.intro .card, .results .card, .captain .card { text-align: center; }
.intro .actions, .results .actions, .captain .actions { justify-content: center; }
.clock { font-weight: 600; color: var(--ink-soft); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .08em; font-size: .8125rem; }
.card h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
.intro-text { font-size: 1.125rem; color: var(--ink-soft); margin: 14px auto 0; max-width: 32em; }
.big-stars { font-size: 3rem; color: var(--gold-deep); margin: 8px 0; letter-spacing: 6px; }
.result-note { color: var(--ink-soft); margin: 0 auto 8px; max-width: 32em; }
.learned-title { font-size: 1.125rem; margin-top: 16px; }
.learned { text-align: left; margin: 10px auto 0; max-width: 32em; padding: 0; list-style: none; display: grid; gap: 8px; }
.learned li { background: var(--cream); border-radius: 12px; padding: 10px 14px 10px 40px; position: relative; }
.learned li::before { content: "✓"; position: absolute; left: 14px; top: 9px; color: var(--green); font-weight: 700; }
.badge-art svg { width: 160px; height: 160px; }

/* ---------- Playing ---------- */
.play-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.play-title { font-size: 1.375rem; }
body[data-time="night"] .play-title, body[data-time="night"] .map-head, body[data-time="night"] .alert-line { color: #fff; }
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.status .btn { margin-left: auto; }
.pill { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-weight: 600; font-size: .875rem; }
.pill.time { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill.peak { background: var(--red); color: #fff; border-color: var(--red); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.meter { height: 8px; border-radius: 99px; background: rgba(16, 45, 90, .12); overflow: hidden; margin-bottom: 10px; }
.meter i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); transition: width .3s linear; }
.meter.night { background: rgba(255, 255, 255, .15); }
.meter.night i { background: linear-gradient(90deg, #6366f1, #a5b4fc); }

.scene { position: relative; border-radius: 18px; overflow: hidden; border: 3px solid #fff; box-shadow: 0 10px 30px rgba(16, 45, 90, .15); background: #e8c992; }
.scene-art svg { display: block; width: 100%; height: auto; }
.hotspot {
  position: absolute; appearance: none; background: transparent; border: 0; border-radius: 14px; cursor: pointer; padding: 0;
  min-width: 32px; min-height: 32px;
}
.hotspot:hover { background: rgba(255, 255, 255, .18); }
.hotspot.active { outline: 4px solid var(--gold); outline-offset: -2px; background: rgba(255, 209, 102, .2); }
.hotspot.missed { outline: 4px dashed var(--red); outline-offset: -2px; background: rgba(232, 65, 79, .15); }
.hotspot:disabled { cursor: default; }
.hotspot:focus-visible { outline: 4px solid var(--blue); outline-offset: -2px; }

.screen.play-water { max-width: 1200px; }
@media (min-width: 960px) {
  .board { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
  .board .panel { margin-top: 0; position: sticky; top: 72px; }
}
[tabindex="-1"]:focus { outline: none; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-top: 12px; min-height: 72px; }
.panel.wide { max-width: 760px; margin: 0 auto; }
.panel .hint, .panel .safe { margin: 0; font-size: 1.0625rem; }
.panel .safe { color: #166534; }
.panel > .btn { margin-top: 12px; }

/* ---------- Questions ---------- */
.quiz-art { margin-bottom: 12px; }
.quiz-art svg { display: block; width: 100%; max-height: 320px; border-radius: 14px; }
.quiz-q { font-size: 1.1875rem; font-weight: 600; margin: 0 0 12px; }
.quiz-options { display: grid; gap: 10px; }
.quiz-options.pictures { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.opt {
  appearance: none; text-align: left; border: 2px solid var(--line); background: #fff; color: var(--ink); border-radius: 14px;
  padding: 12px 16px; min-height: 52px; cursor: pointer; font-weight: 500; display: flex; flex-direction: column; gap: 8px; transition: border-color .15s ease, transform .15s ease;
}
.opt:not(:disabled):hover { border-color: var(--gold-deep); transform: translateY(-1px); }
.opt .opt-art svg { width: 100%; height: auto; display: block; border-radius: 10px; }
.opt.right { border-color: var(--green); background: #ecfdf3; }
.opt.right .opt-label::before { content: "✓ "; color: var(--green); font-weight: 700; }
.opt.wrong { border-color: var(--red); background: #fff1f2; opacity: .8; }
.opt.wrong .opt-label::before { content: "✗ "; color: var(--red); font-weight: 700; }
.opt:disabled { cursor: default; }
.feedback { margin-top: 12px; border-radius: 14px; }
.feedback:empty { display: none; }
.feedback.good, .feedback.bad { padding: 12px 16px; }
.feedback.good { background: #ecfdf3; border: 1px solid #bbf7d0; }
.feedback.bad { background: #fff7ed; border: 1px solid #fed7aa; }
.feedback .next-btn { display: flex; margin-top: 12px; }
.danger-title { font-size: 1.5rem; margin-bottom: 8px; }
.danger-icon { font-size: 4rem; text-align: center; line-height: 1.2; }
.myth-card { font-family: var(--display); font-size: clamp(1.375rem, 4vw, 1.875rem); font-weight: 600; text-align: center; background: var(--ink); color: #fff; border-radius: 18px; padding: 28px 20px; }

/* ---------- Senior extras ---------- */
.lifecycle h2 { font-size: 1.5rem; text-align: center; margin-bottom: 12px; }
.stages { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stage-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: grid; gap: 4px; font-size: .875rem; text-align: center; }
.stage-card svg { width: 100%; height: auto; }
.stage-card b { font-family: var(--display); font-size: 1.0625rem; }
.stage-card .days { color: var(--green); font-weight: 600; }
@media (max-width: 640px) { .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Night Shift ---------- */
.night-scene { background: #0b1734; border-color: #1e293b; }
.night-scene canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; touch-action: manipulation; }
.night-fix { display: flex; align-items: flex-start; justify-content: center; border: 3px solid var(--red); background: rgba(232, 65, 79, .12); animation: ring 1s ease-in-out infinite; }
.night-fix[hidden] { display: none; }
.fix-label { background: var(--red); color: #fff; font-weight: 600; font-size: clamp(.6875rem, 2.2vw, .875rem); border-radius: 999px; padding: 3px 10px; margin-top: 4px; max-width: 95%; line-height: 1.25; }
@keyframes ring { 50% { box-shadow: 0 0 0 6px rgba(232, 65, 79, .25); } }
.alert-line { min-height: 1.5em; font-weight: 600; margin: 10px 0 0; text-align: center; }
.start-overlay { position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; text-align: center; background: rgba(11, 23, 52, .72); color: #fff; padding: 16px; }
.start-overlay p { margin: 0; max-width: 28em; font-size: 1.0625rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.night-fix.fix-papa { align-items: flex-end; }
.night-fix.fix-papa .fix-label { margin: 0 0 4px; }
.lifecycle { max-width: 900px; margin: 0 auto; }
