* { box-sizing: border-box; }
:root {
  --ink: #172033;
  --muted: #64748b;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --surface: #ffffff;
  --soft: #eef2ff;
  --line: #e2e8f0;
  --success: #15803d;
  --danger: #b91c1c;
  --shadow: 0 18px 60px rgba(30, 41, 59, .10);
}
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(99,102,241,.14), transparent 28rem),
    radial-gradient(circle at 88% 30%, rgba(14,165,233,.10), transparent 26rem),
    #f8fafc;
}
button, select { font: inherit; }
button { cursor: pointer; }
.app-shell { width: min(1050px, calc(100% - 32px)); margin: 0 auto; padding: 44px 0 64px; }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 28px; margin-bottom: 28px; }
.hero h1 { margin: 6px 0 8px; font-size: clamp(2.4rem, 6vw, 4.8rem); letter-spacing: -0.055em; line-height: .95; }
.hero h1 span { color: var(--primary); }
.hero p { max-width: 620px; margin: 0; color: var(--muted); font-size: 1.08rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .76rem; font-weight: 800; color: var(--primary); }
.logo-tile { width: 112px; aspect-ratio: 1; flex: 0 0 auto; display: grid; place-items: center; border-radius: 30px; background: var(--primary); color: white; font-weight: 900; font-size: 2.2rem; transform: rotate(5deg); box-shadow: 0 20px 34px rgba(79,70,229,.28); }
.card { background: rgba(255,255,255,.94); border: 1px solid rgba(226,232,240,.9); border-radius: 26px; box-shadow: var(--shadow); }
.setup-card, .game-card, .result-card { padding: clamp(22px, 4vw, 38px); }
.section-title { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.section-title h2, .game-heading h2 { margin: 0 0 3px; font-size: 1.5rem; }
.section-title p { margin: 0; color: var(--muted); }
.step { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--soft); color: var(--primary); font-weight: 900; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
label { display: grid; gap: 8px; font-weight: 750; font-size: .92rem; }
select { width: 100%; padding: 13px 14px; border-radius: 13px; border: 1px solid var(--line); background: white; color: var(--ink); outline: none; }
select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.toggle-row { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); padding: 15px; border-radius: 14px; }
.toggle-row input { width: 20px; height: 20px; accent-color: var(--primary); }
.toggle-row span { display: grid; }
.toggle-row small { color: var(--muted); font-weight: 500; margin-top: 2px; }
.primary-btn { border: 0; border-radius: 14px; background: var(--primary); color: white; padding: 14px 20px; font-weight: 850; box-shadow: 0 10px 24px rgba(79,70,229,.18); }
.primary-btn:hover { background: var(--primary-dark); }
.setup-card > .primary-btn { width: 100%; margin-top: 22px; font-size: 1.03rem; display: flex; justify-content: center; gap: 12px; }
.setup-note { text-align: center; color: var(--muted); font-size: .84rem; margin: 12px 0 0; }
.hidden { display: none !important; }
.hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { background: #172033; color: white; border-radius: 18px; padding: 15px 18px; display: flex; align-items: baseline; justify-content: space-between; }
.stat span { color: #cbd5e1; font-size: .85rem; }
.stat strong { font-size: 1.45rem; }
.game-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.pill { display: inline-block; margin-bottom: 6px; color: var(--primary); background: var(--soft); font-size: .74rem; font-weight: 900; border-radius: 999px; padding: 6px 10px; text-transform: uppercase; letter-spacing: .04em; }
.ghost-btn { border: 1px solid var(--line); background: white; border-radius: 11px; padding: 9px 12px; color: var(--muted); }
.syllable-board { display: flex; flex-wrap: wrap; justify-content: center; gap: 11px; padding: 30px 0 28px; }
.syllable { border: 0; min-width: 67px; padding: 14px 15px; border-radius: 15px; background: var(--soft); color: var(--primary-dark); font-weight: 900; font-size: 1.08rem; box-shadow: inset 0 0 0 1px rgba(79,70,229,.10); transition: transform .15s, background .15s; }
.syllable:hover { transform: translateY(-2px); background: #e0e7ff; }
.builder-wrap { border-top: 1px solid var(--line); padding-top: 22px; }
.helper { margin: 0 0 8px; color: var(--muted); font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.word-builder { min-height: 82px; border: 2px dashed #cbd5e1; border-radius: 18px; padding: 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; background: #f8fafc; }
.word-part { background: white; border: 1px solid #c7d2fe; color: var(--primary-dark); border-radius: 11px; padding: 10px 12px; font-weight: 900; }
.placeholder { width: 100%; text-align: center; color: #94a3b8; }
.builder-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.secondary-btn { border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 12px; padding: 11px 14px; font-weight: 750; }
.compact { padding: 11px 16px; }
.feedback { min-height: 24px; margin: 10px 0 0; font-weight: 750; }
.feedback.good { color: var(--success); }.feedback.bad { color: var(--danger); }
.found-card { margin-top: 14px; padding: 22px; }
.found-title { display: flex; align-items: center; justify-content: space-between; }
.found-title h3 { margin: 0; }
#foundBadge { min-width: 32px; height: 32px; display: grid; place-items: center; background: var(--soft); color: var(--primary); border-radius: 999px; font-weight: 900; }
.found-words, .missed-words { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.word-chip { display: inline-flex; gap: 7px; align-items: center; border: 1px solid var(--line); background: #f8fafc; border-radius: 999px; padding: 8px 11px; font-weight: 750; }
.word-chip small { color: var(--muted); font-weight: 700; }
.empty-state { color: var(--muted); margin: 4px 0; }
.result-card { text-align: center; }
.trophy { width: 74px; height: 74px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 22px; background: var(--soft); color: var(--primary); font-size: 2rem; }
.result-card h2 { margin: 5px 0; font-size: 2.2rem; }
.result-message { color: var(--muted); }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 24px 0; }
.result-stats div { padding: 18px 10px; border-radius: 18px; background: #f8fafc; border: 1px solid var(--line); display: grid; }
.result-stats strong { font-size: 1.7rem; }.result-stats span { color: var(--muted); font-size: .82rem; }
.missed-wrap { text-align: left; border-top: 1px solid var(--line); padding-top: 20px; }
.missed-wrap h3 { margin: 0; }
.result-card > .primary-btn { margin-top: 26px; min-width: 210px; }
@media (max-width: 720px) {
  .app-shell { width: min(100% - 20px, 1050px); padding-top: 24px; }
  .hero { align-items: flex-start; }.logo-tile { width: 78px; border-radius: 22px; font-size: 1.45rem; }
  .form-grid { grid-template-columns: 1fr; }.toggle-row { grid-column: auto; }
  .hud { position: sticky; top: 8px; z-index: 5; gap: 6px; }.stat { display: grid; justify-content: center; text-align: center; padding: 10px 6px; }.stat strong { font-size: 1.2rem; }
  .syllable { min-width: 58px; padding: 12px; }.builder-actions { display: grid; grid-template-columns: 1fr 1fr; }.builder-actions .compact { grid-column: 1 / -1; }
  .result-stats { grid-template-columns: 1fr; }
}
