:root {
  color-scheme: dark;
  --bg: #071d31;
  --surface: #0d2d49;
  --surface-light: #123d5e;
  --ink: #f1f8fb;
  --muted: #a9c1ce;
  --line: rgba(180, 219, 231, 0.2);
  --teal: #65ddd2;
  --blue: #83b7ff;
  --amber: #f8c55f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at top right, #16486a 0, transparent 36%), var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1, h2, p { margin: 0; }
h1 { max-width: 760px; font-size: clamp(2.5rem, 6vw, 5.8rem); line-height: 1.02; letter-spacing: -0.04em; }
h2 { font-size: clamp(1.2rem, 2vw, 1.7rem); line-height: 1.2; }

.live-shell { width: min(1380px, 100%); margin: 0 auto; padding: clamp(24px, 5vw, 72px); }
.live-header, .state-card, .panel, .result-section { border: 1px solid var(--line); box-shadow: var(--shadow); }
.live-header { display: flex; align-items: end; justify-content: space-between; gap: 28px; border: 0; box-shadow: none; }
.eyebrow, .state-kicker, .number-card span, .result-card > span, .signal > span { color: var(--teal); font-size: .72rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.lede { margin-top: 18px; color: var(--muted); font-size: 1.1rem; }
.number-card { min-width: 245px; padding: 17px 20px; background: var(--teal); color: var(--bg); border-radius: 9px; }
.number-card span { color: rgba(7, 29, 49, .72); }
.number-card strong { display: block; margin-top: 4px; font-size: 1.55rem; }
.number-card .hours-note { display: block; margin-top: 8px; color: rgba(7, 29, 49, .78); font-size: .8rem; font-weight: 700; line-height: 1.4; }
.hours-banner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-top: 24px; padding: 16px 20px; background: rgba(248, 197, 95, .16); border: 1px solid rgba(248, 197, 95, .55); border-left: 5px solid var(--amber); border-radius: 9px; }
.hours-banner[hidden] { display: none; }
.hours-banner strong { color: var(--amber); font-size: 1.1rem; }
.hours-banner span { color: var(--ink); font-size: .95rem; line-height: 1.6; }
.state-pill.closed { background: rgba(248, 197, 95, .17); color: var(--amber); }
.scenario-picker { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 20px; align-items: center; margin-top: 36px; padding: 22px 26px; background: rgba(13, 45, 73, .94); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.scenario-copy strong { display: block; margin-top: 6px; font-size: 1.25rem; line-height: 1.4; }
.scenario-copy p { margin-top: 8px; color: var(--muted); font-size: .85rem; line-height: 1.6; }
.scenario-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.scenario-option { display: grid; gap: 6px; padding: 14px 16px; text-align: left; color: var(--ink); background: rgba(255, 255, 255, .05); border: 1px solid var(--line); border-radius: 9px; font: inherit; cursor: pointer; }
.scenario-option strong { font-size: 1rem; }
.scenario-option span { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.scenario-option.selected { background: rgba(101, 221, 210, .14); border: 2px solid var(--teal); }
.scenario-option.selected strong::before { content: "● "; color: var(--teal); }
.scenario-option:disabled { cursor: not-allowed; opacity: .55; }
.scenario-option:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.state-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 16px; padding: 22px 26px; background: linear-gradient(100deg, var(--surface-light), var(--surface)); border-radius: 10px; }
.state-kicker { display: block; color: var(--muted); }
.state-card strong { display: block; margin-top: 6px; font-size: 1.65rem; }
.state-card p { margin-top: 5px; color: var(--muted); }
.state-pill, .result-badge { padding: 7px 12px; border-radius: 999px; background: rgba(169, 193, 206, .14); color: var(--muted); font-size: .73rem; font-weight: 850; }
.state-pill.live { background: rgba(101, 221, 210, .17); color: var(--teal); }
.state-pill.live.listening { background: rgba(101, 221, 210, .28); }
.state-pill.live.thinking { background: rgba(248, 197, 95, .17); color: var(--amber); }
.state-pill.live.speaking { background: rgba(131, 183, 255, .2); color: #bcd6ff; }
.state-pill.ended, .result-badge { background: rgba(248, 197, 95, .17); color: var(--amber); }
.live-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 16px; margin-top: 16px; }
.panel { min-width: 0; padding: 24px; background: rgba(13, 45, 73, .94); border-radius: 10px; }
.panel-heading, .result-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading .eyebrow { margin-bottom: 8px; }
.timer { color: var(--teal); font-variant-numeric: tabular-nums; font-weight: 800; }
.transcript-panel { min-height: 525px; }
.transcript { display: flex; flex-direction: column; gap: 11px; height: 405px; margin: 22px 0 0; padding: 0; overflow: auto; list-style: none; }
.empty-state { padding: 28px 0; color: var(--muted); }
.utterance { display: flex; align-items: flex-end; gap: 9px; width: 100%; }
.utterance.ai { flex-direction: row-reverse; }
.utterance.system { justify-content: center; }
.utterance-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; color: #071d31; font-size: .72rem; font-weight: 900; }
.utterance.customer .utterance-avatar { background: var(--teal); }
.utterance.ai .utterance-avatar { background: var(--blue); }
.utterance.system .utterance-avatar { display: none; }
.utterance-body { display: grid; max-width: 82%; gap: 4px; }
.utterance.ai .utterance-body { justify-items: end; }
.utterance.system .utterance-body { justify-items: center; max-width: 92%; }
.utterance-meta { display: flex; gap: 9px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.utterance.ai .utterance-meta { flex-direction: row-reverse; }
.utterance-bubble { padding: 11px 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, .07); }
.utterance.customer .utterance-bubble { border-color: rgba(101, 221, 210, .35); border-radius: 6px 15px 15px 15px; background: rgba(101, 221, 210, .12); }
.utterance.ai .utterance-bubble { border-color: rgba(131, 183, 255, .34); border-radius: 15px 6px 15px 15px; background: rgba(131, 183, 255, .12); }
.utterance.system .utterance-bubble { padding: 7px 11px; border: 0; border-radius: 999px; background: rgba(169, 193, 206, .12); }
.utterance p { font-size: .93rem; line-height: 1.65; }
.utterance.partial .utterance-bubble { border-style: dashed; opacity: .72; }
/* Interpretation: staff sits on the right like the AI, in its own colour; the translation runs under the original. */
.utterance.staff { flex-direction: row-reverse; }
.utterance.staff .utterance-avatar { background: var(--amber); }
.utterance.staff .utterance-body { justify-items: end; }
.utterance.staff .utterance-meta { flex-direction: row-reverse; }
.utterance.staff .utterance-bubble { border-color: rgba(248, 197, 95, .4); border-radius: 15px 6px 15px 15px; background: rgba(248, 197, 95, .12); }
.utterance-bubble .translation { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); color: var(--muted); font-size: .85rem; }
.utterance.partial .utterance-meta { font-style: italic; }
.intent { color: var(--amber); font-weight: 800; }
.signals { display: grid; gap: 10px; margin-top: 22px; }
.signal { padding: 14px; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 8px; }
.signal strong, .signal small { display: block; }
.signal strong { margin-top: 7px; font-size: 1rem; }
.signal small { margin-top: 5px; color: var(--muted); font-size: .76rem; }
.muted-signal strong { color: var(--muted); font-weight: 600; }
.notice-box { margin-top: 28px; padding: 15px; background: rgba(248, 197, 95, .1); border-left: 3px solid var(--amber); }
.notice-box strong { color: var(--amber); }
.notice-box p { margin-top: 6px; color: var(--muted); font-size: .82rem; line-height: 1.6; }
.result-section { margin-top: 16px; padding: 26px; background: #f2f7f8; color: #102033; border-color: rgba(101, 221, 210, .35); border-radius: 10px; }
.result-heading .eyebrow, .result-card > span { color: #0f7a6b; }
.result-grid { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr 1.2fr; gap: 12px; margin-top: 22px; }
.result-card { min-width: 0; padding: 17px; background: #fff; border: 1px solid #dce4ee; border-radius: 8px; }
.result-card strong, .result-card small { display: block; }
.result-card strong { margin-top: 8px; font-size: 1rem; overflow-wrap: anywhere; }
.result-card small { margin-top: 6px; color: #617085; font-size: .78rem; line-height: 1.5; }
.result-card p { margin-top: 10px; color: #2f455f; font-size: .92rem; line-height: 1.65; white-space: pre-line; }
.result-summary p { margin-top: 10px; color: #2f455f; font-size: .92rem; line-height: 1.65; }
.result-action { background: #e5f7f4; border-color: #8cded5; }
.result-action strong { color: #075f55; }
.live-footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 20px; color: var(--muted); font-size: .78rem; line-height: 1.5; }

@media (max-width: 900px) {
  .live-header { align-items: stretch; flex-direction: column; }
  .number-card { width: fit-content; }
  .live-grid, .result-grid, .scenario-picker { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .live-shell { padding: 22px 16px 36px; }
  h1 { font-size: 2.8rem; }
  .number-card { width: 100%; }
  .state-card, .live-footer { align-items: flex-start; flex-direction: column; }
  .panel, .result-section { padding: 18px; }
  .transcript { height: 390px; }
}
