:root {
  color-scheme: light;
  --ink: #18312c;
  --muted: #687873;
  --paper: #f7f5ef;
  --surface: #fffdf8;
  --line: #dedbd0;
  --green: #183d35;
  --green-2: #2c6658;
  --gold: #a67c44;
  --red: #9a3f34;
  --shadow: 0 18px 60px rgba(24, 49, 44, 0.10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at top, #fffdf8 0, var(--paper) 44rem); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.app-shell { width: min(760px, 100%); height: 100vh; height: 100dvh; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 22px calc(104px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; padding: 22px 4px 18px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: Georgia, serif; font-size: clamp(2.15rem, 8vw, 3.35rem); font-weight: 500; letter-spacing: -0.035em; }
h2 { margin-bottom: 4px; font-family: Georgia, serif; font-weight: 500; font-size: 1.8rem; }
h3 { margin-bottom: 7px; font-size: 1.05rem; }
.eyebrow { margin-bottom: 8px; color: var(--gold); font-size: .72rem; font-weight: 800; letter-spacing: .13em; }
.subtitle, .privacy-note, .muted { color: var(--muted); line-height: 1.55; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 14px 0 18px; }
.stack { display: grid; gap: 12px; }
.card { background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line); border-radius: 19px; padding: 19px; box-shadow: 0 5px 26px rgba(24, 49, 44, .035); }
.passage-card { display: grid; gap: 14px; }
.passage-preview { margin: 0; color: var(--muted); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-actions, .button-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.button-row { justify-content: flex-end; margin-top: 18px; }
.button { border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; background: var(--surface); cursor: pointer; font-weight: 700; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--green); border-color: var(--green); }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.button.danger { color: var(--red); border-color: #d9b5ae; }
.button.ghost { background: transparent; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #ece9df; font-size: 1.5rem; cursor: pointer; }
.empty { margin-top: 52px; text-align: center; padding: 48px 26px; border: 1px dashed #cbc7bb; border-radius: 24px; }
.empty .book { font-size: 3rem; margin-bottom: 14px; }
.tabbar { position: fixed; z-index: 5; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; grid-template-columns: repeat(3, 1fr); width: min(620px, calc(100% - 28px)); padding: 8px; border: 1px solid rgba(222, 219, 208, .9); border-radius: 22px; background: rgba(255, 253, 248, .91); backdrop-filter: blur(18px); box-shadow: var(--shadow); }
.tab { display: grid; place-items: center; gap: 3px; border: 0; padding: 8px; border-radius: 15px; background: transparent; color: var(--muted); font-size: .73rem; font-weight: 750; cursor: pointer; }
.tab span { font-size: 1.2rem; }
.tab.active { color: white; background: var(--green); }
dialog { width: min(650px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 24px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(16, 35, 31, .48); backdrop-filter: blur(4px); }
dialog form { padding: 24px; }
.debug-dialog-content { padding: 24px; }
#debug-report-text { min-height: 320px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .78rem; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
label { display: grid; gap: 8px; margin: 15px 0; font-weight: 750; }
input, textarea, select { width: 100%; border: 1px solid #cbc8be; border-radius: 13px; padding: 12px 13px; background: white; color: var(--ink); outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(44, 102, 88, .12); }
textarea { resize: vertical; line-height: 1.5; }
.review-hero { background: var(--green); color: white; border-radius: 24px; padding: 24px; box-shadow: var(--shadow); }
.review-hero .eyebrow { color: #dac697; }
.review-hero h2 { font-size: 2.15rem; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 22px; }
.metric { background: rgba(255,255,255,.09); border-radius: 13px; padding: 12px; }
.metric small { display: block; color: #d6dfdc; margin-bottom: 5px; }
.metric strong { font-size: 1.05rem; }
.progress { height: 8px; margin-top: 16px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.18); }
.progress > div { height: 100%; background: #e7d6a9; transition: width .25s ease; }
.status-dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; background: #d6c08a; }
.status-dot.listening { background: #8fd4ad; box-shadow: 0 0 0 6px rgba(143,212,173,.13); }
.passage-full { font-family: Georgia, serif; font-size: 1.16rem; line-height: 1.75; white-space: pre-wrap; }
.toggle-row, .setting-row { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.toggle-row input { width: auto; }
.setting-row + .setting-row { border-top: 1px solid var(--line); margin-top: 15px; padding-top: 15px; }
.setting-row label { margin: 0; }
.transcript-box { border-left: 4px solid var(--gold); }
.recognition-state { display: flex; align-items: center; gap: 7px; margin: 10px 0 14px; }
.live-transcript { min-height: 104px; padding: 15px; border: 1px solid #d7d3c7; border-radius: 14px; background: #f3f0e7; }
.live-transcript small { color: var(--gold); font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.live-transcript p { margin: 9px 0 0; font-family: Georgia, serif; font-size: 1.12rem; line-height: 1.55; }
.mic-error { padding: 12px 14px; border-radius: 12px; color: #7c2f27; background: #f8e6e2; line-height: 1.45; }
.correction { color: var(--red); font-weight: 800; }
.history-meta { display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: .82rem; }
.history-row { width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); text-align: left; cursor: pointer; box-shadow: 0 5px 26px rgba(24, 49, 44, .035); }
.history-row:hover { border-color: #b9b4a7; transform: translateY(-1px); }
.history-row-main { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 17px 18px; }
.history-row h2 { margin-bottom: 5px; font-size: 1.45rem; }
.history-row .eyebrow { margin-bottom: 5px; }
.history-row-result { display: grid; gap: 3px; justify-items: end; }
.history-row-result strong { font-family: Georgia, serif; font-size: 1.55rem; }
.history-row-result span { color: var(--muted); font-size: .78rem; }
.history-chevron { color: var(--gold); font-size: 2rem; line-height: 1; }
.detail-back { justify-self: start; }
.detail-hero { padding: 26px; border-radius: 24px; color: white; background: var(--green); box-shadow: var(--shadow); }
.detail-hero h2 { margin-bottom: 18px; font-size: 2.15rem; }
.detail-score { font-family: Georgia, serif; font-size: clamp(3.4rem, 16vw, 5.4rem); line-height: .95; }
.detail-hero > p:last-child { margin: 9px 0 0; color: #d6dfdc; }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.detail-stat { display: grid; gap: 7px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.detail-stat span { color: var(--muted); font-size: .78rem; }
.detail-stat strong { font-size: 1.12rem; }
.analysis-card { border-left: 4px solid var(--gold); }
.detail-transcript { margin-bottom: 0; font-family: Georgia, serif; font-size: 1.08rem; line-height: 1.7; white-space: pre-wrap; }
.mistake-list { display: grid; gap: 10px; }
.mistake-item { display: grid; gap: 5px; padding: 13px; border-radius: 13px; background: #f5eee8; }
.mistake-type { color: var(--red); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.mistake-item small { color: var(--muted); }
.calibration-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.calibration-plan { display: grid; gap: 8px; margin: 14px 0; }
.calibration-option { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 11px; margin: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: #f8f5ed; }
.calibration-option input { width: auto; }
.calibration-option span { display: grid; gap: 2px; }
.calibration-option small { color: var(--muted); font-weight: 500; }
.calibration-card { border-left: 4px solid var(--green-2); }
.calibration-phrase { padding: 18px; border-radius: 14px; background: #f3f0e7; font-family: Georgia, serif; font-size: 1.35rem; line-height: 1.7; }
.calibration-phrase mark { padding: 2px 5px; border-radius: 6px; color: var(--ink); background: #ead8a8; }
.perfect-note { margin-bottom: 0; color: var(--green-2); font-weight: 750; }
.debug-report-card { border-top: 4px solid var(--green-2); }
.debug-report-card h3 { margin-bottom: 6px; }
.debug-content-toggle { display: flex; grid-template-columns: auto 1fr; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 12px; background: #f3f0e7; line-height: 1.4; }
.debug-content-toggle input { width: auto; margin-top: 3px; }
.finish-analyze { width: 100%; padding-block: 14px; }
.toast { position: fixed; z-index: 20; left: 50%; top: 18px; transform: translate(-50%, -140%); padding: 11px 17px; border-radius: 999px; color: white; background: var(--green); box-shadow: var(--shadow); transition: transform .22s ease; }
.toast.show { transform: translate(-50%, 0); }
.update-banner { position: fixed; z-index: 30; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; justify-content: space-between; gap: 18px; width: min(680px, calc(100% - 24px)); padding: 14px 15px 14px 19px; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; color: white; background: #183d35; box-shadow: 0 16px 50px rgba(16, 35, 31, .28); }
.update-banner strong, .update-banner span { display: block; }
.update-banner strong { margin-bottom: 3px; }
.update-banner span { color: #d6dfdc; font-size: .86rem; }
.update-actions { display: flex; gap: 7px; flex-shrink: 0; }
.update-banner .button { padding: 8px 12px; border-color: rgba(255,255,255,.25); color: white; }
.update-banner .button.primary { background: #f7f0dd; border-color: #f7f0dd; color: var(--green); }
.hidden { display: none !important; }
@media (min-width: 760px) { .app-shell { padding-top: 40px; } .topbar { padding-top: 32px; } }
@media (max-width: 600px) { .detail-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .metrics { grid-template-columns: 1fr 1fr; } .metric:first-child { grid-column: 1 / -1; } .button { flex: 1; } .update-banner { align-items: stretch; flex-direction: column; gap: 10px; } .update-actions .button { flex: 1; } .history-row-main { grid-template-columns: minmax(0, 1fr) auto; } .history-row-result { justify-items: start; } .history-chevron { display: none; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
