/* ==========================================================================
   CONNECTRA "Campfire for human connection" theme: the ONLY place colours, fonts, spacing and
   motion are defined. Every page loads this file first; page stylesheets only lay things out
   using these tokens. Slate night by default, a warm light variant, one amber accent, and a
   flame gradient reserved for special moments (match found, connected, a win, the flame mark).
   Token names are historical: "ember" = Primary, "glow" = Warning/streaks, "mint" = Success,
   "rose" = Error, "sky" = Info.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts (self-hosted, OFL): Inter for everything
   -------------------------------------------------------------------------- */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/inter-latin-800-normal.woff2') format('woff2'); }

/* --------------------------------------------------------------------------
   Tokens: dark (default)
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #0F172A;
  --surface: #1E293B;
  --surface-2: #27364B;                   /* elevated surface */
  --border: #334155;
  --overlay: rgba(15, 23, 42, 0.78);
  --scrim: rgba(2, 6, 23, 0.6);           /* behind modals */
  --media-bg: #000000;                    /* behind video */
  --media-scrim: rgba(0, 0, 0, 0.72);     /* captions and labels over video (both themes) */
  --night: #0B1120;                       /* the darkest sky behind the campfire */

  /* Text */
  --text: #F8FAFC;
  --text-muted: #B6C2D2;
  --text-on-accent: #0F172A;              /* on Primary fills */
  --text-on-glow: #0F172A;                /* on Warning fills */
  --text-on-mint: #0F172A;                /* on Success fills */
  --text-on-danger: #0F172A;              /* on Error fills */
  --text-on-media: #FFFFFF;               /* over video and photos */

  /* Brand */
  --ember: #F6A65B;                       /* Primary */
  --ember-hover: #FFBF80;
  --ember-soft: rgba(246, 166, 91, 0.14);
  --glow: #FBBF24;                        /* Warning, streaks, badges, Friendship Clock */
  --glow-soft: rgba(251, 191, 36, 0.14);
  --mint: #34D399;                        /* Success, online, connected */
  --mint-soft: rgba(52, 211, 153, 0.14);
  --rose: #FB7185;                        /* Error, report, block */
  --rose-soft: rgba(251, 113, 133, 0.1);
  --sky: #60A5FA;                         /* Info, links */
  --sky-soft: rgba(96, 165, 250, 0.12);

  /* Accents used AS TEXT (same as the fills in dark mode; darker in light mode for contrast) */
  --ember-text: var(--ember);
  --glow-text: var(--glow);
  --mint-text: var(--mint);
  --rose-text: var(--rose);
  --sky-text: var(--sky);

  /* The campfire: flame layers and warm light */
  --flame-outer: #EA580C;
  --flame-mid: #F6A65B;
  --flame-core: #FEF3C7;
  --fire-light: rgba(246, 166, 91, 0.22); /* the warm glow cast around the fire */
  --fire-light-far: rgba(246, 166, 91, 0.06);
  --spark: rgba(254, 215, 170, 0.9);      /* embers and particles */

  /* The ONLY gradient - reserved for special moments */
  --gradient-moment: linear-gradient(135deg, #F6A65B 0%, #FBBF24 100%);

  /* Game art (boards and pieces) */
  --art-red: #E5484D;
  --art-yellow: #F5C542;
  --art-green: #46A758;
  --art-blue: #3E7BD6;
  --art-light: #F4ECDD;                   /* light board squares / paper */
  --art-dark: #B98B5E;                    /* dark board squares (warm wood) */
  --art-ink: #2A1E14;
  --art-snake: #2F9E5E;
  --art-snake-dark: #1D6B3E;
  --art-ladder: #8A5A35;
  --art-glass: #3F8F4F;
  --art-glass-dark: #1F5A2B;
  --art-label: #FFF3D6;
  --art-cork: #C49A45;
  --gm-mine: var(--ember);               /* your pieces */
  --gm-theirs: var(--sky);                /* the other player's pieces */
  --piece-white: #FFFFFF;
  --piece-black: #1B1A1F;

  /* Type */
  --font-display: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-xs: 13px; --fs-sm: 14px; --fs-md: 16px; --fs-lg: 20px;
  --fs-xl: 30px; --fs-2xl: 40px; --fs-3xl: 60px;

  /* Shape & space (4px grid) */
  --radius-card: 20px; --radius-input: 12px; --radius-pill: 999px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-8: 32px; --space-12: 48px; --space-section: 104px;
  --content-max: 1200px;
  --shadow-1: 0 1px 2px rgba(2, 6, 23, 0.4);
  --shadow-2: 0 12px 32px rgba(2, 6, 23, 0.45);
  --tap: 44px;                            /* minimum tap target */
  --nav-h: 64px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --dur-fast: 180ms; --dur: 300ms; --dur-slow: 500ms; --dur-cinematic: 1100ms;
}

/* Phones: tighter section rhythm */
@media (max-width: 600px) {
  :root { --space-section: 72px; }
}

/* --------------------------------------------------------------------------
   Tokens: light (chosen, or "Auto" on a light system)
   Light primary text uses the darker amber (#A95110) and buttons brighten on hover, so text
   stays at least 4.5:1 everywhere.
   -------------------------------------------------------------------------- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F8F7F4; --surface: #FFFFFF; --surface-2: #F0ECE5; --border: #DDE2E8;
  --overlay: rgba(248, 247, 244, 0.82);
  --scrim: rgba(23, 32, 51, 0.35);
  --night: #EFE7DB;
  --text: #172033; --text-muted: #5E6878;
  --text-on-danger: #FFFFFF; --text-on-glow: #FFFFFF; --text-on-mint: #FFFFFF;
  --ember: #C96819; --ember-hover: #D9782C; --ember-soft: rgba(201, 104, 25, 0.12);
  --glow: #9A5B00; --glow-soft: rgba(154, 91, 0, 0.1);
  --mint: #087F5B; --mint-soft: rgba(8, 127, 91, 0.1);
  --rose: #C62838; --rose-soft: rgba(198, 40, 56, 0.08);
  --sky: #1D4ED8; --sky-soft: rgba(29, 78, 216, 0.08);
  --ember-text: #A95110; --glow-text: #9A5B00; --mint-text: #087756; --rose-text: #C62838; --sky-text: #1D4ED8;
  --fire-light: rgba(201, 104, 25, 0.16);
  --fire-light-far: rgba(201, 104, 25, 0.05);
  --spark: rgba(201, 104, 25, 0.55);
  --gradient-moment: linear-gradient(135deg, #D9782C 0%, #F0B24A 100%);
  --shadow-1: 0 1px 2px rgba(23, 32, 51, 0.08);
  --shadow-2: 0 12px 32px rgba(23, 32, 51, 0.12);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    color-scheme: light;
    --bg: #F8F7F4; --surface: #FFFFFF; --surface-2: #F0ECE5; --border: #DDE2E8;
    --overlay: rgba(248, 247, 244, 0.82);
    --scrim: rgba(23, 32, 51, 0.35);
    --night: #EFE7DB;
    --text: #172033; --text-muted: #5E6878;
    --text-on-danger: #FFFFFF; --text-on-glow: #FFFFFF; --text-on-mint: #FFFFFF;
    --ember: #C96819; --ember-hover: #D9782C; --ember-soft: rgba(201, 104, 25, 0.12);
    --glow: #9A5B00; --glow-soft: rgba(154, 91, 0, 0.1);
    --mint: #087F5B; --mint-soft: rgba(8, 127, 91, 0.1);
    --rose: #C62838; --rose-soft: rgba(198, 40, 56, 0.08);
    --sky: #1D4ED8; --sky-soft: rgba(29, 78, 216, 0.08);
    --ember-text: #A95110; --glow-text: #9A5B00; --mint-text: #087756; --rose-text: #C62838; --sky-text: #1D4ED8;
    --fire-light: rgba(201, 104, 25, 0.16);
    --fire-light-far: rgba(201, 104, 25, 0.05);
    --spark: rgba(201, 104, 25, 0.55);
    --gradient-moment: linear-gradient(135deg, #D9782C 0%, #F0B24A 100%);
    --shadow-1: 0 1px 2px rgba(23, 32, 51, 0.08);
    --shadow-2: 0 12px 32px rgba(23, 32, 51, 0.12);
  }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4,
.display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

a {
  color: var(--sky-text);
}

img,
video,
svg,
canvas {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--ember-soft);
}

:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

.muted { color: var(--text-muted); }
.text-mint { color: var(--mint-text); }
.text-rose { color: var(--rose-text); }
.text-glow { color: var(--glow-text); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Scrollbars: thin and quiet. Chromium/Safari use ::-webkit-scrollbar; the standard properties
   are for Firefox only, because Chrome ignores ::-webkit-scrollbar on elements that set them. */
@supports (-moz-appearance: none) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
  background-clip: padding-box;
}

/* --------------------------------------------------------------------------
   Motion (our own tiny keyframes; transform + opacity only)
   -------------------------------------------------------------------------- */
@keyframes fade-in { from { opacity: 0; } }
@keyframes slide-up { from { opacity: 0; transform: translateY(12px); } }
@keyframes scale-in { from { opacity: 0; transform: scale(0.96); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ember-pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.55; }
  50% { transform: scale(1.06); opacity: 1; }
}
@keyframes dot-pulse {
  50% { transform: scale(1.5); opacity: 0.5; }
}
@keyframes moment-flash {
  0% { opacity: 0; }
  30% { opacity: 0.85; }
  100% { opacity: 0; }
}

.anim-fade { animation: fade-in var(--dur-slow) var(--ease) both; }
.anim-up { animation: slide-up var(--dur-slow) var(--ease) both; }
.anim-scale { animation: scale-in var(--dur) var(--ease) both; }

/* Page transitions (browsers with cross-document View Transitions): the old page dims and softens
   like embers settling, and the next one rises in. Other browsers just navigate. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: page-out 240ms var(--ease) both; }
::view-transition-new(root) { animation: page-in 440ms var(--ease) both; }
@keyframes page-out { to { opacity: 0; transform: scale(0.985); filter: blur(6px); } }
@keyframes page-in { from { opacity: 0; transform: scale(1.015); filter: blur(6px); } }

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   Buttons. Existing page classes share these looks (JS relies on their names):
     primary   .btn-primary  .connect-btn .sc-btn-primary .mini-btn.primary .gm-play-btn .icebreaker-btn.primary
     secondary .btn-secondary .nav-link-btn .sc-btn-secondary .mini-btn .gm-secondary-btn .exit-btn
               .instructions-btn .icebreaker-btn .next-btn .nav-pill-btn
     danger    .btn-danger .signout-btn .mini-btn.danger .gm-quit-btn .safety-btn
     filled danger .sc-btn-danger
   Only ONE primary per screen.
   -------------------------------------------------------------------------- */
.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.connect-btn,
.sc-btn,
.mini-btn,
.gm-play-btn,
.gm-secondary-btn,
.gm-quit-btn,
.icebreaker-btn,
.nav-link-btn,
.nav-pill-btn,
.exit-btn,
.instructions-btn,
.signout-btn,
.next-btn,
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 var(--space-6);
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast), opacity var(--dur-fast);
}

/* Primary: Ember */
.btn-primary,
.connect-btn,
.sc-btn-primary,
.mini-btn.primary,
.gm-play-btn,
.icebreaker-btn.primary {
  background: var(--ember);
  color: var(--text-on-accent);
  border-color: var(--ember);
}

.btn-primary:not(:disabled):hover,
.connect-btn:not(:disabled):hover,
.sc-btn-primary:not(:disabled):hover,
.mini-btn.primary:not(:disabled):hover,
.gm-play-btn:not(:disabled):hover,
.icebreaker-btn.primary:not(:disabled):hover {
  background: var(--ember-hover);
  border-color: var(--ember-hover);
}

/* Secondary: quiet surface */
.btn-secondary,
.sc-btn-secondary,
.mini-btn,
.gm-secondary-btn,
.icebreaker-btn,
.nav-link-btn,
.nav-pill-btn,
.exit-btn,
.instructions-btn,
.next-btn,
.share-btn {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:not(:disabled):hover,
.sc-btn-secondary:not(:disabled):hover,
.mini-btn:not(.primary):not(.danger):not(:disabled):hover,
.gm-secondary-btn:not(:disabled):hover,
.icebreaker-btn:not(.primary):hover,
.nav-link-btn:hover,
.nav-pill-btn:hover,
.exit-btn:hover,
.instructions-btn:hover,
.next-btn:not(:disabled):hover,
.share-btn:not(:disabled):hover {
  border-color: var(--text-muted);
}

/* Ghost */
.btn-ghost,
.btn-link {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover { color: var(--text); }

.btn-link {
  min-height: 0;
  padding: var(--space-1) 0;
  border: none;
  color: var(--rose-text);
  text-decoration: underline;
}

/* Danger: Rose outline (report, block, sign out, quit) */
.btn-danger,
.signout-btn,
.mini-btn.danger,
.gm-quit-btn,
.safety-btn {
  background: transparent;
  color: var(--rose-text);
  border-color: var(--rose);
}

.btn-danger:not(:disabled):hover,
.signout-btn:hover,
.mini-btn.danger:not(:disabled):hover,
.gm-quit-btn:not(:disabled):hover,
.safety-btn:not(:disabled):hover {
  background: var(--rose-soft);
}

.sc-btn-danger {
  background: var(--rose);
  border-color: var(--rose);
  color: var(--text-on-danger);
}

/* Shared states */
.btn:not(:disabled):hover,
.connect-btn:not(:disabled):hover,
.sc-btn:not(:disabled):hover,
.mini-btn:not(:disabled):hover,
.gm-play-btn:not(:disabled):hover,
.gm-secondary-btn:not(:disabled):hover,
.gm-quit-btn:not(:disabled):hover,
.nav-link-btn:hover,
.nav-pill-btn:hover,
.exit-btn:hover,
.instructions-btn:hover,
.signout-btn:hover,
.next-btn:not(:disabled):hover,
.share-btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.btn:not(:disabled):active,
.connect-btn:not(:disabled):active,
.sc-btn:not(:disabled):active,
.mini-btn:not(:disabled):active,
.gm-play-btn:not(:disabled):active,
.gm-secondary-btn:not(:disabled):active,
.next-btn:not(:disabled):active,
.share-btn:not(:disabled):active {
  transform: scale(0.98);
}

.btn:disabled,
.connect-btn:disabled,
.sc-btn:disabled,
.mini-btn:disabled,
.gm-play-btn:disabled,
.gm-secondary-btn:disabled,
.next-btn:disabled,
.share-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Round icon buttons (44 x 44) */
.icon-btn,
.control-btn {
  width: var(--tap);
  height: var(--tap);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-md);
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur-fast), border-color var(--dur-fast);
}

.icon-btn:not(:disabled):hover,
.control-btn:not(:disabled):hover {
  transform: translateY(-1px);
  border-color: var(--text-muted);
}

.control-btn:disabled,
.icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* --------------------------------------------------------------------------
   Cards, panels and inputs
   -------------------------------------------------------------------------- */
.card,
.glass-card,
.glass-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
}

.input,
input[type="text"],
input[type="search"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="date"],
input:not([type]),
textarea,
select {
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  color: var(--text);
  outline: none;
  transition: border-color var(--dur-fast);
}

textarea {
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

.input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--ember);
}

select option {
  background: var(--surface);
  color: var(--text);
}

/* Switch (checkbox + .switch track) */
.switch,
.interest-switch-track {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background-color var(--dur-fast), border-color var(--dur-fast);
}

.switch::after,
.interest-switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--dur) var(--ease), background-color var(--dur-fast);
}

input:checked + .switch,
input:checked + .interest-switch-track {
  background: var(--ember);
  border-color: var(--ember);
}

input:checked + .switch::after,
input:checked + .interest-switch-track::after {
  transform: translateX(18px);
  background: var(--text-on-accent);
}

input:focus-visible + .switch,
input:focus-visible + .interest-switch-track {
  outline: 2px solid var(--ember);
  outline-offset: 2px;
}

/* Chips and badges */
.chip,
.cp-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--fs-sm);
}

.chip-language,
.cp-chip-language {
  color: var(--sky-text);
}

.chip-badge,
.badge {
  background: var(--glow-soft);
  border-color: var(--glow);
  color: var(--glow-text);
  font-weight: 600;
}

/* Avatars: initial on a quiet surface; a Glow ring for people with badges */
.avatar,
.cp-avatar,
.nav-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  border: 2px solid var(--border);
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 800;
}

.avatar img,
.cp-avatar img,
.nav-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.has-badges,
.cp-avatar.has-badges {
  border-color: var(--glow);
  box-shadow: 0 0 0 3px var(--glow-soft);
}

/* Online / connected */
.pulse-dot,
.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  animation: dot-pulse 2s ease-in-out infinite;
}

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto var(--space-4);
  border: 3px solid var(--border);
  border-top-color: var(--ember);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* --------------------------------------------------------------------------
   Navbar (logo, controls, theme toggle)
   -------------------------------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  height: var(--nav-h);
  padding: 0 max(var(--space-4), 4vw);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-lg);
  letter-spacing: 0.02em;
}

/* The logo mark: the CONNECTRA flame */
.nav-logo img {
  width: 28px;
  height: 35px;
  filter: drop-shadow(0 0 8px var(--fire-light));
}

/* --------------------------------------------------------------------------
   Campfire pieces shared by the landing page, lobby and matching screen
   -------------------------------------------------------------------------- */
.flame-outer { fill: var(--flame-outer); }
.flame-mid { fill: var(--flame-mid); }
.flame-core { fill: var(--flame-core); }
.log { fill: var(--art-ladder); }
.log-2 { fill: var(--art-ink); }

.flicker {
  transform-origin: 50% 100%;
  animation: flicker 2.6s ease-in-out infinite;
}

@keyframes flicker {
  0%, 100% { transform: scale(1, 1) skewX(0deg); }
  20% { transform: scale(0.97, 1.05) skewX(-2deg); }
  45% { transform: scale(1.03, 0.96) skewX(2deg); }
  70% { transform: scale(0.98, 1.03) skewX(-1deg); }
}

/* Sparks rising off a fire: put <span class="sparks"><i></i>x8</span> inside a positioned box */
.sparks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sparks i {
  position: absolute;
  left: calc(50% + var(--dx, 0px));
  bottom: var(--from, 30%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--spark);
  opacity: 0;
  animation: spark-rise var(--life, 3s) ease-out var(--delay, 0s) infinite;
}

.sparks i:nth-child(1) { --dx: -14px; --delay: 0s; }
.sparks i:nth-child(2) { --dx: 10px; --delay: 0.5s; --life: 3.4s; }
.sparks i:nth-child(3) { --dx: -4px; --delay: 1.1s; }
.sparks i:nth-child(4) { --dx: 18px; --delay: 1.6s; --life: 2.6s; }
.sparks i:nth-child(5) { --dx: -20px; --delay: 2.1s; --life: 3.6s; }
.sparks i:nth-child(6) { --dx: 4px; --delay: 2.6s; }
.sparks i:nth-child(7) { --dx: -10px; --delay: 0.8s; --life: 2.8s; }
.sparks i:nth-child(8) { --dx: 14px; --delay: 1.9s; --life: 3.2s; }

@keyframes spark-rise {
  0% { opacity: 0; transform: translate(0, 0) scale(1); }
  15% { opacity: 0.95; }
  60% { transform: translate(var(--drift, 10px), -70px) scale(0.8); }
  100% { opacity: 0; transform: translate(calc(var(--drift, 10px) * -0.5), -130px) scale(0.4); }
}

.sparks i:nth-child(even) { --drift: -12px; }

@media (prefers-reduced-motion: reduce) {
  .sparks {
    display: none;
  }
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.theme-toggle {
  width: var(--tap);
  height: var(--tap);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.theme-toggle:hover {
  border-color: var(--text-muted);
}

.theme-toggle .theme-toggle-auto {
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
}

@media (max-width: 480px) {
  .nav-logo span {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Overlays, modals, toasts (glass is allowed only on overlays and the in-call bar)
   -------------------------------------------------------------------------- */
.scrim,
.sc-overlay,
.gm-overlay,
.profanity-popup-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: var(--scrim);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in var(--dur) var(--ease);
}

.modal-card,
.sc-modal,
.gm-picker,
.profanity-popup {
  width: 100%;
  max-height: calc(100vh - 2 * var(--space-4));
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-2);
  animation: scale-in var(--dur) var(--ease);
}

.toast,
.sc-toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-6);
  z-index: 11100;
  max-width: min(92vw, 460px);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ember);
  box-shadow: var(--shadow-2);
  color: var(--text);
  font-size: var(--fs-sm);
  text-align: center;
  transform: translate(-50%, 150%);
  opacity: 0;
  transition: transform var(--dur) var(--ease), opacity var(--dur);
}

.toast.show,
.sc-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.toast.success { border-left-color: var(--mint); }
.toast.error { border-left-color: var(--rose); }

/* Special moments: the only other place the gradient is used */
.moment-bg {
  background: var(--gradient-moment);
  color: var(--text-on-accent);
}

.moment-flash {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  background: var(--gradient-moment);
  opacity: 0;
  animation: moment-flash 300ms ease-out forwards;
}

/* --------------------------------------------------------------------------
   Article pages (instructions, privacy, terms)
   -------------------------------------------------------------------------- */
.article {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4) var(--space-12);
  line-height: 1.7;
}

.article-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  margin-bottom: var(--space-4);
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
}

.article-back:hover {
  color: var(--text);
}

.article h1 {
  font-size: clamp(var(--fs-xl), 6vw, var(--fs-2xl));
  margin-bottom: var(--space-2);
}

.article .lead {
  color: var(--text-muted);
  font-size: var(--fs-lg);
  margin-bottom: var(--space-8);
}

.article-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.article-top .article-back {
  margin-bottom: 0;
}

.article .header {
  margin-bottom: var(--space-6);
}

.article .header p {
  color: var(--text-muted);
}

.article section,
.article .section {
  padding: var(--space-6) 0;
  border-top: 1px solid var(--border);
}

.article h2 {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-lg);
  margin-bottom: var(--space-3);
}

.article p + p,
.article p + ul,
.article ul + p {
  margin-top: var(--space-3);
}

.article ul {
  padding-left: var(--space-6);
}

.article li + li {
  margin-top: var(--space-2);
}

.article .step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ember-soft);
  color: var(--ember-text);
  font-size: var(--fs-sm);
}

/* Legal pages: highlighted summary, contents, data tables, all-caps clauses */
.article .legal-callout {
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-card);
  background: var(--ember-soft);
  border-left: 4px solid var(--ember);
}

.article .toc {
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--border);
}

.article .toc ol {
  columns: 2 240px;
  column-gap: var(--space-8);
  padding-left: var(--space-6);
  font-size: var(--fs-sm);
}

.article .toc li + li {
  margin-top: var(--space-1);
}

.article .section {
  scroll-margin-top: var(--space-4);
}

.article .caps {
  font-size: var(--fs-sm);
  letter-spacing: 0.01em;
}

.article .table-wrap {
  overflow-x: auto;
  margin: var(--space-3) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
}

.article table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  line-height: 1.5;
}

.article th,
.article td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.article th {
  background: var(--surface-2);
  font-weight: 600;
}

.article tr:last-child td {
  border-bottom: none;
}

.article code {
  padding: 0 var(--space-1);
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 0.9em;
}

.article footer,
.article .footer {
  margin-top: var(--space-8);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  text-align: center;
}
