:root {
  --ink: #1c1d1b;
  --muted: #73756f;
  --paper: #f4f1ea;
  --panel: #fffefa;
  --line: #dedbd2;
  --accent: #ec5b34;
  --accent-soft: #fff0e9;
  --green: #1d8a5b;
  --shadow: 0 20px 60px rgba(32, 30, 25, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(236, 91, 52, 0.08), transparent 26rem),
    var(--paper);
  font-family: Inter, "Noto Sans TC", "Segoe UI", Arial, sans-serif;
  min-height: 100vh;
}

button, input, select { font: inherit; }
button { color: inherit; }

.app-shell { max-width: 1420px; margin: 0 auto; padding: 0 34px 70px; }

.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(28, 29, 27, 0.11);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font: 700 20px/1 Georgia, serif;
  letter-spacing: -0.02em;
}

.brand-mark { display: flex; gap: 3px; align-items: end; width: 25px; height: 24px; }
.brand-mark i { display: block; width: 6px; border-radius: 4px; background: var(--accent); }
.brand-mark i:nth-child(1) { height: 12px; }
.brand-mark i:nth-child(2) { height: 22px; }
.brand-mark i:nth-child(3) { height: 16px; }

.topbar-actions, .head-actions { display: flex; align-items: center; gap: 10px; }
.connection-pill {
  display: inline-flex; gap: 8px; align-items: center;
  font-size: 12px; font-weight: 700; letter-spacing: 0.03em;
  background: rgba(255,255,255,.6); border: 1px solid var(--line);
  border-radius: 100px; padding: 8px 12px;
}
.status-dot, .live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #c49b42;
  box-shadow: 0 0 0 4px rgba(196,155,66,.12);
}
.connection-pill.online .status-dot, .live-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(29,138,91,.12); }
.connection-pill.offline .status-dot { background: #c94242; box-shadow: 0 0 0 4px rgba(201,66,66,.12); }

.icon-button, .avatar {
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255,255,255,.68);
}
.avatar { background: var(--ink); color: white; border-color: var(--ink); font-size: 11px; font-weight: 800; }

.meeting-head {
  display: flex; justify-content: space-between; align-items: end;
  gap: 24px; padding: 42px 0 26px;
}
.eyebrow { display: flex; align-items: center; gap: 9px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.meeting-title {
  display: block; width: min(760px, 80vw); margin: 10px 0 6px; padding: 0;
  border: 0; background: transparent; color: var(--ink); outline: none;
  font: 600 clamp(29px, 4vw, 48px)/1.1 Georgia, "Noto Serif TC", serif; letter-spacing: -.035em;
}
.meeting-title:focus { box-shadow: 0 2px 0 var(--accent); }
.meeting-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); margin: 0; font-size: 13px; }

.button {
  border: 1px solid transparent; border-radius: 9px; padding: 11px 16px;
  font-size: 13px; font-weight: 750; cursor: pointer; transition: transform .15s, background .15s;
}
.button:hover { transform: translateY(-1px); }
.button-secondary { border-color: var(--line); background: rgba(255,255,255,.72); }
.button-dark { color: #fff; background: var(--ink); }
.button-full { width: 100%; padding: 13px; }

.caption-stage {
  position: relative; overflow: hidden; border: 1px solid #242521;
  border-radius: 18px; color: #f8f4ea; background: #20211f; box-shadow: var(--shadow);
}
.caption-stage::after {
  content: ""; position: absolute; width: 440px; height: 440px; border-radius: 50%;
  right: -240px; bottom: -310px; border: 80px solid rgba(236,91,52,.09); pointer-events: none;
}
.stage-topline { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 10px; color: #aaa9a2; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.speaker-label { color: #d3d0c7; }
.caption-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.caption-card { min-height: 190px; padding: 23px 27px 34px; border-right: 1px solid rgba(255,255,255,.12); }
.caption-card:last-child { border-right: 0; }
.language-label { display: flex; align-items: center; gap: 9px; color: #aba9a1; font-size: 12px; font-weight: 700; }
.language-label span {
  display: inline-flex; align-items: center; justify-content: center; min-width: 27px; height: 25px; padding: 0 5px;
  border-radius: 6px; color: #fff; background: rgba(255,255,255,.12); font-size: 9px; letter-spacing: .04em;
}
.caption-card p { margin: 22px 0 0; font: 500 clamp(18px, 2vw, 27px)/1.48 Georgia, "Noto Serif TC", serif; letter-spacing: -.015em; }
.interim-line {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 12px;
  min-height: 46px; padding: 10px 24px; color: #d3d0c7; background: rgba(255,255,255,.055);
  border-top: 1px solid rgba(255,255,255,.1); font-size: 13px;
}
.wave { display: flex; gap: 2px; align-items: center; height: 16px; }
.wave i { width: 2px; height: 7px; background: var(--accent); animation: wave .8s infinite alternate; }
.wave i:nth-child(2) { animation-delay: .18s; height: 13px; }
.wave i:nth-child(3) { animation-delay: .32s; height: 10px; }
.wave i:nth-child(4) { animation-delay: .48s; height: 15px; }
@keyframes wave { to { transform: scaleY(.35); } }

.control-dock {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px;
  margin: 14px 0 52px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 13px;
  background: rgba(255,255,255,.62);
}
.language-control { display: flex; align-items: center; gap: 12px; }
.language-control label { color: var(--muted); font-size: 12px; font-weight: 700; }
.language-control select {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 30px 8px 10px; background: var(--panel); font-size: 12px; font-weight: 700;
}
.mic-button {
  display: flex; align-items: center; gap: 9px; min-width: 150px; justify-content: center;
  border: 0; border-radius: 100px; padding: 12px 20px; color: white; background: var(--accent);
  font-size: 13px; font-weight: 800; cursor: pointer; box-shadow: 0 9px 24px rgba(236,91,52,.25);
}
.mic-button.listening { background: #d13e27; }
.mic-icon { font-size: 10px; border: 2px solid rgba(255,255,255,.8); border-radius: 8px; padding: 2px; }
.mic-hint { justify-self: end; color: var(--muted); margin: 0; font-size: 12px; }

.section-heading { display: flex; align-items: end; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.section-kicker { margin: 0 0 5px; color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.section-heading h2, .modal h2 { margin: 0; font: 600 27px/1.2 Georgia, "Noto Serif TC", serif; }
.record-count { color: var(--muted); font-size: 12px; }

.empty-state { padding: 62px 20px; text-align: center; color: var(--muted); }
.empty-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; margin-bottom: 12px; border-radius: 50%; background: #e9e5db; color: var(--ink); font-weight: 900; letter-spacing: 3px; }
.empty-state h3 { margin: 0 0 7px; color: var(--ink); font: 600 18px Georgia, serif; }
.empty-state p { margin: 0; font-size: 13px; }
.transcript-list { display: grid; }
.transcript-item {
  display: grid; grid-template-columns: 96px 1fr; gap: 18px; padding: 23px 4px;
  border-bottom: 1px solid var(--line);
}
.transcript-time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.source-badge { display: inline-block; margin-top: 8px; border-radius: 5px; padding: 4px 7px; color: var(--accent); background: var(--accent-soft); font-size: 9px; font-weight: 900; letter-spacing: .07em; }
.transcript-original { margin: 0 0 12px; font-size: 16px; font-weight: 700; line-height: 1.5; }
.translations { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.translation { color: #666861; font-size: 13px; line-height: 1.55; }
.translation b { display: block; margin-bottom: 3px; color: #979991; font-size: 9px; letter-spacing: .08em; }

.menu {
  position: fixed; z-index: 20; width: 215px; padding: 6px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); box-shadow: 0 15px 40px rgba(24,23,20,.17);
}
.menu button { display: block; width: 100%; padding: 10px 11px; border: 0; border-radius: 7px; background: transparent; text-align: left; font-size: 12px; cursor: pointer; }
.menu button:hover { background: var(--paper); }

.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(22,23,21,.58); backdrop-filter: blur(6px); }
.modal { position: relative; width: min(460px, 100%); padding: 32px; border-radius: 17px; background: var(--panel); box-shadow: 0 30px 90px rgba(0,0,0,.22); }
.access-modal { border-top: 4px solid var(--accent); }
.modal p:not(.section-kicker) { color: var(--muted); font-size: 13px; line-height: 1.6; }
.modal-close { position: absolute; top: 14px; right: 15px; width: 32px; height: 32px; border: 0; background: transparent; font-size: 24px; cursor: pointer; }
.field { display: grid; gap: 7px; margin: 22px 0 7px; font-size: 12px; font-weight: 800; }
.field input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 8px; outline: none; background: white; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(236,91,52,.1); }
.field-note { margin: 0 0 18px; font-size: 11px !important; }
.setup-status {
  display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; padding: 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper);
}
.setup-status .status-dot { flex: 0 0 auto; }
.setup-status.ready .status-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(29,138,91,.12); }
.setup-status.error .status-dot { background: #c94242; box-shadow: 0 0 0 4px rgba(201,66,66,.12); }
.setup-status b, .setup-status small { display: block; }
.setup-status b { margin-bottom: 3px; font-size: 12px; }
.setup-status small { color: var(--muted); font-size: 10px; }
.setup-steps { margin: 0 0 18px; padding-left: 21px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.setup-steps a { color: var(--accent); font-weight: 750; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 30px; transform: translateX(-50%); max-width: min(90vw, 560px); padding: 11px 16px; border-radius: 9px; color: white; background: #232421; box-shadow: 0 12px 35px rgba(0,0,0,.2); font-size: 12px; }
[hidden] { display: none !important; }
.viewer-mode .host-only { display: none !important; }
.viewer-mode .host-editable { pointer-events: none; }

@media (max-width: 850px) {
  .app-shell { padding: 0 18px 48px; }
  .meeting-head { align-items: start; flex-direction: column; }
  .caption-grid { grid-template-columns: 1fr; }
  .caption-card { min-height: 0; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.12); padding: 18px 22px 23px; }
  .caption-card:last-child { border-bottom: 0; }
  .caption-card p { margin-top: 10px; }
  .control-dock { grid-template-columns: 1fr; text-align: center; }
  .language-control { justify-content: center; }
  .mic-button { justify-self: center; }
  .mic-hint { justify-self: center; }
  .translations { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar { height: 66px; }
  .connection-pill { padding: 7px 9px; }
  .avatar { display: none; }
  .meeting-head { padding-top: 28px; }
  .meeting-title { width: 100%; font-size: 31px; }
  .head-actions { width: 100%; }
  .head-actions .button { flex: 1; }
  .transcript-item { grid-template-columns: 1fr; gap: 9px; }
  .source-badge { margin: 0 0 0 8px; }
}
