:root {
  --bg: #f4efe6;
  --ink: #111111;
  --muted: #77736d;
  --line: rgba(17, 17, 17, .28);
  --green: #8fd19e;
  --red: #ee8e87;
  --panel: rgba(255,255,255,.2);
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { font-family: Inter, Arial, sans-serif; min-height: 100dvh; display: grid; place-items: center; overflow: hidden; }
button, a { font: inherit; }
button { color: inherit; }

.app-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 620px;
  background: var(--bg);
  overflow: hidden;
  padding: clamp(22px, 2.4vw, 42px);
  display: flex;
  flex-direction: column;
}

.topbar { display: flex; justify-content: space-between; align-items: center; z-index: 20; }
.brand { color: var(--ink); font-size: clamp(12px, .9vw, 16px); font-weight: 800; text-decoration: none; letter-spacing: -.03em; }
.sound-btn, .text-btn { border: 0; background: transparent; font-size: 11px; font-weight: 700; letter-spacing: .08em; cursor: pointer; padding: 8px 0; }

.screen { display: none; flex: 1; min-height: 0; animation: enter .35s ease; }
.screen.active { display: flex; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.home-grid { flex: 1; display: grid; grid-template-columns: 1.12fr .88fr; gap: clamp(38px, 6vw, 110px); align-items: center; }
.home-copy { align-self: center; }
.eyebrow, .section-label, .micro-label { font-size: clamp(10px, .72vw, 13px); font-weight: 800; letter-spacing: .12em; }
h1 { font-family: "Barlow Condensed", "Arial Narrow", "Helvetica Neue Condensed", Arial, sans-serif; font-stretch: condensed; font-size: clamp(61px, 7.2vw, 136px); line-height: .78; letter-spacing: -.075em; margin: 22px 0 28px; }
.claim { font-size: clamp(18px, 1.65vw, 30px); line-height: 1.2; max-width: 590px; margin: 0; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.home-card { padding: clamp(28px, 3vw, 52px); min-height: 72%; display: flex; flex-direction: column; justify-content: flex-start; gap: 30px; margin-top: clamp(24px, 5vw, 80px); }
.home-card h2 { font-size: clamp(28px, 2.8vw, 54px); line-height: 1; letter-spacing: -.05em; margin: 18px 0; }
.home-card p { color: var(--muted); line-height: 1.5; max-width: 480px; }
.mode-list { border-top: 1px solid var(--line); }
.mode-list div { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.mode-list span, .mode-list small { color: var(--muted); font-size: 12px; }
.mode-list strong { font-size: 14px; }

.primary-btn, .secondary-btn, .answer-btn { min-height: 56px; border-radius: 6px; font-weight: 800; letter-spacing: .02em; cursor: pointer; transition: transform .16s ease, background .16s ease, color .16s ease; }
.primary-btn { border: 1px solid var(--ink); color: var(--bg); background: var(--ink); padding: 0 24px; }
.secondary-btn { border: 1px solid var(--ink); color: var(--ink); background: transparent; padding: 0 24px; }
.primary-btn:hover, .secondary-btn:hover, .answer-btn:hover { transform: translateY(-2px); }
.compact { width: min(320px, 100%); }
.home-footer { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; letter-spacing: .08em; }

#gameScreen { flex-direction: column; padding-top: clamp(28px, 3vw, 54px); }
.game-head { display: flex; justify-content: space-between; align-items: center; }
.game-head > div:first-child { display: flex; gap: 18px; align-items: baseline; }
.round-label { color: var(--muted); font-size: 12px; }
.score-chip { display: flex; gap: 10px; align-items: baseline; }
.score-chip span { font-size: 10px; letter-spacing: .1em; font-weight: 800; }
.score-chip strong { font-size: 24px; }
.timer-track { height: 3px; background: rgba(17,17,17,.12); margin-top: 18px; }
.timer-fill { width: 100%; height: 100%; background: var(--ink); transform-origin: left; }
.game-stage { flex: 1; display: grid; grid-template-columns: 1fr .66fr; align-items: center; gap: clamp(44px, 8vw, 150px); }
.sample-wrap { text-align: center; }
.font-sample { font-size: clamp(60px, 6.8vw, 128px); line-height: 1; letter-spacing: -.05em; margin: clamp(28px, 5vh, 70px) 0 24px; white-space: nowrap; }
.time-left { font-size: 11px; color: var(--muted); letter-spacing: .1em; font-weight: 700; }
.answers { display: grid; gap: 16px; }
.answer-btn { border: 1px solid var(--ink); background: transparent; font-size: clamp(17px, 1.4vw, 24px); padding: 0 24px; text-align: left; position: relative; }
.answer-btn::after { content: "↗"; position: absolute; right: 22px; }
.answer-btn:hover { background: var(--ink); color: var(--bg); }
.game-foot { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: .08em; }

.feedback-screen { flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; }
.feedback-icon { width: clamp(72px, 7vw, 110px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; font-size: clamp(36px, 3vw, 58px); background: var(--green); }
.feedback-screen.wrong .feedback-icon { background: var(--red); }
.feedback-screen h2 { font-size: clamp(15px, 4.25vw, 75px); margin: 6px 0 0; letter-spacing: -.06em; white-space: nowrap; }
.feedback-screen p:not(.section-label) { font-size: clamp(16px, 1.35vw, 24px); color: var(--muted); margin: 0 0 18px; text-wrap: balance; }

.result-screen { flex-direction: column; padding-top: clamp(24px, 2.5vw, 48px); }
.result-grid { flex: 1; display: grid; grid-template-columns: 1.3fr .7fr; gap: clamp(28px, 5vw, 90px); align-items: center; }
.final-score { font-size: clamp(100px, 12vw, 220px); line-height: .85; letter-spacing: -.09em; margin: 20px 0 24px; }
.final-score small { font-size: .28em; letter-spacing: -.04em; }
.result-main h2 { font-size: clamp(30px, 3.4vw, 62px); line-height: .98; letter-spacing: -.055em; margin: 0 0 14px; max-width: 820px; }
.result-main > p:not(.section-label) { color: var(--muted); font-size: clamp(16px, 1.25vw, 22px); }
.result-actions { display: flex; gap: 12px; margin-top: 34px; }
.result-side { padding: clamp(24px, 2.4vw, 42px); }
.achievement-list { margin-top: 18px; }
.achievement { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 15px 0; border-top: 1px solid var(--line); }
.achievement:last-child { border-bottom: 1px solid var(--line); }
.achievement b { display: block; font-size: 14px; }
.achievement span { color: var(--muted); font-size: 12px; }
.result-stats { margin-top: 28px; display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.result-stats div { display: flex; flex-direction: column; gap: 8px; }
.result-stats span { font-size: 9px; color: var(--muted); letter-spacing: .08em; font-weight: 800; }
.result-stats strong { font-size: 20px; }

.toast { position: absolute; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .25s ease; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  body { display: block; overflow: auto; background: var(--bg); }
  .app-shell { width: 100%; height: 100dvh; min-height: 0; padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); overflow-y: auto; }
  .topbar { min-height: 28px; margin-bottom: 4px; }
  .home-grid, .game-stage, .result-grid { grid-template-columns: 1fr; }
  .home-grid { gap: 14px; align-content: center; }
  .home-card { margin-top: 0; }
  .home-copy { align-self: auto; }
  .eyebrow { font-size: 10px; }
  h1 { font-size: clamp(58px, 19vw, 90px); margin: 6px 0 10px; }
  .claim { font-size: 15px; max-width: 330px; line-height: 1.3; }
  .home-card { min-height: 0; padding: 18px; gap: 12px; }
  .home-card h2 { font-size: 22px; margin: 6px 0; }
  .home-card p { font-size: 12px; margin: 0; }
  .primary-btn, .secondary-btn { min-height: 50px; }
  .home-footer { font-size: 9px; }
  #gameScreen { padding-top: 16px; }
  .game-stage { grid-template-columns: 1fr; gap: 20px; align-content: center; }
  .font-sample { font-size: clamp(48px, 15.3vw, 73px); margin: 30px 0 14px; white-space: normal; overflow-wrap: anywhere; }
  .answers { gap: 10px; }
  .answer-btn { min-height: 62px; font-size: 18px; }
  .feedback-screen h2 { font-size: 37px; }
  .result-screen { padding-top: 16px; }
  .result-grid { align-content: center; overflow: auto; padding-bottom: 16px; }
  .final-score { font-size: 100px; margin: 10px 0 14px; }
  .result-main h2 { font-size: 30px; }
  .result-actions { flex-direction: column; margin-top: 18px; }
  .result-side { padding: 18px; }
  .result-stats { gap: 8px; }
  .result-stats strong { font-size: 17px; }
}

@media (max-height: 720px) and (min-width: 761px) {
  .app-shell { min-height: 0; }
  h1 { font-size: clamp(70px, 8vw, 128px); }
  .home-card { min-height: 0; }
  .font-sample { margin: 28px 0 18px; }
}
