/* ============================================================
   KochSprint — Global Stylesheet
   Themes: dark (default) | light
   ============================================================ */

/* ── Dark Theme (default) ── */
:root,
[data-theme="dark"] {
  --primary:       #4f8ef7;
  --primary-dim:   rgba(79,142,247,.15);
  --secondary:     #7c5cbf;
  --accent:        #e06c75;
  --bg:            #1e1e2e;
  --bg-grad:       linear-gradient(160deg, #1e1e2e 0%, #181825 100%);
  --nav-bg:        rgba(24,24,37,.88);
  --card-bg:       rgba(255,255,255,.05);
  --card-border:   rgba(255,255,255,.08);
  --text:          #cdd6f4;
  --text-muted:    #6c7086;
  --success:       #a6e3a1;
  --error:         #f38ba8;
}

/* ── Light Theme ── */
[data-theme="light"] {
  --primary:       #1a56db;
  --primary-dim:   rgba(26,86,219,.12);
  --secondary:     #6c3483;
  --accent:        #c0392b;
  --bg:            #f4f5f7;
  --bg-grad:       linear-gradient(160deg, #f4f5f7 0%, #e8eaf0 100%);
  --nav-bg:        rgba(248,249,252,.92);
  --card-bg:       rgba(255,255,255,.85);
  --card-border:   rgba(0,0,0,.1);
  --text:          #1e1e2e;
  --text-muted:    #6c7086;
  --success:       #2e7d32;
  --error:         #c62828;
}

/* ── Reset ── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

/* ── Base ── */
body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  background-image: var(--bg-grad);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .3s, color .3s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { opacity: .8; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }

/* ── Layout ── */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: min(90%, 860px);
  margin: 0 auto;
  padding: 0 16px;
}

.container--wide { max-width: 1100px; }

main { flex: 1; padding: 40px 0 60px; }

/* ── Navigation ── */
#main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg, rgba(24,24,37,.88));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
}

.nav-inner {
  width: min(95%, 1200px);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 8px 12px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo-dot  { width:10px; height:10px; border-radius:50%; background:var(--primary); box-shadow:0 0 10px var(--primary); }
.logo-dash { width:24px; height:8px; border-radius:4px; background:var(--primary); box-shadow:0 0 10px var(--primary); }

.logo-text {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  display: flex;
  gap: 4px;
  order: 3;
  width: 100%;
}

.nav-links .nav-link {
  color: var(--text-muted);
  font-size: .82rem;
  padding: 4px 10px;
  border-radius: 8px;
  transition: all .2s;
  white-space: nowrap;
}
.nav-links .nav-link:hover,
.nav-links .nav-link.active {
  color: var(--primary);
  background: var(--primary-dim);
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  order: 2;
}

/* ── Tab bar + nav-links breakpoint ── */
/* Below 1024px: hide desktop nav-links, show bottom tab bar instead */
.mobile-tab-bar {
  display: none;
}

@media (max-width: 1024px) {
  .nav-links { display: none !important; }
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--card-border);
    z-index: 200;
    padding: 4px 0 max(4px, env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .page-wrapper { padding-bottom: 60px; }
  .char-input-grid { margin-bottom: 8px; }
  /* Compact nav on tablet/mobile */
  .nav-inner { gap: 6px; padding: 6px 10px; }
  .nav-controls { flex-wrap: wrap; gap: 4px; }
  .btn-google span[data-i18n] { display: none; }
  .lang-btn { font-size: .6rem; padding: 2px 4px; }
  .theme-btn { width: 20px; height: 20px; }
  .user-avatar { width: 22px; height: 22px; }
  .user-name { max-width: 60px; font-size: .7rem; }
  .logo-text { font-size: 1rem; }
}

.mobile-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: .58rem;
  font-weight: 600;
  padding: 5px 2px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-radius: 6px;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-tab.active { color: var(--primary); }
.mobile-tab:active  { opacity: .7; }

/* ── Theme Selector ── */
.theme-selector { display: flex; gap: 6px; }

.theme-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--card-border);
  transition: all .2s;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
[data-theme="dark"]  .theme-btn.theme-swatch--dark  { border-color: var(--primary); box-shadow: 0 0 6px var(--primary); }
[data-theme="light"] .theme-btn.theme-swatch--light { border-color: var(--primary); box-shadow: 0 0 6px var(--primary); }
[data-theme="auto"]  .theme-btn.theme-swatch--auto  { border-color: var(--primary); box-shadow: 0 0 6px var(--primary); }

.theme-swatch--dark  { background: #1e1e2e; }
.theme-swatch--light { background: #f4f5f7; }
.theme-swatch--auto  { background: linear-gradient(135deg, #1e1e2e 50%, #f4f5f7 50%); }

/* ── Lang Selector ── */
.lang-selector { display: flex; gap: 4px; }
.lang-btn {
  background: none;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: .72rem;
  padding: 3px 7px;
  border-radius: 6px;
  transition: all .2s;
}
.lang-btn.active,
.lang-btn:hover {
  background: var(--primary-dim);
  color: var(--primary);
  border-color: var(--primary);
}

/* ── Auth UI ── */
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-avatar { width:30px; height:30px; border-radius:50%; border:2px solid var(--primary); }
.user-name   { font-size:.85rem; max-width:100px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: #333;
  font-size: .85rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  transition: all .2s;
  white-space: nowrap;
}
.btn-google:hover { box-shadow: 0 4px 12px rgba(0,0,0,.3); transform: translateY(-1px); }

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 12px;
  box-shadow: 0 8px 20px -5px rgba(0,0,0,.4);
  transition: all .3s;
}
.btn-primary:hover  { transform: translateY(-2px); box-shadow: 0 14px 24px -5px rgba(0,0,0,.5); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: .95rem;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 12px;
  transition: all .2s;
}
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,.1); border-color: var(--primary); }
.btn-secondary:disabled { opacity: .35; cursor: not-allowed; }

/* ── Card ── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 28px;
  transition: border-color .2s;
}
.card:hover { border-color: var(--primary); }

/* ── Mode Cards (index) ── */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px,1fr));
  gap: 20px;
  margin-top: 32px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: all .3s;
}
.mode-card:hover { transform: translateY(-6px); border-color: var(--primary); }
.mode-card__icon  { font-size: 2.5rem; }
.mode-card__title { font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.mode-card__desc  { font-size: .875rem; color: var(--text-muted); line-height: 1.5; }

/* ── Signal Indicator ── */
.signal-indicator {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 2px solid var(--card-border);
  margin: 0 auto 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all .08s ease;
}
.signal-indicator.active {
  background: var(--primary);
  box-shadow: 0 0 40px var(--primary), 0 0 80px var(--primary-dim);
  border-color: var(--primary);
  transform: scale(1.08);
}

/* ── Display Area ── */
.display-area { text-align: center; margin-bottom: 28px; cursor: pointer; }

.target-display {
  font-family: 'Roboto Mono', monospace;
  font-size: 2.5rem;
  font-weight: 700;
  min-height: 3.5rem;
  letter-spacing: 6px;
  margin-bottom: 10px;
}

.input-display {
  font-family: 'Roboto Mono', monospace;
  font-size: 3rem;
  color: var(--primary);
  min-height: 4rem;
  border-bottom: 2px dashed var(--card-border);
  display: inline-block;
  min-width: 200px;
  letter-spacing: 10px;
}

.placeholder {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: normal;
}

/* ── Signal flash overlay (background flashes on Morse tone) ── */
.signal-flash-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: var(--primary);
  opacity: 0;
  transition: opacity 0.012s linear;
}
.signal-flash-overlay.active { opacity: 0.16; }

/* ── Mobile answer input (hidden but focusable) ── */
.answer-input-hidden {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ── Character input grid (mobile keyboard) ── */
.char-input-grid {
  display: none; /* hidden on desktop */
  margin-top: 20px;
}

.char-grid-keys {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 6px;
}

.char-key {
  font-family: 'Roboto Mono', monospace;
  font-size: .95rem;
  font-weight: 700;
  padding: 10px 4px;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  transition: background .1s, transform .1s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.char-key:active,
.char-key.pressed {
  background: var(--primary-dim);
  border-color: var(--primary);
  transform: scale(.92);
}

.char-key--wide {
  grid-column: span 1;
  background: var(--card-bg);
  color: var(--error);
  font-size: 1.1rem;
}

@media (max-width: 1024px) {
  .char-input-grid { display: block; }
}

/* ── Feedback ── */
.feedback-msg {
  min-height: 28px;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  margin-top: 16px;
  letter-spacing: 1px;
}
.feedback-msg.success { color: var(--success); }
.feedback-msg.error   { color: var(--error); }

/* ── Settings Panel ── */
.settings-panel {
  background: rgba(0,0,0,.25);
  border-radius: 16px;
  padding: 24px;
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap: 20px;
}
.settings-panel h2 {
  grid-column: 1/-1;
  font-size: .85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}
.setting-group { display: flex; flex-direction: column; gap: 8px; }
.setting-group label { font-size: .85rem; color: var(--text-muted); }

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  appearance: none;
  background: var(--card-border);
  accent-color: var(--primary);
}

/* ── Score HUD ── */
.score-hud {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 24px;
}
.hud-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hud-label { font-size: .7rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); }
.hud-value { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.hud-value--timer { color: var(--accent); }
.hud-value--combo { color: var(--success); }

/* ── Ranking Table ── */
.ranking-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 8px 18px;
  border-radius: 10px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 600;
  transition: all .2s;
}
.tab-btn.active, .tab-btn:hover {
  background: var(--primary-dim);
  color: var(--primary);
  border-color: var(--primary);
}

.period-selector { display: flex; gap: 8px; margin-bottom: 20px; }
.period-btn {
  padding: 6px 14px;
  border-radius: 8px;
  background: none;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: .8rem;
  transition: all .2s;
}
.period-btn.active { color: var(--primary); border-color: var(--primary); background: var(--primary-dim); }

.ranking-table { width: 100%; border-collapse: collapse; }
.ranking-table th {
  text-align: left;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--card-border);
}
.ranking-table td {
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: .9rem;
}
.ranking-table tr.you td { background: var(--primary-dim); color: var(--primary); }
.rank-medal { font-size: 1.2rem; }

.player-info { display: flex; align-items: center; gap: 10px; }
.player-avatar { width:28px; height:28px; border-radius:50%; }

/* ── Achievement Badges ── */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px,1fr));
  gap: 16px;
  margin-top: 20px;
}
.badge-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px 14px;
  text-align: center;
  transition: all .3s;
}
.badge-card.unlocked { border-color: var(--primary); background: var(--primary-dim); }
.badge-card.locked   { filter: grayscale(1); opacity: .45; }
.badge-icon   { font-size: 2rem; margin-bottom: 8px; }
.badge-name   { font-size: .85rem; font-weight: 700; margin-bottom: 4px; }
.badge-desc   { font-size: .75rem; color: var(--text-muted); line-height: 1.4; }

/* ── Achievement Toast ── */
.achievement-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card-bg);
  border: 1px solid var(--primary);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  transform: translateX(120%);
  transition: transform .35s cubic-bezier(.34,1.56,.64,1);
  z-index: 9999;
  min-width: 250px;
}
.achievement-toast.show { transform: translateX(0); }
.achievement-toast__icon  { font-size: 2rem; }
.achievement-toast__label { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.achievement-toast__name  { font-size: .95rem; font-weight: 700; color: var(--primary); }

/* ── Guest Banner ── */
#guest-banner {
  background: var(--primary-dim);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 12px 20px;
  text-align: center;
  font-size: .875rem;
  margin-bottom: 24px;
  color: var(--text-muted);
}
#guest-banner a { color: var(--primary); font-weight: 600; }

/* ── Profile Stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px,1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card { text-align: center; padding: 24px 16px; }
.stat-card__value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-card__label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }

/* ── Word Mode ── */
.level-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px,1fr));
  gap: 16px;
  margin: 24px 0;
}
.level-card {
  cursor: pointer;
  text-align: center;
  padding: 28px 16px;
  transition: all .3s;
}
.level-card.selected {
  border-color: var(--primary);
  background: var(--primary-dim);
}
.level-card:hover { transform: translateY(-4px); border-color: var(--primary); }
.level-card__num  { font-size: 2.5rem; font-weight: 800; color: var(--primary); }
.level-card__desc { font-size: .85rem; color: var(--text-muted); margin-top: 6px; }

/* ── Koch Progress Bar ── */
.progress-bar-wrap {
  background: rgba(0,0,0,.3);
  border-radius: 100px;
  height: 8px;
  margin: 12px 0;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width .5s ease;
}

/* ── Result Modal ── */
.result-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.result-overlay.show { opacity: 1; pointer-events: all; }
.result-card {
  background: var(--bg);
  border: 1px solid var(--primary);
  border-radius: 24px;
  padding: 40px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 0 60px var(--primary-dim);
}
.result-title { font-size: 1.8rem; font-weight: 800; color: var(--primary); margin-bottom: 24px; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 32px; }
.result-stat__value { font-size: 1.8rem; font-weight: 800; }
.result-stat__label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.result-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Hero (index) ── */
.hero { text-align: center; padding: 60px 0 40px; }
.hero__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  background: linear-gradient(135deg, #fff 0%, var(--primary) 60%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}
.hero__sub { font-size: 1.1rem; color: var(--text-muted); max-width: 520px; margin: 0 auto 32px; line-height: 1.6; }

/* ── Section titles ── */
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ── Hint Panel ── */
.hint-panel {
  margin-top: 32px;
  background: rgba(0,0,0,.2);
  border-radius: 16px;
  padding: 20px;
}
.btn-hint-toggle {
  background: none;
  color: var(--text-muted);
  font-size: .9rem;
  padding: 4px 8px;
  margin-left: 8px;
  border-radius: 4px;
  transition: all .2s;
}
.btn-hint-toggle:hover { color: var(--primary); }
.hint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
}
.hint-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.hint-item:hover {
  border-color: var(--primary);
  background: var(--primary-dim);
  transform: translateY(-2px);
}
.hint-char {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
}
.hint-code {
  font-family: 'Roboto Mono', monospace;
  font-size: .7rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* ── X Share Button ── */
.share-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
  padding: 8px 0;
}
.btn-share-x {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #000;
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 100px;
  border: 1px solid #333;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-share-x:hover {
  background: #1a1a1a;
  border-color: #666;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
  color: #fff;
  opacity: 1;
}
.btn-share-x svg { width: 16px; height: 16px; fill: #fff; flex-shrink: 0; }

/* ── Footer ── */
footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: .8rem;
  opacity: .5;
  border-top: 1px solid var(--card-border);
}

/* ── Reference Grid ── */
.reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px,1fr));
  gap: 12px;
  margin-top: 24px;
}
.ref-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 18px 10px;
  text-align: center;
  cursor: pointer;
  transition: all .25s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.ref-card:hover {
  background: var(--primary-dim);
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,.3);
}
.ref-char { font-size: 1.8rem; font-weight: 800; color: var(--primary); }
.ref-code { font-family: 'Roboto Mono', monospace; font-size: 1rem; letter-spacing: 3px; color: var(--text-muted); }
.play-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  transition: all .2s;
}
.ref-card:hover .play-icon { background: var(--primary); color: #000; }

/* ── Page Header ── */
.page-header {
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Controls ── */
.controls {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* ── Utility ── */
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.hidden { display: none !important; }

/* ── Responsive — small screens ── */
@media (max-width: 640px) {
  .container { padding: 0 10px; }
  main { padding: 24px 0 40px; }
  .hero { padding: 30px 0 20px; }
  .hero__title { font-size: 1.8rem; }

  .page-header h1 { font-size: 1.3rem; }
  .signal-indicator { width: 60px; height: 60px; margin-bottom: 20px; }
  .target-display { font-size: 2rem; }
  .input-display { font-size: 2.2rem; min-width: 140px; letter-spacing: 6px; }

  .settings-panel { grid-template-columns: 1fr; gap: 14px; padding: 16px; }
  .score-hud { gap: 18px; }
  .hud-value { font-size: 1.3rem; }

  .mode-grid { grid-template-columns: 1fr; }
  .card { padding: 20px; }

  .result-stats { grid-template-columns: 1fr 1fr; }
  .result-card { padding: 28px 20px; }
  .badge-grid { grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); }

  .hint-grid {
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 6px;
  }
  .hint-char { font-size: .95rem; }
  .hint-code { font-size: .6rem; }
}

@media (max-width: 400px) {
  .nav-controls .btn-google span { display: none; }
  .lang-selector { gap: 2px; }
  .lang-btn { font-size: .6rem; padding: 2px 4px; }
}
