:root {
  --bg: #0e141b; --panel: #17212b; --line: #253241; --text: #eef2f6; --muted: #93a1b0;
  --accent: #39c2a5; --danger: #e5675b; --warn: #e8b04b;
  color-scheme: dark;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari",
    "Noto Sans Bengali", "Kohinoor Devanagari", "Kohinoor Bangla", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, select, input { font: inherit; color: inherit; }
button, select {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.45em 0.8em; cursor: pointer; min-height: 40px;
}
button:hover { border-color: var(--accent); }
button.danger { border-color: var(--danger); color: var(--danger); }
input:not([type=checkbox]) {
  width: 100%; background: #0b1117; border: 1px solid var(--line); border-radius: 8px;
  padding: 0.6em 0.7em; min-height: 44px;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- home */
.home { max-width: 640px; margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 16px 40px; }
.brand h1 { margin: 0; font-size: 2rem; color: var(--accent); }
.brand p { margin: 0.3em 0 1.5em; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 1.1rem; }
.card small { color: var(--muted); font-weight: normal; }
.row { display: flex; gap: 8px; }
.stack { display: grid; gap: 12px; }
.stack label { display: grid; gap: 6px; color: var(--muted); }
.stack > button { background: var(--accent); color: #062019; border: 0; font-weight: 600; }
.stack select { width: 100%; min-height: 44px; font-size: 1.05rem; }
.langs { border: 1px solid var(--line); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 12px 12px; }
.langs label { display: flex; align-items: center; gap: 6px; color: var(--text); }
.langs legend { color: var(--muted); padding: 0 4px; }
.hint { margin: -4px 0 0; color: var(--muted); font-size: 0.9rem; }
.err { color: var(--danger); margin: 0; min-height: 1em; }
.pins { margin: 12px 0 0; padding-left: 1.2em; font-variant-numeric: tabular-nums; }
.steps { margin: 8px 0 0; padding-left: 1.3em; line-height: 1.6; }
.steps a { color: var(--accent); }
code { background: #0b1117; padding: 1px 5px; border-radius: 4px; }
.wrap { display: block; overflow-wrap: anywhere; padding: 8px; }
.stack-label { display: grid; gap: 6px; color: var(--muted); margin-bottom: 8px; }
.foot { color: var(--muted); font-size: 0.85rem; text-align: center; }

/* ---------- session */
.top { position: sticky; top: 0; z-index: 2; background: var(--bg); padding-top: env(safe-area-inset-top); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.bar .icon { text-decoration: none; color: var(--text); padding: 0.45em 0.6em; }
.ttl { flex: 1 1 160px; min-width: 0; display: grid; }
.ttl strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { color: var(--muted); font-size: 0.8rem; }
.status::before { content: "●"; margin-right: 0.35em; color: var(--warn); }
.status[data-state=live]::before { color: var(--accent); }
.status[data-state=ended]::before, .status[data-state=error]::before { color: var(--danger); }
.host { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.btn { display: inline-flex; align-items: center; min-height: 40px; padding: 0.45em 0.8em; border: 1px solid var(--accent); border-radius: 8px; color: var(--accent); text-decoration: none; }
.cta { flex-basis: 100%; margin: 0; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 10px; line-height: 1.45; }
#capTab, #capMic.primary { background: var(--accent); color: #062019; border: 0; font-weight: 600; }
.host meter { width: 100px; }
.player { max-width: min(960px, calc(38vh * 16 / 9)); margin: 0 auto; }
.player iframe, .player #player { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; }
.player { position: relative; }
.player video { display: block; width: 100%; max-height: 38vh; background: #000; }
.player.mirror video { max-height: 55vh; }
.overlay { position: absolute; left: 0; right: 0; bottom: 7%; padding: 0 6%; text-align: center; pointer-events: none;
  color: #fff; font-weight: 600; font-size: clamp(16px, 3vw, 44px); line-height: 1.3;
  text-shadow: 0 0 4px #000, 0 0 3px #000, 0 2px 2px #000; }
.player:fullscreen { max-width: none; background: #000; display: flex; align-items: center; }
.player:fullscreen video, .player:fullscreen iframe, .player:fullscreen #player { max-height: 100vh; height: 100%; aspect-ratio: auto; }
.player .pick { display: block; padding: 12px 16px; color: var(--muted); }
.live {
  padding: 12px 16px; min-height: 3.2em; line-height: 1.35; font-weight: 500;
  border-bottom: 1px solid var(--line); background: #000;
  /* phones: cap height so the list stays visible; newest line stays at the bottom, oldest clips */
  max-height: 30vh; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
}
.live p { margin: 0 0 0.25em; }
.live p:first-child:not(:last-child) { color: var(--muted); font-size: 0.75em; }
.live .dim { color: var(--muted); }
.tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; color: var(--muted); }
.tools label { display: flex; gap: 6px; align-items: center; }
.list { list-style: none; margin: 0; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); max-width: 960px; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); line-height: 1.45; font-size: 1.1rem; }
.list li.seek { cursor: pointer; }
.list li.pending .tx { color: var(--muted); }
.list li.failed .tx { color: var(--warn); }
.list .orig { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.toast {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); background: var(--panel); border: 1px solid var(--accent); border-radius: 10px;
  padding: 10px 14px; z-index: 5; overflow-wrap: anywhere;
}
[hidden] { display: none !important; }

/* ---------- Android app: floating strip over the Meet app */
body.overlay-mode { background: transparent; }
body.overlay-mode .top { position: static; background: transparent; padding: 0; }
body.overlay-mode .bar, body.overlay-mode .host, body.overlay-mode .player, body.overlay-mode .tools,
body.overlay-mode .list { display: none !important; }
body.overlay-mode .live { height: 100vh; max-height: none; border: 0; border-radius: 12px; background: rgba(0, 0, 0, 0.62);
  text-shadow: 0 1px 2px #000; padding: 8px 14px; line-height: 1.3;
  font-size: 19px !important; justify-content: center; } /* fixed size: the strip is ~4 lines tall */

/* ---------- floating window */
body.pip { margin: 0; background: #000; }
body.pip .live { border: 0; height: 100vh; max-height: none; }
