:root {
  color-scheme: light;
  --ink: #152421;
  --muted: #546763;
  --line: #dde6e2;
  --surface: #fff;
  --canvas: #f4f7f5;
  --accent: #17694f;
  --accent-dark: #0e503b;
  --accent-soft: #e6f2eb;
  --dark: #142b26;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; color: var(--ink); background: var(--canvas); }
button, select, input, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .52; }
:focus-visible { outline: 3px solid #237f61; outline-offset: 3px; }

.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; background: #edf3ef; border-right: 1px solid var(--line); padding: 24px 15px 15px; align-self: start; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 26px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.brand strong { font-size: 18px; font-weight: 760; }
.new, .quiet, .swap, .primary { border: 1px solid transparent; border-radius: 9px; font-weight: 650; }
.new { min-height: 43px; text-align: left; padding: 8px 12px; background: var(--surface); border-color: #d1e1d8; color: var(--accent-dark); }
.new:hover, .quiet:hover:enabled, .swap:hover:enabled { background: #dceee3; }
.search { display: flex; align-items: center; gap: 8px; padding: 9px; border-bottom: 1px solid #cbdbd2; margin: 16px 0 12px; color: var(--muted); }
.search input { width: 100%; min-width: 0; border: 0; background: transparent; font-size: 13px; }
.rail-label { color: var(--muted); font-size: 12px; margin: 4px 8px 8px; }
.sessions { min-height: 0; overflow: auto; margin-bottom: 12px; }
.history-empty { margin: 12px 8px; color: var(--muted); font-size: 13px; }
.session { display: grid; gap: 4px; width: 100%; text-align: left; padding: 10px 8px; border-radius: 9px; border: 0; background: transparent; }
.session strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.session small { color: var(--muted); font-size: 11px; }
.session:hover, .session[aria-current] { background: #dceae2; }
.settings { margin-top: auto; text-align: left; }

.workspace { width: 100%; max-width: 1330px; justify-self: center; min-width: 0; padding: 19px clamp(18px, 3vw, 42px) 32px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 35px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.breadcrumb { font-size: 13px; color: var(--muted); }
.status { display: flex; align-items: center; gap: 7px; white-space: nowrap; border: 1px solid #d9e6dd; border-radius: 999px; background: #ecf3ee; padding: 6px 10px; font-size: 12px; font-weight: 650; }
.status i, .record-dot, .live-caption-status i { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: #758981; }
.status.active i { background: #20875f; box-shadow: 0 0 0 3px #20875f22; }
.mobile-brand, .dock { display: none; }
.hero { margin: 19px 0 18px; display: grid; gap: 10px; }
.hero-copy { padding: 1px 0 6px; }
h1 { margin: 0; font-size: clamp(29px, 3.9vw, 45px); line-height: 1.13; letter-spacing: -.055em; font-weight: 780; }
.hero-copy p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.segments { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; padding: 3px; margin: 0 14px; border-radius: 10px; background: #edf2ef; }
.segments button { border: 0; border-radius: 7px; background: transparent; font-size: 13px; padding: 8px 5px; color: var(--muted); }
.segments button[aria-pressed=true] { background: var(--surface); color: var(--accent-dark); box-shadow: 0 1px 4px #244c3920; font-weight: 720; }
.mode-switch { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; width: min(100%, 345px); }
.mode-switch button { min-height: 34px; }
.capture { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.languages { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr); align-items: center; gap: 8px; }
.languages label { min-width: 0; display: grid; gap: 2px; min-height: 46px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: #f7faf8; }
.languages label span { color: var(--muted); font-size: 11px; }
.languages select { min-width: 0; width: 100%; border: 0; padding: 2px 0; background: transparent; font-size: 15px; font-weight: 650; }
.swap { width: 34px; height: 34px; background: var(--accent-soft); color: var(--accent); font-size: 18px; }
.primary { min-height: 46px; padding: 0 17px; display: flex; align-items: center; justify-content: center; gap: 9px; white-space: nowrap; color: white; background: var(--accent); }
.primary:hover { background: var(--accent-dark); }
.primary[aria-pressed=true] { background: #913c37; }
.record-dot { background: white; }
.speakers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.speakers .primary { font-size: 12px; padding: 0 8px; }
.mode-tools, .caption-tools, .recording-tools, .recording-player, .export-options { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 12px; }
.mode-tools small { min-width: 0; flex: 1; font-size: inherit; }
.mode-tools select, .caption-tools select, .compose select, .recording-tools select, .recording-player select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); min-height: 32px; }
.speech-feedback { flex: 1 0 100%; margin: 1px 0 0; color: var(--accent-dark); font-size: 13px; line-height: 1.5; }
.input-meter { display: flex; align-items: center; gap: 6px; }
.input-meter meter { width: 72px; height: 16px; accent-color: var(--accent); }
.recording-player { padding: 0 15px 10px; }
.recording-player audio { min-width: 150px; flex: 1; max-width: 100%; height: 36px; }

.live-caption { display: grid; gap: 15px; margin: 0 0 17px; padding: 14px 18px 18px; background: var(--dark); color: #f4faf6; border-radius: 14px; }
.live-caption-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.live-caption-status { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.live-caption-status i { background: #88e0b5; box-shadow: 0 0 0 4px #88e0b526; }
.live-caption-head .quiet, .projection-bar .quiet { background: #263f37; color: #eef9f2; }
.live-caption-head .quiet:hover, .projection-bar .quiet:hover:enabled { background: #36584c; }
.live-caption-lines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.live-caption-lines:has([hidden]) { grid-template-columns: minmax(0, 1fr); }
.live-caption-lines > div { border-top: 1px solid #3e5a50; padding-top: 10px; }
.live-caption-lines small, .popup-lines small { color: #aed0c2; font-size: 12px; }
.live-caption-lines p { margin: 5px 0 0; font-size: clamp(17px, 2vw, 25px); line-height: 1.48; white-space: pre-wrap; overflow-wrap: anywhere; }
#live-source { color: #d6e6de; font-size: clamp(16px, 1.6vw, 21px); }
.live-caption-detail { color: #bad8cd; margin: 0; font-size: 12px; line-height: 1.5; }
.popup { background: var(--dark); color: #f4faf6; }
.popup-lines { display: grid; align-content: center; gap: 16px; min-height: 100dvh; padding: 16px 21px; }
.popup-lines p { overflow-wrap: anywhere; white-space: pre-wrap; margin: 4px 0 0; line-height: 1.45; font-size: clamp(22px, 5vw, 42px); }
.popup-lines #popup-source { color: #d6e6de; font-size: clamp(16px, 3vw, 25px); }
.popup-lines #popup-state { color: #aed0c2; font-size: 12px; margin: 0; }

.work-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(215px, 27%); gap: 14px; align-items: start; }
.sheet { min-width: 0; overflow: hidden; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 15px 15px 12px; }
.section-head h2 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.section-head small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.actions { display: flex; gap: 5px; flex-shrink: 0; }
.quiet { min-height: 32px; padding: 5px 8px; font-size: 12px; color: var(--accent-dark); background: #edf4ef; white-space: nowrap; }
.quiet[aria-pressed=true] { color: var(--accent-dark); background: #dcece2; }
.caption-tools { padding: 0 15px 10px; }
.turns { min-height: 220px; max-height: max(260px, 51dvh); overflow: auto; padding: 0 15px; }
.empty { min-height: 219px; display: grid; align-content: center; justify-items: center; padding: 16px; text-align: center; border-top: 1px solid var(--line); }
.empty-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 23px; margin-bottom: 9px; }
.empty strong { font-size: 15px; }
.empty p { color: var(--muted); font-size: 13px; margin: 5px 0 0; line-height: 1.6; }
.turn { padding: 13px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.turn p { margin: 4px 0 7px; white-space: pre-wrap; line-height: 1.55; }
.turn-meta { font-size: 11px; color: var(--muted); }
.turn .original { color: #495e56; font-size: 14px; }
.turn .translated { color: var(--ink); font-size: 18px; font-weight: 620; }
.turn .error { color: #8a3430; font-size: 14px; }
.turn .quiet { margin-right: 4px; }
.turn[data-speaker=b], .turn[data-speaker=a] { padding-left: 10px; border-inline-start: 2px solid #6ea797; }
.turn[data-speaker=b] { border-inline-start-color: #8ca4c1; }
#turns .turn.is-reference-selected { padding-inline: 12px; border-radius: 8px; background: #fff3c8; box-shadow: inset 4px 0 #9f6a05; scroll-margin-block: 8px; }
.turn.is-reference-selected:focus { outline: 2px solid #9f6a05; outline-offset: -2px; }
#turns[data-display=translated] .original, #turns[data-display=original] .translated { display: none; }
#turns[data-display=translated] .original.pending { display: block; }
.interim { margin: 0 15px 9px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.compose { display: flex; gap: 6px; padding: 10px 13px 13px; border-top: 1px solid var(--line); }
.compose input { flex: 1; width: 100%; min-width: 0; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 16px; }
.assistant-copy { padding: 13px 15px; max-height: 350px; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; font-size: 13px; color: var(--muted); line-height: 1.65; }
.message { margin: 0 0 7px; padding: 7px 8px; border-radius: 8px; background: #f3f7f4; }
.message.user { background: var(--accent-soft); }
.generate { margin: 0 15px 15px; }
.citation-button { display: inline-block; padding: 2px 6px; margin-inline: 2px; }
.citation-button[aria-current=true] { background: #fff3c8; border-color: #9f6a05; color: #654500; }
.notes-section + .notes-section, .notes-paragraph + .notes-paragraph { margin-top: 12px; }
.notes-section h3 { margin: 0 0 4px; font-size: 14px; color: var(--ink); }
.notes-items { margin: 0; padding-inline-start: 18px; color: var(--ink); }
.notes-items li + li { margin-top: 5px; }
.notes-paragraph { margin: 0; }

dialog { border: 1px solid var(--line); color: var(--ink); background: var(--surface); padding: 0; border-radius: 14px; width: min(430px, calc(100% - 24px)); box-shadow: 0 18px 54px #13282135; }
dialog::backdrop { background: #142b2666; }
.dialog-body { padding: 0 15px 15px; }
.setting { padding: 11px 0; border-top: 1px solid var(--line); }
.setting p, .setting small { display: block; margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.setting.auto { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.glossary-setting { display: block; }
.glossary-setting textarea { width: 100%; margin-top: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.projection { width: min(1000px, calc(100% - 20px)); max-height: calc(100dvh - 20px); background: var(--dark); color: #f4faf6; border-color: #3e5a50; }
.projection-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid #3e5a50; padding: 12px 16px; }
.projection-lines { padding: clamp(15px, 4vw, 36px); overflow-wrap: anywhere; }
.projection-lines p { font-size: clamp(20px, 4.8vw, 47px); line-height: 1.45; margin: 0 0 .7em; white-space: pre-wrap; }
.projection-lines p:last-child { margin-bottom: 0; }
.projection-lines .projection-original { color: #d6e6de; font-size: clamp(17px, 3.2vw, 32px); }
.face-lines { display: grid; gap: 1px; background: #3e5a50; }
.face-side { background: var(--dark); padding: 16px; min-height: 148px; display: grid; justify-items: center; align-content: center; gap: 10px; text-align: center; }
.face-side p { margin: 0; overflow-wrap: anywhere; font-size: clamp(18px, 3.8vw, 28px); }
.face-opposite { rotate: 180deg; }
.toast { position: fixed; z-index: 4; left: 50%; bottom: 16px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 30px); background: var(--dark); color: #fff; padding: 9px 13px; border-radius: 9px; font-size: 13px; pointer-events: none; }
.toast:empty { display: none; }

@media (max-width: 1080px) {
  .shell { grid-template-columns: 178px minmax(0, 1fr); }
  .work-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 690px) {
  .shell { display: block; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) calc(72px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .workspace { padding: 0; }
  .rail, .breadcrumb { display: none; }
  .mobile-brand { display: flex; padding: 0; }
  .mobile-brand img { width: 27px; height: 27px; }
  .hero { margin: 12px 0; }
  .hero-copy p { font-size: 13px; }
  .capture { padding: 8px; gap: 7px; }
  #record { min-width: 83px; padding: 0 8px; font-size: 13px; gap: 5px; }
  .languages { grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr); gap: 4px; }
  .languages label { padding: 4px 6px; }
  .languages select { font-size: 13px; }
  .swap { width: 28px; height: 30px; }
  body[data-mode=dialogue] .capture { flex-direction: column; }
  body[data-mode=dialogue] .languages, .speakers { width: 100%; }
  .live-caption { padding: 11px 12px 13px; gap: 10px; }
  .live-caption-lines { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .assistant { display: none; }
  .section-head { padding: 11px 12px; }
  .caption-tools, .turns { padding-inline: 12px; }
  .turns { min-height: 170px; }
  .empty { min-height: 169px; }
  .dock { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: 3; left: 50%; bottom: calc(7px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 22px), 402px); padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 6px 22px #153b2822; }
  .dock button { display: grid; gap: 2px; justify-items: center; align-content: center; min-height: 42px; border: 0; border-radius: 8px; font-size: 11px; color: var(--muted); background: transparent; }
  .dock button span { font-size: 17px; line-height: 1; }
  .dock button[aria-current] { background: var(--accent-soft); color: var(--accent-dark); font-weight: 730; }
  body[data-page=history] .workspace { display: none; }
  body[data-page=history] .rail { position: static; display: flex; height: auto; min-height: min(480px, calc(100dvh - 84px)); border: 1px solid var(--line); border-radius: 14px; }
  body[data-page=history] .rail .settings { display: none; }
  body[data-page=assistant] .assistant { display: block; margin-top: 12px; }
  body[data-page=assistant] .hero, body[data-page=assistant] .captions, body[data-page=assistant] .live-caption { display: none; }
  .toast { bottom: calc(63px + env(safe-area-inset-bottom)); }
}
@media (prefers-contrast: more) {
  :root { --line: #809a8b; --muted: #334c40; }
}
