@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;1,9..144,400&family=Nunito:wght@400;600;700&display=swap");

:root {
  --paper:       #fdf6e8;
  --paper-warm:  #f7e7c3;
  --paper-deep:  #e8d6a8;
  --ink:         #2a241c;
  --ink-soft:    #6e5f4a;
  --sky:         #7fbde6;
  --sky-light:   #cfe7f6;
  --sky-deep:    #2d6f8e;
  --water:       #1d4f6d;
  --sail:        #c45a4f;
  --sail-warm:   #e07b6e;
  --leaf:        #6c9c64;
  --leaf-deep:   #43663d;
  --gold:        #e2b85b;
  --shadow-soft: 0 12px 32px -8px rgba(45, 35, 20, 0.18);
  --shadow-card: 0 6px 24px -4px rgba(45, 35, 20, 0.14);
  --radius:      18px;
  --radius-lg:   28px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: "Fraunces", "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
  color: var(--ink);
}

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

button {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 200ms ease, background 200ms ease;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

button.primary {
  background: var(--sail);
  color: #fff;
  padding: 14px 28px;
  box-shadow: var(--shadow-card);
}
button.primary:hover:not(:disabled) {
  background: var(--sail-warm);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -6px rgba(196, 90, 79, 0.45);
}
button.secondary {
  background: var(--paper-warm);
  color: var(--ink);
  border: 1px solid rgba(45, 35, 20, 0.08);
}
button.secondary:hover:not(:disabled) { background: var(--paper-deep); }
button.danger {
  background: transparent;
  color: var(--sail);
  border: 1px solid rgba(196, 90, 79, 0.3);
}
button.danger:hover:not(:disabled) { background: rgba(196, 90, 79, 0.08); }
button.is-active {
  background: var(--sail);
  color: #fff;
}

/* ---------- Hero (shared by landing + call backdrop) ---------- */

.hero {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
}
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at top, rgba(255,255,255,0) 0%, rgba(253,246,232,0.05) 60%, rgba(253,246,232,0.55) 100%),
    linear-gradient(180deg, rgba(127,189,230,0.0) 0%, rgba(127,189,230,0.0) 60%, rgba(45,35,20,0.18) 100%);
}

/* Subtle paper grain — drawn as inline SVG noise via CSS */
.paper-grain::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.34 0 0 0 0 0.27 0 0 0 0 0.18 0 0 0 0.4 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- Onboarding (mockup landing) ---------- */

.page-onboarding {
  margin: 0;
  min-height: 100vh;
  position: relative;
  color: #1d3a5f;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: hidden;
  background: transparent;
}
html:has(body.page-onboarding) { background: #6cb1e0; }

.onb-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Boat sits in roughly the left third of the source — anchor toward the
     left so it stays visible when the card is centered, and slightly biased
     downward so the sky fills the top. */
  object-position: 28% 55%;
  background: #6cb1e0;
}
.onb-bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 75% 0%, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 55%),
    linear-gradient(180deg, rgba(125,180,225,0) 0%, rgba(40,90,140,0.18) 100%);
}

/* ---------- Top bar: brand + safety pill ---------- */

.onb-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 40px 0;
  gap: 24px;
}
.onb-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(20, 50, 90, 0.35);
}
.onb-brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(20, 50, 90, 0.25);
}
.onb-brand-name {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 600;
  font-size: 38px;
  letter-spacing: -0.01em;
  line-height: 1;
}
.onb-brand-divider {
  width: 1px;
  height: 36px;
  background: rgba(255,255,255,0.55);
  margin: 0 4px;
}
.onb-brand-tag {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: #f1f8ff;
  text-shadow: 0 1px 8px rgba(20, 50, 90, 0.4);
}

.onb-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  color: #2d4a6e;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 6px 18px rgba(20, 50, 90, 0.18);
}
.onb-pill-icon { color: #2d6f8e; }

/* ---------- Main / glass card ---------- */

.onb-main {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: calc(100vh - 110px);
  padding: 24px clamp(40px, 14vw, 220px) 140px clamp(24px, 6vw, 80px);
}
/* Pull the card inward on big desktops so it sits closer to center. */
@media (min-width: 1500px) {
  .onb-main { padding-right: clamp(220px, calc(35vw - 220px), 420px); }
}

.onb-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(22px) saturate(130%);
  -webkit-backdrop-filter: blur(22px) saturate(130%);
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: 26px;
  padding: 24px 26px 18px;
  box-shadow: 0 24px 60px -12px rgba(20, 50, 90, 0.28);
  text-align: center;
  position: relative;
}

.onb-compass {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(45, 111, 142, 0.18);
  color: #2d6f8e;
  margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(20, 50, 90, 0.1);
}

.onb-title {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 26px;
  line-height: 1.12;
  color: #1a3a5e;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.onb-sub {
  margin: 0 auto 16px;
  max-width: 340px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #4a6585;
}

/* ---------- Section block (interests / language) ---------- */

.onb-section {
  border: 1px solid rgba(45, 111, 142, 0.14);
  background: rgba(255,255,255,0.55);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 10px;
  text-align: left;
}
.onb-section legend,
.onb-section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  font-size: 13px;
  font-weight: 700;
  color: #2d4a6e;
  margin-bottom: 8px;
}
.onb-section-label svg,
.onb-section legend svg { color: #2d6f8e; }

/* Device readiness rows */

.onb-devices {
  border: 1px solid rgba(45, 111, 142, 0.14);
  background: rgba(255,255,255,0.55);
  border-radius: 14px;
  margin: 0 0 10px;
  overflow: hidden;
}
.onb-device {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(45, 111, 142, 0.1);
}
.onb-device:last-child { border-bottom: none; }
.onb-device-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #1a3a5e;
}
.onb-device-label svg { color: #4a6585; }

.onb-device-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}
.onb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c5cfd9;
  box-shadow: 0 0 0 0 rgba(80, 180, 130, 0);
}
.onb-device-status[data-status="ready"] { color: #2f9d6e; }
.onb-device-status[data-status="ready"] .onb-dot {
  background: #2fb077;
  box-shadow: 0 0 0 3px rgba(47, 176, 119, 0.18);
}
.onb-device-status[data-status="error"] { color: #c45a4f; }
.onb-device-status[data-status="error"] .onb-dot { background: #c45a4f; }
.onb-device-status[data-status="checking"] { color: #6e87a5; }
.onb-chev { color: #93a8c2; }

/* ---------- Live device preview ---------- */

.onb-preview {
  position: relative;
  height: 140px;
  margin: 0 0 10px;
  border-radius: 14px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 30%, #2d6f8e 0%, #1a3a5e 50%, #0e2438 100%);
  border: 1px solid rgba(45, 111, 142, 0.18);
}
.onb-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Selfie mirror — feels natural to people watching their own preview. */
  transform: scaleX(-1);
  background: #0e2438;
  opacity: 0;
  transition: opacity 200ms ease;
}
.onb-preview.has-video video { opacity: 1; }

.onb-preview-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  padding: 0 24px;
  letter-spacing: 0.01em;
  pointer-events: none;
}
.onb-preview.has-video .onb-preview-empty { display: none; }

.onb-meter {
  position: absolute;
  bottom: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 10px;
  background: rgba(20, 34, 56, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 0;
  transition: opacity 200ms ease;
}
.onb-preview.has-audio .onb-meter { opacity: 1; }
.onb-meter-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.9);
  margin-right: 2px;
}
.onb-meter .bar {
  display: block;
  width: 3px;
  height: 12px;
  background: linear-gradient(180deg, #6cd9a5, #2fb077);
  border-radius: 2px;
  transform-origin: center;
  transform: scaleY(0.18);
  transition: transform 60ms linear;
}

/* Language select */

.onb-select-wrap {
  position: relative;
}
.onb-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  border: 1px solid rgba(45, 74, 110, 0.14);
  border-radius: 10px;
  padding: 11px 40px 11px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: #1a3a5e;
  cursor: pointer;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.onb-select:focus {
  border-color: #6c9ee0;
  box-shadow: 0 0 0 3px rgba(108, 158, 224, 0.18);
}
.onb-select-chev {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #6e87a5;
  pointer-events: none;
}

/* CTA */

.onb-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  padding: 13px 22px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, #6c9ee0 0%, #3a6db8 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 10px 24px -8px rgba(58, 109, 184, 0.55);
  transition: transform 120ms ease, box-shadow 200ms ease, filter 200ms ease;
}
.onb-cta:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 14px 30px -8px rgba(58, 109, 184, 0.65);
}
.onb-cta:active:not(:disabled) { transform: translateY(0); }
.onb-cta:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.onb-cta svg { color: #fff; }

.onb-back {
  display: block;
  margin: 10px auto 0;
  text-align: center;
  font-size: 13.5px;
  font-weight: 700;
  color: #4a6585;
  text-decoration: none;
  padding: 6px;
}
.onb-back:hover { color: #1a3a5e; }

/* ---------- Bottom-left moderation card ---------- */

.onb-moderation {
  position: fixed;
  left: 32px;
  bottom: 64px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 320px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: 14px;
  box-shadow: 0 10px 24px -10px rgba(20, 50, 90, 0.3);
}
.onb-moderation-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(108, 158, 224, 0.18);
  color: #3a6db8;
  flex-shrink: 0;
}
.onb-moderation-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
  line-height: 1.35;
  color: #4a6585;
}
.onb-moderation-text strong {
  color: #1a3a5e;
  font-weight: 800;
  font-size: 13px;
}

/* ---------- Footer ---------- */

.onb-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px 18px;
  font-size: 13px;
  color: #f1f8ff;
  text-shadow: 0 1px 6px rgba(20, 50, 90, 0.5);
  pointer-events: none;
}
.onb-footer > * { pointer-events: auto; }
.onb-footer-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 22px;
}
.onb-footer-links a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  opacity: 0.95;
}
.onb-footer-links a:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.onb-footer-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  .onb-topbar { padding: 18px 18px 0; flex-direction: column; align-items: flex-start; gap: 14px; }
  .onb-brand-tag { display: none; }
  .onb-brand-divider { display: none; }
  .onb-main {
    justify-content: center;
    padding: 24px 16px 24px;
    min-height: auto;
  }
  .onb-card { padding: 24px 22px 18px; }
  .onb-title { font-size: 26px; }
  .onb-bg { object-position: 35% 55%; }
  /* On mobile, let the safety card and footer flow naturally below the
     onboarding card so they can't overlap. The fixed positioning that works
     on desktop creates a stack collision on narrow viewports. */
  .onb-moderation {
    position: static;
    margin: 16px 16px 0;
    max-width: none;
    bottom: auto;
    left: auto;
  }
  .onb-footer {
    position: static;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    padding: 18px 16px 22px;
    color: #1a3a5e;
    text-shadow: none;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,255,255,0.6);
  }
  .onb-footer-links a { color: #2d4a6e; }
}

/* ---------- Landing (legacy language picker, no longer used) ---------- */

.page-landing {
  margin: 0;
}
.landing-content {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 64px 32px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.landing-header {
  text-align: center;
  margin-bottom: 28px;
  color: var(--ink);
  text-shadow: 0 2px 24px rgba(255, 251, 240, 0.7);
}
.landing-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 20px;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: rgba(253, 246, 232, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 18px 6px 8px;
  border-radius: 999px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
}
.brand-mark {
  display: inline-block;
  width: auto;
  height: 1.6em;
  border-radius: 50%;
  vertical-align: middle;
  flex-shrink: 0;
}
.landing-header h1 {
  font-size: clamp(40px, 7vw, 76px);
  font-weight: 600;
  margin-bottom: 12px;
}
.landing-header h1 em {
  font-style: italic;
  color: var(--sail);
}
.landing-header .lede {
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 540px;
  margin: 0 auto;
}

.lang-card {
  background: rgba(253, 246, 232, 0.94);
  backdrop-filter: blur(14px) saturate(110%);
  -webkit-backdrop-filter: blur(14px) saturate(110%);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 720px;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.lang-search {
  width: 100%;
  border: 1.5px solid var(--paper-deep);
  background: rgba(255, 251, 240, 0.7);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 16px;
  margin-bottom: 18px;
  outline: none;
  transition: border-color 160ms, background 160ms;
}
.lang-search:focus { border-color: var(--sky); background: #fff; }
.lang-search::placeholder { color: var(--ink-soft); opacity: 0.7; }

.language-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 4px 8px;
  scrollbar-width: thin;
}
.language-grid::-webkit-scrollbar { width: 6px; }
.language-grid::-webkit-scrollbar-thumb { background: var(--paper-deep); border-radius: 3px; }

.language-item {
  padding: 8px 14px;
  background: var(--paper-warm);
  border: 1.5px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--ink);
  transition: transform 120ms ease, background 160ms, border-color 160ms;
  user-select: none;
}
.language-item:hover { background: var(--paper-deep); transform: translateY(-1px); }
.language-item.selected {
  background: var(--sky);
  border-color: var(--sky-deep);
  color: #fff;
  box-shadow: 0 4px 12px -2px rgba(45, 111, 142, 0.4);
}

.lang-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  gap: 12px;
}
.lang-actions .selected-label {
  font-size: 14px;
  color: var(--ink-soft);
}
.lang-actions .selected-label strong {
  color: var(--ink);
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 600;
}

/* ---------- Call page ---------- */

.page-call {
  background: var(--paper);
  min-height: 100vh;
  position: relative;
}
.page-call::before {
  /* Soft Ghibli backdrop barely visible behind the call */
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url("/static/media/hero.png");
  background-size: cover;
  background-position: center;
  opacity: 0.25;
  filter: blur(12px) saturate(115%);
}
.page-call::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(253,246,232,0.85), rgba(253,246,232,0.95));
}

.call-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 18px 28px 28px;
  gap: 20px;
}
.call-header {
  display: flex;
  align-items: center;
  gap: 16px;
}
.call-header .brand {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 600;
  font-size: 22px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.call-header .status {
  font-size: 14px;
  color: var(--ink-soft);
  font-weight: 500;
}
.call-header .status strong { color: var(--ink); font-family: "Fraunces", serif; font-style: italic; }

.video-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  flex: 1;
  min-height: 0;
}
@media (max-width: 880px) {
  .video-grid { grid-template-columns: 1fr; }
}

.video-panel {
  position: relative;
  margin: 0;
  background: var(--paper-warm);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(45, 35, 20, 0.06);
  aspect-ratio: 16 / 9;
}
.video-panel--local::after,
.video-panel--remote::after {
  /* Tiny corner badge identifying which side */
  content: attr(data-label);
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(253, 246, 232, 0.92);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}
.video-panel video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--ink);
}

.caption {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  /* Fixed height + bottom-anchored content = stable reading position. New
     words always land on the same baseline; old text drifts up and fades. */
  height: 5.6em;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: rgba(253, 246, 232, 0.94);
  color: var(--ink);
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 400;
  font-size: 17px;
  line-height: 1.4;
  padding: 14px 18px;
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(45, 35, 20, 0.06);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 200ms ease;
  /* Soft top-fade so text scrolling out the top of the caption pane fades
     away instead of getting hard-clipped. */
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 28%, #000 56%);
  mask-image: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 28%, #000 56%);
}
.caption.is-empty { opacity: 0; }

.caption-content {
  display: block;
  width: 100%;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}

/* New words fade in; existing words stay put. */
.caption .word {
  display: inline;
  animation: caption-word-fade 220ms ease-out both;
}
@keyframes caption-word-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Peer panel is the one you want to read most — bump prominence slightly. */
.video-panel--remote .caption {
  font-size: 18px;
  background: rgba(255, 252, 240, 0.96);
  border-color: rgba(45, 111, 142, 0.18);
}

/* ---------- Call controls bar ---------- */

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(253, 246, 232, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  align-self: center;
}

.mode-toggle {
  display: inline-flex;
  background: var(--paper-deep);
  border-radius: 999px;
  padding: 4px;
  position: relative;
}
.mode-toggle button {
  background: transparent;
  color: var(--ink-soft);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 999px;
  position: relative;
  z-index: 1;
}
.mode-toggle button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(45, 35, 20, 0.12);
}
.mode-toggle button:disabled { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.icon-btn:disabled { opacity: 0.45; }

.controls .lang-link {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px dashed var(--ink-soft);
  font-size: 13px;
  margin-left: 4px;
}
.controls .lang-link:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- Floating decorations ---------- */

@keyframes drift {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  50% { transform: translate(8px, -6px) rotate(-2deg); }
}
.float-1 { animation: drift 9s ease-in-out infinite; }
.float-2 { animation: drift 11s ease-in-out infinite reverse; }

/* ---------- Stats for nerds ---------- */

.stats-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(20, 24, 32, 0.92);
  color: #cfe7f6;
  font-family: ui-monospace, "SF Mono", "Menlo", monospace;
  font-size: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  min-width: 240px;
  max-width: 320px;
  z-index: 100;
  display: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.stats-panel.is-visible { display: block; }
.stats-panel .stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 2px 0;
}
.stats-panel .stat .k {
  color: #7fa8c4;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stats-panel .stat .v {
  color: #fdf6e8;
  font-variant-numeric: tabular-nums;
}
.stats-panel hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 6px 0;
}
