:root {
  --bg: #f4f3f0; --surface: #ffffff; --surface-2: #ecebe7; --ink: #151515; --muted: #66645f; --line: #dddbd5;
  --accent: #e0431a; --accent-ink: #ffffff; --ok: #1d7a4d; --warn: #a15c00; --bad: #b3261e;
  --strong: #151515; --strong-ink: #ffffff; --tr: #8a2c10; --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 5%);
  --radius: 16px;
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110; --surface: #1b1a19; --surface-2: #262523; --ink: #f1f0ec; --muted: #a3a19b; --line: #33322f;
    --accent: #ff6a3d; --accent-ink: #1a0a05; --ok: #5fc592; --warn: #e0a94f; --bad: #ff8a80;
    --strong: #f1f0ec; --strong-ink: #151515; --tr: #ffb59c; --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.55; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.3; }
h2 { font-size: 15px; }
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
.pill:hover:not(:disabled) { border-color: var(--ink); }
.pill.primary { background: var(--strong); color: var(--strong-ink); border-color: var(--strong); }
.pill.small { min-height: 30px; padding: 0 12px; font-size: 13px; }
.pill.on { background: var(--strong); color: var(--strong-ink); border-color: var(--strong); }
select, input[type=text], input[type=password], textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; width: 100%; }
/* Controls take the page text colour, not the dark header's white: otherwise a light-theme select reads white on white. */
select, input[type=text], input[type=password], textarea { color: var(--ink); }
textarea { resize: vertical; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.status-bad { color: var(--bad); }

/* Shell */
.app { display: grid; grid-template-rows: 56px 1fr; height: 100dvh; }
.topbar { scrollbar-width: none; display: flex; align-items: center; gap: 20px; padding: 0 20px; background: #151515; color: #fff; }
.brand { font-weight: 800; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand i { width: 10px; height: 10px; border-radius: 50%; background: #ff6a3d; }
.nav { display: flex; gap: 4px; }
.nav button { background: none; border: 0; color: #c9c7c2; padding: 6px 14px; border-radius: 999px; white-space: nowrap; }
.nav button[aria-current=page] { background: #fff; color: #151515; }
.conn { margin-left: auto; font-size: 13px; color: #c9c7c2; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: #77756f; }
.conn.conn-live i { background: #4cd38a; }
.conn.conn-retry i { background: #f0b84f; }
.view { min-height: 0; overflow: hidden; }

/* Live */
.live { display: grid; grid-template-columns: 1fr 320px; height: 100%; min-height: 0; }
.stage { display: grid; grid-template-rows: 1fr auto; min-height: 0; position: relative; }
.to-latest { position: absolute; left: 50%; transform: translateX(-50%); bottom: 84px; z-index: 5; box-shadow: 0 2px 10px rgb(0 0 0 / .35); }
.to-latest[hidden] { display: none; }
.viewer .to-latest { position: fixed; bottom: 76px; }
.feed { overflow-y: auto; padding: 20px 24px 12px; display: flex; flex-direction: column; gap: 10px; }
.empty { margin: auto; text-align: center; color: var(--muted); max-width: 420px; }
.empty b { display: block; color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.seg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; content-visibility: auto; contain-intrinsic-size: auto 120px; }
.seg.partial { border-style: dashed; }
.seg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chip { display: inline-flex; align-items: center; padding: 0 8px; min-height: 20px; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-size: 12px; }
.chip.spk { font-weight: 600; }
.seg-src { font-size: 18px; }
.seg.partial .seg-src { color: var(--muted); }
.seg-tr { margin-top: 6px; color: var(--tr); font-size: 17px; }
.seg-tr small { color: var(--muted); font-size: 11px; margin-right: 6px; }
.seg-tr.pending { opacity: .65; }
.timing { margin-left: auto; font-variant-numeric: tabular-nums; }

.dock { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.rec { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700; flex: none; }
.rec.on { background: var(--strong); color: var(--strong-ink); }
.clock { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 700; min-width: 66px; }
.meter { width: 90px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; flex: none; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width 80ms linear; }
.dock select { width: auto; max-width: 190px; border-radius: 999px; }
.dock .spacer { flex: 1; }
/* Source and caption display: in the bar on a computer, inside the settings sheet on a phone (moved there by host.js). */
.dock-more { display: contents; }
.font-size { display: inline-flex; gap: 4px; }
.sheet-head, .sheet-only { display: none !important; }
.live.side-closed { grid-template-columns: 1fr; }
.live.side-closed .side { display: none; }
.seg-src { font-size: calc(18px * var(--feed-scale, 1)); }
.seg-tr { font-size: calc(17px * var(--feed-scale, 1)); }

.side { border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.side section { display: flex; flex-direction: column; gap: 8px; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.langs { display: flex; flex-wrap: wrap; gap: 6px; }
.lang { min-height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; font-size: 13px; }
.lang[aria-pressed=true] { background: var(--strong); color: var(--strong-ink); border-color: var(--strong); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
/* Fixed for the whole recording: dimmed so a tap that does nothing does not look like a broken switch */
.switch:has(:disabled) { opacity: .5; cursor: not-allowed; }
.switch:has(:disabled) * { cursor: not-allowed; }
.share { display: grid; grid-template-columns: 112px 1fr; gap: 12px; align-items: center; }
.qr { width: 112px; height: 112px; background: #fff; border-radius: 10px; padding: 6px; }
.qr svg, .qr img { width: 100%; height: 100%; display: block; }
.code { font-size: 24px; font-weight: 800; letter-spacing: .12em; }
.link-row { word-break: break-all; font-size: 12px; }

/* Two-way */
.duo { display: grid; grid-template-rows: auto 1fr auto; height: 100%; min-height: 0; }
.duo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.duo-bar select { width: auto; border-radius: 999px; }
.duo-panes { display: grid; grid-template-columns: 1fr 1fr; min-height: 0; }
.duo-pane { overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.duo-pane + .duo-pane { border-left: 1px solid var(--line); }
.bubble { max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 19px; background: var(--surface); border: 1px solid var(--line); }
.bubble.heard { align-self: flex-end; background: var(--surface-2); border-color: transparent; font-size: 15px; color: var(--muted); }
.bubble.said { align-self: flex-start; }

/* History */
.history { display: grid; grid-template-columns: 280px 1fr; height: 100%; min-height: 0; }
.rec-list { border-right: 1px solid var(--line); overflow-y: auto; background: var(--surface); }
.rec-item { display: block; width: 100%; text-align: left; padding: 12px 16px; background: none; border: 0; border-bottom: 1px solid var(--line); }
.rec-item[aria-current=true] { background: var(--surface-2); }
.rec-item b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-inbox:not(:empty) { padding: 10px 12px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); display: grid; gap: 8px; }
.share-inbox-title { font-weight: 700; font-size: 14px; }
.share-item { display: grid; gap: 4px; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }
.share-item b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-actions { gap: 8px; }
.share-sent:not(:empty) { display: grid; gap: 4px; margin: -4px 0 10px; }
.share-sent-item { display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; color: var(--muted); }
.detail { overflow-y: auto; padding: 20px 24px; min-width: 0; }
.detail-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.detail-head input { flex: 1 1 200px; width: auto; font-weight: 700; font-size: 17px; }
.term-tips { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.term-rows { display: grid; gap: 6px; margin-top: 4px; }
.term-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.5fr) minmax(0, 1.1fr) auto; gap: 6px; align-items: center; }
.term-head { padding: 0 4px; }
.term-body { display: grid; gap: 10px; }
.term-paste summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.term-paste textarea { margin: 8px 0; }
@media (max-width: 640px) {
  .term-row { grid-template-columns: minmax(0, 1fr) auto; }
  .term-row input:nth-child(2), .term-row input:nth-child(3) { grid-column: 1; }
  .term-row button { grid-row: 1; grid-column: 2; }
  .term-head { display: none; }
  .term-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
}
.detail-meta { display: flex; flex-wrap: wrap; gap: 16px; margin: -6px 0 10px; }
.rec-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.rec-tabs button { background: none; border: 0; padding: 8px 2px 10px; font: inherit; font-size: 16px; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.rec-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.rec-pane { display: grid; gap: 14px; max-width: 980px; }
.notes { width: 100%; min-height: 320px; resize: vertical; line-height: 1.7; }
.columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.line { display: grid; grid-template-columns: 56px 1fr; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.line.star { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.line .stamp { background: none; border: 0; padding: 0; color: var(--accent); font-variant-numeric: tabular-nums; font-size: 13px; text-align: left; align-self: start; }
.line .text { outline: none; border-radius: 4px; }
.line .text:focus { background: var(--surface-2); }
.line .tr { color: var(--tr); font-size: 14px; }
.line .suggest { margin-top: 4px; font-size: 14px; color: var(--ok); }
.line-tools { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.line-tools button { background: none; border: 0; padding: 0; font-size: 13px; color: var(--muted); }
.line-tools button[aria-pressed=true] { color: var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.cards { display: grid; gap: 8px; }
.card { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.card h3 { font-size: 14px; margin-bottom: 4px; }
.card ul { margin: 0; padding-left: 18px; font-size: 14px; }
.answer { white-space: pre-wrap; font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input, .row > select { flex: 1 1 120px; width: auto; }
.row > input[type=checkbox] { flex: none; }
label.row { flex-wrap: nowrap; white-space: nowrap; }

/* Settings and sign-in */
.settings { height: 100%; overflow-y: auto; padding: 24px; }
.settings > div { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 20; padding: 16px; }
.gate form { width: min(400px, 100%); background: var(--surface); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }

/* Full-screen captions */
.theater { position: fixed; inset: 0; z-index: 15; background: #000; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; padding: 4vh 5vw; gap: 2vh; }
.theater-lines { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 2.4vh; scrollbar-width: thin; scrollbar-color: #444 transparent; }
.theater-lines::before { content: ""; margin-top: auto; }  /* a short list sits at the bottom; a long one scrolls */
.theater .tline { display: flex; flex-direction: column; gap: 0.6vh; transition: opacity .4s; }
.theater .tline.old { opacity: .5; }
.theater .src { font-size: 2.8vh; color: #bbb; }
.theater .src:empty, .theater .tr:empty { display: none; }
.theater .tr { font-size: 4.8vh; font-weight: 600; line-height: 1.3; }
.theater button { position: absolute; top: 16px; right: 16px; }
.theater button.theater-latest { top: auto; right: auto; bottom: 3vh; left: 50%; transform: translateX(-50%); }
.theater button[hidden] { display: none; }

/* Floating captions window */
.float { height: 100vh; background: #000; color: #fff; padding: 10px 14px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; overflow: hidden; }
.float .src { color: #bbb; font-size: 15px; }
.float .src:empty { display: none; }
.float .tr { font-size: 22px; font-weight: 600; line-height: 1.3; }

/* Viewer */
.viewer { display: grid; grid-template-rows: auto 1fr auto; height: 100dvh; }
.viewer header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #151515; color: #fff; flex-wrap: wrap; }
.viewer header select { width: auto; flex: 1 1 140px; max-width: 240px; border-radius: 999px; }
.viewer .lines { overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; font-size: var(--caption, 22px); }
.lines-empty { margin: auto; max-width: 32em; text-align: center; color: var(--muted); font-size: 16px; line-height: 1.7; }
.viewer .line-v { line-height: 1.4; }
.viewer .line-v.pending { color: var(--muted); }
.viewer .line-v small { display: block; font-size: 55%; color: var(--muted); }
.viewer footer { display: flex; gap: 8px; padding: 10px 16px; background: var(--surface); border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.join { display: grid; place-items: center; height: 100dvh; padding: 16px; }
.join form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; background: var(--surface); padding: 24px; border-radius: var(--radius); box-shadow: var(--shadow); }
.join input.codein { font-size: 26px; font-weight: 800; letter-spacing: .15em; text-align: center; text-transform: uppercase; }

@media (max-width: 860px) {
  .live { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .side { border-left: 0; border-top: 1px solid var(--line); max-height: 38dvh; }
  .history { grid-template-columns: 1fr; grid-template-rows: 150px minmax(0, 1fr); }
  /* No record open: the list gets the whole screen instead of a strip above a "pick a record" note. */
  .history:has(#detail > .empty, #detail:empty) { grid-template-rows: minmax(0, 1fr); }
  .history #detail:is(:empty, :has(> .empty)) { display: none; }
  .history:has(#detail > .empty, #detail:empty) .rec-list { border-bottom: 0; }
  .rec-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .columns { grid-template-columns: minmax(0, 1fr); }
  .duo-panes { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .duo-pane + .duo-pane { border-left: 0; border-top: 1px solid var(--line); }
  .topbar { gap: 8px; padding: 0 12px; overflow-x: auto; }
  .feed, .dock { padding-left: 16px; padding-right: 16px; }
  .nav button { padding: 6px 10px; }
  .conn span { display: none; }
}

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 30; max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px; border-radius: 12px; background: var(--strong); color: var(--strong-ink); box-shadow: var(--shadow); font-size: 14px; }

/* Presets and live highlights */
.presets { display: grid; gap: 6px; margin-top: 8px; }
.preset { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.preset-use { flex: 1; display: grid; gap: 2px; text-align: left; padding: 8px 10px; border: 0; background: transparent; min-height: 44px; }
.preset-use:hover { background: var(--surface-2); }
.preset-del { width: 40px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 18px; }
.star-toggle { margin-left: auto; min-height: 24px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px; }
.star-toggle.on { color: var(--accent); border-color: var(--accent); }
.seg.star { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }

/* Sign-in, account menu and the account page */
.auth { min-height: 100vh; display: grid; place-content: center; gap: 16px; padding: 24px 16px; background: var(--bg); }
.auth-brand { color: var(--ink); font-size: 18px; justify-content: center; }
.auth-card { width: min(380px, calc(100vw - 32px)); display: grid; gap: 12px; }
.auth-card h1 { font-size: 22px; margin: 0; }
.auth-card label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.auth-card .pill { justify-self: start; }
.user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #c9c7c2; white-space: nowrap; }
.user-link { color: #fff; background: transparent; border: 0; padding: 0; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-button { color: var(--ink); background: transparent; border: 0; padding: 0; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; text-align: left; word-break: break-all; }
.nav-link { color: #fff; text-decoration: none; font-size: 14px; }
.admin { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); width: 100%; }
.app:has(> .admin) { grid-template-columns: minmax(0, 1fr); }  /* the wide accounts table scrolls inside its box */
.license { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.license dt { color: var(--muted); }
.license dd { margin: 0; }
.table-wrap { overflow-x: auto; }
.accounts { width: 100%; border-collapse: collapse; font-size: 14px; }
.accounts th, .accounts td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.accounts th { color: var(--muted); font-weight: 600; }
.accounts .actions { display: flex; gap: 6px; }
.notice { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--ok) 12%, var(--surface)); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.notice code { font-size: 16px; font-weight: 700; letter-spacing: .04em; }
@media (max-width: 720px) { .user span:first-child { display: none; } }
.import-progress { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.meter.wide { width: min(320px, 80%); }
/* Shown inside LINE / Facebook / Instagram in-app browsers, which never grant the microphone */
.inapp { position: sticky; top: 0; z-index: 40; padding: 12px 16px; background: var(--warn); color: #fff; display: grid; gap: 8px; font-size: 14px; line-height: 1.5; }
.inapp p { margin: 0; }
.inapp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inapp .pill { color: var(--ink); text-decoration: none; }

/* Phones and narrow windows: the bar wraps instead of sliding sideways (its scroll bar is hidden, so links past the edge could not be reached), and the connection state (重新連線…, 已中斷) is always visible */
@media (max-width: 860px) {
  .app { grid-template-rows: auto minmax(0, 1fr); }
  .topbar { flex-wrap: wrap; overflow-x: visible; row-gap: 2px; padding: 6px 12px; min-height: 56px; }
  .brand { display: none; }
  .nav { flex: 1 1 auto; }
  .nav button { padding: 6px 10px; font-size: 14px; }
  .conn { margin-left: auto; flex: none; }  /* never squeezed into two lines (that pushed the account row out of the bar) */
  .conn span { display: inline; font-size: 12px; }
  .user { width: 100%; justify-content: flex-end; }
  .user:not(:has(:not([hidden]):not(span))) { display: none; }
}
/* Phones and narrow windows, as in Vurbo: the captions own the screen. Settings are a sheet over them, opened from
   "⚙ 設定" (open on first visit, closed once recording starts); the bar keeps only start, pause, time and level. */
@media (max-width: 860px) {
  .live, .live.side-closed { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); position: relative; }
  .live .side { display: none; position: absolute; left: 0; right: 0; top: 0; bottom: var(--dock-h, 76px); z-index: 8;
    max-height: none; border: 0; border-bottom: 1px solid var(--line); box-shadow: 0 8px 24px rgb(0 0 0 / .18); padding-top: 0; }
  .live.settings-open .side { display: flex; }
  .sheet-head { display: flex !important; position: sticky; top: 0; z-index: 1; align-items: center; justify-content: space-between;
    margin: 0 -16px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 16px; }
  .sheet-only { display: flex !important; }
  .sheet-only .dock-more { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
  .sheet-only select { width: 100%; }
  .dock { flex-wrap: nowrap; gap: 8px; padding: 10px 12px; }
  .dock .meter { flex: 1 1 auto; width: auto; min-width: 24px; }
  .dock .spacer { display: none; }
  .clock { min-width: 0; font-size: 16px; }
  #settings-toggle { flex: none; }
  .feed { padding-top: 12px; }
  .seg { padding: 10px 12px; }
  .to-latest { bottom: calc(var(--dock-h, 76px) + 12px); }
}

.room-box .share { grid-template-columns: minmax(0, 1fr); justify-items: start; gap: 8px; }
.room-box .qr { width: 168px; height: 168px; max-width: 100%; }
.room-box .code { font-size: 26px; letter-spacing: .08em; overflow-wrap: anywhere; }
.room-box .link-row { overflow-wrap: anywhere; }
.share-idle { margin: 0; }
/* "End the meeting?" / "Meeting ended": over the meeting, which stays visible behind it */
.room-dialog.notice-dialog { width: min(400px, calc(100vw - 32px)); }
.room-dialog.notice-dialog::backdrop { background: rgb(0 0 0 / .55); }
.notice-text { margin: 0; line-height: 1.6; color: var(--muted); white-space: pre-line; }
.ask-input { width: 100%; margin-top: 12px; }
#resume-capture { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* Create-room dialog: the settings fixed for the whole meeting, chosen every time */
.room-dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  background: var(--surface); color: var(--ink); box-shadow: 0 12px 40px rgb(0 0 0 / .35); }
.room-dialog::backdrop { background: var(--bg); }  /* nothing of the last meeting behind it */
.room-dialog .dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.room-dialog h2 { font-size: 18px; margin: 0; }
.room-field { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.room-field legend { padding: 0; margin-bottom: 6px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice label { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.choice label:has(input:checked) { background: var(--strong); color: var(--strong-ink); border-color: var(--strong); }
.choice input { accent-color: var(--accent); }
.room-field select:disabled { opacity: .5; }
.room-busy { margin: 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 18%, var(--surface)); font-size: 14px; }
.room-actions { justify-content: flex-end; gap: 8px; }

/* Touch screens: small buttons grow to a size a finger can hit */
@media (pointer: coarse) {
  .pill.small, .lang { min-height: 40px; }
  .star-toggle { min-height: 36px; }
}
.inapp { position: fixed; left: 0; right: 0; top: 0; box-shadow: var(--shadow); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Round 9: start/pause + end, speaker boxes, side tabs, records tools */
.brand-sub { font-weight: 800; opacity: .85; margin-left: 6px; }
.rec.end { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.rec.end:not(:disabled) { background: var(--bad); color: #fff; border-color: var(--bad); }
.rec.on.paused { background: var(--accent); color: var(--accent-ink); }
.side-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin: -4px 0 -6px; }
.side-tabs button { background: none; border: 0; padding: 6px 2px 8px; font-size: 15px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.side-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.side-pane { display: flex; flex-direction: column; gap: 18px; }
.live-notes { min-height: 260px; }

/* Speakers: a colour and an icon each; boxes and record lines take a light tint of it */
.spk-1 { --spk: #2f6fdb; } .spk-2 { --spk: #d9822b; } .spk-3 { --spk: #2e9e5b; } .spk-4 { --spk: #b8457e; } .spk-5 { --spk: #7a5cd6; }
.spk-6 { --spk: #138a8a; } .spk-7 { --spk: #b0882a; } .spk-8 { --spk: #c0392b; } .spk-9 { --spk: #4b7f2a; } .spk-10 { --spk: #5c6b80; }
@media (prefers-color-scheme: dark) {
  .spk-1 { --spk: #7aa7ff; } .spk-2 { --spk: #ffb36b; } .spk-3 { --spk: #6fd69a; } .spk-4 { --spk: #f08cbd; } .spk-5 { --spk: #b6a1ff; }
  .spk-6 { --spk: #5fd0d0; } .spk-7 { --spk: #e8c66a; } .spk-8 { --spk: #ff8a7a; } .spk-9 { --spk: #a6d97a; } .spk-10 { --spk: #a9b6c8; }
}
.chip.spk[class*="spk-"] { background: color-mix(in srgb, var(--spk) 18%, var(--surface)); color: var(--ink); gap: 5px; }
.spk-icon { font-style: normal; color: var(--spk); font-size: 11px; line-height: 1; }
.seg-group[class*="spk-"] { background: color-mix(in srgb, var(--spk) 20%, var(--surface)); border-color: color-mix(in srgb, var(--spk) 45%, var(--line)); }
.seg-group .seg-head { margin-bottom: 6px; }
.seg-time { font-variant-numeric: tabular-nums; }
.seg-lines { display: flex; flex-direction: column; gap: 8px; }
.seg-line { display: flex; gap: 8px; align-items: flex-start; }
.seg-line + .seg-line { padding-top: 8px; border-top: 1px dashed color-mix(in srgb, var(--ink) 12%, transparent); }
.seg-text { flex: 1; min-width: 0; }
.seg-line.partial .seg-src { color: var(--muted); }
.seg-line.star .seg-src { text-decoration: underline 2px color-mix(in srgb, var(--accent) 60%, transparent); text-underline-offset: 4px; }
.seg-line .star-toggle { margin-left: 0; flex: none; }
.line-lang { margin-right: 6px; vertical-align: 2px; }
.seg.partial { border-style: solid; }
.line[class*="spk-"] { background: color-mix(in srgb, var(--spk) 8%, transparent); padding-left: 6px; padding-right: 6px; }
.line.run { border-top: 0; }
.speaker-row { display: inline-flex; align-items: center; gap: 6px; }
.speaker-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.speaker-row input[type=text] { width: 9em; }
.copy-row { justify-content: flex-end; }
.summary-lang h3 { font-size: 14px; color: var(--muted); margin: 6px 0 2px; }

/* Admin: default user password */
.default-form { display: grid; gap: 8px; max-width: 420px; }
.default-form .row { gap: 8px; }
.default-msg { margin: 8px 0 0; font-weight: 600; }

/* Meeting notes fill the side panel down to the bottom */
#side-notes { flex: 1 1 auto; min-height: 0; }
#side-notes section { flex: 1 1 auto; min-height: 0; }
.live-notes { flex: 1 1 auto; min-height: 260px; resize: none; }

/* Record transcript, 模式 1: a chat. A time label, then one bubble per speaker turn with a sentence per line. */
.copy-row { justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.mode-switch { display: inline-flex; gap: 6px; }
.chat-lines { display: flex; flex-direction: column; gap: 14px; padding: 6px 0; }
.chat-run { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 8px; align-items: start; }
.chat-run .stamp { background: none; border: 0; padding: 10px 0 0; color: var(--accent); font-variant-numeric: tabular-nums; font-size: 13px; text-align: left; }
.rec-bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 8px 14px 10px;
  max-width: 880px; display: flex; flex-direction: column; gap: 2px; }
.chat-run[class*="spk-"] .rec-bubble { background: color-mix(in srgb, var(--spk) 20%, var(--surface)); border-color: color-mix(in srgb, var(--spk) 45%, var(--line)); }
.bubble-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.cline { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; border-radius: 6px; }
.cline-body { flex: 1; min-width: 0; line-height: 1.6; }
.cline .text { outline: none; border-radius: 4px; }
.cline .text:focus { background: var(--surface); }
.cline .tr { color: var(--tr); font-size: 14px; }
.cline .suggest { margin-top: 2px; font-size: 14px; color: var(--ok); }
.cline.star .text { text-decoration: underline 2px color-mix(in srgb, var(--accent) 60%, transparent); text-underline-offset: 4px; }
.cline-tools { display: flex; align-items: center; gap: 6px; flex: none; font-size: 12px; color: var(--muted); opacity: 0; transition: opacity .15s; }
.cline:hover .cline-tools, .cline:focus-within .cline-tools, .cline.star .cline-tools { opacity: 1; }
.cline-tools button { background: none; border: 0; padding: 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cline-tools button[aria-pressed=true] { color: var(--accent); }
@media (pointer: coarse) { .cline-tools { opacity: 1; } }
@media (max-width: 640px) {
  .chat-run { grid-template-columns: 1fr; gap: 2px; }
  .chat-run .stamp { padding: 0; }
}

/* Live captions as a chat: the time a speaker started on the left, their bubble on the right (as the record's 對話 view) */
.feed-run { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; align-items: start; }
.feed-time { padding-top: 14px; color: var(--accent); font-size: 13px; }
.feed-run .seg-group { border-radius: 4px var(--radius) var(--radius) var(--radius); }
@media (max-width: 640px) {
  .feed-run { grid-template-columns: 1fr; gap: 2px; }
  .feed-time { padding-top: 0; }
}
.lang:disabled { opacity: .5; cursor: not-allowed; }

/* Viewer page (/v/): the same chat look. Each line is its own row; a "cont" line joins the bubble above it. */
.viewer .lines { gap: 0; }
.viewer .line-v { display: grid; grid-template-columns: 3.2em minmax(0, 1fr); gap: 8px; margin-top: 14px; }
.viewer .line-v.cont { margin-top: 0; }
.viewer .v-time { font-size: 13px; color: var(--accent); font-variant-numeric: tabular-nums; padding-top: 12px; }
.viewer .v-text { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: 8px 14px; }
.viewer .line-v[class*="spk-"] .v-text { background: color-mix(in srgb, var(--spk) 20%, var(--surface)); border-color: color-mix(in srgb, var(--spk) 45%, var(--line)); }
/* Joined lines: no border between them, only the bubble's outer edge */
.viewer .line-v:has(+ .line-v.cont) .v-text { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: transparent; padding-bottom: 4px; }
.viewer .line-v.cont .v-text { border-top-left-radius: 0; border-top-right-radius: 0; border-top-color: transparent; padding-top: 4px; }
.viewer .line-v.pending .v-text { color: var(--muted); }
.viewer .v-who { font-size: 12px; margin-bottom: 2px; }
@media (max-width: 640px) {
  .viewer .line-v { grid-template-columns: 1fr; gap: 2px; }
  .viewer .line-v.cont .v-time { display: none; }
  .viewer .v-time { padding-top: 0; }
  /* Records on a phone: only the star stays beside a sentence (the bubble time still plays), so the text keeps its width */
  .cline-tools .cline-time, .cline-tools span { display: none; }
  .cline-tools { opacity: 1; }
}

/* Guided tour (tour.js): the page behind stays visible, so each step shows its own screen */
.room-dialog.tour { width: min(440px, calc(100vw - 32px)); }
.room-dialog.tour::backdrop { background: rgb(0 0 0 / .45); }
.tour-body { display: flex; flex-direction: column; gap: 10px; padding: 22px 20px 18px; }
.tour-dots { display: flex; gap: 6px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.tour-dots i.on { background: var(--accent); width: 18px; border-radius: 4px; }
.tour-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; font-weight: 700;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); margin-top: 4px; }
.tour h2 { font-size: 18px; }
.tour-text { margin: 0; line-height: 1.7; }
.tour-note { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); line-height: 1.6; }
.tour .room-actions { align-items: center; margin-top: 6px; flex-wrap: wrap; }
.tour .room-actions .spacer { flex: 1; }
.tour-skip { border-color: transparent; color: var(--muted); }

/* A record whose meeting is still under way (history.js): marked in the list, read-only when opened */
.live-badge { color: var(--accent); font-weight: 700; margin-right: 6px; }
.live-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0; padding: 10px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface)); font-size: 14px; line-height: 1.6; }
.live-note span { flex: 1 1 260px; }
/* Terms for recognition and translation (host.js) */
.glossary { min-height: 96px; font-size: 14px; line-height: 1.6; resize: vertical; }
/* The viewer's join card while it connects (neutral) or after a refusal (status-bad) */
#join-error.status-wait { color: var(--muted); }
.viewer .line-v.untranslated .v-text { color: var(--muted); }
.viewer .line-v.untranslated .v-text::after { content: " (沒有這個語言的翻譯 Not translated)"; font-size: 12px; }

/* Spacing helpers (pages carry no inline style attributes: Content-Security-Policy style-src 'self') */
.m-0 { margin: 0 !important; }
.mt-6 { margin: 6px 0 0 !important; }
.mt-8 { margin-top: 8px !important; }
.mt-20vh { margin-top: 20vh !important; }
.w-auto { width: auto !important; }
.fs-20 { font-size: 20px !important; }
