:root {
  --bg: #0e0b1a;
  --bg-2: #171230;
  --panel: #221a44;
  --panel-2: #2c2257;
  --ink: #f4eef7;
  --muted: #b9aede;
  --accent: #ffb547;
  --accent-2: #ff7a59;
  --good: #5fd38c;
  --bad: #ff6b6b;
  --line: #3a2f6b;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #2a1f58 0%, transparent 60%), var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(14,11,26,0.65);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; }
.brand a { color: var(--ink); }
.logo-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 14px rgba(255,181,71,0.6);
}
.topnav { display: flex; gap: 14px; flex-wrap: wrap; }
.topnav a { color: var(--muted); font-size: 0.95rem; }
.topnav a:hover { color: var(--ink); text-decoration: none; }

main { max-width: 1080px; margin: 0 auto; padding: 32px 24px 64px; }

section { margin-bottom: 56px; }
section h2 { font-size: 1.6rem; margin: 0 0 8px; }
.section-lede { color: var(--muted); max-width: 62ch; margin: 0 0 20px; }

.hero { padding: 24px 0 8px; }
.hero h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin: 0 0 12px;
  background: linear-gradient(90deg, #fff, #ffb547 60%, #ff7a59);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: 1.05rem; max-width: 68ch; color: var(--muted); }
.hero-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.pill {
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 10px; font-size: 0.8rem;
}

.ladder .tier-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 24px;
}
.tier {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
  text-align: left; color: inherit; font: inherit;
}
.tier:hover { transform: translateY(-2px); border-color: var(--accent); }
.tier[aria-selected="true"] { background: var(--panel-2); border-color: var(--accent); }
.tier-num { font-size: 0.8rem; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; }
.tier-name { font-size: 1.1rem; font-weight: 600; margin-top: 4px; }
.tier-desc { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }

.stage {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.stage-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.stage-tier { color: var(--accent); font-size: 0.85rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 0; }
.stage-title { margin: 4px 0 0; font-size: 1.3rem; }
.stage-controls { display: flex; gap: 8px; flex-wrap: wrap; }

.wave {
  height: 80px; margin: 18px 0;
  background: linear-gradient(90deg, rgba(255,181,71,0.15), rgba(255,122,89,0.15));
  border: 1px dashed var(--line); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; gap: 6px; overflow: hidden;
}
.wave[aria-hidden="false"] { animation: pulse 1.2s ease-in-out infinite; }
.wave span {
  display: inline-block; width: 4px; background: var(--accent); border-radius: 2px;
  animation: bar 1.1s ease-in-out infinite;
}
.wave span:nth-child(2) { animation-delay: 0.1s; }
.wave span:nth-child(3) { animation-delay: 0.2s; }
.wave span:nth-child(4) { animation-delay: 0.3s; }
.wave span:nth-child(5) { animation-delay: 0.4s; }
.wave span:nth-child(6) { animation-delay: 0.5s; }
.wave span:nth-child(7) { animation-delay: 0.6s; }
.wave span:nth-child(8) { animation-delay: 0.7s; }
.wave span:nth-child(9) { animation-delay: 0.8s; }
.wave span:nth-child(10) { animation-delay: 0.9s; }
@keyframes bar {
  0%, 100% { height: 12%; }
  50% { height: 90%; }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255,181,71,0.0); }
  50% { box-shadow: 0 0 30px rgba(255,181,71,0.15); }
}

.guess-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.guess-input {
  flex: 1 1 240px; min-width: 0;
  background: var(--bg-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; font-size: 1rem;
}
.guess-input:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: transparent; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 8px 2px 0; }

.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  padding: 10px 14px; border-radius: var(--radius); cursor: pointer; font-size: 0.95rem;
  transition: transform .1s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #1a1033; border-color: transparent; font-weight: 600; }
.btn.ghost { background: transparent; }

.result { margin-top: 20px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); }
.result-main { display: flex; flex-direction: column; gap: 4px; }
.result-tag {
  align-self: flex-start; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--good); color: #0e2a18;
}
.result-tag.wrong { background: var(--bad); color: #2a0e0e; }
.result-title { margin: 0; font-size: 1.3rem; }
.result-composer { color: var(--muted); margin: 0; font-size: 0.9rem; }
.result-explain { margin: 12px 0 4px; }
.result-mix { color: var(--muted); font-size: 0.95rem; margin: 4px 0 12px; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.mixups .mixup-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.mixup-list li {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  display: grid; gap: 4px;
}
.mixup-list li strong { color: var(--accent); }
.mixup-list li span { color: var(--muted); font-size: 0.95rem; }

.progress-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: 16px;
}
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
}
.stat-num { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 0.85rem; }

.history { margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.history summary { cursor: pointer; color: var(--muted); }
.history-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.history-list li { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9rem; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.history-list li:last-child { border-bottom: none; }
.history-list .h-cue { color: var(--muted); }
.history-list .h-ok { color: var(--good); }
.history-list .h-no { color: var(--bad); }

.about p { max-width: 72ch; color: var(--muted); }
.about p strong { color: var(--ink); }
.last-updated { font-size: 0.85rem; color: var(--muted); margin-top: 16px; }

.footer {
  border-top: 1px solid var(--line); padding: 24px; margin-top: 32px;
  background: rgba(14,11,26,0.6);
}
.footer-inner { max-width: 1080px; margin: 0 auto; display: grid; gap: 8px; }
.footer-inner p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.footer-inner nav { display: flex; gap: 14px; flex-wrap: wrap; }
.hub { opacity: 0.8; }

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .stage-head { flex-direction: column; }
  .stage-controls { width: 100%; justify-content: flex-start; }
  .guess-form { flex-direction: column; }
  .btn { width: 100%; text-align: center; }
  .result-actions .btn { width: auto; flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .wave, .wave span, .tier:hover, .btn:hover { animation: none !important; transform: none !important; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
