@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);
}

/* ---------- Searching button animations ---------- */

#searchBtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
#searchBtn .search-compass {
  display: inline-block;
  transition: transform 200ms ease;
}
#searchBtn .search-dots {
  display: none;
  align-items: center;
  gap: 3px;
  margin-left: 2px;
}
#searchBtn .search-dots i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: search-dot-pulse 1.2s ease-in-out infinite;
}
#searchBtn .search-dots i:nth-child(2) { animation-delay: 0.18s; }
#searchBtn .search-dots i:nth-child(3) { animation-delay: 0.36s; }

#searchBtn.is-searching {
  background: var(--sky-deep);
  opacity: 1 !important;
  cursor: progress;
}
#searchBtn.is-searching .search-compass {
  animation: search-compass-spin 1.6s linear infinite;
}
#searchBtn.is-searching .search-dots {
  display: inline-flex;
}
/* Shimmer band sweeping across the button. */
#searchBtn.is-searching::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 40%;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,0.22) 50%, transparent 100%);
  animation: search-shimmer 1.8s linear infinite;
  pointer-events: none;
}

@keyframes search-compass-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes search-dot-pulse {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50%      { opacity: 1; transform: translateY(-2px); }
}
@keyframes search-shimmer {
  from { left: -40%; }
  to   { left: 100%; }
}
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; }
/* Rows double as retry buttons — clicking re-runs the device probe (and
   re-prompts when the browser allows it). */
.onb-device { cursor: pointer; }
.onb-device:hover { background: rgba(45, 111, 142, 0.06); }
.onb-preview:not(.has-video) { cursor: pointer; }
.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;
}
.onb-moderation-text a {
  color: #2d6f8e;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- 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 notice 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; }

/* Per-call countdown timer — pinned to the right of the header. Monospace
   tabular figures so the digits don't jitter as they tick down. */
.call-timer {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.call-timer[hidden] { display: none; }
/* Final 30 seconds: go red and pulse to signal the call is about to end. */
.call-timer.is-ending {
  color: #b00020;
  background: rgba(176, 0, 32, 0.1);
  border-color: rgba(176, 0, 32, 0.25);
  animation: call-timer-pulse 1s ease-in-out infinite;
}
@keyframes call-timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* Live "N travelers online" pill — fed by /api/status so a lone visitor
   knows whether anyone is out there before (and while) they search. */
.online-count {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.online-count::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2fa46a;
  box-shadow: 0 0 0 3px rgba(47, 164, 106, 0.18);
}
.online-count[hidden] { display: none; }

/* ---------- Video stage (Meet/Zoom layout) ----------
   Remote video is the stage and fills the entire .video-grid. Local video
   is a picture-in-picture in the bottom-right. Only the peer's caption is
   visible — overlaid on the bottom-center of the stage. */

.video-grid {
  position: relative;
  flex: 1;
  min-height: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--ink);
  box-shadow: var(--shadow-soft);
}

.video-panel {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

/* Remote = the whole stage. */
.video-panel--remote {
  position: absolute;
  inset: 0;
}

/* Local = PiP in the bottom-right corner, on top of the stage. */
.video-panel--local {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  width: 240px;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

/* The PiP is unambiguously the user — drop the "You" badge. Keep the
   remote "Traveler" badge but make it contrast against dark video. */
.video-panel--local::after { display: none; }
.video-panel--remote::after {
  content: attr(data-label);
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  background: rgba(0, 0, 0, 0.55);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.video-panel video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--ink);
}

/* Local caption is hidden — reading your own transcript while you speak is
   confusing and the local renderer keeps firing in_delta in the background
   for slog/eval purposes, so we just don't show it. */
.video-panel--local .caption { display: none !important; }

/* Shared text container; the visible peer caption styles its position/colors/
   size in .video-panel--remote .caption below. No fade: text appears and is
   hidden instantly. */
.caption.is-empty { opacity: 0; }

/* Caption tunables — overridable live by the dev panel via inline custom
   properties on :root. The values here are the production defaults. */
:root {
  --cap-max-lines: 4;
  --cap-font-size: 22px;
  --cap-line-height: 1.4;      /* unitless; also drives the max-height calc */
  --cap-line-gap: 0px;         /* vertical space between segments */
  --cap-align: center;         /* text-align: center | left */
  --cap-width: min(720px, 78%);
  --cap-bottom: 32px;          /* offset from the bottom of the stage */
  --cap-bg-alpha: 0.55;        /* backdrop opacity */
  --cap-blur: 10px;            /* backdrop blur radius */
  --cap-anchor-justify: flex-end;  /* flex-end = grow up | flex-start = grow down */
  --cap-anchor-align: flex-end;
}

/* Column of line segments. With the default anchor, new text grows upward and
   the oldest lines clip off the top (overflow), so the bottom edge stays put. */
.caption-content {
  display: flex;
  flex-direction: column;
  justify-content: var(--cap-anchor-justify, flex-end);
  width: 100%;
  max-height: calc(var(--cap-max-lines, 4) * var(--cap-line-height, 1.4) * 1em);
  overflow: hidden;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
  text-align: var(--cap-align, center);
}

/* Each segment is one logical line (a burst of speech between pauses); it may
   wrap to several visual lines. */
.caption .caption-line {
  display: block;
}
.caption .caption-line + .caption-line {
  margin-top: var(--cap-line-gap, 0px);
}

/* Optional positional slide-in for new segments (no opacity — not a fade). */
.caption-content.cap-slide .caption-line {
  animation: caption-slide-in 180ms ease-out both;
}
@keyframes caption-slide-in {
  from { transform: translateY(0.5em); }
  to   { transform: translateY(0); }
}

/* The peer caption: a translucent overlay at the bottom-center of the stage.
   Dark blurred backdrop reads cleanly over arbitrary video; growing text clips
   at the anchored edge (hard cut, no fade). */
.video-panel--remote .caption {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--cap-bottom, 32px);
  width: var(--cap-width, min(720px, 78%));
  height: auto;
  max-height: calc(var(--cap-max-lines, 4) * var(--cap-line-height, 1.4) * 1em + 28px);
  display: flex;
  align-items: var(--cap-anchor-align, flex-end);
  overflow: hidden;
  padding: 14px 22px;
  border-radius: 14px;
  background: rgba(15, 22, 32, var(--cap-bg-alpha, 0.55));
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(var(--cap-blur, 10px)) saturate(120%);
  -webkit-backdrop-filter: blur(var(--cap-blur, 10px)) saturate(120%);
  color: var(--paper);
  /* Sans-serif, upright by default — easier to read over video. Family/style
     come from the settings modal (settings.js); --cap-font-size is shared
     between the settings modal and the solo dev panel. */
  font-family: var(--caption-font-family, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif);
  font-style: var(--caption-font-style, normal);
  font-weight: 500;
  font-size: var(--cap-font-size, 22px);
  line-height: var(--cap-line-height, 1.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

@media (max-width: 760px) {
  .call-shell { padding: 14px 14px 20px; gap: 14px; }
  /* Move the PiP to the top-right so it doesn't collide with the bottom-
     center caption overlay on a narrow viewport. */
  .video-panel--local {
    width: 110px;
    right: 12px;
    top: 12px;
    bottom: auto;
    border-radius: 12px;
    border-width: 1.5px;
  }
  /* Push the "Traveler" badge to the top-left so it doesn't overlap PiP. */
  .video-panel--remote::after {
    top: 12px; left: 12px; font-size: 11px; padding: 4px 10px;
  }
  .video-panel--remote .caption {
    width: 92%;
    font-size: var(--caption-font-size-mobile, 17px);
    bottom: 18px;
    padding: 11px 16px;
    border-radius: 12px;
    height: auto;
    max-height: calc(var(--cap-max-lines, 4) * var(--cap-line-height, 1.4) * 1em + 22px);
  }
}

/* ---------- 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;
  flex-shrink: 0;
}
.icon-btn:disabled { opacity: 0.45; }
.icon-btn .ico { display: block; }

/* Mute button holds both mic icons; .is-muted swaps which one shows. */
#muteBtn .ico-mic-off { display: none; }
#muteBtn.is-muted .ico-mic-on { display: none; }
#muteBtn.is-muted .ico-mic-off { display: block; }
#muteBtn.is-muted {
  background: rgba(196, 90, 79, 0.14);
  color: var(--sail);
}

/* ---------- 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: "Nunito", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 12.5px;
  padding: 14px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  min-width: 280px;
  max-width: 360px;
  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: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
}
.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: 8px 0 4px;
}
.stats-panel .section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #8fb6d1;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 4px 0 6px;
}
.stats-panel .section .help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(143, 182, 209, 0.18);
  color: #b6d3e8;
  font-family: "Nunito", sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  cursor: help;
}
.stats-panel .state {
  font-weight: 700;
}
.stats-panel .state-ok { color: #6cd9a5; }
.stats-panel .state-warn { color: #e2b85b; }
.stats-panel .state-err { color: #e07b6e; }
.stats-panel .state-n { color: #cfe7f6; }

/* ---------- Legal pages (privacy / terms / guidelines) ---------- */

.legal-page { background: var(--paper); color: var(--ink); min-height: 100vh; }
.legal-wrap { max-width: 760px; margin: 0 auto; padding: 52px 24px 96px; }
.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--sky-deep);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 28px;
}
.legal-back:hover { text-decoration: underline; }
.legal-wrap h1 { font-size: 34px; margin: 0 0 6px; }
.legal-meta { color: var(--ink-soft); font-size: 14px; margin: 0 0 32px; }
.legal-wrap h2 { font-size: 22px; margin: 38px 0 10px; }
.legal-wrap h3 {
  font-family: "Nunito", -apple-system, sans-serif;
  font-weight: 700;
  font-size: 16.5px;
  margin: 22px 0 6px;
}
.legal-wrap p, .legal-wrap li { font-size: 15.5px; line-height: 1.65; color: #3a3328; }
.legal-wrap ul { padding-left: 22px; margin: 8px 0; }
.legal-wrap li { margin: 5px 0; }
.legal-wrap a { color: var(--sky-deep); }
.legal-callout {
  background: var(--paper-warm);
  border: 1px solid var(--paper-deep);
  border-radius: 14px;
  padding: 16px 20px;
  margin: 24px 0;
}
.legal-callout p { margin: 0; }
.legal-footer {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--paper-deep);
  font-size: 14px;
  color: var(--ink-soft);
}
.legal-footer a {
  color: var(--sky-deep);
  font-weight: 700;
  margin-right: 18px;
  text-decoration: none;
}
.legal-footer a:hover { text-decoration: underline; }

@media (max-width: 760px) {
  .legal-wrap { padding: 36px 18px 72px; }
  .legal-wrap h1 { font-size: 28px; }
}

/* ===========================================================================
   BADGE GAME — passport link, connecting globe, badge unlock, onboarding,
   and the passport collection page.
   =========================================================================== */

/* ---------- Passport link in the call header ---------- */
.passport-link {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--sky-deep);
  font-weight: 700;
  font-size: 13.5px;
  padding: 7px 12px 7px 12px;
  border-radius: 999px;
  background: rgba(127, 189, 230, 0.14);
  border: 1px solid rgba(45, 111, 142, 0.18);
  transition: background 160ms ease, transform 120ms ease;
}
.passport-link:hover { background: rgba(127, 189, 230, 0.26); transform: translateY(-1px); }
.passport-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
}
.passport-count.has-badges { background: var(--gold); color: #4a3a16; }
@media (max-width: 640px) { .passport-link .passport-label { display: none; } }

/* ---------- Shared badge medallion (placeholder art) ---------- */
.badge-medallion {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.badge-medallion img { width: 100%; height: 100%; object-fit: contain; }
.badge-svg { display: block; filter: drop-shadow(0 6px 14px rgba(45, 35, 20, 0.28)); }
.badge-rays { transform-origin: 50px 50px; }
.badge-flag {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25));
  user-select: none;
}
.badge-medallion.is-locked { filter: grayscale(1) brightness(0.92); opacity: 0.5; }
.badge-medallion.is-locked .badge-flag { opacity: 0.35; }
.badge-lock {
  position: absolute;
  right: -2px;
  bottom: -2px;
  font-size: 0.9em;
  background: rgba(42, 36, 28, 0.85);
  color: #fff;
  width: 1.5em;
  height: 1.5em;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* ---------- The connecting globe overlay ---------- */
.voyage-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 35%, #14304d 0%, #0a1726 55%, #05080f 100%);
  opacity: 0;
  transition: opacity 500ms ease;
}
.voyage-overlay.is-active { display: flex; opacity: 1; }
.voyage-overlay.is-leaving { opacity: 0; transform: scale(1.04); transition: opacity 600ms ease, transform 600ms ease; }

.voyage-starfield {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 75% 20%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 50% 60%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 85% 75%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 30% 80%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 65% 45%, rgba(255,255,255,0.45), transparent),
    radial-gradient(1.5px 1.5px at 10% 65%, rgba(255,255,255,0.5), transparent);
  opacity: 0.8;
  animation: voyage-twinkle 5s ease-in-out infinite alternate;
}
@keyframes voyage-twinkle { from { opacity: 0.5; } to { opacity: 0.95; } }

.voyage-globe-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.voyage-globe { width: min(82vmin, 640px); height: min(82vmin, 640px); }

.voyage-hud {
  position: absolute;
  bottom: clamp(28px, 9vh, 80px);
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.voyage-status {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-radius: 999px;
  background: rgba(10, 22, 38, 0.6);
  border: 1px solid rgba(127, 189, 230, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #eaf4fb;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.voyage-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(207, 231, 246, 0.35);
  border-top-color: var(--gold);
  animation: voyage-spin 0.9s linear infinite;
}
.voyage-status:not(.is-spinning) .voyage-spinner { display: none; }
@keyframes voyage-spin { to { transform: rotate(360deg); } }

.voyage-hud { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.voyage-cancel {
  pointer-events: auto;
  background: rgba(255,255,255,0.08);
  color: #cfe2f0;
  border: 1px solid rgba(207, 231, 246, 0.22);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
}
.voyage-cancel:hover { background: rgba(255,255,255,0.16); color: #fff; }
/* Hide the cancel affordance once we've matched / revealed a badge. */
.voyage-overlay .voyage-reveal.is-shown ~ .voyage-hud .voyage-cancel,
.voyage-overlay.is-arriving .voyage-cancel { display: none; }

/* ---------- Badge unlock reveal ---------- */
.voyage-reveal {
  position: relative;
  z-index: 2;
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 30px 34px 26px;
  width: min(92vw, 420px);
  border-radius: 28px;
  background: rgba(253, 246, 232, 0.96);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 30px 80px -18px rgba(0,0,0,0.6);
}
.voyage-reveal.is-shown {
  display: flex;
  animation: voyage-reveal-in 600ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes voyage-reveal-in {
  from { opacity: 0; transform: translateY(18px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.voyage-reveal-kicker {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.voyage-reveal-kicker.is-new { color: #b8861f; }
.voyage-reveal-medallion {
  display: inline-flex;
  margin-bottom: 12px;
  animation: voyage-badge-pop 700ms 120ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes voyage-badge-pop {
  0% { transform: scale(0.2) rotate(-25deg); opacity: 0; }
  70% { transform: scale(1.08) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
.voyage-reveal-country {
  font-family: "Fraunces", serif;
  font-size: 30px;
  font-style: italic;
  color: var(--ink);
  margin: 2px 0 4px;
}
.voyage-reveal-sub { margin: 0 0 14px; color: var(--ink-soft); font-size: 14px; max-width: 300px; }
.voyage-reveal-progress {
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--paper-warm);
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.voyage-reveal-progress strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.voyage-reveal-cta {
  position: relative;
  overflow: hidden;
  background: var(--sail);
  color: #fff;
  padding: 13px 30px;
  font-size: 15px;
  box-shadow: 0 10px 26px -8px rgba(196, 90, 79, 0.6);
}
.voyage-reveal-cta:hover { background: var(--sail-warm); transform: translateY(-1px); }
/* Depleting fill bar that visualizes the auto-join countdown. */
.voyage-cta-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
}
.voyage-cta-label { position: relative; z-index: 1; }

/* Confetti */
.voyage-confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.voyage-confetti i {
  position: absolute;
  left: 50%;
  top: 42%;
  display: block;
  border-radius: 2px;
  opacity: 0;
  animation: voyage-confetti-fly 1.8s var(--delay, 0s) cubic-bezier(0.18, 0.7, 0.4, 1) forwards;
}
@keyframes voyage-confetti-fly {
  0% { opacity: 1; transform: translate(0,0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); }
}

/* ---------- Mission briefing (onboarding) ---------- */
.voyage-onboard {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(8, 18, 30, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 400ms ease;
}
.voyage-onboard.is-shown { opacity: 1; }
.voyage-onboard-card {
  width: min(94vw, 460px);
  background: var(--paper);
  border-radius: 28px;
  padding: 30px 30px 24px;
  text-align: center;
  box-shadow: 0 30px 80px -16px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.7);
  transform: translateY(16px) scale(0.97);
  transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
.voyage-onboard.is-shown .voyage-onboard-card { transform: none; }
.voyage-onboard-globe {
  font-size: 52px;
  line-height: 1;
  animation: voyage-globe-bob 4s ease-in-out infinite;
}
@keyframes voyage-globe-bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(4deg); } }
.voyage-onboard-kicker {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sail);
}
.voyage-onboard-card h2 {
  font-size: 30px;
  font-style: italic;
  margin: 6px 0 8px;
}
.voyage-onboard-lede { color: var(--ink-soft); font-size: 14.5px; margin: 0 auto 18px; max-width: 360px; }
.voyage-onboard-steps { list-style: none; padding: 0; margin: 0 0 22px; text-align: left; display: grid; gap: 10px; }
.voyage-onboard-steps li {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper-warm);
  border: 1px solid rgba(45,35,20,0.06);
  border-radius: 14px;
  padding: 10px 14px;
}
.voyage-step-ico { font-size: 22px; flex-shrink: 0; }
.voyage-onboard-steps strong { display: block; font-size: 14.5px; color: var(--ink); }
.voyage-onboard-steps span { font-size: 13px; color: var(--ink-soft); }
.voyage-onboard-cta {
  background: var(--sail);
  color: #fff;
  width: 100%;
  padding: 14px;
  font-size: 15.5px;
  box-shadow: 0 10px 26px -8px rgba(196, 90, 79, 0.55);
}
.voyage-onboard-cta:hover { background: var(--sail-warm); transform: translateY(-1px); }
.voyage-onboard-skip {
  background: none;
  color: var(--ink-soft);
  font-size: 13.5px;
  margin-top: 6px;
  padding: 6px;
}
.voyage-onboard-skip:hover { color: var(--ink); }

/* ===========================================================================
   PASSPORT PAGE
   =========================================================================== */
.page-passport {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% -10%, #cfe7f6 0%, rgba(207,231,246,0) 55%),
    var(--paper);
  color: var(--ink);
}
.passport-shell { max-width: 1040px; margin: 0 auto; padding: 22px 24px 80px; }

.passport-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.passport-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: "Fraunces", serif;
  font-style: italic;
  font-weight: 600;
  font-size: 22px;
  color: var(--ink);
}
.passport-resume {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  color: var(--sky-deep);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(45, 111, 142, 0.2);
}
.passport-resume:hover { background: rgba(127, 189, 230, 0.16); }

.passport-hero {
  position: relative;
  text-align: center;
  padding: 30px 20px 34px;
  margin: 6px 0 22px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(45,111,142,0.10), rgba(45,111,142,0.02));
  border: 1px solid rgba(45, 111, 142, 0.12);
  overflow: hidden;
}
.passport-hero-glow {
  position: absolute;
  top: -120px; left: 50%;
  width: 460px; height: 460px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(226,184,91,0.22), rgba(226,184,91,0));
  pointer-events: none;
}
.passport-kicker {
  margin: 0;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sky-deep);
}
.passport-title { font-size: clamp(30px, 5vw, 46px); font-style: italic; margin: 4px 0 8px; }
.passport-lede { color: var(--ink-soft); max-width: 460px; margin: 0 auto 22px; font-size: 15px; }

.passport-stats {
  display: inline-flex;
  align-items: center;
  gap: 26px;
  padding: 18px 28px;
  background: rgba(253, 246, 232, 0.8);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 22px;
}
.passport-stat { display: inline-flex; align-items: center; gap: 14px; }
.passport-ring { position: relative; display: inline-flex; }
.passport-ring svg { transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--paper-deep); stroke-width: 7; }
.ring-fill {
  fill: none;
  stroke: var(--gold);
  stroke-width: 7;
  stroke-linecap: round;
}
.passport-ring-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 24px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.passport-stat-label { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); line-height: 1.25; text-align: left; }
.passport-stat-divider { width: 1px; align-self: stretch; background: rgba(45,35,20,0.1); }
.passport-stat-figures { display: flex; gap: 22px; }
.passport-stat-figures div { text-align: center; }
.passport-stat-figures strong {
  display: block;
  font-family: "Fraunces", serif;
  font-size: 24px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.passport-stat-figures span { font-size: 12px; color: var(--ink-soft); font-weight: 700; }

.passport-cta {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  background: var(--sail);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 13px 26px;
  border-radius: 999px;
  box-shadow: 0 10px 26px -8px rgba(196, 90, 79, 0.55);
  transition: transform 120ms ease, background 200ms ease;
}
.passport-cta:hover { background: var(--sail-warm); transform: translateY(-1px); }

.passport-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.passport-chip {
  background: var(--paper-warm);
  color: var(--ink-soft);
  border: 1px solid rgba(45,35,20,0.08);
  font-size: 13.5px;
  font-weight: 700;
  padding: 8px 14px;
}
.passport-chip:hover { background: var(--paper-deep); }
.passport-chip.is-active { background: var(--sky-deep); color: #fff; }
.chip-count { opacity: 0.7; font-variant-numeric: tabular-nums; margin-left: 4px; }
.passport-chip.is-active .chip-count { opacity: 0.9; }

.passport-loading { text-align: center; color: var(--ink-soft); padding: 60px 0; }

.passport-group { margin-bottom: 34px; }
.passport-group-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 19px;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--paper-deep);
}
.passport-group-count { font-family: "Nunito", sans-serif; font-size: 13px; font-weight: 700; color: var(--ink-soft); }

.passport-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
}
.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 16px 8px 14px;
  border-radius: 18px;
  background: rgba(253, 246, 232, 0.7);
  border: 1px solid rgba(45,35,20,0.06);
  transition: transform 160ms ease, box-shadow 200ms ease;
}
.badge-card.is-earned:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.badge-card.is-locked { background: rgba(232, 214, 168, 0.18); }
.badge-card-name { font-weight: 700; font-size: 13.5px; color: var(--ink); line-height: 1.2; }
.badge-card.is-locked .badge-card-name { color: var(--ink-soft); }
.badge-card-meta { font-size: 11.5px; color: var(--ink-soft); }
.badge-card-meta.locked { opacity: 0.7; }

@media (max-width: 760px) {
  .passport-stats { flex-direction: column; gap: 16px; }
  .passport-stat-divider { width: 60%; height: 1px; }
  .passport-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
  .voyage-reveal-country { font-size: 26px; }
}

/* ---------- In-call "ending soon" banner ---------- */
/* Floats top-center of the video stage during the final 30s so the call's
   end never sneaks up on anyone (the header pill alone is easy to miss). */

.time-warning {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(176, 0, 32, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: call-timer-pulse 1s ease-in-out infinite;
}
.time-warning[hidden] { display: none; }

/* Quiet-lobby indicators — the connecting globe is a full-screen overlay
   (z-index 1000), so the live count and the solo-mode hint must live in its
   HUD; anything outside the overlay is invisible during a search. */
.voyage-online {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 5px 14px;
  border-radius: 999px;
  white-space: nowrap;
}
.voyage-online::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2fb077;
  box-shadow: 0 0 0 3px rgba(47, 176, 119, 0.25);
}
.voyage-online[hidden] { display: none; }
.voyage-solo-hint {
  max-width: min(440px, calc(100vw - 48px));
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
}
.voyage-solo-hint a { color: #7cc4ff; font-weight: 700; }
.voyage-solo-hint[hidden] { display: none; }

/* ---------- "Time's up" overlay ---------- */

.timeup-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 28, 38, 0.66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: timeup-fade 240ms ease-out both;
}
.timeup-overlay[hidden] { display: none; }
@keyframes timeup-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.timeup-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  width: min(440px, 100%);
  padding: 38px 34px 30px;
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  animation: timeup-pop 320ms cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
@keyframes timeup-pop {
  from { transform: translateY(18px) scale(0.96); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.timeup-icon { color: var(--sail); margin-bottom: 6px; }
.timeup-card h2 { font-size: 30px; }
.timeup-card p { margin: 6px 0 18px; color: var(--ink-soft); font-size: 15px; }
.timeup-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}
.timeup-close {
  background: none;
  color: var(--ink-soft);
  font-size: 13.5px;
  padding: 10px 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.timeup-close:hover { color: var(--ink); }

/* ---------- Settings modal (captions + voice) ---------- */

.set-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 28, 38, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.set-overlay.is-open { display: flex; }

.set-card {
  width: min(460px, 100%);
  max-height: min(86vh, 640px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  padding: 22px 26px 26px;
}
.set-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.set-head h2 { font-size: 24px; }
.set-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-warm);
  color: var(--ink-soft);
}
.set-close:hover { background: var(--paper-deep); color: var(--ink); }

.set-section { margin-top: 16px; }
.set-section h3 {
  font-size: 12px;
  font-family: "Nunito", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 10px 0;
}
.set-label { font-weight: 700; font-size: 14px; }

.set-seg {
  display: inline-flex;
  background: var(--paper-deep);
  border-radius: 999px;
  padding: 3px;
}
.set-seg button {
  background: transparent;
  color: var(--ink-soft);
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 999px;
}
.set-seg button.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(45, 35, 20, 0.12);
}

.set-preview {
  margin-top: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  background: #1a2430;
  text-align: center;
}
/* Mirrors the live caption styling so changes preview instantly. */
.set-preview-text {
  color: var(--paper);
  font-family: var(--caption-font-family, ui-sans-serif, system-ui, sans-serif);
  font-style: var(--caption-font-style, normal);
  font-size: var(--cap-font-size, 22px);
  font-weight: 500;
  line-height: 1.4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.set-select-wrap { position: relative; flex: 1; max-width: 260px; }
.set-voice {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  border: 1px solid var(--paper-deep);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.set-hint {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* ---------- Landing: top-bar actions (donate / passport / settings) ---------- */

.onb-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.donate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--sail);
  color: #fff;
  font-weight: 700;
  font-size: 14.5px;
  text-decoration: none;
  box-shadow: 0 8px 22px -4px rgba(196, 90, 79, 0.55);
  transition: transform 120ms ease, background 200ms ease, box-shadow 200ms ease;
}
.donate-btn:hover {
  background: var(--sail-warm);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -6px rgba(196, 90, 79, 0.6);
}
.donate-btn svg { flex-shrink: 0; }

.onb-settings {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.onb-settings:hover { background: rgba(255, 255, 255, 0.28); }

.onb-mission {
  margin: 18px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  text-align: center;
}
.onb-mission a {
  color: var(--sail);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1px dashed var(--sail);
}
.onb-mission a:hover { color: var(--sail-warm); border-bottom-style: solid; }

/* ---------- Landing: "servers overloaded" notice ---------- */

.overload-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(16, 26, 38, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: timeup-fade 280ms ease-out both;
}
.overload-overlay[hidden] { display: none; }

.overload-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: min(460px, 100%);
  padding: 42px 36px 34px;
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: timeup-pop 340ms cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
.overload-icon { color: var(--sky-deep); margin-bottom: 10px; }
.overload-card h2 { font-size: 27px; line-height: 1.15; }
.overload-card p {
  margin: 12px 0 20px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}
.overload-pill {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(196, 90, 79, 0.12);
  border: 1px solid rgba(196, 90, 79, 0.3);
  color: var(--sail);
  font-weight: 700;
  font-size: 13px;
}

@media (max-width: 640px) {
  .donate-btn { padding: 9px 14px; font-size: 13.5px; }
  .onb-topbar-actions { gap: 8px; }
}
