:root {
  color-scheme: light;
  --ink: #18323d;
  --ink-soft: #42606a;
  --deep: #103b43;
  --teal: #0c716a;
  --teal-bright: #2ca995;
  --teal-pale: #e4f3ed;
  --gold: #c59b4d;
  --gold-light: #f1dfad;
  --coral: #d98067;
  --paper: #fffdf7;
  --sand: #f5f0e4;
  --line: #d8d2c2;
  --shadow: #18323d;
  font-family: Tahoma, Arial, sans-serif;
  color: var(--ink);
  background: var(--sand);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--sand); }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--sand);
  background-image: linear-gradient(90deg, transparent 97%, #d9d2bf45 97%), linear-gradient(transparent 97%, #d9d2bf45 97%);
  background-size: 48px 48px;
}
button { font: inherit; color: inherit; touch-action: manipulation; }
button:focus-visible { outline: 3px solid var(--coral); outline-offset: 4px; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: currentColor; vertical-align: middle; }
.app { min-height: 100vh; max-width: 1180px; margin: auto; padding: max(18px, env(safe-area-inset-top)) 30px max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.loading, .loading-error { margin: auto; padding: 20px 26px; background: var(--paper); border: 2px solid var(--ink); box-shadow: 5px 5px 0 var(--shadow); font-size: 1.1rem; font-weight: 900; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; padding: 4px 0 13px; border-bottom: 1px solid #18323d20; }
.brand { display: flex; align-items: center; gap: 12px; }
.pixel-mark { width: 44px; height: 44px; display: grid; place-items: center; color: var(--gold-light); background: var(--deep); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--gold); }
.pixel-mark .icon { width: 24px; height: 24px; }
.brand-copy { display: grid; gap: 3px; }
.brand-copy strong { font-size: 1rem; letter-spacing: .01em; }
.brand-copy small { color: var(--ink-soft); font-size: .76rem; }
.counter { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 72px; min-height: 42px; padding: 7px 12px; color: var(--deep); background: var(--paper); border: 1px solid var(--line); box-shadow: 3px 3px 0 var(--shadow); font-weight: 900; }
.counter .icon { color: var(--gold); width: 19px; height: 19px; }

.screen { width: 100%; max-width: 1000px; margin: auto; padding: 28px 0 34px; text-align: center; }
.hero { min-height: 510px; display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: 26px; padding: clamp(28px, 5vw, 58px); position: relative; overflow: hidden; background: var(--paper); border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--shadow); text-align: left; }
.hero:before { content: ""; position: absolute; inset: 12px; border: 1px solid #c59b4d4d; pointer-events: none; }
.hero-copy { position: relative; z-index: 1; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; color: #8c6727; font-size: .88rem; font-weight: 900; }
.eyebrow .icon { color: var(--gold); }
.hero h1 { max-width: 570px; margin: 18px 0 14px; color: var(--deep); font-size: clamp(2.25rem, 5vw, 4.1rem); line-height: 1.32; }
.hero p, .subhead { max-width: 36rem; margin: 0; color: var(--ink-soft); font-size: clamp(1rem, 2vw, 1.2rem); line-height: 1.85; font-weight: 600; }
.primary, .secondary { min-height: 56px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 22px; border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--shadow); font-size: 1.05rem; font-weight: 900; cursor: pointer; transition: transform .12s steps(2), box-shadow .12s steps(2), background-color .15s; }
.primary { color: #fffdf7; background: var(--teal); }
.primary:hover { background: var(--deep); }
.secondary { color: var(--deep); background: var(--paper); }
.primary:active, .secondary:active, .tiny-button:active, .level-card:active, .choice:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--shadow); }
.hero .primary { margin-top: 25px; min-width: 220px; }
.hero-facts { display: flex; align-items: center; gap: 13px; margin-top: 25px; color: var(--ink-soft); font-size: .87rem; font-weight: 800; }
.hero-facts span { display: inline-flex; align-items: center; gap: 6px; }
.hero-facts .icon { color: var(--gold); }
.hero-facts i { width: 4px; height: 4px; background: var(--gold); }
.hero-art { min-height: 330px; display: grid; place-items: center; position: relative; background: var(--teal-pale); border: 2px solid var(--ink); box-shadow: 5px 5px 0 var(--teal); }
.hero-art:before, .hero-art:after { content: ""; position: absolute; width: 13px; height: 13px; background: var(--gold); }
.hero-art:before { top: 0; right: 35px; }.hero-art:after { bottom: 0; left: 35px; }
.hero-animal { position: relative; z-index: 1; width: min(100%, 370px); aspect-ratio: 1; object-fit: contain; image-rendering: auto; }
.art-orbit { position: absolute; width: 70%; height: 70%; border: 1px dashed #0c716a49; border-radius: 50%; }
.orbit-two { width: 86%; height: 86%; border-color: #c59b4d55; transform: rotate(22deg); border-radius: 0; }
.art-tag { position: absolute; z-index: 2; top: 16px; left: 16px; padding: 8px 12px; color: var(--deep); background: var(--gold-light); border: 1px solid var(--gold); font-weight: 900; font-size: .78rem; }

.screen-heading { margin: 0 auto 24px; }
.section-title { margin: 10px 0 5px; color: var(--deep); font-size: clamp(1.7rem, 4vw, 2.6rem); }
.levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 24px auto 22px; max-width: 900px; }
.level-card { min-height: 106px; display: grid; grid-template-columns: 52px 1fr 20px; align-items: center; gap: 13px; padding: 14px 16px; text-align: left; background: var(--paper); border: 1px solid var(--line); box-shadow: 3px 3px 0 var(--shadow); cursor: pointer; transition: transform .12s steps(2), box-shadow .12s steps(2), border-color .15s; }
.level-card:not([disabled]):hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: 3px 5px 0 var(--shadow); }
.level-card[disabled] { color: #6e7a7a; background: #eeece4; cursor: not-allowed; }
.level-number { width: 48px; height: 48px; display: grid; place-items: center; color: var(--gold-light); background: var(--deep); border: 1px solid var(--ink); font-size: 1.1rem; font-weight: 900; }
.level-number .icon { width: 19px; height: 19px; color: var(--gold-light); }
.level-copy { display: grid; gap: 4px; }
.level-copy strong { color: var(--deep); font-size: 1.02rem; }
.level-copy small { color: var(--ink-soft); font-size: .81rem; line-height: 1.45; }
.level-progress { margin-top: 2px; color: #8c6727; font-size: .77rem; font-weight: 900; }
.level-enter { color: var(--gold); font-size: 1.3rem; }
.is-complete .level-number { color: #fff; background: var(--teal); }

.play-screen { max-width: 940px; }
.game-header { display: grid; grid-template-columns: 48px 1fr; gap: 16px; align-items: center; margin-bottom: 20px; }
.tiny-button { width: 46px; height: 46px; display: grid; place-items: center; color: var(--deep); background: var(--paper); border: 1px solid var(--line); box-shadow: 3px 3px 0 var(--shadow); cursor: pointer; }
.tiny-button .icon { width: 21px; height: 21px; }
.progress-wrap { display: grid; gap: 9px; }
.progress-line { display: flex; justify-content: space-between; align-items: center; gap: 14px; text-align: left; }
.progress-copy { color: var(--ink-soft); font-size: .91rem; font-weight: 900; }
.level-pill { padding: 6px 10px; color: var(--deep); background: var(--gold-light); border: 1px solid var(--gold); font-size: .77rem; font-weight: 900; white-space: nowrap; }
.progress-track { height: 12px; padding: 2px; overflow: hidden; background: #fffdf7; border: 1px solid var(--ink); }
.progress-fill { height: 100%; width: 0; background: var(--teal-bright); transition: width .2s steps(5); }
.prompt-panel { max-width: 740px; margin: 0 auto 18px; padding: 20px 16px 18px; background: var(--paper); border: 1px solid var(--line); box-shadow: 4px 4px 0 var(--shadow); }
.prompt-kicker { color: #8c6727; font-size: .78rem; font-weight: 900; }
.prompt-title { margin: 6px 0 14px; color: var(--deep); font-size: clamp(1.05rem, 2.2vw, 1.3rem); font-weight: 900; }
.listen-button { min-width: 188px; min-height: 54px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 17px; color: #fffdf7; background: var(--teal); border: 2px solid var(--ink); box-shadow: 3px 3px 0 var(--shadow); font-size: 1rem; font-weight: 900; cursor: pointer; }
.listen-button:hover { background: var(--deep); }
.listen-button .icon { width: 23px; height: 23px; color: var(--gold-light); }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; direction: ltr; max-width: 740px; margin: 0 auto; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.choice { min-width: 0; padding: 10px; position: relative; display: grid; grid-template-rows: 1fr auto; gap: 8px; background: var(--paper); border: 2px solid var(--ink); box-shadow: 5px 5px 0 var(--shadow); cursor: pointer; transition: transform .12s steps(3), background-color .15s; }
.choice-art { width: 100%; aspect-ratio: 1.13; object-fit: contain; pointer-events: none; background: #fffdf8; }
.choice-index { position: absolute; z-index: 2; top: 14px; left: 14px; width: 30px; height: 30px; display: grid; place-items: center; color: var(--deep); background: var(--gold-light); border: 1px solid var(--gold); font-size: .84rem; font-weight: 900; }
.choice-arrow { min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--deep); background: var(--teal-pale); border-top: 1px solid #0c716a48; font-weight: 900; font-size: .9rem; direction: ltr; }
.choice-arrow .icon { width: 17px; height: 17px; color: var(--teal); }
.choice:focus-visible { outline: 3px solid var(--coral); outline-offset: 4px; }
.choice.swipe-left { transform: translateX(-10px) rotate(-2deg); background: #d4f6e7; }
.choice.swipe-right { transform: translateX(10px) rotate(2deg); background: #fff0b7; }
.choice.correct { background: #d8eee1; outline: 4px solid var(--teal-bright); }
.choice.wrong { animation: wiggle .22s steps(2); }
@keyframes wiggle { 25% { transform: translateX(5px); } 75% { transform: translateX(-5px); } }
.feedback { min-height: 76px; max-width: 740px; margin: 16px auto 0; padding: 15px; color: var(--deep); background: #e5f3eb; border: 1px solid var(--teal); box-shadow: 4px 4px 0 var(--shadow); font-size: 1.05rem; font-weight: 900; line-height: 1.55; }
.feedback > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.feedback > span:first-child .icon { color: var(--gold); }
.feedback[hidden] { display: none; }
.feedback.try { background: #fcf0d0; border-color: var(--gold); }
.feedback-word { display: block; margin-top: 3px; font-size: 1.35rem; }
.feedback-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.complete-card { max-width: 700px; margin: 18px auto; padding: 30px 20px; background: var(--paper); border: 2px solid var(--ink); box-shadow: 7px 7px 0 var(--shadow); }
.big-star { color: var(--gold); font-size: 4rem; line-height: 1; }
.stars { display: flex; justify-content: center; gap: 6px; margin: 12px; color: var(--gold); font-size: 1.5rem; }
.footer { display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 15px; color: var(--ink-soft); text-align: center; font-size: .78rem; font-weight: 700; }
.footer > span { display: inline-flex; align-items: center; gap: 6px; }
.footer .icon { width: 14px; height: 14px; color: var(--gold); }
.online-status { opacity: .85; }

@media (max-width: 760px) {
  .app { padding-inline: 18px; }
  .hero { grid-template-columns: 1fr; gap: 20px; min-height: 0; padding: 30px 26px; }
  .hero-copy { grid-row: 2; }
  .hero-art { grid-row: 1; min-height: 260px; }
  .hero-animal { width: min(68vw, 300px); }
  .levels { grid-template-columns: 1fr; max-width: 580px; }
  .play-screen { padding-top: 22px; }
}
@media (max-width: 520px) {
  .app { padding-inline: 13px; }
  .topbar { min-height: 58px; }
  .brand-copy strong { font-size: .88rem; }
  .brand-copy small { font-size: .68rem; }
  .pixel-mark { width: 39px; height: 39px; }
  .screen { padding-top: 20px; }
  .hero { padding: 23px 17px; gap: 17px; }
  .hero-art { min-height: 220px; }
  .hero h1 { font-size: clamp(2rem, 10vw, 3rem); }
  .hero-facts { flex-wrap: wrap; font-size: .78rem; }
  .game-header { grid-template-columns: 42px 1fr; gap: 11px; }
  .tiny-button { width: 40px; height: 40px; }
  .progress-copy { font-size: .78rem; }
  .level-pill { padding: 5px 7px; font-size: .68rem; }
  .prompt-panel { padding: 16px 12px; margin-bottom: 14px; }
  .choices { gap: 10px; }
  .choice { padding: 6px; gap: 5px; box-shadow: 3px 3px 0 var(--shadow); }
  .choice-art { aspect-ratio: .94; }
  .choice-index { top: 9px; left: 9px; width: 25px; height: 25px; font-size: .75rem; }
  .choice-arrow { min-height: 38px; gap: 4px; font-size: .73rem; }
  .choice-arrow .icon { width: 14px; height: 14px; }
  .primary, .secondary { min-height: 50px; padding: 10px 16px; font-size: .93rem; }
  .listen-button { min-height: 50px; min-width: 160px; }
  .feedback-actions { gap: 9px; }
  .level-card { grid-template-columns: 46px 1fr 16px; gap: 10px; padding: 11px; min-height: 95px; }
  .level-number { width: 42px; height: 42px; }
}
@media (max-width: 360px) {
  .app { padding-inline: 9px; }
  .choices { gap: 7px; }
  .choice { padding: 4px; border-width: 1px; }
  .choice-arrow { font-size: .66rem; }
  .choice-index { top: 7px; left: 7px; }
  .brand-copy small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
