:root {
  --ink: #12233a;
  --ink-2: #4a5b70;
  --ink-3: #7d8b9c;
  --bg: #f5f8f9;
  --card: #ffffff;
  --line: #dde5ea;
  --teal: #0e7c86;
  --teal-2: #0a5f67;
  --teal-soft: #e3f2f3;
  --red: #d64045;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(18, 35, 58, .06), 0 8px 28px rgba(18, 35, 58, .08);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
button { font: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px clamp(16px, 4vw, 40px); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.wordmark { font-weight: 800; letter-spacing: .02em; font-size: 20px; color: var(--teal-2); }
.divider { width: 1px; height: 20px; background: var(--line); }
.tag { color: var(--ink-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; color: var(--ink-2); font-size: 13px; }
.lang button[aria-pressed="true"] { background: var(--teal); color: #fff; }

/* layout */
.layout {
  flex: 1; display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: clamp(16px, 3vw, 36px);
  padding: 8px clamp(16px, 4vw, 40px) 28px; max-width: 1240px; width: 100%; margin: 0 auto; align-items: start;
}
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } .intro { display: none; } }

/* stage */
.stage-col { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 12px; }
.stage {
  position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; background: #dfe9ec;
  box-shadow: var(--shadow);
}
.still, .stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage video { opacity: 0; transition: opacity .35s; object-position: center 22%; }
.stage.has-video video { opacity: 1; }
.stage.connecting .still { filter: saturate(.85) brightness(.97); }

.status {
  position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  border-radius: 999px; background: rgba(255, 255, 255, .92); font-size: 13px; color: var(--ink-2); backdrop-filter: blur(6px);
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.status.live .dot { background: #23a55a; }
.status.speaking .dot { background: var(--teal); animation: pulse 1s infinite; }
.status.connecting .dot { background: #e0a100; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.6); opacity: .5; } }
.timer {
  position: absolute; top: 14px; right: 14px; padding: 6px 10px; border-radius: 999px; font-size: 12px;
  background: rgba(18, 35, 58, .55); color: #fff; font-variant-numeric: tabular-nums;
}

.overlay {
  position: absolute; inset: auto 0 0 0; padding: 60px 20px 22px; display: flex; flex-direction: column; align-items: center;
  gap: 10px; background: linear-gradient(transparent, rgba(10, 30, 45, .72));
}
.overlay[hidden] { display: none; }
.start {
  display: flex; align-items: center; gap: 10px; border: 0; border-radius: 999px; padding: 13px 24px;
  background: var(--teal); color: #fff; font-weight: 600; font-size: 16px; box-shadow: 0 6px 20px rgba(14, 124, 134, .45);
}
.start:hover { background: var(--teal-2); }
.start:disabled { opacity: .7; cursor: progress; }
.hint { margin: 0; color: rgba(255, 255, 255, .9); font-size: 13px; text-align: center; }
.hangup {
  position: absolute; bottom: 14px; right: 14px; display: flex; align-items: center; gap: 6px; border: 0;
  border-radius: 999px; padding: 8px 14px; background: var(--red); color: #fff; font-size: 13px;
}
.hangup svg { width: 16px; height: 16px; }

.caption {
  min-height: 48px; padding: 12px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line);
  color: var(--ink); font-size: 15px; line-height: 1.5; max-height: 132px; overflow-y: auto;
}
.caption:empty { display: none; }
.caption small { display: block; color: var(--ink-3); font-size: 13px; }

/* composer */
.composer { display: flex; gap: 8px; align-items: center; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px; box-shadow: var(--shadow); }
.composer input { flex: 1; min-width: 0; border: 0; outline: 0; font: inherit; font-size: 15px; padding: 8px 6px; background: none; color: var(--ink); }
.mic, .send { width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; }
.mic { background: var(--teal-soft); color: var(--teal-2); }
.mic.on { background: var(--red); color: #fff; animation: ring 1.2s infinite; }
.mic[hidden] { display: none; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(214, 64, 69, .5); } 100% { box-shadow: 0 0 0 14px rgba(214, 64, 69, 0); } }
.send { background: var(--teal); color: #fff; }
.send:disabled { opacity: .45; cursor: default; }

/* chat column */
.chat-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.intro h1 { margin: 8px 0 6px; font-size: clamp(26px, 3vw, 34px); line-height: 1.15; letter-spacing: -.01em; }
.intro p { margin: 0; color: var(--ink-2); font-size: 16px; line-height: 1.55; max-width: 56ch; }
.log { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; line-height: 1.55; font-size: 15px; overflow-wrap: anywhere; }
.msg p { margin: 0 0 6px; } .msg p:last-child { margin: 0; }
.msg ul { margin: 4px 0; padding-left: 20px; }
.msg.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.user { align-self: flex-end; background: var(--teal); color: #fff; border-bottom-right-radius: 6px; }
.msg.typing { color: var(--ink-3); }
.msg.typing::after { content: "…"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.msg.note { align-self: center; background: none; color: var(--ink-3); font-size: 13px; padding: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 1px solid var(--line); background: var(--card); color: var(--teal-2); border-radius: 999px;
  padding: 8px 14px; font-size: 14px; }
.chips button:hover { border-color: var(--teal); background: var(--teal-soft); }
.disclaimer { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; border-top: 1px solid var(--line); padding-top: 12px; }
