/* Booth — the interpreter's booth, in blue.
   Deep navy ink and steel-blue "glass" on cool quiet neutrals; one amber tally light for whatever is
   live right now (live status, the dub, the start button). Bricolage Grotesque for display, Figtree
   for text and subtitles, JetBrains Mono for timecodes. */

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --soft: #e3e8ef;
  --text: #0f1e33;
  --text-2: #34445a;
  --muted: #4d5c6e;
  --dim: #8e9aa8;
  --line: rgba(15, 30, 51, 0.08);
  --line-2: rgba(15, 30, 51, 0.14);

  /* brand scale: steel-blue glass (400) to booth navy (700) */
  --brand-50: #eaf0f6;
  --brand-100: #d3dfeb;
  --brand-300: #8ca9c8;
  --brand-400: #2f5d8c;
  --brand-500: #24497a;
  --brand-700: #0f1e33;
  --sky-400: #7fa3c9;
  --sky-500: #4e7aa8;
  /* the tally light, and a darker amber for amber text on light grounds */
  --orange: #f0a21b;
  --amber-ink: #8a5a00;
  --ok: #19a463;
  --warn: #d9480f;

  --grad: linear-gradient(0deg, var(--brand-700), var(--brand-700));
  --grad-deep: linear-gradient(160deg, #0f1e33 0%, #1a3150 100%);
  --display: "Bricolage Grotesque", "Figtree", "Segoe UI", system-ui, sans-serif;

  --r-xl: 32px;
  --r-lg: 24px;
  --r-md: 16px;
  --r-sm: 12px;

  --shadow-1: 0 1px 2px rgba(10, 12, 40, 0.04), 0 4px 16px rgba(10, 12, 40, 0.04);
  --shadow-2: 0 2px 6px rgba(10, 12, 40, 0.05), 0 18px 48px rgba(15, 30, 51, 0.10);

  --font: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Motion: one curve, three speeds. Hover and tints are quick; small pieces (menus, chips, errors)
     take a beat; anything that moves the layout (panels, heights, pages) takes the longest, so the eye
     can follow it. Exits are a bit faster than entrances. */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-hover: 0.2s;
  --t-ui: 0.3s;
  --t-layout: 0.42s;
  --t-exit: 0.22s;
}

/* Large screens: the layout is drawn for about 1340 × 860 px, so on a 2K or 4K monitor everything
   would sit small in the middle. Zoom the whole page in steps, keeping at least 1340 × 860 of room.
   Viewport heights inside the zoomed page are divided by --z so they still match the window. */
:root { --z: 1; }
@media (min-width: 1800px) and (min-height: 1000px) { :root { --z: 1.15; } }
@media (min-width: 2200px) and (min-height: 1150px) { :root { --z: 1.3; } }
@media (min-width: 2500px) and (min-height: 1350px) { :root { --z: 1.5; } }
@media (min-width: 3000px) and (min-height: 1600px) { :root { --z: 1.75; } }
html { zoom: var(--z); scrollbar-gutter: stable; } /* a scrollbar appearing never shifts the page */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--brand-500); }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; font-family: var(--display); font-weight: 700; text-wrap: balance; }
h1 { font-size: 32px; line-height: 1.2; font-weight: 600; }
h2 { font-size: 26px; line-height: 1.25; font-weight: 600; }
h3 { font-size: 17px; line-height: 1.35; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-feature-settings: "zero" 0; }
.link { color: var(--brand-500); text-decoration: underline; text-underline-offset: 3px; }

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- ambient background ---------- */


.view { position: relative; z-index: 1; min-height: calc(100vh / var(--z)); }

/* ---------- reveal ---------- */

.reveal { animation: reveal 0.5s var(--ease) both; animation-delay: calc(var(--d, 0ms) * 0.7); }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- buttons ---------- */

.btn {
  --h: 44px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--h); padding: 0 20px; border: 0; border-radius: var(--r-sm);
  font: 500 15px/1 var(--font); color: var(--text); background: transparent; cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.25s var(--ease), background-color 0.2s, color 0.2s, opacity 0.2s;
  overflow: hidden; white-space: nowrap; user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; }
.btn--lg { --h: 52px; font-size: 16px; padding: 0 24px; }
.btn--sm { --h: 34px; font-size: 13px; padding: 0 12px; border-radius: 10px; }
.btn--block { width: 100%; }

.btn--primary { color: #fff; background: var(--grad); box-shadow: 0 6px 20px -6px rgba(47, 93, 140, 0.55); }
.btn--primary::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-110%);
  background: linear-gradient(105deg, transparent 25%, rgba(255, 255, 255, 0.16) 45%, rgba(255, 255, 255, 0.22) 50%, rgba(255, 255, 255, 0.16) 55%, transparent 75%);
}
.btn--primary:hover { box-shadow: 0 10px 28px -8px rgba(47, 93, 140, 0.75); transform: translateY(-1px); }
/* A soft, slow sheen once per hover. */
.btn--primary:hover::after { transform: translateX(110%); transition: transform 1.6s cubic-bezier(0.45, 0, 0.25, 1); }
.btn--primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn--primary:disabled::after { display: none; }

.btn--soft { background: var(--soft); }
.btn--soft:hover { background: #e4e4e8; }
.btn--ghost { background: transparent; border: 1px solid var(--line-2); }
.btn--ghost:hover { border-color: var(--brand-300); color: var(--brand-500); background: var(--brand-50); }

.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::before {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff; animation: spin 0.7s linear infinite;
}
.btn--soft.is-loading::before { border-color: rgba(0, 0, 0, 0.15); border-top-color: var(--brand-500); }
.oauth-block { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.oauth-block .btn--primary { margin-top: 0; }
.g-logo { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; transition: background 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.icon-btn:hover { background: var(--soft); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn--lg { width: 48px; height: 48px; border-radius: 50%; color: #fff; background: var(--text); }
.icon-btn--lg:hover { background: var(--brand-500); color: #fff; }

/* ---------- inputs ---------- */

.field {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field:focus-within { border-color: var(--brand-400); box-shadow: 0 0 0 4px rgba(47, 93, 140, 0.12); }
.field-icon { color: var(--dim); display: grid; }
.field input { flex: 1; border: 0; outline: 0; font: 400 15px var(--font); background: transparent; color: var(--text); min-width: 0; }
.field input::placeholder { color: var(--dim); }

.select { position: relative; display: block; flex: 1; min-width: 0; }
.settings > .select { flex: none; } /* in the card's column it must keep its own height (and fold smoothly) */
.select-label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px 2px; }

/* language picker */
.lp { position: relative; }
.lp-btn {
  width: 100%; height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  font: 500 15px var(--font); cursor: pointer; text-align: left; transition: border-color 0.2s, box-shadow 0.2s;
}
.lp-btn:hover { border-color: var(--brand-300); }
.lp-btn:focus-visible, .lp.is-open .lp-btn { outline: 0; border-color: var(--brand-400); box-shadow: 0 0 0 4px rgba(47, 93, 140, 0.12); }
.lp-flag { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--soft); box-shadow: 0 0 0 1px var(--line); }
.lp-flag.is-missing { visibility: hidden; }
.lp-text { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; overflow: hidden; white-space: nowrap; }
.lp-text .lp-label { overflow: hidden; text-overflow: ellipsis; }
.lp-text .lp-native { display: none; }
.lp-chev { flex: none; color: var(--muted); transition: transform var(--t-ui) var(--ease); }
.lp.is-open .lp-chev { transform: rotate(180deg); }
.lp.bump .lp-btn .lp-flag { animation: pop-flag 0.4s var(--spring); }
@keyframes pop-flag { from { transform: scale(0.6); } }

.lp-pop {
  position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; width: max(100%, 300px);
  padding: 8px; border-radius: var(--r-md); background: var(--surface); box-shadow: 0 2px 6px rgba(10, 12, 40, 0.06), 0 24px 56px rgba(15, 30, 51, 0.16);
  border: 1px solid var(--line); transform-origin: top left; animation: lp-in 0.28s var(--ease);
}
.lang-row .select:last-child .lp-pop { left: auto; right: 0; transform-origin: top right; }
.lp-pop { max-width: calc(100vw - 32px); }
.lp-pop.is-up { top: auto; bottom: calc(100% + 8px); transform-origin: bottom left; animation-name: lp-in-up; }
.lang-row .select:last-child .lp-pop.is-up { transform-origin: bottom right; }
@keyframes lp-in-up { from { opacity: 0; transform: translateY(6px) scale(0.97); } }
@keyframes lp-in { from { opacity: 0; transform: translateY(-6px) scale(0.97); } }
.lp-search {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; margin-bottom: 6px;
  border-radius: 10px; background: var(--surface-2); color: var(--muted);
}
.lp-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 400 14px var(--font); color: var(--text); }
.lp-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #ced6df transparent; }
.lp-list li[data-code] {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; border-radius: 10px; cursor: pointer;
  font-size: 14px; animation: lp-item 0.3s var(--ease) both; animation-delay: calc(var(--i) * 12ms);
}
@keyframes lp-item { from { opacity: 0; transform: translateX(-4px); } }
.lp-list li .lp-flag { width: 20px; height: 20px; }
.lp-list li .lp-label { font-weight: 500; white-space: nowrap; }
.lp-list li .lp-native { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-list li .lp-code { font-size: 11px; color: var(--dim); }
.lp-list li.is-active { background: var(--brand-50); }
.lp-list li[aria-selected="true"] .lp-label { color: var(--brand-500); }
.lp-list li[aria-selected="true"]::after {
  content: ""; width: 6px; height: 10px; margin: -3px 2px 0 0; border: solid var(--brand-500); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.lp-empty { padding: 16px 10px; color: var(--muted); font-size: 14px; text-align: center; }

/* voice picker */
.vp.is-locked .vp-btn { cursor: not-allowed; background: var(--surface-2); border-style: dashed; }
.vp.is-locked .vp-btn:hover { border-color: var(--line-2); }
.vp.is-locked .lp-chev { opacity: 0.3; }
.vp.is-locked .vp-avatar { background: var(--brand-400); }
.vp-row { display: flex; gap: 8px; }
.vp-row .vp-btn { flex: 1; min-width: 0; }
.vp-btn .lp-text { flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.25; }
.vp-sub { font-size: 12px; font-weight: 400; color: var(--muted); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.vp-avatar, .vp-play {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-500); font-size: 12px; font-weight: 600;
}
.vp-btn .vp-avatar { background: var(--grad); color: #fff; }
.vp-play { border: 0; cursor: pointer; position: relative; transition: background 0.2s, color 0.2s, transform 0.2s var(--spring); }
.vp-play:hover { background: var(--grad); color: #fff; transform: scale(1.08); }
.vp-play--lg { width: 52px; height: 52px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line-2); color: var(--brand-500); }
.vp-play--lg:hover { border-color: var(--brand-300); transform: none; }
.vp-play .eq { display: none; align-items: flex-end; gap: 2px; height: 12px; }
.vp-play .eq i { width: 3px; border-radius: 2px; background: currentColor; animation: eqb 0.9s ease-in-out infinite; }
.vp-play .eq i:nth-child(2) { animation-delay: -0.3s; }
.vp-play .eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes eqb { 0%, 100% { height: 3px; } 50% { height: 12px; } }
.vp-play.is-playing { background: var(--grad); color: #fff; }
.vp-play.is-playing .i-play { display: none; }
.vp-play.is-playing .eq { display: flex; }
.vp-pop { width: max(100%, 360px); }
.vp-list { max-height: 340px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #ced6df transparent; }
.vp-group { padding: 12px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.vp-hint { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 4px; }
.vp-item {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; border-radius: 10px; cursor: pointer;
  animation: lp-item 0.3s var(--ease) both; animation-delay: calc(var(--i) * 12ms);
}
.vp-item:hover { background: var(--brand-50); }
.vp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.vp-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vp-item .lp-code { font-size: 11px; color: var(--dim); }
.vp-item[aria-selected="true"] .vp-name { color: var(--brand-500); }
.vp-item[aria-selected="true"]::after {
  content: ""; flex: none; width: 6px; height: 10px; margin: -3px 4px 0 0; border: solid var(--brand-500); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.vp-more {
  width: 100%; margin-top: 6px; padding: 10px; border: 1px dashed var(--line-2); border-radius: 10px; background: transparent;
  font: 500 13px var(--font); color: var(--brand-500); cursor: pointer; transition: background 0.2s, border-color 0.2s;
}
.vp-more:hover { background: var(--brand-50); border-color: var(--brand-300); }

.switch { position: relative; flex: none; width: 44px; height: 26px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #d9d9de; transition: background 0.25s; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.35s var(--spring);
}
.switch input:checked + span { background: var(--orange); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand-400); outline-offset: 2px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 500;
}
.chip--brand { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.tag {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 8px;
  background: var(--brand-50); color: var(--brand-500); font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
}

.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }

.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }

/* ============================================================
   SIGN IN
   ============================================================ */

.view--signin { display: grid; grid-template-columns: minmax(420px, 720px) 1fr; }
.signin-card {
  position: relative; margin: 8px; min-height: calc(100vh / var(--z) - 16px); padding: 40px 24px 28px;
  background: var(--surface); border-radius: var(--r-xl); display: flex; flex-direction: column; align-items: center;
  box-shadow: var(--shadow-1); animation: reveal 0.6s var(--ease) both;
}
.signin-body { width: 100%; max-width: 360px; margin: auto 0; display: flex; flex-direction: column; gap: 16px; text-align: center; padding: 40px 0; }
.signin-body h1 { margin-bottom: -6px; }
.signin-body .btn--primary { margin-top: 18px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.keys summary { list-style: none; width: 100%; }
.keys summary::-webkit-details-marker { display: none; }
.keys[open] summary { background: transparent; color: var(--muted); height: 32px; font-size: 14px; }
.keys-form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; text-align: left; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.form-error {
  padding: 12px 14px; border-radius: var(--r-sm); background: #fff1ec; color: var(--warn);
  font-size: 14px; text-align: left; animation: shake 0.45s var(--ease);
}
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.signin-foot { font-size: 13px; }

.signin-hero { display: flex; flex-direction: column; justify-content: center; }
.hero-sub { max-width: 460px; font-size: 16px; }

@keyframes floaty { 50% { transform: translateY(-6px); } }
@keyframes eq { 0%, 100% { height: 14%; opacity: 0.55; } 50% { height: 92%; opacity: 1; } }
@keyframes nudge { 50% { transform: translateX(4px); } }

.features { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; max-width: 680px; }
.features li { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 500; color: var(--text-2); }
.feat-ico { color: var(--brand-500); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: rgba(255, 255, 255, 0.7); }

/* ============================================================
   APP
   ============================================================ */

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  height: 64px; padding: 0 24px; background: rgba(242, 242, 242, 0.72); backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid transparent;
}
.topbar-spacer { flex: 1; }
.balance {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--text-2);
  white-space: nowrap; animation: reveal 0.5s var(--ease) both;
}
.balance svg { color: var(--brand-500); }
.balance-sub { color: var(--muted); font-weight: 400; }
.balance.is-low { background: #fff1ec; border-color: #ffd2c2; color: var(--warn); }
.balance.is-low svg { color: var(--warn); }
.user { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 4px 0 4px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--grad); color: #fff; font-size: 12px; font-weight: 600;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 14px; font-weight: 500; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stage { max-width: 1320px; margin: 0 auto; padding: 24px 24px 48px; }

/* ---------- setup ---------- */

.setup-head { display: flex; flex-direction: column; }
.setup-grid { display: grid; align-items: stretch; }

.dropzone {
  --mx: 50%; --my: 50%;
  position: relative; place-items: center;
  outline: none; overflow: hidden; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.dropzone::before {
  content: ""; position: absolute; inset: 12px; border-radius: 18px; pointer-events: none;
  background:
    linear-gradient(90deg, var(--brand-300) 50%, transparent 0) top / 14px 1.5px repeat-x,
    linear-gradient(90deg, var(--brand-300) 50%, transparent 0) bottom / 14px 1.5px repeat-x,
    linear-gradient(0deg, var(--brand-300) 50%, transparent 0) left / 1.5px 14px repeat-y,
    linear-gradient(0deg, var(--brand-300) 50%, transparent 0) right / 1.5px 14px repeat-y;
  opacity: 0.55; transition: opacity 0.3s;
}
.dropzone::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(320px circle at var(--mx) var(--my), rgba(47, 93, 140, 0.10), transparent 70%);
}
.dropzone:hover::after, .dropzone:focus-visible::after { opacity: 1; }
.dropzone:hover::before { opacity: 0.9; animation: march 1s linear infinite; }
.dropzone.is-drag { transform: scale(1.01); box-shadow: var(--shadow-2); }
.dropzone.is-drag::before { opacity: 1; animation: march 0.5s linear infinite; }
.dropzone.is-drag .dz-icon { transform: translateY(-6px) scale(1.06); }
.dropzone.has-file::before { opacity: 0; animation: none; }
@keyframes march {
  to { background-position: 14px 0, -14px 100%, 0 -14px, 100% 14px; }
}
.dz-empty { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; width: min(480px, 100%); align-self: stretch; }
.dz-panel { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; width: 100%; padding-bottom: 36px; animation: reveal 0.3s var(--ease) both; }
.dz-panel[hidden] { display: none; }
.dz-panel .dz-url, .dz-panel .dz-url-hint, .dz-panel .dz-url-error { width: 100%; max-width: none; }
.dz-src button[hidden] { display: none; } /* #dz-src-tab outside Chromium */
.dz-icon {
  width: 88px; height: 88px; border-radius: 26px; display: grid; place-items: center; margin-bottom: 6px;
  color: #fff; background: var(--grad); box-shadow: 0 16px 36px -12px rgba(47, 93, 140, 0.6);
  transition: transform 0.4s var(--spring);
}
.dz-icon svg { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-3px); } }

.dz-url {
  display: flex; align-items: center; gap: 6px; width: min(460px, 100%); height: 44px; padding: 0 5px 0 12px; cursor: text;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); transition: border-color 0.2s, box-shadow 0.2s;
}
.dz-url:focus-within { border-color: var(--brand-400); box-shadow: 0 0 0 4px rgba(47, 93, 140, 0.12); }
.dz-url.is-error { border-color: #f3a58c; animation: shake 0.45s var(--ease); }
.dz-url-icon { display: grid; color: var(--dim); }
.dz-url input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 400 14px var(--font); color: var(--text); }
.dz-url .btn { flex: none; }
.dz-url-hint { max-width: 460px; font-size: 12px; }
.dz-url-error { max-width: 460px; padding: 10px 12px; border-radius: 10px; background: #fff1ec; color: var(--warn); font-size: 13px; text-align: left; animation: reveal 0.3s var(--ease) both; }
.dz-file { position: relative; z-index: 1; width: 100%; display: flex; flex-direction: column; gap: 18px; animation: reveal 0.5s var(--ease) both; }
.dz-preview {
  position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden;
  background: var(--grad-deep); display: grid; place-items: center;
}
.dz-preview video { width: 100%; height: 100%; object-fit: cover; display: block; }
.dz-audio-art { color: rgba(255, 255, 255, 0.85); }
.dz-duration {
  position: absolute; right: 12px; bottom: 12px; padding: 4px 8px; border-radius: 8px;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 12px; backdrop-filter: blur(6px);
}
.dz-meta { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; }
.dz-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-meta .btn { grid-row: 1 / 3; grid-column: 2; }

.settings { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.lang-row { display: flex; align-items: flex-end; gap: 8px; }
.swap {
  flex: none; width: 40px; height: 40px; margin-bottom: 6px; border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
}
.swap:hover { border-color: var(--brand-300); color: var(--brand-500); }
.swap.spin svg { animation: swapspin 0.5s var(--ease); }
@keyframes swapspin { from { transform: rotate(-180deg); } }

.opt { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.adv { border-top: 1px solid var(--line); margin-top: -14px; }
.adv summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 0; list-style: none; cursor: pointer; user-select: none;
}
.adv summary::-webkit-details-marker { display: none; }
.adv-title { font-weight: 500; }
.adv-chips { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.adv-chip { height: 22px; padding: 0 8px; border-radius: 7px; background: var(--brand-50); color: var(--brand-500); font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; animation: pop-flag 0.35s var(--spring); }
.adv-chev { color: var(--muted); transition: transform 0.3s var(--ease); }
.adv[open] .adv-chev { transform: rotate(180deg); }
.adv[open]:not(.is-closing) .adv-chips { opacity: 0; }
.adv-chips { transition: opacity 0.25s; }
.adv.is-closing .adv-chev { transform: none; }
.adv-body { padding-bottom: 2px; }
.adv-body .opt:first-child { border-top: 0; padding-top: 0; }
.opt-title { font-weight: 500; }

/* ---------- live ---------- */

.stage--live { padding-top: 16px; padding-bottom: 24px; }
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; height: calc(100vh / var(--z) - 64px - 40px); min-height: 600px; }
.player-col { display: flex; flex-direction: column; gap: 14px; min-height: 0; }

.player {
  position: relative; flex: 1; min-height: 280px; overflow: hidden; background: #07081a; border-radius: var(--r-lg);
  animation: reveal 0.6s var(--ease) both; box-shadow: var(--shadow-2);
}
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.player::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 45%; pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent);
}
.audio-only-art {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 15% 10%;
  background: radial-gradient(70% 90% at 20% 10%, rgba(127, 163, 201, 0.45), transparent 60%), var(--grad-deep);
}
.audio-only-art canvas { width: 100%; height: 60%; }

.player-top { position: absolute; z-index: 3; top: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; }
.status-pill, .lang-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 10px;
  background: rgba(10, 14, 26, 0.72); color: #fff; font-size: 13px; font-weight: 500;
}
.lang-pill { font-size: 12px; letter-spacing: 0.06em; }
.player-top-right { display: inline-flex; align-items: center; gap: 8px; }
.replay-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 10px;
  background: rgba(240, 162, 27, 0.95); color: #0f1e33; font-size: 12.5px; font-weight: 500;
  animation: reveal 0.5s var(--ease) both;
}
.status-pill[data-state="replay"] .live-dot { background: var(--orange); }
.status-pill[data-state="replay"] .live-dot::after { animation: none; opacity: 0; }
.player.is-replay .progress-bar, .is-replay-controls .progress-bar { cursor: pointer; }
.progress-track { position: relative; padding: 6px 0; margin: -6px 0; }
.is-replay-controls .progress-track { cursor: pointer; touch-action: none; }
.is-replay-controls .progress-bar { transition: height var(--t-hover) var(--ease); }
.is-replay-controls .progress-track:hover .progress-bar { height: 8px; }
.progress-tip {
  position: absolute; bottom: calc(100% + 2px); transform: translateX(-50%); padding: 3px 7px; border-radius: 6px;
  background: var(--text); color: #fff; font-size: 11px; pointer-events: none; opacity: 0; transition: opacity var(--t-hover) var(--ease); white-space: nowrap;
}
.is-replay-controls .progress-track:hover .progress-tip { opacity: 1; }
.is-replay-controls #progress-play::after {
  content: ""; position: absolute; right: -6px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 1px var(--line-2), 0 2px 6px rgba(15, 30, 51, 0.3); opacity: 0; transition: opacity var(--t-hover) var(--ease);
}
.is-replay-controls .progress-track:hover #progress-play::after { opacity: 1; }
.progress-bar { overflow: visible; }
.is-replay-controls #progress-sent { background: var(--soft); }
.transcript.is-replay .tr-item { cursor: pointer; }
.transcript.is-replay .tr-item:hover { background: var(--surface-2); }
.tr-item.is-current { background: var(--brand-50); }
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: #f0a21b; }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: pulse 1.6s infinite; will-change: transform, opacity; }
.status-pill[data-state="connecting"] .live-dot, .status-pill[data-state="buffering"] .live-dot, .status-pill[data-state="rebuffering"] .live-dot, .status-pill[data-state="finishing"] .live-dot { background: var(--sky-400); }
.status-pill[data-state="connecting"] .live-dot::after, .status-pill[data-state="buffering"] .live-dot::after, .status-pill[data-state="rebuffering"] .live-dot::after, .status-pill[data-state="finishing"] .live-dot::after { animation-name: pulse-blue; }
.status-pill[data-state="paused"] .live-dot { background: #ffcc00; }
.status-pill[data-state="paused"] .live-dot::after { animation: none; opacity: 0; }
.status-pill[data-state="done"] .live-dot { background: #34c759; }
.status-pill[data-state="done"] .live-dot::after { animation: none; opacity: 0; }
@keyframes pulse { 0% { transform: scale(1); opacity: 0.6; } 70%, 100% { transform: scale(3); opacity: 0; } }
@keyframes pulse-blue { 0% { transform: scale(1); opacity: 0.7; } 70%, 100% { transform: scale(3); opacity: 0; } }

/* warm-up overlay */
.warmup {
  position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; gap: 40px;
  background: radial-gradient(60% 80% at 30% 20%, rgba(47, 93, 140, 0.55), transparent 70%), rgba(7, 8, 26, 0.86);
  color: #fff; transition: opacity 0.6s var(--ease), visibility 0.6s;
}
.warmup.is-done { opacity: 0; visibility: hidden; }
.warmup-ring { position: relative; width: 120px; height: 120px; display: grid; place-items: center; }
.warmup-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.warmup-ring circle { fill: none; stroke-width: 6; }
.ring-bg { stroke: rgba(255, 255, 255, 0.12); }
.ring-fg { stroke: var(--sky-400); stroke-linecap: round; stroke-dasharray: 80 400; transform-origin: center; animation: ringspin 1.4s linear infinite; }
.warmup:has(#warmup-count:not(:empty)) .ring-fg { animation: none; transition: stroke-dashoffset 0.15s linear; }
@keyframes ringspin { to { transform: rotate(360deg); } }
#warmup-count { font-size: 38px; font-weight: 500; }
.warmup-note { min-height: 18px; margin: 2px 0 0 34px; font-size: 12px; color: var(--sky-400); }
.warmup-note.is-call {
  margin-left: 0; padding: 12px 16px; border-radius: 12px; font: 600 15px var(--font); color: #fff;
  background: var(--grad); box-shadow: 0 10px 28px -10px rgba(47, 93, 140, 0.7); animation: callpulse 1.6s ease-in-out infinite;
}
@keyframes callpulse { 50% { transform: scale(1.03); } }
.warmup-logo { animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.12); opacity: 0.75; } }
.warmup-steps { display: flex; flex-direction: column; gap: 14px; }
.wstep { display: flex; align-items: center; gap: 12px; font-size: 15px; color: rgba(255, 255, 255, 0.4); transition: color 0.4s; }
.wstep i { position: relative; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.25); transition: border-color 0.4s var(--ease), background 0.4s var(--ease); }
.wstep.is-active { color: #fff; }
.wstep.is-active i { border-color: var(--sky-400); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.wstep.is-done { color: rgba(255, 255, 255, 0.85); }
.wstep.is-done i { border-color: transparent; background: var(--grad); }
.wstep.is-done i::after {
  content: ""; position: absolute; left: 7px; top: 3.5px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg); animation: pop 0.35s var(--spring);
}
@keyframes pop { from { transform: rotate(45deg) scale(0); } }

/* subtitles */
.subtitle {
  position: absolute; z-index: 3; left: 6%; right: 6%; bottom: 28px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; opacity: 0; transform: translateY(8px); transition: opacity 0.35s var(--ease), transform 0.35s var(--ease); pointer-events: none;
}
.subtitle.is-visible { opacity: 1; transform: none; }
.subtitle-src { color: rgba(255, 255, 255, 0.78); font-size: 15px; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); max-width: min(100%, 60em); }
.subtitle-src:empty, .subtitle-dst:empty { display: none; }
.subtitle-dst {
  /* ≈ 50 characters a line: grows with the font, so in full screen it spans most of the picture */
  max-width: min(100%, 50em); padding: 8px 16px; border-radius: 12px; background: rgba(8, 10, 20, 0.74);
  color: #fff; font-size: clamp(17px, 1.7vw, 24px); font-weight: 500; line-height: 1.35; box-decoration-break: clone;
}
.w { display: inline-block; opacity: 0; transform: translateY(6px); }
.is-in .w, .tr-dst .w { animation: word 0.45s var(--ease) forwards; animation-delay: calc(var(--i) * 28ms); }
@keyframes word { to { opacity: 1; transform: none; } }

/* controls */
.controls { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-radius: var(--r-md); animation: reveal 0.6s var(--ease) both; animation-delay: 80ms; }
#btn-play .i-play { display: none; }
#btn-play.is-paused .i-play { display: block; }
#btn-play.is-paused .i-pause { display: none; }
.progress { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.progress-bar { position: relative; height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.progress-bar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; transition: width 0.25s linear; }
#progress-sent { background: var(--brand-100); }
#progress-play { background: var(--brand-400); }
.progress-time { display: flex; justify-content: space-between; color: var(--muted); }

.mix { position: relative; display: inline-flex; padding: 3px; border-radius: 12px; background: var(--soft); }
.seg {
  position: relative; z-index: 1; height: 34px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent;
  font: 500 13.5px var(--font); color: var(--muted); cursor: pointer; transition: color 0.25s; min-width: 98px;
}
.seg.is-active { color: var(--text); }
.seg-glider {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 9px; background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); transition: transform 0.4s var(--spring);
}
.mix[data-mix="dub"] .seg-glider { transform: translateX(100%); }

.meters { display: grid; grid-template-columns: 1fr 1fr 130px 130px; gap: 14px; animation: reveal 0.6s var(--ease) both; animation-delay: 140ms; }
.meter { padding: 12px 14px; border-radius: var(--r-md); display: flex; flex-direction: column; gap: 8px; }
.meter-head { display: flex; justify-content: space-between; align-items: center; }
.meter canvas { width: 100%; height: 34px; display: block; }
.stat { justify-content: space-between; }
.vol { display: flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.vol svg { flex: none; transition: color 0.2s; }
.vol:hover svg { color: var(--brand-500); }
.vol.is-muted .vol-wave { opacity: 0.2; }
.vol-val { width: 34px; text-align: right; color: var(--text-2); }
.vol input {
  --p: 50%;
  flex: 1; min-width: 0; height: 18px; margin: 0; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer;
}
.vol input::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--brand-400), var(--sky-400)) 0 / var(--p) 100% no-repeat, var(--soft); }
.vol input::-moz-range-track { height: 4px; border-radius: 99px; background: var(--soft); }
.vol input::-moz-range-progress { height: 4px; border-radius: 99px; background: linear-gradient(90deg, var(--brand-400), var(--sky-400)); }
.vol input::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 0 1px var(--line-2), 0 2px 6px rgba(15, 30, 51, 0.25); transition: transform 0.2s var(--spring);
}
.vol input::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px var(--line-2), 0 2px 6px rgba(15, 30, 51, 0.25); }
.vol input:hover::-webkit-slider-thumb, .vol input:active::-webkit-slider-thumb { transform: scale(1.25); }
.vol input:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; border-radius: 4px; }
.stat-val { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; }

/* transcript */
.transcript { display: flex; flex-direction: column; min-height: 0; overflow: hidden; animation: reveal 0.6s var(--ease) both; animation-delay: 120ms; }
.transcript-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--soft); }
.tab { height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; font: 500 12.5px var(--font); color: var(--muted); cursor: pointer; transition: color var(--t-hover), background var(--t-hover), box-shadow var(--t-hover); }
.tab.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }

.transcript-body { position: relative; flex: 1; overflow-y: auto; padding: 8px 10px 20px; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: #ced6df transparent; }
.transcript-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }

.tr-item {
  position: relative; display: grid; grid-template-columns: 44px 1fr; column-gap: 8px; row-gap: 4px;
  padding: 12px 10px; border-radius: 14px; animation: slidein 0.5s var(--ease) both;
}
.tr-item.flash { animation: slidein 0.5s var(--ease) both, flash 1.6s var(--ease); }
@keyframes slidein { from { opacity: 0; transform: translateY(10px); } }
@keyframes flash { 0% { background: var(--brand-50); } 100% { background: transparent; } }
.tr-time { grid-row: 1 / 3; padding-top: 2px; font-size: 11.5px; color: var(--dim); }
.tr-src { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.tr-dst { font-size: 15.5px; color: var(--text); font-weight: 500; line-height: 1.45; min-height: 22px; }
.tr-item:not(.has-dst) .tr-dst { opacity: 0.8; }
.is-partial {
  background: linear-gradient(90deg, var(--muted) 0%, var(--muted) 40%, var(--brand-300) 50%, var(--muted) 60%, var(--muted) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 1.8s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }

.transcript-body[data-view="dst"] .tr-src { display: none; }
.transcript-body[data-view="src"] .tr-dst { display: none; }
.transcript-body[data-view="src"] .tr-src { color: var(--text); font-size: 15px; }

.typing { display: inline-flex; gap: 4px; align-items: center; height: 22px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-300); animation: dot 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

.transcript-foot { padding: 12px 14px; border-top: 1px solid var(--line); }
.dl { display: flex; flex-wrap: wrap; gap: 6px; }

/* done sheet */
.done-sheet {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; place-items: safe center; padding: 16px; overflow-y: auto; overscroll-behavior: contain;
  background: rgba(242, 242, 242, 0.55); backdrop-filter: blur(10px); animation: fade 0.4s var(--ease) both;
}
@keyframes fade { from { opacity: 0; } }
.done-card {
  width: min(480px, 100%); padding: 36px 32px 28px; border-radius: var(--r-xl); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px; box-shadow: var(--shadow-2);
  animation: popin 0.55s var(--spring) both;
}
@keyframes popin { from { opacity: 0; transform: scale(0.92) translateY(10px); } }
.done-check { width: 72px; height: 72px; margin-bottom: 6px; }
.done-check svg { width: 100%; height: 100%; }
.done-check circle { fill: none; stroke: var(--brand-400); stroke-width: 3; stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw 0.7s var(--ease) 0.15s forwards; }
.done-check path { fill: none; stroke: var(--brand-400); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 0.45s var(--ease) 0.7s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* rewind during live */
.player-top-left { display: inline-flex; align-items: center; gap: 8px; }
.golive {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border: 0; border-radius: 10px; cursor: pointer;
  background: #f0a21b; color: #0f1e33; font: 600 13px var(--font); box-shadow: 0 6px 18px -6px rgba(240, 162, 27, 0.7);
  animation: reveal 0.4s var(--ease) both; transition: transform 0.2s var(--spring);
}
.golive:hover { transform: scale(1.04); }
.golive .live-dot { background: #fff; }
.status-pill[data-state="timeshift"] .live-dot { background: var(--orange); }
.status-pill[data-state="timeshift"] .live-dot::after { animation: none; opacity: 0; }
#progress-live {
  position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: #f0a21b;
  box-shadow: 0 0 0 3px rgba(240, 162, 27, 0.25); pointer-events: none;
}
.is-live-seekable .progress-track { cursor: pointer; touch-action: none; }
.is-live-seekable .progress-track:hover .progress-bar { height: 8px; }
.is-live-seekable .progress-track:hover .progress-tip { opacity: 1; }
.transcript { position: relative; }
.tr-live {
  position: absolute; z-index: 5; left: 50%; bottom: 72px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 0; border-radius: 99px; cursor: pointer;
  background: var(--text); color: #fff; font: 500 13px var(--font); box-shadow: 0 10px 28px -8px rgba(10, 12, 40, 0.5);
  animation: trlive 0.35s var(--spring) both;
}
.tr-live:hover { background: var(--brand-500); }
@keyframes trlive { from { opacity: 0; transform: translate(-50%, 10px) scale(0.92); } }

/* speakers */
.spk-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.spk-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--soft); }
.spk { height: 26px; min-width: 36px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; font: 500 12.5px var(--font); color: var(--muted); cursor: pointer; transition: color var(--t-hover), background var(--t-hover), box-shadow var(--t-hover); }
.spk.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }

.field-eye { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--dim); cursor: pointer; }
.field-eye:hover, .field-eye.is-on { color: var(--brand-500); background: var(--brand-50); }
a.btn { text-decoration: none; }
a.btn:hover { color: inherit; }

/* export */
.export-card { text-align: left; align-items: stretch; width: min(520px, 100%); }
.export-card h2, .export-card > p { text-align: center; }
.export-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.xopt {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 14px;
  cursor: pointer; transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.xopt:hover { border-color: var(--brand-300); }
.xopt input { position: absolute; opacity: 0; pointer-events: none; }
.xopt:has(input:checked) { border-color: var(--brand-400); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(47, 93, 140, 0.12); }
.xopt:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.xopt-ico { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--soft); color: var(--brand-500); transition: background 0.2s, color 0.2s; }
.xopt:has(input:checked) .xopt-ico { background: var(--grad); color: #fff; }
.xopt-text { display: flex; flex-direction: column; line-height: 1.35; }
.xopt-text b { font-weight: 500; }
.xprogress { margin-top: 6px; display: flex; flex-direction: column; gap: 8px; animation: reveal 0.35s var(--ease) both; }
.xprogress-label { display: flex; justify-content: space-between; font-size: 13.5px; }
.xprogress .progress-bar { height: 8px; }
#xbar { background: var(--brand-400); }
#xbar.is-indeterminate { width: 30% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.export-card .done-actions { justify-content: flex-end; }

/* still-watching */
.still-ring { position: relative; width: 84px; height: 84px; display: grid; place-items: center; margin-bottom: 4px; }
.still-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.still-ring circle { fill: none; stroke-width: 7; }
.still-ring .ring-bg { stroke: var(--soft); }
.still-fg { stroke: var(--brand-400); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.still-ring span { font-size: 22px; font-weight: 500; }
#file-duration.is-live { background: #f0a21b; color: #0f1e33; }

/* exits */
.lp-pop.is-leaving { animation: lp-out var(--t-exit) var(--ease-in) forwards; pointer-events: none; }
@keyframes lp-out { to { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.done-sheet.is-leaving { animation: fade-out 0.22s ease-in forwards; pointer-events: none; }
.done-sheet.is-leaving .done-card { animation: pop-out 0.22s ease-in forwards; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-out { to { opacity: 0; transform: scale(0.96) translateY(6px); } }

/* skeletons */
.skel {
  border-radius: var(--r-sm); color: transparent !important;
  background: linear-gradient(90deg, #e6ebf1 0%, #f2f5f8 40%, #e6ebf1 80%) 0 0 / 200% 100%;
  animation: skel 1.3s ease-in-out infinite;
}
@keyframes skel { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.skel-row { height: 44px; border-radius: 12px; }
.skel-row + .skel-row { margin-top: 6px; }

.select > select { display: none; } /* the language pickers stand in for the native selects */
.lp-skel { height: 52px; }
.user.is-loading .user-name { color: transparent; border-radius: 6px; background: linear-gradient(90deg, #e6ebf1, #f2f5f8, #e6ebf1) 0 0 / 200% 100%; animation: skel 1.3s ease-in-out infinite; }
.user.is-loading .avatar { background: #e6ebf1; color: transparent; }
.balance.is-loading span { color: transparent; border-radius: 6px; background: linear-gradient(90deg, #e6ebf1, #f2f5f8, #e6ebf1) 0 0 / 200% 100%; animation: skel 1.3s ease-in-out infinite; }
.dz-preview.is-loading::after {
  content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.18) 50%, rgba(255,255,255,0) 100%) 0 0 / 200% 100%;
  animation: skel 1.1s ease-in-out infinite;
}
.vp-play.is-loading .i-play, .vp-play.is-loading .eq { display: none; }
.vp-play.is-loading::after { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }

/* toast */
.toast {
  position: fixed; z-index: 100; left: 50%; bottom: 24px; max-width: min(560px, calc(100vw / var(--z) - 32px));
  padding: 12px 18px; border-radius: 14px; background: var(--text); color: #fff; font-size: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25); transform: translate(-50%, 20px); opacity: 0;
  transition: transform 0.35s var(--spring), opacity 0.25s;
}
.toast.is-in { transform: translate(-50%, 0); opacity: 1; }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1100px) {
  .view--signin { grid-template-columns: 1fr; }
  .signin-card { min-height: auto; }
  .live-grid { grid-template-columns: 1fr; height: auto; }
  .player { min-height: 0; aspect-ratio: 16 / 9; flex: none; }
  .transcript { height: 520px; }
}

@media (max-width: 820px) {
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meters { grid-template-columns: 1fr 1fr; }
  .controls { flex-wrap: wrap; }
  .progress { order: 3; flex-basis: 100%; }
  .user-name, .tag { display: none; }
  .topbar { padding: 0 16px; gap: 10px; }
  .stage { padding-left: 16px; padding-right: 16px; }
  .warmup { flex-direction: column; gap: 20px; }
  .lang-row { flex-direction: column; align-items: stretch; }
  .lang-row .select { width: 100%; }
  .swap { align-self: center; margin: 0; transform: rotate(90deg); }
  .warmup-ring { width: 84px; height: 84px; }
  #warmup-count { font-size: 28px; }
  .wstep { font-size: 13px; }
}

@media (max-width: 520px) {
  .topbar .logo img + img { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  /* Loading indicators keep telling that something is going on — slowly, without travel. */
  .btn.is-loading::before, .wstep.is-active i, .ring-fg, .vp-play.is-loading::after { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}

/* Something that just appeared because the layout changed (see smoothLayout in ui.js). */
.fade-in { animation: appear var(--t-layout) var(--ease) both; }
@keyframes appear { from { opacity: 0; } }

/* Exits for things that animate in (hidden through leave() in ui.js). */
.replay-pill.is-leaving, #tr-live.is-leaving, #btn-golive.is-leaving, .dz-url-error.is-leaving, .xprogress.is-leaving {
  animation: fade-down var(--t-exit) var(--ease-in) forwards; pointer-events: none;
}
@keyframes fade-down { to { opacity: 0; transform: translateY(6px); } }

/* ---------- accounts (email + password) ---------- */
.auth-tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 12px; background: var(--soft); margin-top: 6px; }
.auth-tab {
  position: relative; z-index: 1; height: 38px; border: 0; background: transparent; border-radius: 9px;
  font: 500 14px var(--font); color: var(--muted); cursor: pointer; transition: color 0.25s;
}
.auth-tab.is-active { color: var(--text); }
.auth-glider {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 9px; background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); transition: transform 0.4s var(--spring);
}
.auth-tabs[data-mode="register"] .auth-glider { transform: translateX(100%); }
.auth-form .btn--primary { margin-top: 6px; }
.balance-sub { color: var(--muted); font-weight: 400; }

/* ---------- Booth wordmark ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.wordmark { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1; letter-spacing: -0.045em; }
.logo--lg .wordmark { font-size: 34px; }
.logo:hover { color: var(--text); }
/* the start button carries the tally light */
#btn-start svg { color: var(--orange); }

/* ---------- sign-in extras, top bar links ---------- */
.btn--google { gap: 10px; text-decoration: none; color: var(--text); }
.oauth-block { display: flex; flex-direction: column; gap: 14px; }
.site-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.site-links a { color: var(--muted); text-decoration: none; }
.site-links a:hover { color: var(--brand-400); text-decoration: underline; }
.topbar-link { font-size: 14px; font-weight: 500; color: var(--text-2); text-decoration: none; padding: 8px 10px; border-radius: 10px; }
.topbar-link:hover { background: var(--surface); color: var(--brand-400); }

/* ---------- account sheet, reset ---------- */
.user[role="button"] { cursor: pointer; }
.account-card { max-width: 440px; text-align: left; align-items: stretch; gap: 14px; }
.account-card h2 { text-align: left; }
.account-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.account-rows > div { padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; }
.account-rows b { font-size: 17px; color: var(--text); }
.account-danger { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.account-danger summary { display: flex; align-items: center; gap: 8px; cursor: pointer; color: var(--warn); font-weight: 600; font-size: 14px; list-style: none; }
.account-danger summary::-webkit-details-marker { display: none; }
.account-danger summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); transition: transform var(--t-ui) var(--ease); }
.account-danger[open]:not(.is-closing) summary::after { transform: translateY(1px) rotate(225deg); }
.account-danger[open] { gap: 10px; }
.account-danger-body { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
.btn--danger { color: #9a3412; }
.btn--danger:not(:disabled):hover { background: #fde4dc; }
.auth-forgot { text-align: center; }
.free-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin-left: 8px; border-radius: 99px; background: var(--orange); color: var(--brand-700); font-size: 12px; font-weight: 700; }

/* ---------- subtitles / AI dubbing choice ---------- */
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card {
  display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 13px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--line-2); border-radius: 14px; background: var(--surface); color: var(--text);
  font: inherit; transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.mode-card:hover { border-color: var(--brand-300); }
.mode-card:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; }
.mode-card.is-active { border-color: var(--brand-700); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(15, 30, 51, 0.06); }
.mode-head { display: flex; align-items: center; gap: 8px; }
.mode-head b { font-size: 15.5px; white-space: nowrap; }
.mode-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--soft); color: var(--brand-400); flex: none; }
.mode-card.is-active .mode-ico { background: var(--brand-700); color: var(--orange); }
.mode-desc { font-size: 13px; line-height: 1.4; color: var(--muted); }
@media (max-width: 520px) { .mode-pick { grid-template-columns: 1fr; } }

/* ---------- share a tab ---------- */
.dz-tab #tab-hint { font-size: 12px; }
.tab-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.tab-mode { position: relative; cursor: pointer; display: flex; }
.tab-mode input { position: absolute; opacity: 0; pointer-events: none; }
.tab-mode span {
  flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; text-align: left;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); transition: border-color 0.2s, background 0.2s;
}
.tab-mode b { font-weight: 600; font-size: 14px; }
.tab-mode small { font-size: 12px; line-height: 1.4; color: var(--muted); }
.tab-mode:hover span { border-color: var(--brand-300); }
.tab-mode input:checked + span { border-color: var(--brand-500); background: var(--brand-50); box-shadow: inset 0 0 0 1px var(--brand-500); }
.tab-mode input:focus-visible + span { outline: 2px solid var(--brand-500); outline-offset: 2px; }

/* ---------- wide view: the player across the page, one row of controls under it ---------- */
.wide-btn .i-narrow { display: none; }
.is-wide .wide-btn .i-wide { display: none; }
.is-wide .wide-btn .i-narrow { display: block; }
.wide-btn[aria-pressed="true"] { color: var(--brand-400); background: var(--brand-50); }
.is-wide .live-grid { grid-template-columns: minmax(0, 1fr); }
.is-wide .transcript, .is-wide .meters .stat { display: none; }
.is-wide .player-col { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr) auto; gap: 14px; }
.is-wide .player { grid-column: 1 / -1; min-height: 0; }
.is-wide .controls { grid-column: 1; }
.is-wide .meters { grid-column: 2; grid-template-columns: repeat(2, 220px); gap: 10px; animation: none; }
.is-wide .meter { padding: 8px 12px; gap: 4px; justify-content: center; }
.is-wide .meter canvas { height: 18px; }

/* ---------- subtitles only: no translated voice to mix or turn up ---------- */
.is-subs .mix, .is-subs .meter--dst { display: none; }
.is-subs .meters { grid-template-columns: 1fr 130px 130px; }
.is-subs.is-wide .meters { grid-template-columns: 220px; }

@media (max-width: 1100px) {
  .is-wide .player-col { grid-template-columns: minmax(0, 1fr); }
  .is-wide .controls, .is-wide .meters { grid-column: 1; }
  .is-wide .meters { grid-template-columns: 1fr 1fr; }
}

/* ---------- full screen: the player (video + subtitles) fills the screen, controls float over it ---------- */
.fs-btn .i-fs-off { display: none; }
.player.is-fs .fs-btn .i-fs-on { display: none; }
.player.is-fs .fs-btn .i-fs-off { display: block; }
.player:fullscreen { width: calc(100vw / var(--z)); height: calc(100vh / var(--z)); border-radius: 0; box-shadow: none; animation: none; }
.player.is-fs .controls {
  position: absolute; z-index: 5; left: 24px; right: 24px; bottom: 20px; animation: none;
  background: rgba(10, 21, 38, 0.9); color: #e3e8ef; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.player.is-fs .controls .progress-time, .player.is-fs .controls .icon-btn:not(.icon-btn--lg) { color: #e3e8ef; }
.player.is-fs .controls .icon-btn:not(.icon-btn--lg):hover { background: rgba(255, 255, 255, 0.12); }
.player.is-fs .controls .mix { background: rgba(255, 255, 255, 0.12); }
.player.is-fs .controls .seg { color: #b9c6d6; }
.player.is-fs .controls .seg.is-active { color: var(--text); }
.player.is-fs .controls .wide-btn { display: none; }
.player.is-fs .subtitle { bottom: 112px; transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), bottom 0.3s var(--ease); }
.player.is-fs .subtitle-dst { font-size: clamp(22px, 2.2vw, 40px); }
.player.is-fs .subtitle-src { font-size: clamp(15px, 1.3vw, 24px); }
.player.is-fs.is-idle { cursor: none; }
.player.is-fs.is-idle .controls { opacity: 0; transform: translateY(12px); pointer-events: none; }
.player.is-fs.is-idle .subtitle { bottom: 48px; }

/* First-visit tips: hand-drawn notes that walk a newcomer through the setup without getting in the way
   (no dialogs). They go away by themselves after two translations, or with "hide tips". */
@font-face { font-family: "Caveat"; src: url("../assets/fonts/caveat-600-latin.woff2") format("woff2"); font-weight: 600; font-display: swap; }
.doodle {
  display: inline-flex; align-items: flex-end; gap: 4px; pointer-events: none; color: var(--brand-400);
  font: 600 25px/1 "Caveat", "Comic Sans MS", cursive; white-space: nowrap; transition: opacity 0.3s, color 0.3s;
}
.doodle-arrow { flex: none; width: auto; height: 40px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.doodle-x {
  pointer-events: auto; align-self: center; margin-left: 10px; padding: 2px 6px; border: 0; border-radius: 6px; background: none;
  font: 500 11.5px var(--font); color: var(--dim); cursor: pointer; text-decoration: underline dotted;
}
.doodle-x:hover { color: var(--text); }
.dz-src-wrap { position: relative; }
.doodle--1 { position: absolute; top: calc(100% + 2px); left: 34%; transform: rotate(-3deg); }
.doodle--1 span { margin-bottom: -6px; }
.settings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; min-height: 30px; }
.doodle--2 { transform: rotate(2deg) translateY(4px); margin-right: 30%; }
.doodle--2 .doodle-arrow { transform: scaleX(-1) translateY(10px); }
.doodle--2 span { margin-bottom: 14px; }
.doodle--start { align-self: flex-end; margin: -8px 18px -10px 0; transform: rotate(-3deg); }
.doodle--3 span { margin-bottom: 18px; }
.no-tips .doodle { display: none; }
@media (max-width: 720px) { .doodle { display: none; } }

/* Interface language: the page stays hidden for a moment until it's translated (see i18n-boot.js). */
html.i18n-wait body, html.fonts-wait body { visibility: hidden; }
.lang-switch { position: relative; display: inline-flex; vertical-align: middle; }
.ls-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 9px 0 7px; border: 1px solid transparent; border-radius: 9px;
  background: none; cursor: pointer; font: 500 13px var(--font); color: var(--muted); transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.ls-btn:hover, .ls-btn[aria-expanded="true"] { color: var(--text); background: var(--surface-2); }
.ls-flag { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.ls-badge { display: inline-grid; place-items: center; font: 700 8.5px var(--font); letter-spacing: 0.02em; color: #fff; background: var(--brand-400); }
.ls-chev { width: 12px; height: 12px; opacity: 0.6; transition: transform var(--t-ui) var(--ease); }
.ls-btn[aria-expanded="true"] .ls-chev { transform: rotate(180deg); }
.ls-menu {
  position: absolute; z-index: 50; top: calc(100% + 6px); right: 0; min-width: 180px; padding: 6px; display: grid; gap: 2px;
  border-radius: 12px; background: var(--surface); box-shadow: 0 2px 6px rgba(10, 12, 40, 0.06), 0 18px 44px rgba(15, 30, 51, 0.16);
  transform-origin: top right; animation: lp-in 0.28s var(--ease);
}
.ls-menu.is-leaving { animation: lp-out var(--t-exit) var(--ease-in) forwards; pointer-events: none; }
.lang-switch.is-up .ls-menu { transform-origin: bottom center; animation-name: lp-in-up; }
.lang-switch.is-up .ls-menu { top: auto; bottom: calc(100% + 6px); }
.signin-foot .ls-menu, .site-foot .ls-menu { right: auto; left: 50%; translate: -50% 0; }
.ls-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  font: 500 14px var(--font); color: var(--text); text-align: left;
}
.ls-item:hover, .ls-item:focus-visible { background: var(--surface-2); outline: none; }
.ls-item[aria-selected="true"] { color: var(--brand-500); background: var(--brand-50); }
.site-links { align-items: center; }
#btn-pip[aria-pressed="true"] { color: var(--brand-400); }

/* Phones: the top bar keeps only what fits — logo, language (flag only), balance, account. Pricing and
   admin stay reachable from the account menu and the sign-in page. */
@media (max-width: 640px) {
  .topbar .topbar-link { display: none; }
  .topbar .ls-btn > span:not(.ls-flag) { display: none; }
  .topbar .balance-sub { display: none; }
  .topbar .wordmark { display: none; }
  .ls-menu { right: 0; left: auto; }
}

/* ---------- Setup screen: what (source cards) → its details → how → summary with the one action ---------- */
.stage--setup { max-width: 1120px; padding-top: 18px; padding-bottom: 16px; }
.eyebrow { font: 500 13px var(--mono); color: var(--brand-400); letter-spacing: 0.04em; text-transform: uppercase; }
.stage--setup .setup-head { text-align: left; max-width: none; margin: 0 0 14px; gap: 4px; }
.stage--setup .setup-head h1 { font-size: 34px; line-height: 1.05; letter-spacing: -0.03em; font-weight: 800; }

.dz-src.src-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.dz-src .src-card {
  position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 14px; row-gap: 2px; align-items: center; padding: 14px 16px;
  border: 2px solid var(--soft); border-radius: 20px; background: var(--surface); text-align: left; font: inherit; color: var(--text); cursor: pointer;
  transition: border-color var(--t-ui) var(--ease), box-shadow var(--t-ui) var(--ease), transform var(--t-hover) var(--ease);
}
.dz-src .src-card:hover { border-color: var(--brand-300); transform: translateY(-1px); }
.dz-src .src-card[aria-selected="true"] { border-color: var(--brand-400); background: var(--surface); box-shadow: 0 12px 32px -16px rgba(47, 93, 140, 0.45); }
.src-ico { grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-400); transition: background var(--t-ui) var(--ease), color var(--t-ui) var(--ease); }
.src-card[aria-selected="true"] .src-ico { background: var(--brand-400); color: #fff; }
.src-card b { font-size: 17px; font-weight: 700; align-self: end; }
.src-desc { font-size: 13px; line-height: 1.35; color: var(--muted); align-self: start; }
.src-chip { position: absolute; top: 10px; right: 12px; padding: 2px 8px; font-size: 11px !important; border-radius: 999px; background: #fff3dc; color: var(--amber-ink); font-size: 12px; font-weight: 600; }

/* The chosen source's details: a drop row for files, the link field, the tab modes, or the picked file. */
.stage--setup .dropzone { min-height: 0; display: block; margin: 12px 0 14px; padding: 12px 14px; cursor: default; }
.stage--setup .dropzone:not(:has(.dz-panel--file:not([hidden])))::before,
.stage--setup .dropzone:not(:has(.dz-panel--file:not([hidden])))::after { display: none; }
.stage--setup .dropzone:has(.dz-panel--file:not([hidden])) { cursor: pointer; }
.stage--setup .dz-empty { width: 100%; align-items: stretch; text-align: left; gap: 0; }
.stage--setup .dz-panel { padding: 0; align-items: stretch; justify-content: flex-start; gap: 10px; }
.dz-panel--file { flex-direction: row; align-items: center !important; gap: 16px !important; padding: 6px 10px !important; }
.dz-panel--file .dz-icon { width: 44px; height: 44px; border-radius: 13px; margin: 0; flex: none; }
.dz-panel--file .dz-icon svg { width: 22px; height: 22px; }
.dz-text h3 { margin: 0 0 4px; font-size: 18px; }
.dz-text p { margin: 0; }
.stage--setup .dz-panel .dz-url { height: 46px; width: 100%; }
.stage--setup .dz-file { flex-direction: row; align-items: center; gap: 20px; }
.stage--setup .dz-preview { width: 144px; flex: none; border-radius: 12px; }
.stage--setup .dz-meta { flex: 1; min-width: 0; }

.stage--setup .setup-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 20px; }
.stage--setup .settings { padding: 22px; gap: 14px; }
.settings-head .eyebrow { align-self: center; }

.card.summary { display: flex; flex-direction: column; gap: 12px; padding: 22px; border-radius: 22px; background: var(--brand-700); color: #fff; box-shadow: var(--shadow-2); }
.summary .eyebrow { color: #8fb7e0; }
.sum-title { font-size: 22px; font-weight: 700; line-height: 1.25; }
.summary .estimate { color: #b6c4d6; font-size: 14px; line-height: 1.45; }
.summary .estimate b { color: #fff; font-weight: 600; }
.summary .estimate.is-warn { color: #f7c56b; }
.sum-space { flex: 1; }
.summary .btn--primary { background: var(--orange); color: var(--brand-700); box-shadow: 0 10px 28px -10px rgba(240, 162, 27, 0.6); }
.summary .btn--primary:hover { box-shadow: 0 14px 32px -10px rgba(240, 162, 27, 0.75); }
.sum-note { margin: 0; font-size: 13px; line-height: 1.45; color: #8fa3bb; text-align: center; }
.sum-note:empty { display: none; }

/* Tips, placed for this layout. */
.stage--setup .dz-src-wrap { position: relative; }
.stage--setup .doodle--1 { top: -64px; left: auto; right: 2%; }
.stage--setup .doodle--1 .doodle-arrow { transform: scaleY(-1) translateY(-14px); }
.stage--setup .doodle--1 span { margin-bottom: 26px; }
.summary .doodle { color: #8fb7e0; }
/* Once a source is in, step 1 is done: it fades and the last step takes the colour. */
.stage--setup:has(.dropzone.has-file) .doodle--1 { opacity: 0; }
.stage--setup:has(.dropzone.has-file) .summary .doodle--start { color: var(--orange); }

@media (max-width: 900px) {
  .stage--setup .setup-grid { grid-template-columns: minmax(0, 1fr); }
  .stage--setup .setup-head h1 { font-size: 32px; }
}
@media (max-width: 640px) {
  .stage--setup .dz-file { flex-direction: column; align-items: stretch; }
  .stage--setup .dz-preview { width: 100%; }
  .dz-src .src-card .src-chip { display: none; }
}
.mode-note { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: -4px 2px 0; font-size: 14px; color: var(--muted); }
.price-chip { padding: 3px 9px; border-radius: 8px; background: var(--orange); color: var(--brand-700); font: 600 13px var(--mono); }

/* ---------- Translation screen: dark, the picture first (the palette flips; components follow) ---------- */
body:has(#stage-live:not([hidden])) {
  --bg: #0b1626; --surface: #13243b; --surface-2: #1a2f4c; --soft: #22405f;
  --text: #ffffff; --text-2: #c9d6e5; --muted: #8fa3bb; --dim: #6b7f98;
  --line: rgba(255, 255, 255, 0.08); --line-2: rgba(255, 255, 255, 0.16);
  --brand-50: rgba(143, 183, 224, 0.12); --brand-100: rgba(143, 183, 224, 0.22); --brand-300: #5f86b0; --brand-500: #8fb7e0;
  --grad: linear-gradient(0deg, #2f5d8c, #2f5d8c);
  --shadow-1: none; --shadow-2: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
  background: var(--bg); color: var(--text);
}
body:has(#stage-live:not([hidden])) .topbar { background: transparent; border-color: var(--line); }
body:has(#stage-live:not([hidden])) .card { border-color: var(--line); }
body:has(#stage-live:not([hidden])) .transcript-body .tr-item.is-current { background: rgba(143, 183, 224, 0.12); box-shadow: inset 0 0 0 1px rgba(143, 183, 224, 0.35); }
.warmup-note.is-call { background: #2f5d8c; }

/* The result card stays light over the dark screen. */
.done-card {
  --bg: #f5f7fa; --surface: #ffffff; --surface-2: #f0f3f7; --soft: #e3e8ef; --text: #0f1e33; --text-2: #34445a; --muted: #4d5c6e; --dim: #8e9aa8;
  --line: rgba(15, 30, 51, 0.08); --line-2: rgba(15, 30, 51, 0.14); --brand-50: #eaf0f6; --brand-100: #d3dfeb; --brand-300: #8ca9c8; --brand-500: #24497a;
  --grad: linear-gradient(0deg, #0f1e33, #0f1e33);
  color: var(--text);
}
.done-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; width: 100%; margin-top: 4px; }
.done-stats:empty { display: none; }
.done-stat { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; background: var(--surface-2); text-align: left; }
.done-stat b { font-size: 22px; font-weight: 700; }
.done-stat span { font-size: 13px; color: var(--muted); }
body:has(#stage-live:not([hidden])) .icon-btn--lg { background: #ffffff; color: #0f1e33; }
body:has(#stage-live:not([hidden])) .icon-btn--lg:hover { background: #8fb7e0; color: #0f1e33; }
body:has(#stage-live:not([hidden])) .done-sheet { background: rgba(5, 10, 20, 0.6); }
.transcript-head { flex-wrap: wrap; }
.transcript-head h3 { flex: 1 1 auto; }

/* ---------- Account sheet: the balance up front, top-ups right there ---------- */
.acc-balance { display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: 20px; background: #0f1e33; color: #fff; }
.acc-balance .eyebrow { color: #8fb7e0; }
.acc-balance > b { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; }
.acc-sub { font-size: 14px; color: #b6c4d6; }
.acc-topup { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.acc-topup:empty { display: none; }
.acc-pack {
  position: relative; height: 46px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.2); background: transparent; color: #fff;
  font: 600 14px var(--font); cursor: pointer; transition: background var(--t-hover), border-color var(--t-hover);
}
.acc-pack:hover { background: rgba(255, 255, 255, 0.08); }
.acc-pack.is-featured { border: 0; background: var(--orange); color: #0f1e33; font-weight: 700; }
.acc-pack.is-loading { opacity: 0.6; pointer-events: none; }
.account-rows { grid-template-columns: 1fr; }

/* ---------- Sign-in: the right side is the dark showcase ---------- */
.signin-hero {
  --text: #ffffff; --text-2: #c9d6e5; --muted: #b6c4d6; --dim: #8fa3bb; --line: rgba(255, 255, 255, 0.1);
  --brand-50: rgba(255, 255, 255, 0.08); --brand-100: rgba(255, 255, 255, 0.14); --brand-700: #ffffff;
  margin: 8px 8px 8px 0; border-radius: var(--r-xl); background: #0f1e33; color: var(--text);
  align-items: flex-start; text-align: left; padding: 44px 56px; gap: 18px;
}
.signin-hero .hero-title { font-weight: 800; letter-spacing: -0.035em; font-size: 46px; line-height: 1.04; max-width: 600px; }
.signin-hero .grad-text { background: none; -webkit-text-fill-color: #8fb7e0; color: #8fb7e0; }
.signin-hero .hero-sub { color: #b6c4d6; font-size: 18px; max-width: 540px; }
.signin-hero .features { display: flex; flex-wrap: wrap; gap: 10px; max-width: 100%; margin-top: 4px; }
.signin-hero .features li { flex-direction: row; gap: 8px; padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 13.5px; color: #fff; text-align: left; }
.signin-hero .feat-ico { width: auto; height: auto; background: none; box-shadow: none; color: #8fb7e0; }
.signin-hero .feat-ico svg { width: 18px; height: 18px; }
.signin-hero .chip { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.14); color: #fff; }
.signin-hero .chip--brand { background: rgba(143, 183, 224, 0.18); border-color: rgba(143, 183, 224, 0.3); }
@media (max-width: 900px) { .signin-hero { margin: 0 8px 8px; padding: 32px 20px; } .signin-hero .hero-title { font-size: 34px; } }

/* The selection frame glides from card to card (Motion board: "the frame flows to the chosen card"). */
.src-cards { position: relative; }
.src-frame {
  position: absolute; z-index: 1; top: 0; left: 0; border: 2px solid var(--brand-400); border-radius: 20px; pointer-events: none;
  box-shadow: 0 12px 32px -16px rgba(47, 93, 140, 0.45);
  transition: transform var(--t-layout) var(--ease), width var(--t-layout) var(--ease), height var(--t-layout) var(--ease);
}
.src-cards.has-frame .src-card[aria-selected="true"] { border-color: var(--soft); box-shadow: none; }

/* Compact setup: everything fits a laptop screen; one motion per change (the layout glide, no extra reveal). */
.stage--setup .dz-panel { animation: none; }
.sum-title { font-size: 20px; }

.stage--setup .tab-mode span { padding: 10px 12px; }
.dz-src .src-chip { top: -9px; right: 14px; }
.stage--setup .settings-head { min-height: 0; position: relative; }
.stage--setup .settings-head .doodle--2 { position: absolute; left: 46%; top: -14px; margin: 0; }
.stage--setup .settings { gap: 12px; }
.stage--setup .mode-card { padding: 11px 13px; gap: 4px; }

.stage--setup .tab-mode span { padding: 9px 12px; gap: 2px; }
.dz-src .src-chip { z-index: 2; }

/* The source details row keeps one height whatever the source, so switching File / Website / Stream never
   moves the rest of the page: only its inside changes (it can still grow for a long error message). */
.stage--setup .dropzone { min-height: 112px; display: flex; align-items: center; box-sizing: border-box; }
.stage--setup .dropzone > .dz-empty, .stage--setup .dropzone > .dz-file { width: 100%; }
.stage--setup .dz-panel .dz-url-hint, .stage--setup .tab-modes + #tab-hint { margin: 0; }
.stage--setup .dz-panel { gap: 8px; }
/* Step and title on one line. */
.stage--setup .setup-head { flex-direction: row; align-items: baseline; flex-wrap: wrap; column-gap: 16px; }
.stage--setup .setup-head .eyebrow { order: 2; }
.stage--setup { padding-top: 12px; }
.stage--setup .doodle--1 { top: -46px; }

/* ---------- "How it works": three looping scenes (js/howto.js switches data-scene) ---------- */
.howto { width: min(540px, 100%); display: flex; flex-direction: column; gap: 14px; }
.howto-screen {
  position: relative; aspect-ratio: 16 / 9; border-radius: 22px; overflow: hidden;
  background: radial-gradient(120% 90% at 30% 20%, #23466e 0%, #18304f 55%, #12253d 100%); color: #fff;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.6);
}
.hs { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; opacity: 0; transform: translateY(8px); transition: opacity var(--t-layout) var(--ease), transform var(--t-layout) var(--ease); pointer-events: none; }
.howto[data-scene="1"] .hs-1, .howto[data-scene="2"] .hs-2, .howto[data-scene="3"] .hs-3 { opacity: 1; transform: none; }

/* 1 · choose: a cursor picks "Website or call", the shared tab appears */
.hs-cards { display: flex; gap: 10px; }
.hs-card {
  width: 118px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.07); border: 2px solid rgba(255, 255, 255, 0.12); font-size: 12.5px; text-align: center;
}
.hs-card b { font-weight: 600; }
.hs-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.1); color: #8fb7e0; }
.hs-tab { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.1); font-size: 13px; opacity: 0; }
.hs-tab-dot { width: 8px; height: 8px; border-radius: 50%; background: #f0a21b; }
.hs-cursor { position: absolute; left: 80%; top: 86%; width: 26px; height: 26px; opacity: 0; }
.howto[data-scene="1"] .hs-cursor { animation: hs-cursor 2s var(--ease) 0.3s forwards; }
.howto[data-scene="1"] .hs-card--tab { animation: hs-pick 0.5s var(--ease) 1.75s forwards; }
.howto[data-scene="1"] .hs-card--tab .hs-ico { animation: hs-pick-ico 0.5s var(--ease) 1.75s forwards; }
.howto[data-scene="1"] .hs-tab { animation: hs-up 0.5s var(--ease) 2.4s forwards; }
@keyframes hs-cursor {
  0% { opacity: 0; left: 80%; top: 86%; }
  15% { opacity: 1; }
  70% { left: 29%; top: 60%; transform: none; }
  80% { left: 29%; top: 60%; transform: scale(0.82); }
  100% { opacity: 1; left: 29%; top: 60%; transform: none; }
}
@keyframes hs-pick { to { border-color: #8fb7e0; background: rgba(143, 183, 224, 0.16); transform: translateY(-2px); } }
@keyframes hs-pick-ico { to { background: #2f5d8c; color: #fff; } }
@keyframes hs-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 2 · languages and voice: the target language decodes in, the switch flips to the voice */
.hs-langs { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 600; }
.hs-lang { padding: 9px 16px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.14); min-width: 4ch; text-align: center; }
.hs-lang--to { background: rgba(143, 183, 224, 0.18); border-color: rgba(143, 183, 224, 0.35); }
.hs-arrow { color: #8fb7e0; }
.hs-mode { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.08); font-size: 13.5px; font-weight: 600; }
.hs-seg { position: relative; z-index: 1; padding: 8px 18px; text-align: center; color: rgba(255, 255, 255, 0.6); }
.hs-glider { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 9px; background: #fff; }
.hs-seg:first-child { color: #0f1e33; }
.howto[data-scene="2"] .hs-glider { animation: hs-glide 0.5s var(--spring) 2.2s forwards; }
.howto[data-scene="2"] .hs-seg:first-child { animation: hs-off 0.3s ease 2.25s forwards; }
.howto[data-scene="2"] .hs-seg:last-child { animation: hs-on 0.3s ease 2.25s forwards; }
@keyframes hs-glide { to { transform: translateX(100%); background: #f0a21b; } }
@keyframes hs-off { to { color: rgba(255, 255, 255, 0.6); } }
@keyframes hs-on { to { color: #0f1e33; } }

/* 3 · watch: the sound plays, the original line, then the translation word by word and the voice */
.hs-3 { justify-content: flex-end; padding-bottom: 7%; }
.hs-wave { position: absolute; left: 0; right: 0; top: 24%; display: flex; justify-content: center; align-items: center; gap: 5px; height: 64px; }
.hs-wave i { width: 4px; height: 100%; border-radius: 4px; background: rgba(255, 255, 255, 0.55); transform: scaleY(0.25); }
.howto[data-scene="3"] .hs-wave i { animation: hs-bar 1.1s ease-in-out infinite; }
.hs-wave i:nth-child(3n) { animation-duration: 0.85s !important; }
.hs-wave i:nth-child(4n+1) { animation-duration: 1.3s !important; }
.hs-wave i:nth-child(5n+2) { animation-duration: 0.7s !important; }
@keyframes hs-bar { 50% { transform: scaleY(1); } }
.hs-live { position: absolute; top: 14px; left: 14px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 8px; background: rgba(0, 0, 0, 0.35); font: 600 11px var(--mono); }
.hs-delay { position: absolute; top: 14px; right: 14px; padding: 4px 9px; border-radius: 8px; background: rgba(0, 0, 0, 0.35); font-size: 11px; color: #b6c4d6; }
.hs-voice { position: absolute; right: 16px; bottom: 18px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #f0a21b; color: #0f1e33; opacity: 0; }
.howto[data-scene="3"] .hs-voice { animation: hs-up 0.4s var(--ease) 1.6s forwards, hs-pulse 1.4s ease-in-out 2s infinite; }
@keyframes hs-pulse { 50% { box-shadow: 0 0 0 8px rgba(240, 162, 27, 0.25); } }
.hs-sub { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 86%; text-align: center; }
.hs-src { font-size: 13px; color: rgba(255, 255, 255, 0.75); opacity: 0; }
.hs-dst { padding: 7px 14px; border-radius: 10px; background: rgba(8, 10, 20, 0.78); font-size: 17px; font-weight: 600; line-height: 1.35; }
.hs-dst span { display: inline-block; opacity: 0; transform: translateY(5px); }
.howto[data-scene="3"] .hs-src { animation: hs-up 0.4s var(--ease) 0.3s forwards; }
.howto[data-scene="3"] .hs-dst span { animation: word 0.45s var(--ease) forwards; animation-delay: calc(1.4s + var(--i) * 110ms); }

/* captions and dots */
.howto-cap { display: none; align-items: flex-start; gap: 12px; animation: hs-up var(--t-ui) var(--ease); }
.howto[data-scene="1"] .howto-cap[data-s="1"], .howto[data-scene="2"] .howto-cap[data-s="2"], .howto[data-scene="3"] .howto-cap[data-s="3"] { display: flex; }
.howto-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #f0a21b; color: #0f1e33; font: 700 14px var(--font); }
.howto-cap b { display: block; font-size: 16px; }
.howto-cap span:not(.howto-n) { font-size: 14px; color: var(--muted); }
.howto-dots { display: flex; gap: 6px; }
.howto-dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 99px; background: var(--line-2); cursor: pointer; transition: width var(--t-ui) var(--ease), background var(--t-ui); }
.howto-dots button[aria-selected="true"] { width: 22px; background: #f0a21b; }
@media (max-width: 640px) { .hs-card { width: 92px; font-size: 11px; } .hs-langs { font-size: 15px; } .hs-dst { font-size: 14px; } }
.howto-wrap { width: min(540px, 100%); }
.howto-wrap .howto, .hs-voice { bottom: auto; top: 46px; right: 14px; }

/* "?" in the top bar and the guide sheet */
.help-btn { width: 38px; height: 38px; color: var(--muted); }
.help-btn:hover { color: var(--text); }
.guide-card { width: min(640px, 100%); max-width: none; align-items: stretch; text-align: left; gap: 16px; }
.guide-card h2 { text-align: left; }
.guide-tabs { position: relative; display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.guide-tabs button { flex: 1 1 auto; padding: 8px 12px; border: 0; border-radius: 9px; background: transparent; font: 500 13.5px var(--font); color: var(--muted); cursor: pointer; transition: background var(--t-hover), color var(--t-hover); }
.guide-tabs button:hover { color: var(--text); }
.guide-tabs button { position: relative; z-index: 1; }
.guide-tabs button[aria-selected="true"] { color: var(--text); }
/* The white pill under the chosen tab glides from tab to tab (app.js sets its box). */
.guide-pill {
  position: absolute; top: 0; left: 0; width: 0; height: 0; border-radius: 9px; background: var(--surface); box-shadow: 0 1px 3px rgba(15, 30, 51, 0.12);
  transition: transform var(--t-layout) var(--ease), width var(--t-layout) var(--ease), height var(--t-layout) var(--ease);
}
/* All panels share one grid cell: the card is as tall as the tallest and never changes size on a switch. */
.guide-panels { display: grid; }
.guide-panel {
  grid-area: 1 / 1; opacity: 0; visibility: hidden;
  transition: opacity var(--t-layout) var(--ease), visibility 0s linear var(--t-layout);
}
.guide-panel.is-on { opacity: 1; visibility: visible; transition: opacity var(--t-layout) var(--ease), visibility 0s; }
.guide-panels.is-instant .guide-panel { transition: none; }
@media (prefers-reduced-motion: reduce) { .guide-pill, .guide-panel, .guide-panel.is-on { transition: none; } }
.guide-steps, .guide-keys { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.guide-steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.5; color: var(--text-2); }
.guide-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-50); color: var(--brand-400); font: 700 13px var(--font); margin-top: 1px; }
.guide-note { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; color: var(--muted); }
.guide-keys li { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr); gap: 14px; align-items: baseline; font-size: 14.5px; color: var(--text-2); }
.guide-keys kbd, .guide-key { justify-self: start; padding: 3px 9px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); font: 600 13px var(--mono); color: var(--text); box-shadow: 0 1px 0 var(--line-2); }
@media (max-width: 640px) { .guide-keys li { grid-template-columns: 1fr; gap: 4px; } }
.guide-key { font: 600 13px var(--font) !important; }

/* Sign in / Create account: the notes under the button share one grid cell (see index.html). */
.auth-note { display: grid; }
.auth-note > * { grid-area: 1 / 1; transition: opacity var(--t-layout) var(--ease), visibility 0s; }
.auth-note > .is-off { opacity: 0; visibility: hidden; transition: opacity var(--t-exit) var(--ease-in), visibility 0s linear var(--t-exit); }
.auth-reg-note { display: flex; flex-direction: column; gap: 6px; text-align: center; }
.auth-reg-note a { color: inherit; }

/* Feedback: thumbs on the done card (ask ↔ thanks share one cell, so the card keeps its size), the form. */
.done-rate { display: grid; justify-items: center; margin-top: 4px; }
.done-rate > * { grid-area: 1 / 1; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted);
  transition: opacity var(--t-layout) var(--ease), visibility 0s; }
.done-rate > .is-off { opacity: 0; visibility: hidden; transition: opacity var(--t-exit) var(--ease-in), visibility 0s linear var(--t-exit); }
.rate-btn { width: 40px; height: 40px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--muted);
  display: grid; place-items: center; cursor: pointer; transition: background var(--t-hover) var(--ease), color var(--t-hover) var(--ease), border-color var(--t-hover) var(--ease); }
.rate-btn:hover { background: var(--brand-50); color: var(--brand-500); border-color: var(--brand-300); }
.link-btn { border: 0; padding: 0; background: none; font: inherit; color: var(--brand-400); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.feedback-card { max-width: 480px; text-align: left; align-items: stretch; gap: 12px; }
.feedback-card h2 { text-align: left; }
.feedback-card textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 120px; padding: 12px 14px; border: 1px solid var(--line-2);
  border-radius: 14px; background: var(--surface); color: var(--text); font: 400 15px/1.5 var(--font); transition: border-color var(--t-hover) var(--ease); }
.feedback-card textarea:focus { outline: 0; border-color: var(--brand-300); }
.feedback-card .done-actions { justify-content: flex-end; }
.summary .sum-note.is-warn { color: #f7c56b; font-weight: 600; }

/* ---------- Listening with the microphone (phones): big subtitles over a calm field, then the transcript ---------- */
.stage--live.is-mic .live-grid { display: flex; flex-direction: column; height: auto; min-height: 0; gap: 14px; }
.stage--live.is-mic .live-grid { height: calc(100dvh - 104px); }
.stage--live.is-mic .player-col { flex: 0 0 44%; min-height: 0; }
.stage--live.is-mic .player { flex: 1; min-height: 0; }
.stage--live.is-mic .player video, .stage--live.is-mic .player::after { display: none; }
.stage--live.is-mic .audio-only-art { padding: 0; background: radial-gradient(80% 70% at 30% 0%, rgba(127, 163, 201, 0.35), transparent 65%), var(--grad-deep); }
.stage--live.is-mic .audio-only-art > * { display: none; }
.stage--live.is-mic .subtitle { top: 64px; bottom: 20px; left: 16px; right: 16px; justify-content: center; }
.stage--live.is-mic .subtitle-dst { background: none; padding: 0; font-size: clamp(22px, 6.4vw, 34px); font-weight: 600; line-height: 1.3; }
.stage--live.is-mic .subtitle-src { font-size: 15px; }
.stage--live.is-mic .controls, .stage--live.is-mic .meters { display: none !important; }
.stage--live.is-mic .transcript { flex: 1; min-height: 0; }
.mic-stop { display: none; }
.stage--live.is-mic .mic-stop { display: inline-flex; background: rgba(255, 255, 255, 0.14); color: #fff; border: 0; }
.stage--live.is-mic .mic-stop:hover { background: rgba(255, 255, 255, 0.24); }

/* Sheets over the dark live screen are dark too (a white card at night hurts, above all on a phone). */
body:has(#stage-live:not([hidden])) .done-card {
  --bg: #0b1626; --surface: #13243b; --surface-2: #1a2f4c; --soft: #22405f;
  --text: #ffffff; --text-2: #c9d6e5; --muted: #8fa3bb; --dim: #6b7f98;
  --line: rgba(255, 255, 255, 0.08); --line-2: rgba(255, 255, 255, 0.16);
  --brand-50: rgba(143, 183, 224, 0.12); --brand-100: rgba(143, 183, 224, 0.22); --brand-300: #5f86b0; --brand-500: #8fb7e0;
  --grad: linear-gradient(0deg, #2f5d8c, #2f5d8c);
  background: var(--surface); color: var(--text); border-color: var(--line);
}
body:has(#stage-live:not([hidden])) .done-card .btn--primary { background: #ffffff; color: #0f1e33; }
/* A close cross in the corner of the result card. */
#done .done-card { position: relative; }
.sheet-x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 12px; background: var(--surface-2);
  color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: background var(--t-hover) var(--ease), color var(--t-hover) var(--ease); }
.sheet-x:hover { color: var(--text); background: var(--soft); }
.btn--google.is-waiting { pointer-events: none; opacity: 0.8; }
.btn--google.is-waiting .g-logo { animation: pulse-soft 1.6s var(--ease) infinite; }
@keyframes pulse-soft { 50% { opacity: 0.45; } }

/* The minutes left sit inside the account button (its left part), set off by a thin line. */
.user .balance { height: 30px; padding: 0 10px 0 8px; margin-right: 2px; border: 0; border-right: 1px solid var(--line); border-radius: 0; background: none; animation: none; }
.user .balance.is-low { background: none; color: var(--warn); }
.user { cursor: pointer; transition: border-color var(--t-hover) var(--ease), background var(--t-hover) var(--ease); }
.user:hover { border-color: var(--brand-300); }

/* The previous subtitle line, kept above the new one until it has been read. */
.subtitle-prev {
  max-width: min(100%, 50em); padding: 6px 14px; border-radius: 12px; background: rgba(8, 10, 20, 0.6);
  color: rgba(255, 255, 255, 0.72); font-size: clamp(14px, 1.35vw, 19px); line-height: 1.35;
  animation: appear var(--t-ui) var(--ease) both;
}
.subtitle-prev:empty { display: none; }
.stage--live.is-mic .subtitle-prev { background: none; padding: 0; font-size: 16px; }
/* Reconnecting: shown in the status pill (amber, pulsing), not as a toast. */
.status-pill[data-state="reconnecting"] .live-dot { background: #f0a21b; }
.status-pill[data-state="reconnecting"] .live-dot::after { animation-name: pulse-blue; }
/* Toasts keep their own colors: on the dark live screen the palette's "text" is white. */
.toast { background: #0f1e33; color: #ffffff; }
body:has(#stage-live:not([hidden])) .toast { background: #e8eef6; color: #0f1e33; }

/* ---------- Setup screen background: a lava lamp ----------
   Five pale drops on their own slow loops, stretching and turning as they go. Only transform is animated
   (the GPU moves the layers, nothing is repainted); off on the dark translation screen and under
   reduced motion. */
.lava { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
body:has(#stage-live:not([hidden])) .lava { display: none; }
.lava i { position: absolute; border-radius: 50%; will-change: transform; animation: var(--n) var(--d) ease-in-out infinite; }
.lava .l1 { --n: lava1; --d: 22s; width: 38vw; height: 30vw; left: 2vw; top: 4vh; background: radial-gradient(closest-side, rgba(186,212,242,.7), rgba(186,212,242,0)); }
.lava .l2 { --n: lava2; --d: 27s; width: 34vw; height: 30vw; left: 52vw; top: 46vh; background: radial-gradient(closest-side, rgba(170,198,240,.42), rgba(170,198,240,0)); }
.lava .l3 { --n: lava3; --d: 31s; width: 30vw; height: 26vw; left: 60vw; top: -6vh; background: radial-gradient(closest-side, rgba(208,226,248,.75), rgba(208,226,248,0)); }
.lava .l4 { --n: lava4; --d: 25s; width: 28vw; height: 24vw; left: 18vw; top: 58vh; background: radial-gradient(closest-side, rgba(201,207,244,.55), rgba(201,207,244,0)); }
.lava .l5 { --n: lava2; --d: 35s; width: 26vw; height: 22vw; left: 36vw; top: 18vh; background: radial-gradient(closest-side, rgba(205,234,242,.55), rgba(205,234,242,0)); animation-direction: reverse; }
@keyframes lava1 { 0%,100% { transform: translate3d(0,0,0) rotate(0) scale(1,1); } 25% { transform: translate3d(18vw,22vh,0) rotate(20deg) scale(1.25,.85); } 50% { transform: translate3d(30vw,8vh,0) rotate(-10deg) scale(.9,1.2); } 75% { transform: translate3d(10vw,-6vh,0) rotate(12deg) scale(1.15,.95); } }
@keyframes lava2 { 0%,100% { transform: translate3d(0,0,0) rotate(0) scale(1,1); } 30% { transform: translate3d(-24vw,-18vh,0) rotate(-24deg) scale(.85,1.25); } 60% { transform: translate3d(-8vw,-34vh,0) rotate(16deg) scale(1.2,.9); } 80% { transform: translate3d(6vw,-12vh,0) rotate(-6deg) scale(1,1.1); } }
@keyframes lava3 { 0%,100% { transform: translate3d(0,0,0) rotate(0) scale(1,1); } 35% { transform: translate3d(-16vw,30vh,0) rotate(28deg) scale(1.3,.8); } 70% { transform: translate3d(8vw,44vh,0) rotate(-14deg) scale(.85,1.2); } }
@keyframes lava4 { 0%,100% { transform: translate3d(0,0,0) rotate(0) scale(1,1); } 40% { transform: translate3d(26vw,-20vh,0) rotate(-18deg) scale(1.2,.85); } 75% { transform: translate3d(40vw,4vh,0) rotate(10deg) scale(.9,1.15); } }
@media (prefers-reduced-motion: reduce) { .lava i { animation: none; } }

/* Inverted pills ("Back to live", the progress tooltip) take the palette's text color as their background:
   on the dark translation screen that is white, so they get explicit light-on-dark colors there. */
body:has(#stage-live:not([hidden])) .tr-live { background: #ffffff; color: #0f1e33; }
body:has(#stage-live:not([hidden])) .tr-live:hover { background: #8fb7e0; color: #0f1e33; }
body:has(#stage-live:not([hidden])) .progress-tip { background: #ffffff; color: #0f1e33; }
body:has(#stage-live:not([hidden])) .btn--danger { color: #ffb199; }
