:root {
  --paper: #f4f1ea;
  --surface: #faf8f3;
  --ink: #171816;
  --muted: #74756f;
  --line: #d9d5cc;
  --accent: #b64635;
  --accent-dark: #8d3025;
  --gold: #a48142;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body { min-height: 100vh; margin: 0; font-family: 'Avenir Next', Avenir, 'Helvetica Neue', Arial, sans-serif; background: var(--paper); }
button, select { font: inherit; }
button { color: inherit; }
.site-header { height: 74px; padding: 0 clamp(22px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.wordmark { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 700; letter-spacing: .16em; }
.wordmark b { color: var(--gold); font-weight: 700; }
.wordmark-symbol { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 50%; font-family: Georgia, serif; font-size: 17px; font-weight: 400; letter-spacing: 0; }
.local-badge { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
.local-badge i { width: 7px; height: 7px; border-radius: 50%; background: #4c7d5f; box-shadow: 0 0 0 4px rgba(76,125,95,.10); }
.app-shell { width: min(790px, calc(100% - 36px)); margin: 0 auto; padding: 58px 0 46px; }
.intro { text-align: center; margin-bottom: 28px; }
.kicker { margin: 0 0 12px; color: var(--gold); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 500; letter-spacing: .15em; }
.intro h1 { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(41px, 7vw, 61px); font-weight: 400; line-height: 1; letter-spacing: -.045em; }
.intro > p:last-child { margin: 15px auto 0; color: var(--muted); font-size: 14px; }
.capture-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 24px 65px rgba(37,34,27,.07); }
.capture-head { padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.status { display: flex; align-items: center; gap: 9px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.status span { width: 8px; height: 8px; border-radius: 50%; background: #a3a39d; }
.status.live { color: var(--accent); }
.status.live span { background: var(--accent); box-shadow: 0 0 0 5px rgba(182,70,53,.12); animation: status-pulse 1.8s ease-out infinite; }
.status.paused span { background: var(--gold); }
.status.processing span { border: 1px solid var(--gold); border-right-color: transparent; background: transparent; animation: spin .8s linear infinite; }
.status.finished span { background: #4c7d5f; }
.capture-head time { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: #535550; font-variant-numeric: tabular-nums; }
.meter { position: relative; height: 144px; margin: 0 24px; display: grid; place-items: center; border-bottom: 1px solid var(--line); }
.meter-line { position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: #dfdcd4; }
.meter-bars { position: relative; width: 100%; height: 78px; display: flex; align-items: center; justify-content: center; gap: clamp(5px, 1vw, 10px); }
.meter-bars i { width: 3px; height: 4%; min-height: 3px; border-radius: 2px; background: linear-gradient(to top, var(--ink), var(--gold) 82%, var(--accent)); transition: height 80ms linear; }
.meter-label { position: absolute; bottom: 10px; color: #a09f98; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.meter-label.left { left: 0; }.meter-label.center { left: 50%; transform: translateX(-50%); }.meter-label.right { right: 0; }
.format-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 20px 22px 0; }
.format-card { position: relative; min-height: 90px; padding: 14px 15px; display: grid; grid-template-columns: 1fr auto; align-content: center; gap: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: transparent; text-align: left; cursor: pointer; transition: border-color .18s, background .18s; }
.format-card:hover { border-color: #aaa69d; }
.format-card.selected { border-color: var(--ink); background: #fff; box-shadow: inset 0 0 0 1px var(--ink); }
.format-card.selected::after { content: '✓'; position: absolute; top: 9px; right: 10px; width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--ink); font-size: 10px; }
.format-card span { font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.format-card small { justify-self: end; color: var(--muted); font-size: 10px; }
.format-card em { grid-column: 1 / -1; color: #96958f; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; font-style: normal; }
.format-card:disabled { cursor: not-allowed; opacity: .56; }
.action-zone { padding: 25px 22px 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.record-button { min-height: 52px; padding: 0 22px; display: inline-flex; align-items: center; gap: 11px; border: 0; border-radius: 9px; color: white; background: var(--ink); font-size: 13px; font-weight: 650; cursor: pointer; box-shadow: 0 9px 22px rgba(23,24,22,.13); transition: transform .17s, background .17s; }
.record-button:hover { transform: translateY(-1px); background: #30312e; }
.record-dot { width: 13px; height: 13px; border: 2px solid white; border-radius: 50%; background: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.action-zone p { margin: 0; color: var(--muted); font-size: 10px; }
.capture-actions { padding: 24px 22px; display: flex; justify-content: center; gap: 9px; }
.control-button, .stop-button, .new-button { min-height: 46px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 11px; font-weight: 650; cursor: pointer; transition: border-color .17s, background .17s; }
.control-button:hover, .new-button:hover { border-color: #aaa69d; }
.control-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }
.stop-button { border-color: #ddbbb4; color: #8f3328; background: #fff6f3; }
.stop-button:hover { background: #fce9e4; }
.stop-button > span { width: 10px; height: 10px; border-radius: 2px; background: currentColor; }
.processing { min-height: 94px; padding: 22px; display: flex; align-items: center; justify-content: center; gap: 13px; }
.processing-spinner { width: 25px; height: 25px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.processing > div, .result-head > div { display: flex; flex-direction: column; gap: 3px; }
.processing b, .result-head b { font-size: 12px; }
.processing small, .result-head small { color: var(--muted); font-size: 9px; }
.result-panel { padding: 22px; }
.result-head { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.result-check { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; color: white; background: #4c7d5f; font-size: 13px; }
.result-panel audio { width: 100%; height: 42px; margin-bottom: 15px; }
.result-actions { display: flex; gap: 9px; }
.download-button { min-height: 46px; padding: 0 19px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; color: white; background: var(--ink); text-decoration: none; font-size: 11px; font-weight: 650; }
.download-button:hover { background: #30312e; }
.error-message { margin: 0; padding: 13px 22px; border-top: 1px solid #e5c8c1; color: #8f3328; background: #fff4f1; font-size: 10px; line-height: 1.5; text-align: center; }
.settings { border-top: 1px solid var(--line); }
.settings summary { min-height: 52px; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 15px; cursor: pointer; list-style: none; font-size: 11px; font-weight: 650; }
.settings summary::-webkit-details-marker { display: none; }
.settings summary::before { content: '+'; order: 3; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 17px; font-weight: 400; }
.settings[open] summary::before { content: '−'; }
.settings-value { margin-left: auto; color: var(--muted); font-weight: 400; }
.settings-body { padding: 0 22px 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-body label { display: grid; gap: 7px; color: var(--muted); font-size: 10px; }
.settings-body select { height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--ink); font-size: 11px; }
.settings-body select:disabled, .settings-body input:disabled { cursor: not-allowed; opacity: .55; }
.toggle-setting { grid-column: 1 / -1; min-height: 48px; display: flex !important; grid-template-columns: 1fr auto; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }
.toggle-setting > span { display: grid; gap: 2px; }
.toggle-setting b { color: var(--ink); font-size: 10px; }
.toggle-setting small { font-size: 9px; }
.toggle-setting input { appearance: none; width: 34px; height: 19px; margin: 0; padding: 2px; border-radius: 999px; background: #c9c6be; cursor: pointer; transition: background .17s; }
.toggle-setting input::before { content: ''; display: block; width: 15px; height: 15px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.17); transition: transform .17s; }
.toggle-setting input:checked { background: var(--ink); }
.toggle-setting input:checked::before { transform: translateX(15px); }
.settings-note { margin: 0; padding: 0 22px 18px; color: #8d8c85; font-size: 9px; line-height: 1.5; }
.privacy-note { max-width: 610px; margin: 22px auto 0; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.privacy-note svg { width: 19px; height: 19px; flex: 0 0 auto; fill: none; stroke: var(--gold); stroke-width: 1.5; }
.privacy-note p { margin: 0; font-size: 10px; line-height: 1.45; }
.privacy-note b { color: var(--ink); }
footer { min-height: 64px; padding: 18px clamp(22px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: #8f8e87; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; letter-spacing: .04em; }
.hidden { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes status-pulse { 70% { box-shadow: 0 0 0 10px rgba(182,70,53,0); } 100% { box-shadow: 0 0 0 0 rgba(182,70,53,0); } }
button:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

@media (max-width: 620px) {
  .site-header { height: 64px; }
  .wordmark { font-size: 10px; }
  .local-badge { font-size: 0; }
  .app-shell { padding-top: 38px; }
  .format-row { grid-template-columns: 1fr; }
  .format-card { min-height: 72px; }
  .meter { height: 116px; }
  .settings-value { display: none; }
  .settings-body { grid-template-columns: 1fr; }
  .toggle-setting { grid-column: auto; }
  .result-actions { flex-direction: column; }
  footer { align-items: flex-start; flex-direction: column; }
}

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