* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --purple: #4A1A63; --purple-soft: #6B3A85; --amber: #FFC42E;
  --orange: #FF7A2F; --orange-dark: #DD5E15; --teal: #2FAFAF;
  --teal-dark: #218A8A; --cream: #FFF7EA; --cream-2: #FCEBD2;
  --white: #fff; --shadow: #DFCBAE;
  --font-brand: ui-rounded, "SF Pro Rounded", Nunito, Quicksand,
    "Hiragino Maru Gothic ProN", "Trebuchet MS", system-ui, sans-serif;
}
html, body { min-height: 100%; font-family: var(--font-brand); color: var(--purple); background: var(--cream); }
body { min-height: 100vh; min-height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 4px solid var(--amber); outline-offset: 3px; }
#app { min-height: 100vh; min-height: 100dvh; }
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: flex; }
.hidden { display: none !important; }
.menu-screen { flex-direction: column; align-items: center; overflow-y: auto; padding: clamp(16px, 4vh, 34px) 16px; }
.brand-mark { width: clamp(86px, 23vw, 122px); height: auto; }
h1 { margin-top: 8px; font-size: clamp(30px, 8vw, 48px); text-align: center; }
.tagline { width: min(470px, 94vw); margin: 12px 0 25px; color: var(--purple-soft); font-size: clamp(16px, 4vw, 20px); line-height: 1.5; text-align: center; }
.menu-buttons { display: grid; gap: 14px; width: min(340px, 92vw); }
.big-btn { min-height: 56px; border: 0; border-radius: 16px; padding: 10px 18px; color: var(--white); background: var(--orange); box-shadow: 0 5px 0 var(--orange-dark); font-size: 18px; font-weight: 800; cursor: pointer; }
.big-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--orange-dark); }
.big-btn.ghost { color: var(--purple); background: var(--white); box-shadow: 0 5px 0 var(--shadow); }
.reset-btn { background: var(--purple-soft); box-shadow: 0 5px 0 var(--purple); }
.portal-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 24px; padding: 10px 20px; border-radius: 999px; color: var(--purple); background: var(--white); box-shadow: 0 3px 0 var(--shadow); font-weight: 700; text-decoration: none; }
.build { margin-top: 14px; color: var(--purple-soft); font-size: 12px; }
.menu-header { display: flex; align-items: center; gap: 14px; width: min(680px, 100%); margin-bottom: 18px; }
.menu-header h2 { font-size: clamp(21px, 5vw, 30px); }
.subtle { margin-top: 4px; color: var(--purple-soft); font-size: 14px; }
.icon-btn { flex: 0 0 auto; min-width: 48px; min-height: 48px; border: 0; border-radius: 14px; color: var(--purple); background: var(--white); box-shadow: 0 3px 0 var(--shadow); font-size: 20px; cursor: pointer; }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shadow); }
.trail-grid { display: grid; gap: 14px; width: min(680px, 100%); }
.trail-card { display: grid; grid-template-columns: 60px 1fr auto; align-items: center; gap: 12px; min-height: 88px; border: 0; border-radius: 18px; padding: 12px; color: var(--purple); background: var(--white); box-shadow: 0 4px 0 var(--shadow); text-align: left; cursor: pointer; }
.trail-card:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }
.trail-card:disabled { opacity: .55; cursor: default; }
.trail-icon { font-size: 38px; text-align: center; }
.trail-copy strong { display: block; font-size: 18px; }
.trail-copy span { display: block; margin-top: 4px; color: var(--purple-soft); font-size: 14px; line-height: 1.35; }
.trail-state { font-size: 22px; }
#screen-game { flex-direction: column; overflow: hidden; }
.game-header { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 8px 10px; background: rgba(255,255,255,.94); box-shadow: 0 2px 0 var(--cream-2); }
.round-meta { display: flex; flex: 1; min-width: 0; flex-direction: column; text-align: center; }
.round-meta strong { overflow: hidden; font-size: clamp(15px, 4vw, 19px); text-overflow: ellipsis; white-space: nowrap; }
.round-meta span { margin-top: 2px; color: var(--purple-soft); font-size: 13px; }
.play-area { display: flex; flex: 1; min-height: 0; flex-direction: column; align-items: center; overflow-y: auto; padding: clamp(10px, 3vh, 24px) 12px 18px; }
.prompt-kicker { min-height: 24px; color: var(--purple-soft); font-size: 15px; font-weight: 800; text-align: center; }
.letter-display { display: grid; place-items: center; min-width: 120px; min-height: 120px; margin-top: 4px; border: 5px solid var(--amber); border-radius: 28px; color: var(--purple); background: var(--white); box-shadow: 0 6px 0 var(--shadow); font-size: clamp(70px, 22vw, 108px); font-weight: 900; line-height: 1; }
.letter-display.word-card { min-width: min(310px, 88vw); min-height: 105px; padding: 12px 18px; font-size: clamp(28px, 9vw, 50px); }
.sound-display { min-height: 32px; margin-top: 9px; color: var(--teal-dark); font-size: clamp(19px, 5vw, 27px); font-weight: 900; }
.instruction { min-height: 30px; margin-top: 4px; font-size: clamp(16px, 4vw, 20px); font-weight: 800; text-align: center; }
.choices { display: grid; grid-template-columns: repeat(3, minmax(88px, 145px)); justify-content: center; gap: clamp(9px, 3vw, 18px); width: min(100%, 500px); margin-top: 16px; }
.choice-btn { position: relative; display: flex; align-items: center; justify-content: center; min-height: 118px; border: 0; border-radius: 20px; padding: 8px; color: var(--purple); background: var(--white); box-shadow: 0 5px 0 var(--shadow); font-weight: 900; cursor: pointer; }
.choice-btn.emoji-choice { flex-direction: column; font-size: clamp(42px, 13vw, 66px); }
.choice-btn.letter-choice { color: var(--white); background: var(--teal); box-shadow: 0 5px 0 var(--teal-dark); font-size: clamp(52px, 16vw, 78px); }
.choice-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--shadow); }
.choice-btn:disabled { cursor: default; }
.choice-btn.wobble { animation: wobble .4s ease; }
.choice-btn.correct { border: 4px solid var(--teal-dark); background: #E8FAF7; animation: bounce .75s ease; }
.reveal-word { display: block; margin-top: 3px; font-size: 16px; text-transform: capitalize; }
.feedback { min-height: 32px; margin-top: 14px; font-size: clamp(16px, 4vw, 20px); font-weight: 900; text-align: center; }
.feedback.success { color: var(--teal-dark); }
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(74,26,99,.58); }
.card { width: min(420px, 94vw); max-height: 90vh; overflow-y: auto; border-radius: 22px; padding: 24px; background: var(--white); text-align: center; }
.card h2 { font-size: clamp(23px, 6vw, 31px); }
.card p { margin-top: 10px; color: var(--purple-soft); font-size: 16px; line-height: 1.5; }
.celebration { font-size: 60px; animation: bounce .8s ease; }
.card-buttons { display: grid; gap: 12px; margin-top: 20px; }
.setting-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 4px; font-size: 17px; font-weight: 800; text-align: left; cursor: pointer; }
.setting-row input { width: 24px; height: 24px; accent-color: var(--teal-dark); }
@keyframes wobble { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-7px) rotate(-3deg); } 75% { transform: translateX(7px) rotate(3deg); } }
@keyframes bounce { 0% { transform: scale(.5); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
@media (max-width: 390px) { .game-header { gap: 5px; padding-inline: 6px; } .icon-btn { min-width: 44px; min-height: 44px; } .choices { gap: 8px; grid-template-columns: repeat(3, 1fr); } .choice-btn { min-height: 104px; } .trail-card { grid-template-columns: 50px 1fr auto; padding: 10px; } }
@media (orientation: landscape) and (max-height: 590px) { .game-header { min-height: 54px; } .play-area { padding-top: 5px; } .letter-display { min-width: 82px; min-height: 82px; font-size: 62px; } .letter-display.word-card { min-height: 72px; font-size: 32px; } .sound-display { min-height: 25px; margin-top: 3px; } .choices { margin-top: 7px; } .choice-btn { min-height: 88px; } .feedback { margin-top: 7px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
