:root {
  --paper: #f4f0e8;
  --paper-deep: #eae4d8;
  --ink: #1d2925;
  --muted: #626e66;
  --line: #d8d1c4;
  --card: rgba(255, 253, 248, .78);
  --green: #174f43;
  --green-soft: #dce9df;
  --coral: #dd6f54;
  --shadow: 0 22px 60px rgba(38, 48, 42, .08);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button, select { touch-action: manipulation; }
button:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(221, 111, 84, .38); outline-offset: 3px; }
.page-noise { position: fixed; inset: 0; pointer-events: none; opacity: .14; background-image: radial-gradient(rgba(29, 41, 37, .16) .55px, transparent .55px); background-size: 6px 6px; mask-image: linear-gradient(to bottom, black, transparent 70%); }
.topbar, .app-shell, .footer { position: relative; width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 28px 0 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; letter-spacing: -.04em; font-size: 18px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; color: #fff; border-radius: 9px; background: var(--coral); font-size: 20px; line-height: 1; }
.brand-muted { color: #8b968e; font-weight: 500; }
.topbar-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.status-pill, .voice-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.35); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #be9a52; }
.status-dot.ready { background: #5c9a76; }
.status-dot.error { background: var(--coral); }
.voice-pill { color: var(--green); border-color: #c9dbcd; background: var(--green-soft); }
.hero { display: flex; justify-content: space-between; gap: 40px; padding: 48px 0 56px; }
.eyebrow, .section-label, .prompt-kicker { margin: 0; color: var(--coral); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow span { margin: 0 5px; color: #9ba59e; }
h1 { max-width: 680px; margin: 18px 0 18px; font-size: clamp(42px, 6vw, 74px); font-weight: 500; line-height: .98; letter-spacing: -.07em; }
h1 em { color: var(--green); font-family: Georgia, serif; font-weight: 400; }
.hero-copy { max-width: 480px; margin: 0; color: var(--muted); font-size: 17px; }
.topic-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.topic-tags span { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 11px; }
.hero-note { align-self: flex-end; display: flex; gap: 16px; width: 190px; margin-bottom: 5px; color: var(--green); font: italic 17px/1.3 Georgia, serif; }
.hero-note p { margin: 0; }
.note-line { width: 2px; height: 74px; flex: 0 0 auto; background: var(--coral); transform: rotate(8deg); }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .7fr); gap: 54px; padding-bottom: 90px; }
.section-label { display: flex; align-items: center; gap: 10px; padding-bottom: 13px; color: var(--muted); border-bottom: 1px solid var(--line); letter-spacing: .12em; }
.section-label span { color: var(--coral); }
.practice-card, .feedback-card, .rhythm-card, .history-card, .method-card { border: 1px solid rgba(210, 202, 190, .9); background: var(--card); box-shadow: var(--shadow); }
.practice-card { overflow: hidden; border-radius: 18px; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.select-wrap { position: relative; min-width: 0; flex: 1; }
select { appearance: none; min-width: 160px; padding: 8px 28px 8px 0; color: var(--green); border: 0; background: transparent; font-weight: 800; cursor: pointer; }
.select-wrap select { width: 100%; min-width: 0; }
.select-wrap::after { content: "⌄"; position: absolute; right: 7px; top: 6px; color: var(--coral); pointer-events: none; }
.difficulty { flex-shrink: 0; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.difficulty span { color: var(--coral); }
.prompt-block { padding: 27px 27px 24px; background: linear-gradient(135deg, rgba(220, 233, 223, .85), rgba(255,253,248,.58)); }
.prompt-kicker { color: var(--green); }
.prompt-icon { display: inline-block; margin-right: 6px; color: var(--coral); }
.prompt-text { max-width: 720px; margin: 14px 0 15px; font-size: 23px; line-height: 1.3; letter-spacing: -.025em; }
.text-button, .quiet-button, .clear-button { padding: 0; color: var(--green); border: 0; background: transparent; font-size: 12px; font-weight: 800; }
.text-button { color: #a54834; }
.text-button:hover, .quiet-button:hover, .clear-button:hover { text-decoration: underline; }
.answer-block { padding: 25px 27px 20px; }
.answer-heading { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--green); font-size: 13px; font-weight: 800; }
.answer-heading span { color: var(--muted); font-size: 11px; font-weight: 500; }
textarea { display: block; width: 100%; resize: vertical; min-height: 142px; padding: 15px 16px; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; outline: 0; background: rgba(255,255,255,.58); line-height: 1.6; }
textarea::placeholder { color: #a1aaa4; }
textarea:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(23,79,67,.08); }
.voice-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 11px; }
.voice-button { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; color: var(--green); border: 1px solid #c6d8cc; border-radius: 999px; background: var(--green-soft); font-size: 12px; font-weight: 800; }
.voice-button:hover, .voice-button.listening { color: #fff; border-color: var(--green); background: var(--green); }
.mic-icon { display: inline-grid; place-items: center; width: 12px; height: 12px; color: var(--coral); font-size: 9px; }
.listening .mic-icon { color: #fff; animation: pulse 1s infinite; }
.voice-status { color: var(--muted); font-size: 11px; }
@keyframes pulse { 50% { transform: scale(1.5); opacity: .55; } }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 19px; padding: 0 27px 21px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 15px; padding: 13px 18px; color: #fff; border: 0; border-radius: 9px; background: var(--green); box-shadow: 0 8px 18px rgba(23,79,67,.16); font-size: 13px; font-weight: 800; transition: transform .15s, background .15s; }
.primary-button:hover { background: #0f4136; transform: translateY(-1px); }
.primary-button:disabled { cursor: wait; opacity: .55; transform: none; }
.quiet-button { color: var(--muted); font-weight: 600; }
.privacy-note { margin: 0; padding: 12px 27px; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; }
.feedback-card { margin-top: 20px; padding: 24px 27px 27px; border-radius: 18px; }
.feedback-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
h2 { margin: 5px 0 0; font-size: 23px; font-weight: 500; letter-spacing: -.04em; }
.feedback-text { margin: 22px 0; padding: 17px 18px; color: #30413b; border-left: 3px solid var(--coral); background: rgba(244,240,232,.75); white-space: pre-wrap; }
.full-width { width: 100%; }
.error-card { margin-top: 20px; padding: 15px 18px; color: #733c2e; border: 1px solid #edb7a8; border-radius: 12px; background: #fff1eb; }
.side-column .section-label + .rhythm-card { border-top-left-radius: 0; border-top-right-radius: 0; }
.rhythm-card { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; align-items: center; padding: 22px 20px; border-top: 0; border-radius: 0 0 15px 15px; }
.rhythm-number { grid-row: span 2; color: var(--green); font: 500 53px/.8 Georgia, serif; letter-spacing: -.08em; }
.rhythm-title { margin: 0; color: var(--green); font-weight: 800; }
.rhythm-subtitle { margin: 0; color: var(--muted); font-size: 12px; }
.rhythm-spark { display: flex; align-items: end; gap: 4px; height: 21px; margin-top: 13px; }
.rhythm-spark i { display: block; width: 7px; border-radius: 4px; background: #bdd3c4; }
.rhythm-spark i:nth-child(1) { height: 7px; }.rhythm-spark i:nth-child(2) { height: 14px; }.rhythm-spark i:nth-child(3) { height: 10px; }.rhythm-spark i:nth-child(4) { height: 19px; background: var(--coral); }.rhythm-spark i:nth-child(5) { height: 13px; }.rhythm-spark i:nth-child(6) { height: 17px; }.rhythm-spark i:nth-child(7) { height: 9px; }
.history-label { margin-top: 43px; }
.history-card { min-height: 160px; max-height: 430px; overflow-y: auto; padding: 12px; border-top: 0; border-radius: 0 0 15px 15px; }
.empty-history { display: grid; place-items: center; min-height: 130px; color: var(--muted); text-align: center; }
.empty-history span { color: var(--coral); font-size: 23px; }.empty-history p { margin: 5px 0 0; font: italic 15px/1.35 Georgia, serif; }
.history-item { display: block; width: 100%; text-align: left; padding: 12px 10px; border: 0; border-bottom: 1px solid var(--line); background: transparent; overflow-wrap: anywhere; }.history-item:last-child { border-bottom: 0; }
.history-item:hover { background: var(--green-soft); border-radius: 6px; }
.history-item time { color: var(--coral); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }.history-item p { overflow: hidden; margin: 4px 0 0; color: var(--green); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 12px; }
.clear-button { display: block; margin: 12px 3px 0 auto; color: var(--muted); font-weight: 500; }
.method-card { position: relative; margin-top: 39px; padding: 22px 22px 20px; border-radius: 15px; background: var(--green); color: #e7f0e8; box-shadow: none; }
.method-mark { display: block; margin-bottom: 12px; color: #ee937c; font-size: 22px; }.method-card p { margin: 0 0 18px; font: 15px/1.45 Georgia, serif; }.method-card strong { color: #fff; font-family: inherit; }.method-card a { color: #c8dfcd; font-size: 11px; font-weight: 800; text-decoration: none; }.method-card a:hover { text-decoration: underline; }
.footer { display: flex; justify-content: space-between; gap: 20px; padding: 20px 0 30px; color: var(--muted); border-top: 1px solid var(--line); font-size: 10px; letter-spacing: .1em; }
.exercise-tabs { display: flex; gap: 4px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.exercise-tabs button { flex: 1; padding: 10px 5px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 12px; white-space: nowrap; }
.exercise-tabs button[aria-pressed="true"] { background: var(--green); color: white; }
.task-instruction { margin: 12px 0; color: var(--muted); font-size: 13px; }
.listening-cover { margin: 18px 0; padding: 30px 18px; border: 1px dashed #9ebbad; border-radius: 10px; color: var(--green); text-align: center; }
.inline-actions, .history-actions { display: flex; flex-wrap: wrap; gap: 16px; }
.inline-actions button, .quiet-button, .clear-button { min-height: 36px; }
.history-actions { justify-content: flex-end; gap: 20px; }
.history-actions button { margin: 5px 0 0; }
.method-card small { display: block; margin-top: 7px; color: #c8dfcd; font-size: 10px; }
.feedback-text { white-space: normal; overflow-wrap: anywhere; }
.feedback-text p:first-child { margin-top: 0; }
.correction { margin: 18px 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.correction blockquote { margin: 0 0 8px; color: #a54834; font-weight: 650; }
.correction p { margin: 8px 0; }
.correction details { font-size: 13px; color: var(--muted); }
summary { color: var(--green); cursor: pointer; padding-block: 7px; }
.next-question { font-size: 18px; line-height: 1.5; }
audio { width: 100%; margin-top: 10px; }
dialog { width: min(560px, calc(100% - 32px)); max-height: 85dvh; padding: 27px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: #fffdf8; box-shadow: var(--shadow); overflow-wrap: anywhere; }
dialog::backdrop { background: rgba(20, 38, 31, .48); backdrop-filter: blur(4px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; }
dialog label { display: block; color: var(--green); font-size: 13px; font-weight: 650; margin-top: 18px; }
dialog select { width: 100%; min-width: 0; margin: 7px 0; padding: 10px; appearance: auto; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; }
dialog > p, dialog details { font-size: 13px; color: var(--muted); }
.saved-answer { white-space: pre-wrap; padding: 15px; background: var(--green-soft); border-radius: 9px; }
.history-prompt { color: var(--muted); }
h3 { font-size: 15px; margin-top: 24px; }
.hidden { display: none !important; }.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 780px) {
  .topbar, .app-shell, .footer { width: min(100% - 30px, 620px); }
  .topbar { padding-top: 18px; gap: 12px; }.topbar-meta { gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
  .hero { display: block; padding: 47px 0 52px; }.hero-note { margin-top: 38px; }.workspace-grid { display: block; padding-bottom: 55px; }.side-column { margin-top: 48px; }
  .history-label { margin-top: 36px; }.method-card { margin-top: 28px; }.footer { display: block; line-height: 2; }
}
@media (max-width: 470px) {
  .topbar-meta { max-width: 140px; text-align: right; }.status-pill { padding: 5px 7px; font-size: 9px; }.voice-pill { padding: 6px 10px; font-size: 11px; }
  h1 { font-size: 46px; }.prompt-text { font-size: 20px; }.prompt-block, .answer-block { padding-inline: 19px; }.card-actions { align-items: stretch; flex-direction: column; padding-inline: 19px; gap: 12px; }.quiet-button { padding: 4px; }
  .privacy-note { padding-inline: 19px; }.voice-row { gap: 8px 13px; }
  textarea { font-size: 16px; }.hero-note { display: none; }.hero { padding: 24px 0 35px; }
  .difficulty { font-size: 9px; letter-spacing: 0; }.card-topline { padding-inline: 16px; }
  .exercise-tabs { padding-inline: 10px; }.footer span { display: block; }
  dialog { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
