:root {
  --ink: #103f43;
  --muted: #567579;
  --teal-950: #083f42;
  --teal-900: #0b5556;
  --teal-800: #0d6968;
  --teal-700: #0d7773;
  --teal-600: #118c86;
  --teal-500: #21a9a2;
  --aqua: #b9efeb;
  --aqua-2: #e6fbf8;
  --cream: #fffaf0;
  --white: #fff;
  --yellow: #ffd46a;
  --green: #2fb878;
  --red: #e75d67;
  --shadow: 0 24px 60px rgba(8, 63, 66, .18);
  --radius: 28px;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--teal-800); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 12%, rgba(185,239,235,.23), transparent 28%),
    radial-gradient(circle at 90% 8%, rgba(255,212,106,.12), transparent 26%),
    linear-gradient(155deg, #0d7773 0%, #0a5558 58%, #083f42 100%);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.app-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.site-header {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--white);
}
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 900; letter-spacing: .06em; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 15px; display: grid; place-items: center;
  background: var(--white); color: var(--teal-700); font-size: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.14);
}
.header-actions { display: flex; align-items: center; gap: 10px; }
.ghost-btn, .back-btn, .icon-btn {
  border: 1px solid rgba(255,255,255,.3); color: var(--white); background: rgba(255,255,255,.08);
  border-radius: 999px; min-height: 44px; padding: 0 16px; cursor: pointer; font-weight: 800;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.ghost-btn:hover, .back-btn:hover, .icon-btn:hover { transform: translateY(-1px); background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.55); }
.main { flex: 1; width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 58px; }
.hero { min-height: calc(100dvh - 170px); display: grid; grid-template-columns: 1.1fr .9fr; align-items: center; gap: clamp(28px, 7vw, 88px); }
.eyebrow { margin: 0 0 14px; color: var(--yellow); font-size: .82rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
.hero h1 { color: var(--white); font-size: clamp(3.35rem, 8vw, 6.9rem); line-height: .9; letter-spacing: -.065em; margin-bottom: 24px; max-width: 780px; }
.hero h1 span { color: var(--aqua); }
.hero-copy { color: rgba(255,255,255,.82); font-size: clamp(1.06rem, 2vw, 1.25rem); line-height: 1.7; max-width: 650px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.primary-btn, .secondary-btn, .choice-card, .answer-btn {
  border: 0; cursor: pointer; font-weight: 900; transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.primary-btn { min-height: 56px; padding: 0 24px; border-radius: 18px; background: var(--yellow); color: #523d00; box-shadow: 0 14px 30px rgba(255,212,106,.23); }
.primary-btn:hover, .secondary-btn:hover, .choice-card:hover, .answer-btn:hover { transform: translateY(-2px); }
.secondary-btn { min-height: 56px; padding: 0 22px; border-radius: 18px; color: var(--white); border: 1px solid rgba(255,255,255,.26); background: rgba(255,255,255,.09); }
.hero-card {
  position: relative; background: rgba(255,255,255,.95); border: 1px solid rgba(255,255,255,.5); border-radius: 36px; padding: 26px;
  box-shadow: var(--shadow); overflow: hidden;
}
.hero-card::before { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: var(--aqua); right: -70px; top: -80px; opacity: .55; }
.mini-top { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 8px 12px; background: var(--aqua-2); color: var(--teal-800); font-size: .78rem; font-weight: 900; }
.mini-score { font-size: .84rem; color: var(--muted); font-weight: 800; }
.mini-question { position: relative; background: var(--teal-800); color: var(--white); border-radius: 24px; padding: 24px; font-weight: 800; line-height: 1.5; }
.word-preview { display: flex; gap: 8px; justify-content: center; margin: 26px 0; }
.word-preview span { width: 34px; height: 42px; border-bottom: 4px solid var(--teal-700); display: grid; place-items: center; font-weight: 900; font-size: 1.2rem; }
.mini-keyboard { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.mini-key { aspect-ratio: 1; border-radius: 11px; display: grid; place-items: center; background: #eef8f7; color: var(--teal-800); font-size: .73rem; font-weight: 900; }
.mini-key.correct { background: #d8f4e6; color: #15724a; }
.mini-key.wrong { background: #ffe0e2; color: #a52f39; }
.home-lower { margin-top: 24px; display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; color: rgba(255,255,255,.75); }
.share-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.share-chip { border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: var(--white); border-radius: 999px; min-height: 40px; padding: 0 13px; cursor: pointer; font-weight: 800; }
.screen-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin: 20px 0 28px; color: var(--white); }
.screen-head h1 { text-align: center; margin: 0; font-size: clamp(2rem, 5vw, 4.2rem); letter-spacing: -.04em; }
.screen-head .spacer { width: 98px; }
.selection-wrap { max-width: 920px; margin: 0 auto; }
.selection-intro { color: rgba(255,255,255,.78); text-align: center; margin: -4px auto 28px; max-width: 650px; line-height: 1.65; }
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.choice-grid.categories { grid-template-columns: repeat(2, 1fr); }
.choice-card {
  min-height: 128px; padding: 22px; text-align: left; border-radius: 25px; background: rgba(255,255,255,.95); color: var(--ink); box-shadow: 0 14px 34px rgba(4,52,54,.13); position: relative; overflow: hidden;
}
.choice-card::after { content: "→"; position: absolute; right: 18px; bottom: 13px; font-size: 1.4rem; color: var(--teal-500); }
.choice-card small { display: block; color: var(--teal-600); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.choice-card strong { font-size: clamp(1.2rem, 2vw, 1.55rem); }
.game-layout { max-width: 980px; margin: 0 auto; }
.game-topbar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin: 8px 0 18px; }
.game-topbar .back-btn { justify-self: start; }
.game-actions { justify-self: end; display: flex; gap: 9px; }
.stat-cluster { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; }
.stat-pill { min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.11); border: 1px solid rgba(255,255,255,.19); color: var(--white); border-radius: 999px; font-size: .86rem; font-weight: 900; }
.stat-pill b { color: var(--yellow); }
.game-card { background: rgba(255,255,255,.97); border-radius: 34px; padding: clamp(20px, 4vw, 38px); box-shadow: var(--shadow); }
.game-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.meta-badge { background: var(--aqua-2); color: var(--teal-800); border-radius: 999px; padding: 8px 12px; font-weight: 900; font-size: .78rem; }
.question-box { background: linear-gradient(140deg, var(--teal-800), var(--teal-950)); color: var(--white); border-radius: 25px; padding: clamp(22px, 4vw, 34px); text-align: center; }
.question-label { color: var(--aqua); text-transform: uppercase; letter-spacing: .11em; font-size: .72rem; font-weight: 900; margin-bottom: 10px; }
.question { font-size: clamp(1.15rem, 3vw, 1.7rem); line-height: 1.5; font-weight: 850; margin: 0; }
.answer-slots { display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(5px, 1.1vw, 10px); padding: 28px 0 20px; min-height: 94px; }
.answer-slot { width: clamp(25px, 5vw, 42px); height: clamp(38px, 7vw, 52px); display: grid; place-items: center; border-bottom: 4px solid var(--teal-700); font-size: clamp(1.25rem, 3.7vw, 2rem); font-weight: 950; text-transform: uppercase; }
.score-life-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; margin: 4px 0 22px; }
.score-card { background: #f2fbfa; border-radius: 19px; padding: 12px 16px; min-width: 112px; }
.score-card small { display: block; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.score-card strong { display: block; color: var(--teal-800); font-size: 1.6rem; margin-top: 2px; }
.lives { display: flex; justify-content: center; gap: 8px; }
.heart { font-size: 1.65rem; filter: drop-shadow(0 4px 4px rgba(231,93,103,.14)); }
.heart.empty { filter: grayscale(1); opacity: .22; }
.lifeline-btn { min-height: 50px; border: 0; border-radius: 17px; padding: 0 16px; background: var(--yellow); color: #513c00; cursor: pointer; font-weight: 950; }
.lifeline-btn:disabled { cursor: not-allowed; filter: grayscale(.7); opacity: .55; }
.keyboard { display: flex; flex-direction: column; gap: 8px; }
.keyboard-row { display: flex; justify-content: center; gap: 7px; }
.key {
  flex: 0 1 58px; min-width: 34px; height: clamp(42px, 8vw, 58px); border: 0; border-radius: 13px; background: #edf7f6; color: var(--teal-900); cursor: pointer; text-transform: uppercase; font-weight: 950; font-size: 1rem; box-shadow: inset 0 -2px 0 rgba(13,105,104,.09); transition: transform .12s ease, background .16s ease, color .16s ease;
}
.key:hover:not(:disabled) { transform: translateY(-2px); background: var(--aqua); }
.key.correct { background: #d6f4e4; color: #127049; box-shadow: inset 0 -2px 0 rgba(47,184,120,.2); }
.key.wrong { background: #ffe1e3; color: #a9343e; box-shadow: inset 0 -2px 0 rgba(231,93,103,.18); }
.key:disabled { cursor: default; }
.feedback { min-height: 28px; text-align: center; margin: 13px 0 0; font-weight: 850; }
.feedback.good { color: #13734c; }
.feedback.bad { color: #ab3841; }
.loading-card, .error-card { background: var(--white); border-radius: 28px; padding: 32px; text-align: center; box-shadow: var(--shadow); max-width: 640px; margin: 80px auto 0; }
.spinner { width: 42px; height: 42px; border-radius: 50%; margin: 0 auto 18px; border: 4px solid #d7eeee; border-top-color: var(--teal-700); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(3,37,40,.68); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 18px; animation: fade .16s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(680px, 100%); max-height: min(88dvh, 850px); overflow: auto; background: var(--white); border-radius: 28px; box-shadow: 0 28px 80px rgba(0,0,0,.28); padding: clamp(22px, 5vw, 34px); position: relative; }
.modal h2 { font-size: clamp(1.7rem, 4vw, 2.35rem); letter-spacing: -.04em; margin-bottom: 8px; }
.modal-sub { color: var(--muted); line-height: 1.55; }
.close-btn { position: absolute; top: 14px; right: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: #eef7f6; color: var(--teal-800); cursor: pointer; font-size: 1.2rem; font-weight: 900; }
.rules { display: grid; gap: 18px; margin-top: 22px; }
.rule-block { background: #f5fbfa; border-radius: 18px; padding: 18px; }
.rule-block h3 { margin-bottom: 8px; color: var(--teal-800); }
.rule-block p, .rule-block li { color: #48696c; line-height: 1.6; }
.rule-block ul, .rule-block ol { margin: 8px 0 0; padding-left: 21px; }
.scoring-list { display: grid; gap: 8px; margin-top: 10px; }
.scoring-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 12px; border-radius: 12px; background: var(--white); }
.scoring-row b { color: var(--teal-800); text-align: right; }
.answer-options { display: grid; gap: 10px; margin-top: 22px; }
.answer-btn { min-height: 54px; border-radius: 16px; padding: 10px 14px; background: #edf7f6; color: var(--ink); }
.answer-btn.correct { background: #d6f4e4; color: #126b46; }
.answer-btn.wrong { background: #ffe1e3; color: #a9343e; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.modal-actions > * { flex: 1; }
.danger-btn { min-height: 50px; border: 0; border-radius: 16px; background: #ffe5e7; color: #9b333c; font-weight: 900; cursor: pointer; }
.game-over-answer { margin: 20px 0; background: var(--teal-950); color: var(--white); border-radius: 18px; padding: 18px; text-align: center; }
.game-over-answer small { display:block; color: var(--aqua); text-transform: uppercase; font-weight: 900; letter-spacing: .09em; }
.game-over-answer strong { display:block; font-size: 2rem; margin-top: 5px; text-transform: uppercase; }
.footer-note { text-align: center; color: rgba(255,255,255,.55); font-size: .82rem; padding: 0 16px 24px; }
.toast { position: fixed; z-index: 200; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translate(-50%, 18px); opacity: 0; pointer-events: none; background: #082f32; color: white; padding: 12px 17px; border-radius: 999px; font-weight: 800; box-shadow: 0 12px 28px rgba(0,0,0,.24); transition: .2s ease; max-width: calc(100% - 28px); text-align:center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 820px) {
  .site-header { min-height: 68px; }
  .hero { grid-template-columns: 1fr; min-height: auto; padding: 34px 0 20px; }
  .hero-card { max-width: 590px; width: 100%; margin: 0 auto; }
  .home-lower { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
  .choice-grid.categories { grid-template-columns: 1fr 1fr; }
  .game-topbar { grid-template-columns: auto 1fr auto; }
  .stat-cluster { display: none; }
  .score-life-row { grid-template-columns: 1fr auto; }
  .lives { order: 3; grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .site-header, .main { width: min(100% - 22px, 1180px); }
  .main { padding-top: 10px; padding-bottom: 34px; }
  .header-actions .ghost-btn { padding: 0 12px; }
  .brand { font-size: .93rem; }
  .brand-mark { width: 38px; height: 38px; border-radius: 13px; }
  .hero h1 { font-size: clamp(3rem, 17vw, 4.7rem); }
  .hero-actions { display: grid; grid-template-columns: 1fr; }
  .primary-btn, .secondary-btn { width: 100%; }
  .hero-card { border-radius: 27px; padding: 18px; }
  .mini-keyboard { grid-template-columns: repeat(7, 1fr); gap: 5px; }
  .choice-grid.categories { grid-template-columns: 1fr; }
  .choice-card { min-height: 102px; }
  .screen-head { grid-template-columns: auto 1fr; margin-top: 8px; }
  .screen-head h1 { text-align: right; font-size: 2rem; }
  .screen-head .spacer { display: none; }
  .game-topbar { grid-template-columns: auto 1fr; }
  .game-actions { justify-self: end; }
  .game-card { border-radius: 25px; padding: 16px 13px 20px; }
  .question-box { border-radius: 20px; padding: 20px 16px; }
  .score-life-row { grid-template-columns: 1fr 1fr; gap: 9px; }
  .lifeline-btn { grid-column: 1 / -1; }
  .lives { grid-column: auto; order: initial; align-self: center; }
  .keyboard { gap: 6px; }
  .keyboard-row { gap: 4px; }
  .key { min-width: 0; flex: 1 1 0; height: 44px; border-radius: 10px; font-size: .91rem; }
  .answer-slots { gap: 4px; }
  .answer-slot { width: 25px; height: 40px; border-bottom-width: 3px; }
  .modal { border-radius: 23px; padding: 23px 17px; }
  .scoring-row { flex-direction: column; gap: 2px; }
  .scoring-row b { text-align: left; }
}
@media (max-width: 380px) {
  .header-actions .ghost-btn { font-size: .78rem; }
  .hero h1 { font-size: 3.2rem; }
  .key { height: 40px; font-size: .82rem; }
  .heart { font-size: 1.4rem; }
}
