/* ---------- Self-hosted fonts (no external CDN at runtime) ---------- */
@font-face {
  font-family: "Inter";
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/inter-700.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/sg-500.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/sg-700.woff2") format("woff2");
}

:root {
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;

  --bg: #0b0d13;
  --panel: #161925;
  --panel-2: #1f2330;
  --line: #2a2f3e;
  --text: #e9edf5;
  --muted: #8b93a7;
  --accent: #6c5ce7;
  --accent-2: #00d1b2;
  --pro: #1fbf75;
  --con: #e74c6f;
  --danger: #e74c6f;

  --grad: linear-gradient(135deg, #6c5ce7, #00d1b2);
  --grad-hot: linear-gradient(135deg, #7d6ff0, #c44be0);
  --glass: rgba(255, 255, 255, 0.04);
  --glass-line: rgba(255, 255, 255, 0.08);
  --glow: 0 10px 40px -12px rgba(108, 92, 231, 0.55);
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.8);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: radial-gradient(1200px 600px at 50% -10%, #1a1f30, var(--bg));
  color: var(--text);
  font-family: var(--font);
  letter-spacing: -0.01em;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle moving aurora behind everything */
body::before {
  content: "";
  position: fixed;
  inset: -30%;
  z-index: -1;
  background: radial-gradient(40% 40% at 18% 22%, rgba(108, 92, 231, 0.32), transparent 70%),
    radial-gradient(38% 38% at 84% 18%, rgba(0, 209, 178, 0.24), transparent 70%),
    radial-gradient(48% 48% at 78% 88%, rgba(231, 76, 111, 0.2), transparent 70%);
  filter: blur(20px);
  animation: drift 24s ease-in-out infinite alternate;
}
@keyframes drift {
  to {
    transform: translate3d(-3%, 2%, 0) scale(1.08);
  }
}

/* Vignette for depth (sits above the aurora, below content) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  box-shadow: inset 0 0 240px 60px rgba(0, 0, 0, 0.55);
}

/* Fine film grain for a matte, premium texture */
html::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: rgba(108, 92, 231, 0.4);
  color: #fff;
}

/* Custom scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: #3a4056;
  background-clip: padding-box;
}

.screen {
  display: none;
  height: 100vh;
  height: 100dvh; /* use the *visible* viewport on mobile so the bottom controls aren't hidden behind the browser toolbar */
}
.screen.active {
  display: flex;
}

.hidden {
  display: none !important;
}

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s;
}
.btn:hover {
  background: #262b3a;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--grad);
  border-color: transparent;
  box-shadow: var(--glow);
  font-weight: 600;
}
.btn.primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 14px 46px -12px rgba(108, 92, 231, 0.7);
}
.btn.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.btn.danger:hover {
  background: rgba(231, 76, 111, 0.12);
}
.btn.danger-soft {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}
.btn.danger-soft:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(231, 76, 111, 0.08);
}
.btn.ghost {
  background: transparent;
}
.btn.big {
  font-size: 18px;
  padding: 14px 28px;
}
.btn.round {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 20px;
  padding: 0;
}
.btn.round.off {
  background: var(--danger);
  border-color: var(--danger);
}
.btn.send {
  border-radius: 10px;
  background: var(--grad);
  border-color: transparent;
  font-weight: 600;
}
.btn.send:hover {
  filter: brightness(1.08);
}
.btn.round {
  transition: transform 0.1s ease, background 0.15s, box-shadow 0.15s;
}
.btn.round:hover {
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.7);
}

/* ---------- Entrance (press to start) ---------- */
#entrance {
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  outline: none;
  background: var(--bg);
  transition: opacity 0.5s ease;
}
#entrance.fade-out {
  opacity: 0;
  pointer-events: none;
}
.entrance-bg {
  position: absolute;
  inset: -40%;
  background: conic-gradient(
    from 0deg,
    #6c5ce7,
    #00d1b2,
    #e74c6f,
    #6c5ce7
  );
  filter: blur(120px);
  opacity: 0.35;
  animation: swirl 18s linear infinite;
}
@keyframes swirl {
  to {
    transform: rotate(360deg);
  }
}
.entrance-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.entrance-kicker {
  text-transform: uppercase;
  letter-spacing: 6px;
  font-size: 13px;
  color: var(--muted);
}
.entrance-logo {
  font-family: var(--display);
  font-size: clamp(54px, 11vw, 124px);
  font-weight: 700;
  letter-spacing: -3px;
  margin: 0;
  line-height: 1;
  text-shadow: 0 8px 40px rgba(108, 92, 231, 0.45);
}
.entrance-logo span {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.press-start {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: pulse 1.6s ease-in-out infinite;
}
.press-text {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.press-sub {
  font-size: 14px;
  color: var(--muted);
}
@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ---------- Home ---------- */
#home {
  align-items: center;
  /* Top-align so the logo is always the first thing in view; scroll if tall. */
  justify-content: flex-start;
  overflow-y: auto;
}
.home-inner {
  max-width: 880px;
  width: 100%;
  margin: auto; /* centres vertically when short, but never clips when tall */
  padding: 34px 24px 48px;
  text-align: center;
  animation: homeRise 0.5s ease both;
}
@keyframes homeRise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
.logo {
  font-family: var(--display);
  font-size: 60px;
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: -2.5px;
}
.logo span {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tagline {
  color: var(--muted);
  font-size: 17px;
  max-width: 560px;
  margin: 0 auto 28px;
  line-height: 1.5;
}
.tagline b {
  color: var(--text);
}
.pick-title {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
  margin-bottom: 16px;
}
.categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.cat {
  position: relative;
  color: var(--text);
  font-family: var(--font);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  padding: 18px 16px;
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(8px);
  overflow: hidden;
  transition: border-color 0.18s, transform 0.12s ease, background 0.18s,
    box-shadow 0.18s;
}
/* Gradient sheen that fades in on hover */
.cat::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    120% 80% at 0% 0%,
    rgba(108, 92, 231, 0.16),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.cat:hover {
  transform: translateY(-3px);
  border-color: #44496a;
  box-shadow: var(--shadow);
}
.cat:hover::after {
  opacity: 1;
}
.cat.selected {
  border-color: transparent;
  background: linear-gradient(#1c1d33, #1c1d33) padding-box,
    var(--grad) border-box;
  box-shadow: var(--glow);
}
.cat .emoji {
  font-size: 30px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}
.cat .name {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.3px;
  margin: 8px 0 4px;
  font-size: 16px;
}
.cat .blurb {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.cat .count {
  display: inline-block;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 700;
  margin-top: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0, 209, 178, 0.1);
  border: 1px solid rgba(0, 209, 178, 0.22);
}
.fineprint {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 16px;
}

/* ---------- Home footer ---------- */
.home-footer {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--glass-line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}
.footer-logo {
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.5px;
}
.footer-logo span {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.footer-tag {
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- Live online pill ---------- */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
  backdrop-filter: blur(8px);
}
.live-pill b {
  color: var(--text);
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1fbf75;
  box-shadow: 0 0 0 0 rgba(31, 191, 117, 0.7);
  animation: livePulse 1.8s ease-out infinite;
}
@keyframes livePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(31, 191, 117, 0.6);
  }
  100% {
    box-shadow: 0 0 0 9px rgba(31, 191, 117, 0);
  }
}

/* ---------- Mode tabs ---------- */
.mode-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  margin: 4px auto 28px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  backdrop-filter: blur(8px);
}
.mode-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.15s, background 0.2s;
}
.mode-tab:hover {
  color: var(--text);
}
.mode-tab.active {
  color: #fff;
  background: var(--grad);
  box-shadow: var(--glow);
}
.mode-panel {
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------- Private rooms ---------- */
.private-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 28px;
  text-align: left;
}
.private-card {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  padding: 26px 22px;
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.private-icon {
  font-size: 30px;
}
.private-card h3 {
  font-family: var(--display);
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.5px;
}
.private-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  flex: 1;
}
.private-or {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.private-or span {
  padding: 8px 4px;
}
.select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
}
.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.18);
}
.code-input {
  text-align: center;
  letter-spacing: 6px;
  font-weight: 800;
  font-size: 22px;
  text-transform: uppercase;
}
.room-error {
  color: var(--con);
  font-size: 13px;
  min-height: 18px;
  margin: 0;
}

/* ---------- How it works ---------- */
.how-it-works {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin: 8px auto 4px;
  color: var(--muted);
  font-size: 14px;
}
.how-step {
  display: flex;
  align-items: center;
  gap: 8px;
}
.how-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.how-arrow {
  opacity: 0.4;
}

/* ---------- Room share (searching screen) ---------- */
.room-share {
  margin: 8px auto 24px;
  max-width: 360px;
}
.code-box {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  padding: 12px 12px 12px 22px;
  margin-top: 8px;
}
#roomCodeText {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 8px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@media (max-width: 680px) {
  .private-grid {
    grid-template-columns: 1fr;
  }
  .private-or {
    justify-content: center;
  }
}

/* ---------- Public arena lobby ---------- */
.arena-head {
  margin-bottom: 18px;
}
.arena-create {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 620px;
  margin: 0 auto;
}
.arena-create-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.arena-create-row .select {
  width: auto;
  flex: 1;
  min-width: 150px;
}
#customTopic {
  text-align: center;
  font-size: 16px;
}

/* ---------- Host approval prompts ---------- */
.join-requests {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, 92vw);
}
.jr-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(22, 25, 37, 0.96);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--glow), var(--shadow);
  backdrop-filter: blur(12px);
  animation: jrIn 0.25s ease;
}
@keyframes jrIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}
.jr-text {
  flex: 1;
  font-size: 14px;
}
.jr-btn {
  padding: 8px 14px;
  font-size: 14px;
}
.arena-sub {
  color: var(--muted);
  font-size: 13.5px;
  margin: 14px auto 0;
  max-width: 520px;
  line-height: 1.5;
}
.arena-browse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 14px;
}
.arena-browse-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
  margin: 0;
}
.arena-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}
.btn.btn-sm {
  padding: 7px 14px;
  font-size: 13px;
}
.btn.btn-sm.spin {
  pointer-events: none;
  opacity: 0.6;
}

.public-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 26px;
  text-align: left;
}
.arena-empty {
  text-align: center;
  padding: 24px;
}
.arena-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  padding: 16px 18px;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s, transform 0.1s;
}
.arena-card:hover {
  transform: translateY(-2px);
  border-color: #44496a;
}
.arena-card.is-live {
  border-color: rgba(231, 76, 111, 0.4);
  background: linear-gradient(
    100% 100% at 0% 0%,
    rgba(231, 76, 111, 0.07),
    var(--glass)
  );
}
.arena-card.is-live:hover {
  border-color: var(--con);
}
.arena-info {
  flex: 1;
  min-width: 0;
}
.arena-status {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}
.arena-status.live {
  color: var(--con);
  animation: blink 1.4s ease-in-out infinite;
}
.arena-status.waiting {
  color: var(--muted);
}
@keyframes blink {
  50% {
    opacity: 0.45;
  }
}
.arena-topic {
  font-family: var(--display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.3px;
  margin: 5px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.arena-meta {
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- Live vote bar (debater view) ---------- */
.live-vote {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 20px;
  background: rgba(16, 18, 26, 0.85);
  border-bottom: 1px solid var(--glass-line);
  font-size: 13px;
}
.lv-watch {
  color: var(--muted);
  white-space: nowrap;
}
.lv-bar {
  flex: 1;
  display: flex;
  height: 22px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.lv-pro,
.lv-con {
  display: flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  padding: 0 10px;
  transition: width 0.4s ease;
  white-space: nowrap;
  overflow: hidden;
}
.lv-pro {
  background: linear-gradient(135deg, #25d684, var(--pro));
}
.lv-con {
  background: linear-gradient(135deg, #f0617f, var(--con));
  justify-content: flex-end;
}
.lv-count {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- Spectate screen ---------- */
#spectate {
  flex-direction: column;
}
.spec-watch {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
}
.spec-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 18px;
  min-height: 0;
}
.spec-video {
  position: relative;
  flex: 1;
  height: 100%;
  max-width: 46%;
  background: radial-gradient(circle at 50% 40%, #15171f, #000);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.spec-video.pro {
  border: 2px solid var(--pro);
}
.spec-video.con {
  border: 2px solid var(--con);
}
.spec-vs {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 1px;
  flex-shrink: 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow);
}
.vote-panel {
  background: rgba(16, 18, 26, 0.85);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--glass-line);
  padding: 16px 20px 20px;
  text-align: center;
}
.vote-title {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}
.vote-bar {
  position: relative;
  display: flex;
  height: 30px;
  border-radius: 999px;
  overflow: hidden;
  max-width: 640px;
  margin: 0 auto 14px;
  border: 1px solid var(--line);
}
.vote-fill {
  height: 100%;
  transition: width 0.4s ease;
}
.vote-fill.pro {
  background: linear-gradient(135deg, #25d684, var(--pro));
}
.vote-fill.con {
  background: linear-gradient(135deg, #f0617f, var(--con));
}
.vote-pct {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.vote-pct.left {
  left: 12px;
}
.vote-pct.right {
  right: 12px;
}
.vote-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.vote-btn {
  font-weight: 700;
  font-size: 15px;
  padding: 12px 24px;
  border-width: 2px;
}
.vote-btn.pro {
  border-color: var(--pro);
  color: var(--pro);
  background: transparent;
}
.vote-btn.pro:hover,
.vote-btn.pro.chosen {
  background: var(--pro);
  color: #fff;
}
.vote-btn.con {
  border-color: var(--con);
  color: var(--con);
  background: transparent;
}
.vote-btn.con:hover,
.vote-btn.con.chosen {
  background: var(--con);
  color: #fff;
}

@media (max-width: 700px) {
  .spec-stage {
    flex-direction: column;
  }
  .spec-video {
    max-width: 100%;
    width: 100%;
  }
  .spec-vs {
    transform: rotate(90deg);
  }
}

/* ---------- Searching ---------- */
#searching {
  align-items: center;
  justify-content: center;
}
.search-inner {
  text-align: center;
}
.spinner {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 28px;
  background: conic-gradient(from 0deg, transparent, var(--accent), var(--accent-2), transparent);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 0);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.muted {
  color: var(--muted);
}

/* ---------- Debate ---------- */
#debate {
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(16, 18, 26, 0.7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-line);
}
.topic-block {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.topic-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--muted);
}
.topic-text {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-badge {
  font-weight: 800;
  font-size: 15px;
  padding: 8px 18px;
  border-radius: 999px;
  white-space: nowrap;
  border: 2px solid var(--line);
}
.side-badge.pro {
  color: #fff;
  background: linear-gradient(135deg, #25d684, var(--pro));
  border-color: transparent;
  box-shadow: 0 6px 20px -8px rgba(31, 191, 117, 0.8);
}
.side-badge.con {
  color: #fff;
  background: linear-gradient(135deg, #f0617f, var(--con));
  border-color: transparent;
  box-shadow: 0 6px 20px -8px rgba(231, 76, 111, 0.8);
}

.stage {
  flex: 1;
  display: flex;
  min-height: 0;
  padding: 16px;
  gap: 16px;
}
.videos {
  flex: 1;
  position: relative;
  min-width: 0;
}
.video-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 40%, #15171f, #000);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow);
}
.video-wrap.small {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 220px;
  height: 150px;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease;
}
.video-wrap.small:hover {
  transform: scale(1.03);
}
video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#localVideo {
  transform: scaleX(-1); /* mirror your own preview */
}
.vid-tag {
  position: absolute;
  left: 12px;
  bottom: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  border: 1px solid var(--glass-line);
  padding: 4px 10px;
  border-radius: 999px;
}
.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  padding: 20px;
}
.placeholder.hidden {
  display: none;
}

.chat {
  width: 340px;
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  overflow: hidden;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.35;
  word-wrap: break-word;
}
.msg.me {
  align-self: flex-end;
  background: var(--grad);
  box-shadow: 0 4px 14px -6px rgba(108, 92, 231, 0.6);
}
.msg.them {
  align-self: flex-start;
  background: var(--panel-2);
}
.msg.sys {
  align-self: center;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-style: italic;
  text-align: center;
}
.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.chat-form input {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}
.chat-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.18);
}

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(16, 18, 26, 0.7);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--glass-line);
}
.controls-spacer {
  flex: 1;
}
.reactions {
  display: flex;
  gap: 6px;
}
.btn.react {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  font-size: 20px;
  line-height: 1;
}
.btn.react:hover {
  transform: translateY(-2px);
}

/* ---------- Avatars: emoji or uploaded photo ---------- */
.av-img {
  width: 1.3em;
  height: 1.3em;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  display: inline-block;
}
.av-emoji {
  display: inline-block;
  vertical-align: middle;
}
.pic-preview {
  display: flex;
  justify-content: center;
  min-height: 4px;
  margin: 6px 0 2px;
}
.pic-preview .av-img.preview {
  width: 76px;
  height: 76px;
  border: 2px solid var(--line);
}
.pic-preview .av-emoji.preview {
  font-size: 60px;
  line-height: 1;
}
.upload-pic {
  display: inline-block;
  cursor: pointer;
  text-align: center;
  margin: 6px auto 12px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 14px;
}
.upload-pic:hover {
  color: #fff;
  border-color: var(--accent, #6c8cff);
}

/* ---------- Age gate / content warning ---------- */
.age-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 9, 14, 0.93);
  backdrop-filter: blur(10px);
}
.age-card {
  max-width: 460px;
  width: 100%;
  background: var(--card, #161821);
  border: 1px solid var(--glass-line, rgba(255, 255, 255, 0.1));
  border-radius: 18px;
  padding: 28px 26px;
  text-align: center;
}
.age-emoji {
  font-size: 44px;
}
.age-card h2 {
  margin: 6px 0 10px;
}
.age-rules {
  text-align: left;
  margin: 14px auto;
  padding-left: 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.age-agree {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 16px;
}
.age-agree a {
  color: var(--accent, #6c8cff);
}
.age-card .btn {
  width: 100%;
  margin-top: 8px;
}

/* ---------- Footer links + report ---------- */
.footer-links {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}
.footer-links a,
.link-btn {
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  padding: 0;
}
.footer-links a:hover,
.link-btn:hover {
  color: #fff;
  text-decoration: underline;
}

/* ---------- Modal actions + report status ---------- */
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}
#reportText {
  resize: vertical;
  width: 100%;
}
.report-status {
  margin-top: 10px;
  min-height: 18px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

/* ---------- Scorecard (home) ---------- */
.scorecard {
  display: inline-block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  color: var(--text);
  margin: 0 auto 24px;
}
.scorecard.hidden {
  display: none;
}

/* ---------- Debate clock (topbar) ---------- */
.phase {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  white-space: nowrap;
  transition: border-color 0.2s, background 0.2s;
}
.phase.hidden {
  display: none;
}
.phase.mine {
  border-color: var(--accent-2);
  background: rgba(0, 209, 178, 0.12);
  box-shadow: 0 0 0 1px var(--accent-2);
}
.phase-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.phase.mine .phase-label {
  color: var(--accent-2);
}
.phase-clock {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 15px;
}

/* ---------- Floating reactions ---------- */
.reaction-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 6;
}
.floater {
  position: absolute;
  bottom: 12%;
  font-size: 40px;
  animation: floatUp 2.2s ease-out forwards;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.floater.mine {
  opacity: 0.85;
  font-size: 32px;
}
@keyframes floatUp {
  0% {
    transform: translateY(0) scale(0.4);
    opacity: 0;
  }
  15% {
    transform: translateY(-10px) scale(1.15);
    opacity: 1;
  }
  100% {
    transform: translateY(-220px) scale(1);
    opacity: 0;
  }
}

/* ---------- Swap-side prompt + badge flash ---------- */
.btn.tiny {
  padding: 4px 10px;
  font-size: 12.5px;
  border-radius: 8px;
  background: var(--accent);
  border-color: var(--accent);
}
.swap-offer {
  font-style: normal !important;
  background: var(--panel-2) !important;
  padding: 8px 12px !important;
  border-radius: 12px !important;
}
.side-badge.flash {
  animation: badgeFlash 0.7s ease;
}
@keyframes badgeFlash {
  0%,
  100% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.18);
    filter: brightness(1.4);
  }
}

@media (max-width: 820px) {
  .stage {
    flex-direction: column;
  }
  .chat {
    width: 100%;
    height: 180px;
  }
  .video-wrap.small {
    width: 120px;
    height: 90px;
  }
  /* Let the control bar wrap onto multiple rows so Next/Stop are always
     reachable instead of overflowing off the right edge. */
  .controls {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }
  .controls-spacer {
    display: none;
  }
  .btn.react {
    width: 38px;
    height: 38px;
    font-size: 17px;
  }
}

/* ===================== Added features ===================== */

/* AI opponent: animated face fills the remote video slot */
.ai-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}

/* "Debate the AI" call-to-action on the home page */
.ai-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.ai-or {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
}
.btn.ai-btn {
  font-size: 16px;
  font-weight: 700;
  padding: 12px 24px;
  border-color: transparent;
  background: linear-gradient(135deg, #2a2350, #163a3a);
  box-shadow: 0 0 0 1px var(--glass-line), 0 12px 36px -14px rgba(108, 92, 231, 0.7);
}
.btn.ai-btn:hover {
  background: linear-gradient(135deg, #342a63, #1b4a4a);
  transform: translateY(-2px);
}
.ai-note {
  font-size: 12px;
  color: var(--muted);
}
.btn.listening {
  background: var(--con);
  border-color: var(--con);
  color: #fff;
  animation: badgeFlash 1.2s ease infinite;
}

/* Smooth screen transitions */
.screen.active {
  animation: screenIn 0.35s ease;
}
@keyframes screenIn {
  from {
    opacity: 0;
  }
}

/* Home top bar: profile chip + leaderboard */
.home-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.chip:hover {
  border-color: #44496a;
  background: var(--panel-2);
}
.chip-avatar {
  font-size: 16px;
}

/* Profile / identity modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 16, 0.7);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--glass-line);
  border-radius: 20px;
  padding: 28px;
  width: min(440px, 94vw);
  text-align: center;
  box-shadow: var(--shadow);
  animation: jrIn 0.25s ease;
}
.modal h2 {
  font-family: var(--display);
  margin: 0 0 6px;
}
.modal p {
  margin: 0 0 16px;
}
.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.avatar-opt {
  font-size: 22px;
  aspect-ratio: 1;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
}
.avatar-opt:hover {
  transform: translateY(-2px);
}
.avatar-opt.sel {
  border-color: transparent;
  box-shadow: 0 0 0 2px var(--accent);
  background: #1c1d33;
}
.modal .select {
  margin-bottom: 14px;
}
.modal .btn {
  width: 100%;
}

/* Leaderboard */
#leaderboard {
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
}
.lb-inner {
  max-width: 640px;
  width: 100%;
  padding: 48px 24px;
  text-align: center;
  margin: auto;
}
.lb-title {
  font-family: var(--display);
  font-size: 40px;
  margin: 0 0 4px;
}
.lb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 24px 0;
  text-align: left;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  padding: 12px 16px;
}
.lb-row.top {
  border-color: rgba(108, 92, 231, 0.4);
}
.lb-rank {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  width: 28px;
  color: var(--muted);
}
.lb-row.top .lb-rank {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lb-av {
  font-size: 24px;
}
.lb-name {
  flex: 1;
  font-weight: 600;
}
.lb-wins {
  font-weight: 800;
  color: var(--accent-2);
}
.lb-wins small {
  color: var(--muted);
  font-weight: 600;
}
.lb-debates {
  color: var(--muted);
  font-size: 13px;
}

/* Announcement banner (premium, centered, animated) */
.announce-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 260;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.announce-inner {
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 13px;
  width: min(760px, calc(100% - 24px));
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(20, 23, 34, 0.92);
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  box-shadow: 0 20px 55px -18px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(16px);
  animation: annDrop 0.55s cubic-bezier(0.2, 0.9, 0.25, 1.25);
}
@keyframes annDrop {
  from {
    transform: translateY(-130%);
    opacity: 0;
  }
}
/* moving shine */
.announce-inner::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 38%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.07), transparent);
  animation: annShine 3.4s ease-in-out infinite;
}
@keyframes annShine {
  0% {
    left: -60%;
  }
  55%,
  100% {
    left: 120%;
  }
}
.announce-badge {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  background: var(--grad);
  box-shadow: 0 6px 18px -6px rgba(108, 92, 231, 0.7);
}
.announce-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.announce-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-2);
}
#announceText {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.35;
}
.announce-close {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}
.announce-close:hover {
  color: var(--text);
  background: #2a3040;
}
/* style variants */
.announce-warn .announce-badge {
  background: linear-gradient(135deg, #ffb020, #e7794c);
  box-shadow: 0 6px 18px -6px rgba(231, 121, 76, 0.7);
}
.announce-warn .announce-label {
  color: #ffb020;
}
.announce-success .announce-badge {
  background: linear-gradient(135deg, #25d684, var(--pro));
  box-shadow: 0 6px 18px -6px rgba(31, 191, 117, 0.7);
}
.announce-success .announce-label {
  color: var(--pro);
}

/* Private warning toast */
.warn-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 30px);
  z-index: 280;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(460px, 92vw);
  padding: 13px 18px;
  background: rgba(34, 22, 26, 0.96);
  border: 1px solid var(--con);
  border-radius: 14px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 18px 50px -16px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.warn-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.warn-ic {
  font-size: 18px;
}

/* Coin flip overlay */
.coin-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background: rgba(8, 10, 16, 0.82);
  backdrop-filter: blur(8px);
}
.coin {
  width: 120px;
  height: 120px;
  position: relative;
  transform-style: preserve-3d;
}
.coin-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 21px;
  color: #fff;
  backface-visibility: hidden;
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.5);
}
.coin-face.for {
  background: linear-gradient(135deg, #25d684, var(--pro));
}
.coin-face.against {
  background: linear-gradient(135deg, #f0617f, var(--con));
  transform: rotateY(180deg);
}
.coin.land-for {
  animation: flipFor 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
.coin.land-against {
  animation: flipAgainst 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}
@keyframes flipFor {
  from {
    transform: rotateY(0);
  }
  to {
    transform: rotateY(1440deg);
  }
}
@keyframes flipAgainst {
  from {
    transform: rotateY(0);
  }
  to {
    transform: rotateY(1620deg);
  }
}
.coin-label {
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 1px;
}

/* Spectator (audience) chat */
.spec-main {
  flex: 1;
  display: flex;
  min-height: 0;
  gap: 16px;
  padding: 16px;
}
.spec-main > .spec-stage {
  padding: 0;
}
.spec-chat {
  width: 300px;
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.spec-chat-head {
  padding: 12px 14px;
  font-weight: 700;
  font-size: 14px;
  font-family: var(--display);
  border-bottom: 1px solid var(--glass-line);
}
.msg-author {
  display: block;
  font-size: 11px;
  color: var(--accent-2);
  margin-bottom: 2px;
  font-weight: 700;
}

/* Shareable link box */
.link-box {
  padding: 10px 12px 10px 16px;
}
.link-text {
  font-size: 13px;
  word-break: break-all;
  max-width: 280px;
  color: var(--text);
}

@media (max-width: 820px) {
  .spec-main {
    flex-direction: column;
  }
  .spec-chat {
    width: 100%;
    height: 200px;
  }
}

/* =====================================================================
   QOL FEATURES (features.js): typing indicator, speaking meter,
   connection dot, transcript / PiP / volume controls.
   ===================================================================== */

/* ---- Typing indicator ---- */
.typing-ind {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.78rem;
  color: var(--muted);
}
.typing-ind.hidden { display: none; }
.typing-ind .typing-who { margin-left: 4px; }
.typing-ind .td {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
  animation: tdBounce 1.2s infinite ease-in-out;
}
.typing-ind .td:nth-child(2) { animation-delay: 0.18s; }
.typing-ind .td:nth-child(3) { animation-delay: 0.36s; }
@keyframes tdBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Speaking-time meter ---- */
.speak-bar {
  padding: 8px 12px 4px;
  border-bottom: 1px solid var(--line);
}
.speak-bar.hidden { display: none; }
.speak-track {
  display: flex;
  height: 8px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--line);
}
.speak-fill { transition: width 0.4s ease; }
.speak-fill.mine { background: var(--accent); }
.speak-fill.theirs { background: #5a6275; }
.speak-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
  font-size: 0.72rem;
  color: var(--muted);
}
.speak-legend b { color: var(--text); }
.speak-legend .speak-title { letter-spacing: 0.02em; }
.speak-legend .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: middle;
}
.speak-legend .dot.mine { background: var(--accent); }
.speak-legend .dot.theirs { background: #5a6275; }
/* Gentle nudge when one side is hogging the mic. */
.speak-bar.hog-mine .speak-fill.mine,
.speak-bar.hog-theirs .speak-fill.theirs {
  background: var(--con);
}

/* ---- Connection-quality dot (corner of opponent video) ---- */
.conn-dot {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  font-size: 0.68rem;
  color: #fff;
  z-index: 3;
  pointer-events: none;
}
.conn-dot.hidden { display: none; }
.conn-dot .conn-led {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 6px currentColor;
}
.conn-dot.good .conn-led { background: var(--pro); color: var(--pro); }
.conn-dot.ok .conn-led { background: #e8b339; color: #e8b339; }
.conn-dot.bad .conn-led {
  background: var(--con);
  color: var(--con);
  animation: connPulse 1s infinite;
}
@keyframes connPulse {
  50% { opacity: 0.35; }
}

/* ---- Opponent volume slider ---- */
.vol-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
}
.vol-wrap .vol-ic { font-size: 0.95rem; }
.vol-slider {
  width: 78px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--line);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
.vol-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
