:root {
  --bg: #f5f3ee; --card: #ffffff; --ink: #1d2320; --muted: #5d6763; --line: #dcd8cf;
  --accent: #0f5c4d; --accent-ink: #ffffff; --accent-soft: #dcefe9; --warn: #9a5b00; --bad: #a3271f;
  --rec: #c2331f;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121614; --card: #1b201e; --ink: #e8ece9; --muted: #9aa5a0; --line: #2d3532;
    --accent: #4fb89f; --accent-ink: #08201a; --accent-soft: #1d3530; --warn: #e0a64a; --bad: #ef7a70; --rec: #ff6a52;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121614; --card: #1b201e; --ink: #e8ece9; --muted: #9aa5a0; --line: #2d3532;
  --accent: #4fb89f; --accent-ink: #08201a; --accent-soft: #1d3530; --warn: #e0a64a; --bad: #ef7a70; --rec: #ff6a52;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top) 0 calc(24px + env(safe-area-inset-bottom));
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 6px; max-width: 640px; margin: 0 auto; }
.brand { display: flex; gap: 10px; align-items: center; }
.logo { width: 40px; height: 40px; border-radius: 10px; flex: none; }
h1 { font-size: 20px; margin: 0; }
.sub { margin: 0; color: var(--muted); font-size: 13px; }
h2 { font-size: 15px; margin: 0 0 8px; }
main { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 12px 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill[data-state="ready"] .dot { background: #2f9e6e; }
.pill[data-state="busy"] .dot { background: var(--warn); }
.pill[data-state="error"] .dot { background: var(--bad); }

.mic-area { text-align: center; padding: 18px 0 4px; }
.mic { position: relative; width: 132px; height: 132px; border-radius: 50%; border: none; background: var(--accent); color: var(--accent-ink); font-size: 52px; cursor: pointer; touch-action: manipulation; }
.mic:disabled { opacity: .45; cursor: default; }
.mic.recording { background: var(--rec); }
.mic.working { opacity: .7; }
.mic .ring { position: absolute; inset: -8px; border-radius: 50%; border: 4px solid var(--rec); opacity: 0; transform: scale(1); transition: transform 80ms linear, opacity 120ms; pointer-events: none; }
.mic.recording .ring { opacity: .6; }
.hint { margin: 10px 0 0; font-weight: 600; }
.small { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

.label, .label-row { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.label-row .small { text-transform: none; letter-spacing: 0; font-weight: 400; margin: 0; }
textarea { display: block; width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; font-size: 18px; color: var(--ink); background: transparent; resize: vertical; }
.en { font-size: 20px; margin: 8px 0 4px; min-height: 1.5em; white-space: pre-wrap; }
.en.placeholder { color: var(--muted); font-size: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
button, .file-btn { font: inherit; font-size: 15px; border-radius: 10px; padding: 9px 14px; cursor: pointer; }
.primary { background: var(--accent); color: var(--accent-ink); border: none; font-weight: 600; }
.ghost, .file-btn { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: .45; cursor: default; }
.bar { height: 10px; border-radius: 6px; background: var(--accent-soft); overflow: hidden; margin: 10px 0 0; }
#bar-fill { height: 100%; width: 0; background: var(--accent); transition: width 200ms; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { border-top: 1px solid var(--line); padding: 8px 0; cursor: pointer; }
.history li:first-child { border-top: none; }
.history .h-it { color: var(--muted); font-size: 14px; }
.detail { margin: 0; padding-left: 18px; font-size: 14px; }
.detail .ok { color: #2f9e6e; } .detail .no { color: var(--bad); }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; max-width: calc(100% - 32px); font-size: 14px; }
