/* ==========================================================================
   PaxPlay — "Night Transit Wayfinding" design system
   Distinctive departure-board aesthetic: amber on near-black, route-line
   navigation, ticket-stub game cards, gate-numbered sections.
   Mobile-first · responsive · prefers-reduced-motion aware
   ========================================================================== */

/* ── 1 · Tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Surfaces — night bus interior */
  --bg: #0b0e17;
  --bg-2: #0f1322;
  --surface: #141a2b;
  --surface-2: #1b2338;
  --surface-3: #232d47;

  /* Lines */
  --line: rgba(240, 235, 220, 0.08);
  --line-2: rgba(240, 235, 220, 0.16);

  /* Ink */
  --ink: #f2efe6;
  --ink-2: #a8b0c0;
  --ink-3: #6b7386;

  /* Accents — departure board amber + signal colours */
  --accent: #ffb020;
  --accent-2: #ff8a00;
  --accent-ink: #1a1206;
  --green: #3ddc97;
  --cyan: #4fc3f7;
  --red: #ff5a5a;
  --violet: #60a5fa;

  /* Gradients */
  --accent-grad: linear-gradient(135deg, #ffb020, #ff8a00);

  /* Shadows */
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --glow-acc: 0 0 24px rgba(255, 176, 32, 0.3);

  /* Radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* Type */
  --font-display: "Space Grotesk", "Sora", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  /* Layout — fluid; refined further by fluid-scale.css / ui-core.css */
  --topbar-h: clamp(52px, 3.2rem + 0.6vw, 64px);
  --bnav-h: clamp(56px, 3.5rem + 0.45vw, 68px);
  --page-px: clamp(14px, 3.2vw, 28px);
  --max-w: min(1200px, 100%);
  --sidebar-w: clamp(220px, 13rem + 1.2vw, 250px);

  /* Motion */
  --dur: 0.2s;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light theme — day bus, warm paper */
:root[data-theme="light"] {
  --bg: #f4f1e8;
  --bg-2: #ede9dd;
  --surface: #ffffff;
  --surface-2: #f6f3eb;
  --surface-3: #ede9dc;
  --line: rgba(20, 25, 40, 0.1);
  --line-2: rgba(20, 25, 40, 0.18);
  --ink: #1a2233;
  --ink-2: #5a6373;
  --ink-3: #8a93a0;
  --accent: #d97706;
  --accent-2: #b45309;
  --accent-ink: #ffffff;
  --green: #059669;
  --cyan: #0284c7;
  --red: #dc2626;
  --violet: #0284c7;
  --shadow-sm: 0 2px 10px rgba(20, 25, 40, 0.08);
  --shadow-md: 0 10px 28px rgba(20, 25, 40, 0.12);
  --shadow-lg: 0 24px 60px rgba(20, 25, 40, 0.16);
  --glow-acc: 0 0 20px rgba(217, 119, 6, 0.2);
}

/* ── 2 · Reset & base ───────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: clamp(0.9rem, 0.84rem + 0.28vw, 1.05rem);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  letter-spacing: 0.002em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
  min-height: 100dvh;
  overscroll-behavior: none;
}

h1,
h2,
h3,
.brand-name,
.section-title,
.featured-title,
.card-title,
.player-title,
.elia h1 {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.mark {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
::selection {
  background: rgba(255, 176, 32, 0.35);
}

button,
input,
select,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  font-family: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
[hidden] {
  display: none !important;
}
img,
svg {
  display: block;
  max-width: 100%;
}
ul,
ol {
  list-style: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ── 3 · Utilities ──────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
.skip-link {
  position: fixed;
  top: -70px;
  left: 14px;
  z-index: 999;
  padding: 11px 18px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 13.5px;
  transition: top 0.2s var(--ease);
}
.skip-link:focus {
  top: 14px;
}
.ui-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.meta-sep {
  color: var(--ink-3);
}
.empty-msg {
  color: var(--ink-3);
  font-size: 0.9rem;
  text-align: center;
  padding: 40px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
}

/* ── 4 · App shell ──────────────────────────────────────────────────────── */
.tech-frame {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
}
.tech-frame::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(
      1000px 600px at 15% -5%,
      rgba(255, 176, 32, 0.05),
      transparent 55%
    ),
    radial-gradient(
      800px 500px at 95% 5%,
      rgba(79, 195, 247, 0.04),
      transparent 55%
    );
}

/* ── 5 · Top bar ────────────────────────────────────────────────────────── */
.tech-top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--page-px);
  padding-left: max(var(--page-px), env(safe-area-inset-left));
  padding-right: max(var(--page-px), env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.tech-window-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.tech-window-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--surface);
}
.tech-window-dot:first-child {
  background: var(--accent);
  border-color: var(--accent);
}
.tech-window-dot:nth-child(2) {
  background: var(--cyan);
  border-color: var(--cyan);
}
.tech-window-dot:nth-child(3) {
  background: var(--surface);
}

.tech-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-family: var(--font-display);
  line-height: 1;
  white-space: nowrap;
}
.tech-brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-grad);
  box-shadow: var(--glow-acc);
}
.tech-brand-mark svg {
  width: 16px;
  height: 16px;
}
.tech-brand-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.tech-brand-name em {
  font-style: normal;
  color: var(--accent);
}
.tech-brand-sep {
  color: var(--ink-3);
  font-weight: 500;
}
.tech-brand-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
}
.tech-sys {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  flex-shrink: 0;
}
.tech-sys-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.18);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}
.header-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 16px;
  transition:
    background var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.header-btn:hover {
  background: var(--surface-2);
  border-color: var(--line-2);
}
.header-btn:active {
  transform: scale(0.92);
}
.header-actions #account-button {
  min-height: 38px;
  padding: 0 16px;
  border: none;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  transition: background var(--dur) var(--ease);
}
.header-actions #account-button:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Volume */
.volume-control {
  display: none;
  align-items: center;
}
.volume-control.is-open {
  display: flex;
}
.volume-slider {
  appearance: none;
  width: 100px;
  height: 4px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) 30%, var(--line-2) 30%);
  outline: none;
}
.volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--accent);
  box-shadow: var(--glow-acc);
}
.volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--accent);
}

/* ── 6 · Sidebar nav (desktop) / route strip (mobile) ───────────────────── */
.app-header {
  flex-shrink: 0;
  width: 100%;
  padding: 8px 12px;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.side-nav {
  width: 100%;
}
.mobile-nav-heading,
.mobile-nav-next {
  display: none;
}
.sidebar-heading {
  display: none;
}
.side-links {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}
.side-links::-webkit-scrollbar {
  display: none;
}
.side-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.side-link:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.side-link.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  box-shadow: var(--glow-acc);
}
.side-footer {
  display: none;
}

/* ── 7 · Main layout ────────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  padding: 20px 14px calc(var(--bnav-h) + env(safe-area-inset-bottom) + 20px);
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
}
.section {
  margin-bottom: 28px;
}

/* ── 8 · Buttons ────────────────────────────────────────────────────────── */
.btn,
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  border-radius: var(--r-md);
  border: none;
  transition:
    transform var(--dur) var(--spring),
    box-shadow var(--dur) var(--ease),
    background var(--dur) var(--ease);
}
.btn-primary {
  background: var(--accent-grad);
  color: var(--accent-ink);
  padding: 12px 22px;
  box-shadow: var(--glow-acc);
}
.btn-primary:hover {
  box-shadow: 0 0 30px rgba(255, 176, 32, 0.45);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: scale(0.95);
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line-2);
  padding: 11px 20px;
}
.btn-secondary:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.btn:active,
.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.95);
}
.theme-select {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  min-height: 44px;
}

/* ── 9 · Home layout ────────────────────────────────────────────────────── */
.home-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.welcome-banner {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px 22px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(
      500px 300px at 20% 0%,
      rgba(255, 176, 32, 0.12),
      transparent 60%
    ),
    var(--surface);
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.welcome-copy {
  position: relative;
  z-index: 2;
}
.hero-ticket {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero-ticket i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 176, 32, 0.2);
}
.welcome-copy h1 {
  font-size: clamp(2.2rem, 7vw, 3.5rem);
  font-weight: 700;
  line-height: 1.06;
  color: var(--ink);
  margin: 14px 0 12px;
}
.welcome-copy h1 em {
  font-style: normal;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.heading-star {
  font-size: 24px;
  margin-left: 4px;
}
.welcome-copy > p:not(.hero-note) {
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 48ch;
  margin-bottom: 20px;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}
.hero-primary,
.hero-secondary {
  min-height: 48px;
  padding: 13px 22px;
  font-size: 13px;
  border-radius: var(--r-pill);
}
.hero-primary {
  background: var(--accent-grad);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: var(--glow-acc);
}
.hero-primary:hover {
  box-shadow: 0 0 30px rgba(255, 176, 32, 0.45);
  transform: translateY(-1px);
}
.hero-primary:active {
  transform: scale(0.95);
}
.hero-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-2);
  font-weight: 600;
}
.hero-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.hero-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.stat b {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat span {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.welcome-copy .hero-note {
  font-size: 11px;
  line-height: 1.7;
  color: var(--ink-3);
  margin-top: 18px;
}

/* Departure art panel */
.departure-art {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 200px;
  padding: 22px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(
      ellipse at 70% 30%,
      rgba(255, 176, 32, 0.2),
      transparent 50%
    ),
    linear-gradient(145deg, var(--surface-3), var(--surface));
  border: 1px solid var(--line-2);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.departure-art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(
      circle at 80% 20%,
      rgba(79, 195, 247, 0.15),
      transparent 40%
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0 40px,
      rgba(240, 235, 220, 0.015) 40px 41px
    );
}
.departure-art .eyebrow {
  color: var(--cyan);
  font-size: 9px;
}
.departure-art strong {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--ink);
  margin: 10px 0;
  letter-spacing: -0.02em;
}
.departure-art small {
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.7;
}

/* Discovery section */
.home-discovery {
  padding: 22px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
}
.discovery-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}
.discovery-heading h2 {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  font-weight: 700;
  color: var(--ink);
  margin-top: 6px;
  letter-spacing: -0.02em;
}
.discovery-note {
  font-size: 11px;
  color: var(--ink-3);
}
.mood-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.mood-bar button {
  padding: 9px 14px;
  min-height: 40px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease);
}
.mood-bar button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.experience-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.experience-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 200px;
  padding: 20px;
  border-radius: var(--r-lg);
  overflow: hidden;
  isolation: isolate;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition:
    transform var(--dur) var(--spring),
    box-shadow var(--dur) var(--ease);
  cursor: pointer;
}
.experience-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.05) 20%,
    rgba(0, 0, 0, 0.65) 100%
  );
}
.experience-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.experience-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  font-size: 24px;
  background: rgba(255, 255, 255, 0.12);
}
.experience-card strong {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.experience-card small {
  font-size: 11px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.8);
  max-width: 200px;
}
.experience-arrow {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
.exp-play {
  background: linear-gradient(145deg, #b45309, #78350f);
}
.exp-watch {
  background: linear-gradient(145deg, #0369a1, #0c4a6e);
}
.exp-listen {
  background: linear-gradient(145deg, #0284c7, #075985);
}
.exp-read {
  background: linear-gradient(145deg, #047857, #064e3b);
}

/* Home rail */
.home-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.home-companion {
  padding: 22px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
}
.home-companion h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin: 10px 0;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.home-companion p {
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-2);
  margin-bottom: 16px;
}
.home-companion button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  transition: border-color var(--dur) var(--ease);
}
.home-companion button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.home-feature {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 170px;
  padding: 20px;
  border-radius: var(--r-lg);
  color: #fff;
  background: linear-gradient(145deg, #1e3a5f, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform var(--dur) var(--spring);
  cursor: pointer;
}
.home-feature:hover {
  transform: translateY(-3px);
}
.home-feature .eyebrow {
  color: var(--cyan);
  font-size: 9px;
}
.home-feature strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin: 8px 0;
  letter-spacing: -0.02em;
}
.home-feature small {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}
.rail-section {
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}
.rail-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.rail-heading h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.rail-track {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 14px 0;
  min-height: 60px;
  background: transparent;
  border: none;
  border-top: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.rail-track:hover {
  background: var(--surface-2);
}
.rail-track strong,
.rail-track small {
  display: block;
}
.rail-track strong {
  font-size: 13px;
  font-weight: 600;
}
.rail-track small {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 3px;
}
.track-art {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--accent);
  font-size: 20px;
}
.saved-art {
  color: var(--violet);
}

/* ── 10 · Service sections (videos / music / ebooks / library / settings) ── */
.service-section {
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 24px 22px;
}
.service-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}
.service-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--accent-grad);
  color: var(--accent-ink);
  font-size: 22px;
  box-shadow: var(--glow-acc);
}
.service-heading h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 4px;
  letter-spacing: -0.02em;
}
#service-description {
  font-size: 0.9rem;
  color: var(--ink-2);
  line-height: 1.65;
  margin-bottom: 20px;
}
.service-actions {
  display: grid;
  gap: 12px;
}
.service-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: border-color var(--dur) var(--ease);
}
.service-card:hover {
  border-color: var(--line-2);
}
.service-card h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.service-card p {
  font-size: 0.8rem;
  color: var(--ink-3);
  margin-top: 3px;
}
.service-action {
  padding: 10px 18px;
  min-height: 40px;
  border-radius: var(--r-pill);
  background: var(--accent-grad);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  border: none;
  transition: box-shadow var(--dur) var(--ease);
}
.service-action:hover {
  box-shadow: var(--glow-acc);
}
.service-action:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── 11 · Featured spotlight ───────────────────────────────────────────── */
.featured-section {
  margin-bottom: 28px;
}
.featured-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  min-height: 240px;
  cursor: pointer;
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-md);
  transition:
    transform var(--dur) var(--spring),
    box-shadow var(--dur) var(--ease);
}
.featured-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.featured-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    110deg,
    rgba(11, 14, 23, 0.75) 0%,
    rgba(11, 14, 23, 0.35) 50%,
    transparent 75%
  );
  pointer-events: none;
}
.featured-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 30px;
  min-height: 240px;
}
.featured-prism {
  font-size: 72px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.5));
}
.featured-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.featured-content .eyebrow {
  color: var(--accent);
}
.featured-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(242, 239, 230, 0.85);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.tag--diff {
  background: rgba(0, 0, 0, 0.35);
}
.tag--easy {
  color: var(--green);
}
.tag--medium {
  color: var(--accent);
}
.tag--hard {
  color: var(--red);
}
.featured-title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}
.featured-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(242, 239, 230, 0.8);
  max-width: 46ch;
}
.featured-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: rgba(242, 239, 230, 0.65);
}
.btn-featured {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 26px;
  border-radius: var(--r-pill);
  border: none;
  background: var(--accent-grad);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    transform var(--dur) var(--spring),
    box-shadow var(--dur) var(--ease);
}
.btn-featured:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  transform: translateY(-2px);
}
.btn-featured:active {
  transform: scale(0.95);
}
.btn-play-glyph {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-ink);
  color: var(--accent);
  font-size: 10px;
}

/* ── 12 · Library toolbar ───────────────────────────────────────────────── */
.library-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
}
.library-search {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 14px;
}
.library-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}
.library-search input::placeholder {
  color: var(--ink-3);
}
.connection-status {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ── 13 · Category pills ────────────────────────────────────────────────── */
.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.category-pills::-webkit-scrollbar {
  display: none;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  min-height: 40px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  transition:
    background var(--dur) var(--ease),
    color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.pill-emoji {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 14px;
}
.pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.pill--active {
  background: var(--accent-grad);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--glow-acc);
}
.pill--active .pill-emoji {
  background: rgba(255, 255, 255, 0.2);
}

/* ── 14 · Section headers ───────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  font-weight: 700;
  color: var(--ink);
  margin-top: 3px;
  letter-spacing: -0.02em;
}
.section-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

/* ── 15 · Game grid & ticket-stub cards ─────────────────────────────────── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.game-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  user-select: none;
  transition:
    transform var(--dur) var(--spring),
    box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 176, 32, 0.3);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}
.game-card:active {
  transform: scale(0.97);
}
.game-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Card art */
.card-art {
  aspect-ratio: 16/9;
  position: relative;
  background: linear-gradient(
    140deg,
    var(--card-a, var(--surface-3)),
    var(--card-b, var(--surface))
  );
  overflow: hidden;
}
.card-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      200px 120px at 20% -5%,
      rgba(255, 255, 255, 0.18),
      transparent 60%
    ),
    linear-gradient(to top, rgba(0, 0, 0, 0.3), transparent 55%);
  pointer-events: none;
}
.card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  z-index: 1;
}
.card-tag {
  position: absolute;
  top: 10px;
  left: 30px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: rgba(11, 14, 23, 0.6);
  color: rgba(242, 239, 230, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
  text-transform: uppercase;
}
.card-emoji {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  line-height: 1;
  z-index: 1;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.5));
  pointer-events: none;
  transition: transform var(--dur) var(--spring);
}
.game-card:hover .card-emoji {
  transform: translate(-50%, -52%) scale(1.12) rotate(-4deg);
}
.card-dots {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  z-index: 2;
  background: rgba(11, 14, 23, 0.5);
  padding: 3px 8px;
  border-radius: var(--r-pill);
  backdrop-filter: blur(3px);
}
.diff-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}
.diff-dot.filled {
  background: var(--accent);
  box-shadow: 0 0 6px rgba(255, 176, 32, 0.6);
}
.card-play {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  backdrop-filter: blur(4px);
  transition:
    transform var(--dur) var(--spring),
    background var(--dur) var(--ease);
}
/* Play icon removed from game cards per user request */
.card-play {
  display: none;
}

/* Card body — matches Popular Games .pax-card-info padding */
.card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
}
/* Hide category, description, and meta rows to match Popular Games cards */
.card-cat,
.card-desc,
.card-meta {
  display: none;
}
.card-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Tag pill matching Popular Games style */
.card-tag-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--surface-2);
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  align-self: flex-start;
}

/* ── 16 · Recently played ───────────────────────────────────────────────── */
.recent-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.recent-scroll::-webkit-scrollbar {
  display: none;
}
.recent-card {
  flex-shrink: 0;
  width: 88px;
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  cursor: pointer;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--dur) var(--spring),
    box-shadow var(--dur) var(--ease);
}
.recent-card:active {
  transform: scale(0.93);
}
.recent-card:hover {
  box-shadow: var(--shadow-md);
}
.recent-emoji {
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}
.recent-name {
  font-size: 9px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  line-height: 1.2;
}

/* ── 17 · Bottom nav (mobile) ─────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.bnav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 0;
  min-height: 48px;
  color: var(--ink-3);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: relative;
  border: none;
  background: none;
  transition:
    color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}
.bnav-btn span.bnav-icon {
  font-size: 20px;
  line-height: 1;
}
.bnav-btn.active {
  color: var(--accent);
}
.bnav-btn.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255, 176, 32, 0.7);
}
.bnav-btn:active {
  transform: scale(0.92);
}

/* ── 19 · Search overlay ────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow: hidden;
}
.search-overlay {
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  background: rgba(3, 8, 20, 0.68);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
  display: none;
}
.search-overlay.is-open {
  opacity: 1;
}
.search-container {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2.4vh, 22px);
  width: min(100%, 720px);
  height: min(
    680px,
    calc(
      100dvh -
        max(32px, env(safe-area-inset-top) + env(safe-area-inset-bottom) + 32px)
    )
  );
  min-height: 0;
  padding: clamp(18px, 3vw, 32px);
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: clamp(16px, 2vw, 24px);
  background: var(--bg-2);
  box-shadow: var(--shadow-lg);
}
.search-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.search-eyebrow {
  color: var(--accent);
  font: 600 10px/1.4 var(--font-mono);
  letter-spacing: 0.14em;
}
.search-heading h2 {
  margin-top: 5px;
  color: var(--ink);
  font-size: clamp(21px, 3vw, 30px);
}
.search-heading p {
  max-width: 240px;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.5;
  text-align: right;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 6px 8px 6px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-2);
  transition:
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.search-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.search-input-icon {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  color: var(--accent);
}
.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--ink);
  font: 500 16px/1.4 var(--font-body);
  min-width: 0;
}
.search-input::placeholder {
  color: var(--ink-3);
}
.search-close {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  transition: background var(--dur) var(--ease);
  cursor: pointer;
}
.search-close:hover {
  background: var(--surface-3);
  color: var(--ink);
}
.search-results {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 3px 4px;
}
.search-hint {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin: 0;
  padding: 20px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}
.search-result-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
  min-height: 74px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color var(--dur) var(--ease),
    background var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}
.search-result-item:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.search-result-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sri-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  font-size: 24px;
  flex-shrink: 0;
}
.sri-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sri-info strong {
  overflow: hidden;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sri-info span {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sri-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  min-height: 40px;
  border-radius: var(--r-pill);
  background: var(--accent-grad);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  transition: box-shadow var(--dur) var(--ease);
}
.search-result-item:hover .sri-play {
  box-shadow: var(--glow-acc);
}

@media (max-width: 560px) {
  .search-overlay {
    padding: max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }
  .search-container {
    width: 100%;
    height: calc(
      100dvh -
        max(20px, env(safe-area-inset-top) + env(safe-area-inset-bottom) + 20px)
    );
    padding: 18px 14px;
    border-radius: 18px;
  }
  .search-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .search-heading p {
    max-width: none;
    text-align: left;
  }
  .search-input-wrap {
    min-height: 54px;
    gap: 9px;
    padding-left: 12px;
  }
  .search-input {
    font-size: 15px;
  }
  .sri-icon {
    width: 42px;
    height: 42px;
    font-size: 21px;
  }
  .search-result-item {
    gap: 10px;
    padding: 10px;
  }
  .sri-play {
    padding-inline: 11px;
  }
}

@media (max-height: 480px) and (orientation: landscape) {
  .search-overlay {
    padding-block: max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-bottom));
  }
  .search-container {
    height: calc(
      100dvh -
        max(16px, env(safe-area-inset-top) + env(safe-area-inset-bottom) + 16px)
    );
    gap: 10px;
    padding-block: 12px;
  }
  .search-heading {
    align-items: center;
  }
  .search-heading h2 {
    font-size: 20px;
  }
  .search-heading p {
    display: none;
  }
  .search-input-wrap {
    min-height: 48px;
  }
  .search-close {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }
}

/* ── 20 · Game player ───────────────────────────────────────────────────── */
.game-player {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: none;
  flex-direction: column;
  background: var(--bg);
}
.game-player.is-open {
  animation: player-in 0.28s var(--ease);
}
@keyframes player-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.player-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.player-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 16px;
  flex-shrink: 0;
  transition: background var(--dur) var(--ease);
}
.player-btn:hover {
  background: var(--surface-3);
}
.player-btn:active {
  transform: scale(0.9);
}
.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.player-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-score-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.player-score-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.player-score {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}
.player-score.pop {
  animation: score-pop 0.3s var(--spring);
}
@keyframes score-pop {
  40% {
    transform: scale(1.35);
  }
  to {
    transform: scale(1);
  }
}
.player-actions {
  display: flex;
  gap: 6px;
}
.player-help {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  min-height: 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  flex-shrink: 0;
}
.player-help #player-help-text {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.player-help-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.player-help-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  color: var(--accent);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background var(--dur) var(--ease);
}
.player-help-btn:hover {
  background: var(--surface-3);
}
.player-frame-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  background: var(--bg);
}
.player-frame-wrap::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  z-index: 6;
  pointer-events: none;
  background: linear-gradient(to bottom, var(--bg), transparent);
}
.game-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.player-loader {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 8;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 600;
}
.loader-ring {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: loader-spin 0.9s linear infinite;
}
@keyframes loader-spin {
  to {
    transform: rotate(360deg);
  }
}
.player-error {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  gap: 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  color: var(--ink);
  text-align: center;
  padding: 20px;
}
.player-error strong {
  font-size: 1rem;
  font-weight: 700;
}
.player-error p {
  font-size: 0.85rem;
  color: var(--ink-2);
  max-width: 34ch;
  line-height: 1.55;
}

/* Rotate hint */
.rotate-hint {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: color-mix(in srgb, var(--bg) 95%, transparent);
  color: var(--ink);
}
.rotate-hint__icon {
  font-size: 50px;
  line-height: 1;
  animation: rotate-nudge 2.4s ease-in-out infinite;
}
.rotate-hint__text {
  font: 600 15px/1.4 var(--font-body);
  max-width: 20ch;
}
@keyframes rotate-nudge {
  0%,
  45% {
    transform: rotate(0deg);
  }
  60%,
  100% {
    transform: rotate(-90deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .rotate-hint__icon {
    animation: none;
    transform: rotate(-90deg);
  }
}

/* ── 21 · Touchpad — PPSSPP control-layout clone ───────────────────────────
   L/R top shoulders · stick left-mid · d-pad bottom-left ·
   face bottom-right · SELECT/START bottom-center (horizontal) */
.player-frame-wrap.has-touchpad .game-frame {
  height: 100%;
}
.touchpad {
  --psp-line: rgba(255, 255, 255, 0.78);
  --psp-fill: rgba(255, 255, 255, 0.08);
  --psp-press: rgba(255, 255, 255, 0.32);
  --psp-edge: max(10px, env(safe-area-inset-left));
  --psp-edge-r: max(10px, env(safe-area-inset-right));
  --psp-edge-b: max(10px, env(safe-area-inset-bottom));
  --psp-edge-t: max(10px, env(safe-area-inset-top));
  --psp-stick: clamp(88px, 22vmin, 128px);
  --psp-dpad: clamp(96px, 24vmin, 140px);
  --psp-face: clamp(108px, 26vmin, 148px);
  --psp-btn: calc(var(--psp-face) * 0.36);
  --psp-arm: calc(var(--psp-dpad) * 0.34);
  position: absolute;
  inset: 0;
  z-index: 5;
  display: block;
  background: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: contain;
  font-family: "Segoe UI", system-ui, sans-serif;
}
.touchpad[hidden] {
  display: none;
}
.touchpad button {
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0;
  color: var(--psp-line);
  background: var(--psp-fill);
  border: 2px solid var(--psp-line);
  box-shadow: none;
  outline: none;
  cursor: pointer;
  transition: background 0.06s linear, border-color 0.06s linear, opacity 0.06s;
}
.touchpad button:active,
.touchpad button.is-pressed {
  background: var(--psp-press);
  border-color: #fff;
  color: #fff;
}

.touchpad__toggle {
  position: absolute;
  top: var(--psp-edge-t);
  right: calc(var(--psp-edge-r) + 8px);
  z-index: 6;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  background: rgba(0, 0, 0, 0.4) !important;
  border-width: 1.5px;
}
.touchpad__toggle .touchpad__chevron {
  display: block;
  transition: transform 0.16s ease;
  transform: rotate(180deg);
}
.touchpad.is-collapsed .touchpad__chevron {
  transform: rotate(0deg);
}
.touchpad.is-collapsed .psp-dpad,
.touchpad.is-collapsed .psp-face,
.touchpad.is-collapsed .psp-sys,
.touchpad.is-collapsed .psp-stick,
.touchpad.is-collapsed .psp-shoulder {
  opacity: 0;
  pointer-events: none;
}

/* L / R — wide top shoulders (PPSSPP trapezoids) */
.psp-shoulder {
  position: absolute;
  top: var(--psp-edge-t);
  width: clamp(76px, 16vw, 112px);
  height: 40px;
  display: grid;
  place-items: center;
  font: 700 14px/1 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.08em;
  background: transparent !important;
  border: 0 !important;
  color: var(--psp-line);
}
.psp-shoulder::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  opacity: 0.95;
}
.psp-shoulder--l {
  left: calc(var(--psp-edge) + 8px);
}
.psp-shoulder--l::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 112 40' fill='none'%3E%3Cpath d='M18 2H108a2 2 0 0 1 2 2v32a2 2 0 0 1-2 2H10L2 22V12L18 2Z' fill='rgba(255,255,255,0.06)' stroke='rgba(255,255,255,0.78)' stroke-width='2'/%3E%3C/svg%3E");
}
.psp-shoulder--r {
  right: calc(var(--psp-edge-r) + 8px);
}
.psp-shoulder--r::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 112 40' fill='none'%3E%3Cpath d='M4 2h90L110 12v10L102 38H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Z' fill='rgba(255,255,255,0.06)' stroke='rgba(255,255,255,0.78)' stroke-width='2'/%3E%3C/svg%3E");
}
.psp-shoulder span {
  position: relative;
  z-index: 1;
}
.psp-shoulder:active::before,
.psp-shoulder.is-pressed::before {
  filter: brightness(1.45);
}

/* Analog stick — LEFT mid (above d-pad) */
.psp-stick {
  position: absolute;
  left: calc(var(--psp-edge) + 18px);
  top: 42%;
  translate: 0 -50%;
  width: var(--psp-stick);
  height: var(--psp-stick);
  pointer-events: auto;
  border-radius: 50%;
}
.psp-stick__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--psp-line);
  background: rgba(255, 255, 255, 0.04);
}
.psp-stick__ring::after {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
}
.psp-stick__knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48%;
  height: 48%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--psp-line);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.35), transparent 45%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.12), transparent 60%),
    repeating-radial-gradient(
      circle at 50% 50%,
      rgba(255, 255, 255, 0.55) 0 1.2px,
      transparent 1.2px 5px
    );
  pointer-events: none;
  will-change: transform;
}
.psp-stick.is-active .psp-stick__knob {
  border-color: #fff;
}

/* D-pad — bottom-left, pointed PPSSPP house pads (SVG stroke) */
.psp-dpad {
  position: absolute;
  left: calc(var(--psp-edge) + 14px);
  bottom: var(--psp-edge-b);
  width: var(--psp-dpad);
  height: var(--psp-dpad);
}
.psp-dpad__btn {
  position: absolute;
  width: var(--psp-arm);
  height: var(--psp-arm);
  display: grid;
  place-items: center;
  background: transparent !important;
  border: 0 !important;
  font-size: calc(var(--psp-arm) * 0.3);
  line-height: 1;
  color: var(--psp-line);
}
.psp-dpad__btn::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.psp-dpad__btn span {
  position: relative;
  z-index: 1;
  opacity: 0.92;
  font-size: 0.82em;
}
.psp-dpad__btn:active::before,
.psp-dpad__btn.is-pressed::before {
  filter: brightness(1.5);
}
.psp-dpad__up {
  top: 0;
  left: 50%;
  translate: -50% 0;
}
.psp-dpad__up::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none'%3E%3Cpath d='M24 3L45 18.5V45H3V18.5L24 3Z' fill='rgba(255,255,255,0.06)' stroke='rgba(255,255,255,0.78)' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.psp-dpad__down {
  bottom: 0;
  left: 50%;
  translate: -50% 0;
}
.psp-dpad__down::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none'%3E%3Cpath d='M3 3H45V29.5L24 45L3 29.5V3Z' fill='rgba(255,255,255,0.06)' stroke='rgba(255,255,255,0.78)' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.psp-dpad__left {
  left: 0;
  top: 50%;
  translate: 0 -50%;
}
.psp-dpad__left::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none'%3E%3Cpath d='M45 3V45H18.5L3 24L18.5 3H45Z' fill='rgba(255,255,255,0.06)' stroke='rgba(255,255,255,0.78)' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.psp-dpad__right {
  right: 0;
  top: 50%;
  translate: 0 -50%;
}
.psp-dpad__right::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='none'%3E%3Cpath d='M3 3H29.5L45 24L29.5 45H3V3Z' fill='rgba(255,255,255,0.06)' stroke='rgba(255,255,255,0.78)' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Face buttons — BOTTOM-RIGHT diamond */
.psp-face {
  position: absolute;
  right: calc(var(--psp-edge-r) + 10px);
  bottom: var(--psp-edge-b);
  width: var(--psp-face);
  height: var(--psp-face);
}
.psp-face__btn {
  position: absolute;
  width: var(--psp-btn);
  height: var(--psp-btn);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05) !important;
  font-size: calc(var(--psp-btn) * 0.4);
  font-weight: 500;
  line-height: 1;
}
.psp-face__btn span {
  display: block;
  transform: translateY(-0.04em);
}
.psp-face__tri {
  top: 0;
  left: calc(50% - var(--psp-btn) / 2);
}
.psp-face__cir {
  top: calc(50% - var(--psp-btn) / 2);
  right: 0;
}
.psp-face__cro {
  bottom: 0;
  left: calc(50% - var(--psp-btn) / 2);
}
.psp-face__squ {
  top: calc(50% - var(--psp-btn) / 2);
  left: 0;
}

/* SELECT / START — bottom-center horizontal (PPSSPP) */
.psp-sys {
  position: absolute;
  left: 50%;
  bottom: calc(var(--psp-edge-b) + 6px);
  translate: -50% 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.psp-sys__pause {
  width: 34px;
  height: 28px;
  border-radius: 3px;
  display: grid;
  place-items: center;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05) !important;
}
.psp-sys__btn {
  min-width: 72px;
  height: 28px;
  padding: 0 12px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05) !important;
  font: 700 10px/1 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.14em;
  display: grid;
  place-items: center;
}

/* ── 22 · Result overlay ────────────────────────────────────────────────── */
.result-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: none;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 20px;
}
.result-card {
  width: min(420px, 100%);
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  padding: 28px 28px 24px;
  text-align: center;
  animation: result-in 0.32s var(--spring);
}
@keyframes result-in {
  from {
    transform: scale(0.86);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.result-emoji {
  font-size: 56px;
  line-height: 1;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
}
.result-headline {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 6px;
}
.result-subtitle {
  font-size: 0.85rem;
  color: var(--ink-2);
  margin-top: 4px;
}
.result-scores {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 18px 0 6px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 96px;
}
.score-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.score-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.score-best {
  color: var(--accent);
}
.score-divider {
  width: 1px;
  height: 46px;
  background: var(--line-2);
}
.result-new-best {
  display: inline-block;
  padding: 7px 16px;
  border-radius: var(--r-pill);
  background: var(--accent-grad);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  margin: 0 auto 4px;
  animation: best-pulse 1.6s var(--ease) infinite;
}
@keyframes best-pulse {
  0%,
  100% {
    box-shadow: 0 0 10px rgba(255, 176, 32, 0.25);
  }
  50% {
    box-shadow: 0 0 24px rgba(255, 176, 32, 0.5);
  }
}
.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}
.result-actions .btn-primary,
.result-actions .btn-secondary {
  flex: 1;
}
.result-suggestion {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.result-suggestion > span {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
}
.suggestion-games {
  display: flex;
  gap: 10px;
}
.suggestion-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 84px;
  height: 74px;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  color: #fff;
  transition:
    transform var(--dur) var(--spring),
    box-shadow var(--dur) var(--ease);
}
.suggestion-card:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-lg);
}
.suggestion-card:active {
  transform: scale(0.93);
}

/* Trip scoreboard */
.trip-score {
  margin-top: 14px;
}
.trip-nick {
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.trip-scores {
  margin-top: 8px;
}
.trip-scores li {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  padding: 4px 0;
}

/* ── 23 · Account drawer ────────────────────────────────────────────────── */
html.account-drawer-open {
  overflow: hidden;
}
.account-drawer {
  box-sizing: border-box;
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(480px, 100%);
  max-width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line-2);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: -16px 0 60px rgba(0, 0, 0, 0.4);
}
.account-drawer[open] {
  display: flex;
  flex-direction: column;
  animation: account-arrive 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.account-drawer::backdrop {
  background: rgba(11, 14, 23, 0.6);
  animation: account-scrim 0.25s ease;
}
.account-drawer.is-closing {
  animation: account-leave 0.22s ease-in forwards;
}
.account-drawer.is-closing::backdrop {
  animation: account-scrim 0.22s ease reverse forwards;
}
.account-drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--accent-grad);
  color: var(--accent-ink);
}
.account-drawer-top > span {
  font: 600 11px var(--font-mono);
  letter-spacing: 0.06em;
}
.account-drawer-top button {
  min-height: 44px;
  padding: 8px 0 8px 12px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-ink);
  border: none;
}
.account-drawer-intro {
  position: relative;
  padding: 30px 32px 26px;
  border-bottom: 1px dashed var(--line-2);
}
.account-kicker {
  margin: 0 0 18px;
  font: 600 11px var(--font-mono);
  letter-spacing: 1px;
  color: var(--ink-3);
}
.account-drawer h2 {
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: -1.6px;
  white-space: pre-line;
}
.account-stamp {
  display: inline-block;
  padding: 6px 9px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font: 600 10px var(--font-mono);
  letter-spacing: 1px;
  transform: rotate(-3deg);
}
.account-drawer-body {
  padding: 22px 32px 28px;
}
.account-drawer-body p {
  font-size: 14px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.account-description {
  margin: 0 0 24px;
  color: var(--ink-2);
}
.account-status:empty {
  display: none;
}
.account-status:not(:empty) {
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  margin: 0 0 20px;
}
.account-facebook {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin: 0 0 18px;
  padding: 12px 48px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  font: 700 15px var(--font-body);
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    box-shadow 0.18s ease;
}
.account-google {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin: 0 0 12px;
  padding: 12px 48px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  font: 700 15px var(--font-body);
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}
.account-provider-icon {
  position: absolute;
  display: block;
  left: 18px;
  top: 50%;
  width: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  max-height: 18px !important;
  transform: translateY(-50%);
  flex: 0 0 20px;
  pointer-events: none;
  z-index: 1;
}
.account-google:hover {
  border-color: var(--ink-3);
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
}
.account-google:active {
  background: var(--surface-3);
}
.account-google:focus-visible {
  outline: 3px solid #8ab4f8;
  outline-offset: 3px;
}
.account-google:disabled {
  cursor: wait;
  opacity: 0.75;
}
.account-facebook:hover {
  background: var(--surface-2);
  border-color: var(--ink-3);
  box-shadow: var(--shadow-sm);
}
.account-facebook:active {
  background: var(--surface-3);
}
.account-facebook:focus-visible {
  outline: 3px solid #8ab4f8;
  outline-offset: 3px;
}
.account-facebook:disabled {
  cursor: wait;
  opacity: 0.75;
}
.account-auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  color: var(--ink-3);
  font-size: 12px;
  text-align: center;
}
.account-auth-divider::before,
.account-auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line-2);
}
.account-drawer form {
  display: grid;
  gap: 18px;
  margin: 0 0 12px;
}
.account-drawer label {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.account-drawer input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: 400 16px var(--font-body);
}
.account-drawer input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}
.account-drawer .service-action {
  min-height: 48px;
  padding: 14px 18px;
  border-radius: var(--r-sm);
  background: var(--accent-grad);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 700;
  border: none;
}
.account-drawer .service-action:hover {
  box-shadow: var(--glow-acc);
}
.account-switch {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 8px;
  background: none;
  border: none;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  text-align: center;
  cursor: pointer;
}
.account-switch:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.account-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.account-recovery-link {
  text-align: center;
}
.account-mode-switch {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.media-demo-notice {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
}
.pax-card-demo {
  cursor: default;
}
.account-drawer-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: auto;
  padding: 22px 32px max(22px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font: 500 10px var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.account-drawer-footer span:last-child {
  white-space: nowrap;
  color: var(--accent);
  font-weight: 600;
}
.account-drawer [hidden] {
  display: none;
}
@keyframes account-arrive {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}
@keyframes account-leave {
  to {
    transform: translateX(100%);
  }
}
@keyframes account-scrim {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@media (max-width: 480px) {
  .account-drawer-top {
    padding-inline: 22px;
  }
  .account-drawer-intro {
    padding: 26px 24px 22px;
  }
  .account-drawer h2 {
    font-size: 32px;
  }
  .account-drawer-body {
    padding: 20px 24px 24px;
  }
  .account-drawer-footer {
    padding-inline: 24px;
  }
}

/* ── 24 · Media library (videos / music / ebooks) ───────────────────────── */
.media-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px;
  margin-bottom: 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
}
.media-tools input,
.media-tools select {
  min-width: 0;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14px;
}
.media-tools input {
  flex: 1;
}
.media-tools select {
  max-width: 240px;
  flex: 0 1 220px;
}
.media-result-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.media-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.media-grid .service-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  min-width: 0;
  padding: 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}
.media-grid .service-card h2 {
  font-size: 17px;
  font-weight: 700;
  margin: 8px 0;
  letter-spacing: -0.02em;
}
.media-grid .service-card p {
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0 0 10px;
}
.media-artwork {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16/9;
  background: var(--surface-3);
  overflow: hidden;
  border-radius: var(--r-sm);
  margin-bottom: 12px;
  color: var(--ink-2);
}
.media-artwork-symbol {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 700;
}
.media-artwork .media-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  margin: 0;
}
.saved-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: auto;
  padding-top: 10px;
}
.favorite-action {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 600;
}
.favorite-action[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--accent);
}
.media-library > h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 22px 0 12px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}
.library-block {
  min-width: 0;
  background: var(--surface);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.library-block > h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 12px;
}
.library-block .media-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}
.library-block .empty-msg {
  padding: 14px;
  background: var(--surface-2);
  font-size: 12px;
}
.media-dialog {
  width: min(1000px, calc(100% - 32px));
  max-height: 90dvh;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: auto;
}
.media-dialog::backdrop {
  background: rgba(11, 14, 23, 0.7);
  backdrop-filter: blur(6px);
}
.media-heading {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.media-heading h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}
.media-heading button {
  min-height: 44px;
  flex: none;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}
.media-body {
  padding: 24px;
  display: grid;
  gap: 18px;
}
.media-body > audio {
  width: 100%;
}
.media-body > video {
  width: 100%;
  max-height: 65dvh;
  background: #000;
  border-radius: var(--r-sm);
}
.media-body > pre {
  font:
    17px/1.9 Georgia,
    serif;
  white-space: pre-wrap;
  max-width: 68ch;
  margin: 24px auto;
  color: var(--ink);
}
.media-body > a {
  font-size: 13px;
  color: var(--accent);
}
.media-body input {
  min-height: 44px;
  max-width: 100px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  padding: 8px;
}

/* ── 25 · Elia chat ─────────────────────────────────────────────────────── */
.elia {
  color: var(--ink);
  font-family: var(--font-body);
}
.elia button,
.elia select,
.elia input {
  font-family: inherit;
}
.elia button:focus-visible,
.elia select:focus-visible,
.elia input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.service-section.elia-section {
  padding: 20px 0 30px;
}
.elia-section > .service-heading,
.elia-section > #service-description {
  display: none;
}
.elia-section .service-actions {
  display: block;
  margin: 0;
}
.elia-heading,
.elia-brand,
.elia-chat-top,
.elia-chat-top > div,
.elia-section-label,
.elia-flight-meta,
.elia-footer,
.elia-chat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.elia-heading {
  margin-bottom: 22px;
}
.elia-brand {
  justify-content: flex-start;
}
.elia-avatar {
  width: 43px;
  height: 43px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  border-radius: var(--r-md);
  font-size: 24px;
}
.elia-brand > .elia-avatar {
  width: 52px;
  height: 52px;
  font-size: 32px;
}
.elia-eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  text-transform: uppercase;
}
.elia h1 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1.1px;
  margin: 5px 0 0;
}
.elia h1 > span {
  font: 400 12px var(--font-body);
  letter-spacing: 0;
  color: var(--ink-2);
  margin-left: 15px;
}
.elia-status {
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 9px 13px;
  font-size: 10px;
  white-space: nowrap;
  background: var(--surface);
}
.elia-status i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
}
.elia-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}
.elia-sidebar {
  min-width: 0;
}
.elia-journey {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid var(--line-2);
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
}
.elia-route {
  padding: 22px;
}
.elia-journey-top {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-2);
}
.elia-airports {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 22px 0;
}
.elia-airports strong {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
}
.elia-airports span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
}
.elia-flight-meta {
  align-items: flex-start;
  line-height: 1.6;
}
.elia-flight-meta > span {
  max-width: 115px;
}
.elia-flight-meta > strong {
  white-space: nowrap;
}
.elia-arrival {
  border-top: 1px solid var(--line);
  padding: 16px 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.elia-arrival > .elia-eyebrow {
  grid-column: 1;
}
.elia-arrival > strong {
  grid-column: 1;
  grid-row: 2;
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}
.elia-arrival > span:not(.elia-eyebrow) {
  grid-column: 1;
  grid-row: 3;
}
.elia-weather {
  grid-column: 2;
  grid-row: 1/4;
  margin: 0;
  gap: 9px;
}
.elia-weather b {
  font-size: 20px;
}
.elia-weather small {
  display: block;
  font-size: 10px;
  margin: 3px 0;
}
.elia-weather div > span {
  font-size: 8px;
}
.elia-section-label {
  margin: 22px 0 12px;
}
.elia-section-label > span {
  display: none;
}
.elia-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}
.elia-actions > button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  text-align: left;
  min-height: 68px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  transition: border-color var(--dur) var(--ease);
}
.elia-actions > button:hover {
  border-color: var(--accent);
}
.elia-actions b {
  font-size: 13px;
  display: block;
}
.elia-actions small {
  font-size: 11px;
  color: var(--ink-2);
  display: block;
}
.elia-action-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  border-radius: var(--r-sm);
  font-size: 20px;
}
.elia-actions i {
  font-style: normal;
  color: var(--accent);
}
.elia-chat {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  height: 650px;
  max-height: 85dvh;
  min-height: 460px;
}
.elia-chat-top {
  padding: 18px 22px;
  flex-shrink: 0;
}
.elia-chat-top b {
  font-size: 14px;
}
.elia-chat-top small {
  font-size: 11px;
  color: var(--ink-2);
}
.elia-chat-top > div > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}
.elia-chat-status {
  font-size: 10px;
  color: var(--ink-3);
}
.elia-chat-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-shrink: 0;
}
.elia-new-chat {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}
.elia-log {
  flex: 1;
  min-height: 0;
  padding: 22px;
  overflow-y: auto;
}
.elia-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}
.elia-message > .elia-avatar {
  width: 25px;
  height: 28px;
  font-size: 16px;
}
.elia-bubble {
  max-width: min(88%, 620px);
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.elia-message.passenger .elia-bubble {
  background: var(--accent-grad);
  color: var(--accent-ink);
  border-color: transparent;
}
.elia-speaker {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: block;
  margin-bottom: 4px;
}
.elia-message.passenger .elia-speaker {
  color: rgba(26, 18, 6, 0.6);
}
.elia-bubble > p {
  font-size: 14px;
  line-height: 1.7;
}
.elia-thinking {
  opacity: 0.6;
}
.elia-error {
  border-color: var(--red) !important;
}
.elia-suggestions {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
}
.elia-suggestions button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
}
.elia-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 14px;
  padding: 6px;
  border-radius: var(--r-md);
  border: 2px solid var(--line);
  background: var(--surface-2);
}
.elia-composer:focus-within {
  border-color: var(--accent);
}
.elia-composer input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  color: var(--ink);
  font-size: 16px;
  padding: 8px;
}
.elia-composer button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent-grad);
  color: var(--accent-ink);
  font-size: 18px;
  flex-shrink: 0;
}
.elia-composer button:disabled {
  opacity: 0.5;
}
.elia-chat-foot {
  padding: 9px 14px;
  font-size: 10px;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
}
.elia-footer {
  gap: 12px;
  font-size: 10px;
  color: var(--ink-3);
  padding: 14px 0;
  flex-wrap: wrap;
}
.elia-footer details {
  font-size: 12px;
}
.elia-theme,
.elia-sound {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
}
.elia-local-card {
  padding: 20px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
.elia-local-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.elia-demo {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--surface-2);
  padding: 3px 8px;
  border-radius: var(--r-pill);
}
.elia-local-place {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 16px;
}
.elia-location-pin {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: var(--surface-3);
  font-size: 24px;
}
.elia-local-place strong {
  font-size: 22px;
  font-weight: 700;
  display: block;
}
.elia-local-place span {
  font-size: 11px;
  color: var(--ink-3);
}
.elia-local-date {
  display: grid;
  gap: 4px;
  padding: 14px 0;
  border-block: 1px solid var(--line);
}
.elia-local-date > span {
  font-size: 10px;
  color: var(--ink-3);
}
.elia-local-date > strong {
  font-size: 28px;
  font-weight: 700;
}
.elia-local-date > small {
  font-size: 9px;
  color: var(--ink-3);
}
.elia-weather-live {
  margin: 14px 0 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.elia-weather-live > span {
  font-size: 30px;
}
.elia-weather-live b {
  font-size: 24px;
  font-weight: 700;
  display: block;
}
.elia-weather-live small {
  font-size: 11px;
  color: var(--ink-2);
  display: block;
}
.elia-weather-live div > span {
  font-size: 9px;
  color: var(--ink-3);
  display: block;
}
.elia-weather-credit {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 8px;
  color: var(--ink-3);
}
.elia-location-map {
  display: block;
  position: relative;
  width: 100px;
  height: 80px;
  flex-shrink: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  overflow: hidden;
}
.elia-map-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 24px;
}
.elia-location-map .elia-map-credit {
  position: absolute;
  z-index: 800;
  right: 3px;
  bottom: 2px;
  max-width: calc(100% - 6px);
  margin: 0;
  padding: 2px 3px;
  border-radius: 3px;
  background: rgba(11, 14, 23, 0.72);
  color: #fff;
  font-size: 5px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.elia-location-map.leaflet-container {
  background: var(--surface-3);
  font-family: inherit;
}
.elia-location-map.leaflet-container .elia-map-placeholder {
  display: none;
}
.elia-location-map .leaflet-control-container {
  display: none;
}
.elia-location-map-trigger {
  display: block;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: var(--r-md);
  background: transparent;
  box-shadow: 0 0 0 1px var(--line-2);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.elia-location-map-trigger:not(:disabled):hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 2px var(--accent);
}
.elia-location-map-trigger:disabled {
  opacity: 0.65;
  cursor: wait;
}
.elia-map-dialog {
  /* The global `*` reset above clears the UA sheet's `margin: auto`, which is the
     only thing keeping a modal <dialog> out of the viewport corner. */
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  max-height: calc(100dvh - 32px);
  width: min(900px, calc(100% - 32px));
  max-width: none;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.elia-map-dialog[open] {
  display: flex;
  flex-direction: column;
}
.elia-map-dialog::backdrop {
  background: rgba(11, 14, 23, 0.7);
  backdrop-filter: blur(5px);
}
.elia-map-dialog-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.elia-map-dialog-head h2 {
  margin: 5px 0 0;
  font-size: 20px;
  font-weight: 700;
}
.elia-map-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 24px;
  border: 1px solid var(--line);
}
.elia-expanded-map {
  /* Flex row is capped by the dialog's max-height, so the map gives way first
     instead of pushing the caption out of the frame. */
  flex: 1 1 auto;
  height: min(65vh, 600px);
  min-height: 0;
  background: var(--surface-2);
}
.elia-map-dialog > p {
  flex: none;
  margin: 0;
  padding: 12px 22px;
  background: var(--surface);
  color: var(--ink-3);
  font-size: 11px;
}
.elia-quiz strong {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
}
.elia-quiz button {
  display: block;
  width: 100%;
  margin: 6px 0;
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.elia-quiz button:disabled {
  opacity: 0.6;
  cursor: default;
}
.elia-destinations {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.elia-place {
  flex: 1 1 200px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  background: var(--surface-2);
}
.elia-place-art {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.elia-place-art span {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
}
.elia-place-art i {
  font-size: 24px;
}
.elia-place small {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.elia-place h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 4px 0;
}
.elia-place p {
  font-size: 12px;
  color: var(--ink-2);
}
.elia-place button {
  margin-top: 10px;
  width: 100%;
  padding: 10px;
  border-radius: var(--r-sm);
  background: var(--accent-grad);
  color: var(--accent-ink);
  border: none;
  font-size: 12px;
  font-weight: 700;
}
.elia-flight-card .elia-map {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 11px;
}
.elia-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.elia-stat-grid small {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.elia-stat-grid strong {
  font-size: 16px;
  font-weight: 700;
}
.elia-comfort {
  text-align: center;
  padding: 20px;
}
.elia-breath {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 32px;
  background: var(--surface-2);
  border: 2px solid var(--line-2);
}
.elia-breath.is-breathing {
  animation: elia-breathe 8s ease-in-out infinite;
  border-color: var(--accent);
}
@keyframes elia-breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.25);
  }
}
.elia-breath-label {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 16px;
}
.elia-comfort button {
  display: block;
  width: 100%;
  margin: 6px 0;
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

/* ── 26 · Announcements ─────────────────────────────────────────────────── */
.announcement-toasts {
  position: fixed;
  z-index: 300;
  top: calc(var(--topbar-h) + 12px);
  right: 12px;
  width: min(380px, calc(100vw - 24px));
  display: grid;
  gap: 12px;
  max-height: calc(100dvh - 145px);
  overflow: auto;
  padding: 4px;
  pointer-events: none;
}
.announcement-toast {
  pointer-events: auto;
  transition:
    opacity 0.32s ease,
    transform 0.32s ease;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-md);
  padding: 12px 18px 18px;
  box-shadow: var(--shadow-md);
  animation: announcement-in 0.22s ease-out;
  overflow-wrap: anywhere;
}
.announcement-toast-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.announcement-toast-top span {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}
.announcement-toast-top button {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 22px;
  border-radius: 50%;
  border: none;
}
.announcement-toast h2 {
  margin: 4px 0 8px;
  font-size: 17px;
  font-weight: 700;
}
.announcement-toast p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 220px;
  overflow: auto;
}
.announcement-toast.is-leaving {
  opacity: 0;
  transform: translateX(24px);
}
@keyframes announcement-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 600px) {
  .announcement-toasts {
    top: auto;
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 12px;
  }
  .announcement-toast {
    padding: 10px 14px 14px;
  }
}

/* ── 27 · Transform loader ─────────────────────────────────────────────── */
.transform-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(
    circle at 50% 42%,
    #1b2338 0,
    #0f1322 42%,
    #070b14 100%
  );
  color: #f2efe6;
  font: 600 14px/1.4 var(--font-body);
  opacity: 1;
  transition:
    opacity 0.45s ease,
    visibility 0.45s ease;
}
.transform-loader.is-compact {
  position: absolute;
  z-index: 3;
}
.transform-loader.is-leaving {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.transform-loader__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.transform-loader__fallback {
  position: absolute;
  left: 50%;
  top: 44%;
  width: min(42vw, 230px);
  aspect-ratio: 1.75;
  transform: translate(-50%, -50%);
  border: 3px solid #ffb020;
  border-radius: var(--r-xl);
  background: var(--accent-grad);
  box-shadow:
    0 0 70px rgba(255, 176, 32, 0.3),
    inset 0 3px rgba(255, 255, 255, 0.2);
  opacity: 0;
  transition: opacity 0.25s;
}
.transform-loader.is-fallback .transform-loader__fallback {
  opacity: 1;
}
.transform-loader__fallback:before,
.transform-loader__fallback:after {
  content: "";
  position: absolute;
  top: 45%;
  width: 18%;
  aspect-ratio: 1;
  border: 3px solid #1a1206;
  border-radius: 50%;
}
.transform-loader__fallback:before {
  left: 15%;
}
.transform-loader__fallback:after {
  right: 15%;
}
.transform-loader__hud {
  position: absolute;
  left: 50%;
  bottom: max(7vh, 32px);
  width: min(520px, calc(100% - 40px));
  transform: translateX(-50%);
  display: grid;
  gap: 12px;
  text-align: center;
}
.transform-loader__brand {
  font: 700 clamp(18px, 3vw, 28px)/1 var(--font-display);
  letter-spacing: -0.04em;
}
.transform-loader__brand em {
  color: var(--accent);
  font-style: normal;
}
.transform-loader__status {
  min-height: 20px;
  color: #a8b0c0;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.transform-loader__track {
  height: 4px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.transform-loader__bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-grad);
  box-shadow: 0 0 16px rgba(255, 176, 32, 0.5);
  transition: width 0.25s ease;
}
.transform-loader__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #a8b0c0;
}
.transform-loader__skip {
  padding: 8px 16px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f2efe6;
  font-size: 12px;
  font-weight: 600;
}
html.loader-active,
html.loader-active body {
  overflow: hidden;
}
@media (prefers-reduced-motion: reduce) {
  .transform-loader {
    transition: opacity 0.12s;
  }
  .transform-loader__bar {
    transition: none;
  }
}
@media (max-height: 480px) {
  .transform-loader__hud {
    bottom: 16px;
  }
  .transform-loader__fallback {
    top: 39%;
    width: 160px;
  }
}

/* ── 28 · View-specific page themes ─────────────────────────────────────── */
body[data-page="videos"] {
  --page-accent: var(--cyan);
}
body[data-page="music"] {
  --page-accent: var(--violet);
}
body[data-page="ebooks"] {
  --page-accent: var(--green);
}

/* ── 29 · Entrance choreography ─────────────────────────────────────────── */
.welcome-copy > * {
  animation: rise 0.5s var(--ease) both;
}
.welcome-copy > *:nth-child(1) {
  animation-delay: 0.02s;
}
.welcome-copy > *:nth-child(2) {
  animation-delay: 0.06s;
}
.welcome-copy > *:nth-child(3) {
  animation-delay: 0.12s;
}
.welcome-copy > *:nth-child(4) {
  animation-delay: 0.18s;
}
.welcome-copy > *:nth-child(5) {
  animation-delay: 0.26s;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet & Desktop (mobile-first base above)
   ══════════════════════════════════════════════════════════════════════════ */

/* ≥ 600px — large phones / small tablets */
@media (min-width: 600px) {
  :root {
    --page-px: 24px;
  }
  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .experience-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .home-rail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .home-rail .rail-section {
    grid-column: 1 / -1;
  }
  .elia-workspace {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .elia-actions {
    grid-template-columns: 1fr;
  }
}

/* ≥ 900px — tablet landscape / small desktop */
@media (min-width: 900px) {
  :root {
    --page-px: 32px;
  }
  .game-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
  .welcome-banner {
    flex-direction: row;
    align-items: center;
    gap: 40px;
    padding: 44px 40px;
  }
  .departure-art {
    min-height: 280px;
    flex: 0 0 300px;
  }
  .home-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 24px;
  }
  .welcome-banner {
    grid-column: 1 / -1;
  }
  .home-rail {
    grid-column: 2;
    grid-row: 2;
    display: flex;
  }
  .home-discovery {
    grid-column: 1;
    grid-row: 2;
  }
  .elia-workspace {
    grid-template-columns: 300px minmax(0, 1fr);
  }
}

/* ≥ 1100px — desktop sidebar layout */
@media (min-width: 1100px) {
  .tech-frame {
    flex-direction: column;
    min-height: 100dvh;
  }
  .tech-top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    width: 100%;
    flex-shrink: 0;
  }
  .app {
    display: flex;
    flex: 1;
    min-height: 0;
  }
  .app-header {
    width: var(--sidebar-w);
    height: 100%;
    max-height: none;
    overflow-y: auto;
    padding: 24px 16px;
    border-bottom: none;
    border-right: 1px solid var(--line);
    background: var(--bg-2);
    flex-shrink: 0;
  }
  .sidebar-heading {
    display: block;
    padding: 0 12px 14px;
    color: var(--ink-3);
    font: 600 10px/1.4 var(--font-mono);
    letter-spacing: 1.5px;
    text-transform: uppercase;
  }
  .side-links {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    overflow: visible;
    padding: 0;
  }
  .mobile-nav-heading,
  .mobile-nav-next {
    display: none !important;
  }
  .side-link {
    width: 100%;
    min-height: 46px;
    padding: 12px 14px;
    gap: 12px;
    font-size: 13px;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    text-align: left;
    line-height: 1.5;
  }
  .side-link.active {
    background: var(--surface);
    color: var(--accent);
    border-color: var(--line);
    box-shadow: none;
  }
  .side-link[data-view="library"] {
    margin-top: 14px;
  }
  .side-footer {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: auto 12px 0;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--ink-3);
    font-size: 10px;
  }
  .side-live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--green);
  }
  .side-live i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px rgba(61, 220, 151, 0.7);
  }
  .side-foot-txt {
    font-size: 10px;
    font-weight: 500;
    color: var(--ink-3);
    white-space: nowrap;
  }
  .app-main {
    padding: 32px 36px calc(var(--bnav-h) + env(safe-area-inset-bottom) + 20px);
    max-width: var(--max-w);
  }
  .bottom-nav {
    display: none !important;
  }
  .game-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .welcome-banner {
    min-height: 340px;
  }
  .featured-inner {
    padding: 40px;
  }
}

/* ≥ 1400px — wide desktop */
@media (min-width: 1400px) {
  .game-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  :root {
    --max-w: min(81.25rem, 100%);
  }
}

/* ≥ 1800px — ultra-wide */
@media (min-width: 1800px) {
  .game-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

/* ── Landscape phone tuning for game player ────────────────────────────── */
@media (orientation: landscape) and (max-height: 560px) {
  .game-player {
    height: 100dvh;
  }
  .player-header {
    padding: 5px 10px;
    gap: 8px;
    min-height: 0;
  }
  .player-header .player-btn {
    min-width: 40px;
    min-height: 40px;
    width: 40px;
    height: 40px;
  }
  .player-title {
    font-size: 13px;
  }
  .player-score-label {
    display: none;
  }
  .player-score {
    font-size: 14px;
  }
  .player-actions #player-favorite {
    display: none;
  }
  .player-help {
    padding: 5px 12px;
    font-size: 11px;
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  .game-player:has(.player-frame-wrap.has-touchpad) .player-header,
  .game-player:has(.player-frame-wrap.has-touchpad) .player-help {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 6;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition:
      opacity 0.2s ease,
      transform 0.2s ease;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
  .game-player:has(.player-frame-wrap.has-touchpad) .player-header {
    top: 0;
    padding-top: max(5px, env(safe-area-inset-top));
    padding-bottom: 5px;
    border-bottom: 1px solid var(--line);
  }
  .game-player:has(.player-frame-wrap.has-touchpad) .player-help {
    top: var(--pax-chrome-h, 50px);
    display: none;
    border-bottom: 1px solid var(--line);
  }
  .game-player:has(.player-frame-wrap.has-touchpad) .player-help.is-open {
    display: flex;
  }
  .game-player:has(.player-frame-wrap.has-touchpad)
    .player-help.is-open.is-compact {
    white-space: normal;
    max-height: 34dvh;
    overflow: auto;
  }
  .game-player:has(.player-frame-wrap.has-touchpad) .player-frame-wrap {
    position: absolute;
    inset: 0;
    z-index: 1;
  }
}
@media (orientation: landscape) and (max-height: 400px) {
  .player-header {
    padding: 3px 8px;
  }
  .player-header .player-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }
  .player-title {
    font-size: 12px;
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  #player-help-toggle {
    display: grid;
  }
}
@media (orientation: landscape) and (max-height: 560px) {
  body:has(.game-player.is-open) {
    overflow: hidden;
  }
}
@media (hover: none) and (pointer: coarse) {
  .player-btn {
    min-width: 44px;
    min-height: 44px;
  }
  .player-favorite,
  .player-header .player-btn {
    touch-action: manipulation;
  }
}

/* PPSSPP pad — landscape / short phones (same layout, tighter scale) */
@media (orientation: landscape) and (max-height: 520px) {
  .touchpad {
    --psp-dpad: min(36vh, 118px);
    --psp-face: min(38vh, 124px);
    --psp-stick: min(32vh, 100px);
    --psp-edge-t: max(6px, env(safe-area-inset-top));
    --psp-edge-b: max(6px, env(safe-area-inset-bottom));
  }
  .psp-shoulder {
    width: clamp(64px, 14vw, 96px);
    height: 30px;
    font-size: 12px;
  }
  .psp-stick {
    top: 40%;
    left: calc(var(--psp-edge) + 12px);
  }
  .psp-dpad {
    left: calc(var(--psp-edge) + 10px);
  }
  .psp-face {
    right: calc(var(--psp-edge-r) + 6px);
  }
  .psp-sys__btn {
    min-width: 64px;
    height: 24px;
    font-size: 9px;
    letter-spacing: 0.12em;
  }
  .psp-sys__pause {
    width: 28px;
    height: 24px;
  }
  .touchpad__toggle {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}
@media (orientation: portrait) {
  .touchpad {
    --psp-stick: clamp(96px, 28vw, 140px);
    --psp-dpad: clamp(110px, 32vw, 156px);
    --psp-face: clamp(120px, 34vw, 164px);
  }
  .psp-stick {
    top: auto;
    bottom: calc(var(--psp-dpad) + 28px);
    translate: 0 0;
  }
  .psp-sys {
    bottom: calc(var(--psp-edge-b) + 12px);
  }
}
@media (max-width: 360px) {
  .touchpad {
    --psp-dpad: 118px;
    --psp-face: 126px;
    --psp-stick: 100px;
  }
}

/* Notch / safe-area in landscape */
@supports (padding: max(0px)) {
  @media (orientation: landscape) and (max-height: 560px) {
    .game-player {
      padding-left: max(6px, env(safe-area-inset-left));
      padding-right: max(6px, env(safe-area-inset-right));
      padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
  }
}

/* Compact player help */
.player-help.is-compact {
  padding: 6px 12px;
  max-height: none;
  font-size: 11px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  min-height: 30px;
  align-items: center;
}
.player-help.is-compact.is-expanded {
  white-space: normal;
  max-height: 34dvh;
  overflow: auto;
}

/* Very small phones */
@media (max-width: 360px) {
  .game-grid {
    grid-template-columns: 1fr;
  }
  .tech-brand-tag,
  .tech-brand-sep,
  .tech-sys {
    display: none;
  }
  .experience-grid {
    grid-template-columns: 1fr;
  }
}
