@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  --paper: #f4f0e7;
  --card: #fffdf8;
  --ink: #11110f;
  --muted: #67665f;
  --line: #d8d2c6;
  --blue: #2767ff;
  --blue-soft: #e6edff;
  --green: #137d55;
  --red: #b83f30;
  --shadow: 0 22px 70px rgba(35, 30, 20, .08);
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; font-family: Manrope, sans-serif; background: radial-gradient(circle at 85% 5%, #fff8eb 0, transparent 35%), var(--paper); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.site-header {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  min-height: 78px; padding: 14px max(24px, calc((100vw - 1260px) / 2)); border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 231, .93); backdrop-filter: blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: white; background: var(--blue); font-weight: 800; font-size: 22px; transform: rotate(-4deg); }
.brand strong { display: block; letter-spacing: .14em; font-size: 14px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.save-state { font-family: "DM Mono", monospace; font-size: 12px; color: var(--muted); }
.save-state[data-state="saved"] { color: var(--green); }
.save-state[data-state="error"] { color: var(--red); }

main { width: min(1260px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 100px; }
.eyebrow { margin: 0 0 12px; font: 500 12px/1 "DM Mono", monospace; letter-spacing: .2em; color: var(--blue); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-size: clamp(40px, 7vw, 84px); line-height: .98; letter-spacing: -.055em; }
h2 { margin-bottom: 10px; font-size: clamp(25px, 3vw, 38px); line-height: 1.08; letter-spacing: -.035em; }
.lede { max-width: 680px; color: var(--muted); font-size: 18px; line-height: 1.55; }

.language-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 50px; }
.language-link { position: relative; min-height: 220px; padding: 28px; border: 1px solid var(--line); border-radius: 22px; color: inherit; text-decoration: none; background: var(--card); box-shadow: var(--shadow); overflow: hidden; }
.language-link::after { content: "↗"; position: absolute; right: 24px; top: 22px; font-size: 28px; color: var(--blue); }
.language-link strong { display: block; margin-top: 65px; font-size: 32px; letter-spacing: -.04em; }
.language-link span { color: var(--muted); }

.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.hero-row h1 { font-size: clamp(42px, 6vw, 72px); }
.progress-panel { margin: 34px 0 22px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255, 253, 248, .72); }
.progress-copy { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 12px; font-size: 13px; }
.progress-copy span { font-family: "DM Mono", monospace; color: var(--muted); }
.progress-track { height: 8px; border-radius: 99px; background: #ddd7ca; overflow: hidden; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .3s ease; }

.prompt-card { display: grid; grid-template-columns: 100px 1fr; gap: 24px; padding: 30px; border-radius: 22px 22px 0 0; background: #0c0e11; color: white; }
.prompt-index { font: 500 48px/1 "DM Mono", monospace; color: #6f96ff; }
.prompt-label { margin-bottom: 10px; font: 500 11px/1 "DM Mono", monospace; letter-spacing: .18em; color: var(--muted); }
.prompt-card .prompt-label { color: #9ca3af; }
.prompt-text { margin: 0; max-width: 1000px; font-size: clamp(22px, 2.5vw, 34px); line-height: 1.35; }

.sample-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 22px 22px; overflow: hidden; }
.sample-card { padding: 24px; background: var(--card); }
.sample-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.sample-heading strong { font-size: 18px; }
.listen-status { font: 400 11px/1 "DM Mono", monospace; color: var(--muted); }
.listen-status.played { color: var(--green); }
audio { width: 100%; height: 42px; margin-bottom: 20px; }
.scale-guide { display: flex; justify-content: space-between; gap: 16px; padding: 0 0 10px; color: var(--muted); font: 500 11px/1.3 "DM Mono", monospace; }
.metric-row { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 14px; padding: 9px 0; border-top: 1px solid #ece7dd; }
.metric-row > span { font-size: 13px; font-weight: 600; }
.score-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.score-button { min-width: 0; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); }
.score-button:hover, .score-button:focus-visible { border-color: var(--blue); color: var(--blue); }
.score-button.selected { border-color: var(--blue); color: #fff; background: var(--blue); }
.score-button:disabled { opacity: .38; cursor: not-allowed; }

.preference-card { margin-top: 22px; padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.preference-options { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 22px 0 26px; }
.preference-button { min-height: 54px; border: 1px solid var(--line); border-radius: 12px; background: transparent; font-weight: 700; }
.preference-button:hover, .preference-button:focus-visible, .preference-button.selected { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.notes-label { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.notes-label span { color: var(--muted); font-weight: 400; }
textarea, input { width: 100%; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; outline: 0; }
textarea { padding: 14px; resize: vertical; }
input { height: 52px; padding: 0 14px; }
textarea:focus, input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39, 103, 255, .12); }

.case-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 22px; }
.primary-button, .secondary-button { min-height: 48px; padding: 0 22px; border-radius: 12px; font-weight: 700; }
.primary-button { border: 1px solid #0c0e11; color: white; background: #0c0e11; }
.primary-button:hover, .primary-button:focus-visible { background: var(--blue); border-color: var(--blue); }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: var(--card); }
.secondary-button:disabled { opacity: .42; cursor: not-allowed; }
.wide { width: 100%; }

dialog { width: min(560px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 24px; background: var(--card); box-shadow: 0 30px 120px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(13, 17, 15, .72); backdrop-filter: blur(8px); }
dialog form, .complete-content { position: relative; padding: 38px; }
dialog h2 { font-size: 44px; }
dialog p { color: var(--muted); line-height: 1.55; }
dialog label { display: block; margin: 26px 0 8px; font-weight: 700; }
.dialog-close { position: absolute; top: 18px; right: 18px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #eee9df; font-size: 24px; }
.form-error { min-height: 22px; margin: 8px 0; color: var(--red); font-size: 13px; }

@media (max-width: 760px) {
  .site-header { min-height: 66px; padding: 10px 16px; }
  .save-state { max-width: 120px; text-align: right; }
  main { width: min(100% - 24px, 1260px); padding-top: 36px; }
  .language-grid, .sample-grid { grid-template-columns: 1fr; }
  .hero-row { align-items: flex-start; flex-direction: column; }
  .prompt-card { grid-template-columns: 1fr; padding: 24px; }
  .prompt-index { font-size: 34px; }
  .sample-card { padding: 18px; }
  .metric-row { grid-template-columns: 1fr; gap: 8px; }
  .preference-options { grid-template-columns: repeat(2, 1fr); }
  .preference-options button:last-child { grid-column: 1 / -1; }
  dialog form, .complete-content { padding: 30px 24px; }
  dialog h2 { font-size: 34px; }
}

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
