/* ===========================================================================
   glass-core.css — premium shared base for Meta Ray-Ban Display web apps.
   Blended Ascent system (Augur green + cyan, Atlas depth) within Meta limits:
   - body #000 = transparent on the additive waveguide (DO NOT change)
   - system font stack only (Meta perf: no external fonts on-glasses)
   - 600x600, no scroll (paginate), 88px targets, subtle GPU-cheap effects
   Source of truth: shared/. Synced into each app by scripts/sync-shared.sh.
   =========================================================================== */
:root {
  --bg-page: #000000;                 /* transparent on display — required */
  --s-1: #0c0f14;                     /* lowest surface (headers/nav)       */
  --s-2: #11151c;                     /* rows / list items                  */
  --s-3: #161b24;                     /* cards / elevated                   */
  /* Tuned for the additive waveguide: it ADDS light, so anything dim is
     effectively transparent. Dim greys/borders that look fine in a
     browser vanish on-glass — luminance is lifted and hierarchy is
     carried by weight/size, not by dimming color. */
  --s-hi: rgba(255, 255, 255, 0.07);  /* sheen overlay                      */
  --line: rgba(255, 255, 255, 0.18);  /* hairline border (visible on-glass) */
  --line-2: rgba(255, 255, 255, 0.28);
  --text-primary: #f8fbff;
  --text-secondary: #ccd5df;          /* was a dim grey — invisible on-glass */
  --text-muted: #9fabb8;              /* lifted so meta/labels still read   */
  --brand: #5b9dff;                   /* blue — primary (store-matched)     */
  --brand-ink: #04122a;
  --accent: #52d9ff;                  /* cyan — secondary                   */
  --accent-ink: #042029;
  --up: #33d987;
  --down: #7193ff;
  --danger: #ff6b81;
  --warning: #ffca75;
  --focus-ring: #52d9ff;
  --focus-glow: 0 0 0 1px rgba(82, 217, 255, 0.55), 0 0 22px rgba(82, 217, 255, 0.30);
  --r-sm: 18px;                       /* rounder by default — MRBD-native   */
  --r-md: 26px;
  --r-lg: 32px;
  --r-pill: 999px;                    /* MRBD capsule/circle chrome         */
  /* Translucent "glass" fills for pill chrome (nav, back, chips). Alpha
     kept high (~.6) on purpose: the additive waveguide makes anything
     dimmer effectively vanish, so this is the safe translucency floor —
     paired with a backdrop blur it reads as a true MRBD glass capsule. */
  --glass-1: rgba(13, 17, 23, 0.62);
  --glass-2: rgba(20, 25, 33, 0.55);
  --glass-blur: saturate(1.25) blur(16px);
  /* ── Meta RBD surface language (official reference): bright
     translucent frosted glass with a soft iridescent blue→purple→pink
     sheen. Frost fill is mid-luminance so white text stays legible and
     the panel still reads against bright real-world backdrops. ── */
  --iri: linear-gradient(135deg, rgba(122,178,255,0.34) 0%, rgba(188,142,255,0.24) 48%, rgba(255,162,198,0.24) 100%);
  --iri-strong: linear-gradient(135deg, #63a0ff 0%, #a878ff 50%, #ff96b8 100%);
  /* Bright luminous frost — light periwinkle so it reads as Meta's
     bright translucent glass on the see-through display (the dark-bg
     web preview makes it look darker than on-glass). White text still
     clears the mid-tone fill. */
  --frost-1: linear-gradient(180deg, rgba(124,138,196,0.60), rgba(98,112,168,0.54));
  --frost-2: linear-gradient(180deg, rgba(152,166,222,0.66), rgba(122,138,198,0.60));
  --frost-border: rgba(255,255,255,0.30);
  --frost-shadow: 0 10px 30px rgba(0,0,0,0.30);
  --frost-inset: inset 0 1px 0 rgba(255,255,255,0.22);
  --ease: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  /* Type & spacing scale — single source of truth so rhythm is
     consistent and globally tunable (replaces ad-hoc px over time). */
  --fs-xs: 11px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-lg: 17px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 22px;
  --sp-6: 30px;
  --shadow-1: 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 18px 50px rgba(0, 0, 0, 0.5);
}

/* Premium numerics: fixed-width digits so changing values (prices,
   counts, timers, page x/y) don't jitter and columns line up. Pure
   typography — zero layout risk. */
.row-badge, .header-meta, .pager-bar, .state-text,
.stat-value, .cc-price, .cc-chg, .cc-sv, .cc-pc, .cc-pcv,
.pf-total, .pf-val, .pf-pct, .pf-amt, .vote-count, .num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
/* CRITICAL: <button> defaults to the UA's near-black text. Rows/tiles are
   buttons, so titles inherited BLACK = invisible on the additive display.
   Force every control to inherit the light app color. */
button, input, textarea, select { color: inherit; font-family: inherit; }

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.1px;
  /* Let the MRBD shell detect its own gestures (double-swipe-down to
     menu, swipe-back, etc.). Without this, the browser may synthesize
     defaults that block the system from seeing the touch sequence. */
  touch-action: pan-y;
}

#app { width: 600px; height: 600px; position: relative; }

/* ---- Screens ---- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  /* Gentle outer breath so nothing crowds the edge of the see-through
     viewport. Every element inside reads as a floating piece of glass. */
  padding: 14px 12px 10px;
  gap: 10px;
}
.screen.hidden { display: none; }

/* ---- Header ---- */
/* Premium header: a real product top-bar — accent-ringed app mark, a
   confident title, a pill of context, and a luminous edge-light under
   it (reads on the additive waveguide; no dark fills). */
.header {
  /* MRBD-native: a detached floating pill that sizes to its contents.
     Centers itself; expands when there's a back button + title + meta,
     contracts to just the app mark + title on a bare screen. The
     backdrop blur carries it visually — no opaque slab. */
  display: inline-flex;
  align-self: center;
  align-items: center;
  gap: 12px;
  height: 52px;
  flex-shrink: 0;
  padding: 0 16px;
  margin: 6px auto 4px;
  max-width: calc(100% - 24px);
  background: rgba(8, 12, 22, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--r-pill);
  position: relative;
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28),
              inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
/* The old left-edge accent stripe + bottom hairline don't belong on a
   pill — disable them so the header reads as a clean capsule. */
.header::after, .header::before { display: none; }
.header::before {
  content: "";
  position: absolute;
  left: 16px; top: 50%;
  width: 3px; height: 26px;
  transform: translateY(-50%);
  background: var(--brand);
  border-radius: 2px;
  box-shadow: 0 0 14px rgba(91, 157, 255, 0.6);
}
/* The thin accent bar is only for bare headers — a brand badge OR a
   back button replaces it (otherwise the bar collides with the back
   button on detail screens, reading as a stray green stripe). */
.header:has(.app-badge)::before,
.header:has(.back-btn)::before,
.header.no-accent::before { display: none; } /* JS-tagged fallback for webviews without :has() */
/* Render the icon.svg full-bleed with no chip wrapper around it — the
   icon.svg has its own dark background + rounded corners. Result: the
   header badge, the hub tile, and the MRBD install icon all render
   the *same* art (just at different sizes). */
.app-badge {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  overflow: hidden;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.app-badge .icon, .app-badge svg { width: 100%; height: 100%; display: block; }

/* Shell-empty: shared utility for the "link on companion" landing
   screen used by every shell-only branded app (Mastodon / GitHub /
   Strava / Notion / Slack / Govee / Nanoleaf). Per-app palette flows
   in via --app-accent. */
.shell-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 16px 14px;
}
.shell-empty-icon { width: 96px; height: 96px; margin-bottom: 4px; }
.shell-empty-icon img,
.shell-empty-icon svg {
  width: 100%; height: 100%; display: block;
  border-radius: 22px;
  filter: drop-shadow(0 0 24px var(--aa-glow-lg, rgba(255,255,255,0.18)));
}
.shell-empty-h {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.15px;
  color: var(--text-primary, #fff);
  text-shadow: 0 0 14px var(--aa-glow-soft, rgba(255,255,255,0.20));
}
.shell-empty-p {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-secondary, rgba(255,255,255,0.8));
  max-width: 460px;
}
.shell-empty-p.shell-dim {
  font-size: 12px;
  color: var(--text-muted, rgba(255,255,255,0.55));
}
.shell-url {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  color: #e6e9f2;
  font-weight: 700;
}

.header h1 {
  /* No flex:1 stretch — the pill hugs its content. */
  flex: 0 0 auto;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
  padding: 0;
  white-space: nowrap;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.14);
}
.header:has(.app-badge) h1 { padding-left: 2px; }
.header-meta {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text-secondary, rgba(255, 255, 255, 0.78));
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}
.back-btn {
  background: rgba(255, 255, 255, 0.04);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  font-size: 20px;
  line-height: 1;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-pill);
  flex-shrink: 0;
  transition: background 140ms ease, border-color 140ms ease;
}
.back-btn:hover, .back-btn:focus {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(82, 217, 255, 0.5);
}

/* ---- Content ---- */
/* MRBD-native pattern: content fades into nothing at top and bottom
   edges, so the surface feels like a floating window over the world.
   The mask is a soft gradient — opaque in the center, transparent at
   the rim. Scroll position is implicit; new items emerge from / dissolve
   into the fade rather than hitting a hard edge. */
.content {
  flex: 1;
  min-height: 0;
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-mask-image: linear-gradient(180deg,
    transparent 0%,
    #000 18px,
    #000 calc(100% - 22px),
    transparent 100%);
  mask-image: linear-gradient(180deg,
    transparent 0%,
    #000 18px,
    #000 calc(100% - 22px),
    transparent 100%);
  scrollbar-width: none;
}
.content::-webkit-scrollbar { display: none; }

/* ---- Focus states (critical for D-pad) ---- */
.focusable {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  outline: none;
  transition: box-shadow var(--ease), background var(--ease),
    border-color var(--ease), transform var(--ease);
}
.focusable:focus {
  border-color: var(--focus-ring);
  /* Unmissable on the additive display: solid bright inset ring + outer
     glow + lift. You should never be unsure what's selected. */
  box-shadow: 0 0 0 2px var(--focus-ring), 0 0 0 5px rgba(82, 217, 255, 0.22),
    0 0 26px rgba(82, 217, 255, 0.42);
  transform: translateY(-1px);
  z-index: 2;
}
/* `.focusable` (generic 20px radius) is defined after `.back-btn` and
   would otherwise flatten the circular back button by source order.
   Re-assert the MRBD circle here, after `.focusable`. */
.back-btn { border-radius: var(--r-pill); }

/* ---- Icons (crisp SVG, themed via currentColor) ---- */
.icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -4px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--fill { fill: currentColor; stroke: none; }
.nav-item .icon, .action .icon { width: 23px; height: 23px; }
/* Icon-only sizing for the nav-bar.icons + action-rail.icons variants
   is now defined alongside the floating-pill rules further down so the
   pill sizing stays in one place. */
.back-btn .icon { width: 22px; height: 22px; vertical-align: middle; }
.row-icon .icon { width: 21px; height: 21px; }
.state-icon .icon { width: 46px; height: 46px; stroke-width: 1.5; }
.tile-ico .icon { width: 26px; height: 26px; }
.vote-arrow .icon { width: 15px; height: 15px; stroke-width: 2.6; vertical-align: middle; }
.row-icon--live { color: var(--accent); }
.row-icon--live .icon { filter: drop-shadow(0 0 5px rgba(82, 217, 255, 0.75)); }

/* ---- Nav / action rail ----
   MRBD-native: each button is ITS OWN floating glass pill. The
   .nav-bar wrapper is purely layout — invisible. Buttons sit with
   breathing room between them, easy to hit, each one feels like its
   own piece of glass floating over the world. */
.nav-bar {
  display: inline-flex;
  align-self: center;
  flex-shrink: 0;
  gap: 10px;
  padding: 0;
  margin: 8px auto 4px;
  background: transparent;
  border: 0;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  box-shadow: none;
}
/* When an app uses a sticky bottom dock, the pills still float, just
   anchored to the bottom-center. */
.nav-bar.dock {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  margin: 0;
}
.nav-item {
  /* Each item is a standalone frosted pill. Big enough to read on the
     additive display but small enough that 7 of them in a row fit
     comfortably within the 600-wide viewport without clipping. */
  flex: 0 0 auto;
  min-height: 56px;
  padding: 0 26px;
  background: rgba(8, 12, 22, 0.34);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  color: var(--text-primary, #fff);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--r-pill);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28),
              inset 0 1px 0 rgba(255, 255, 255, 0.07);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 140ms ease, color 140ms ease,
              border-color 140ms ease, transform 140ms ease;
}
/* Icon-only variant — square pill (round) at smaller size. */
.nav-bar.icons .nav-item {
  padding: 0;
  min-width: 56px;
  min-height: 56px;
}
.nav-bar.icons .nav-item .icon { width: 28px; height: 28px; }
/* The nav-bar wrapper gets a smaller gap when packed with icon-only
   pills so 6–7 fit cleanly within the viewport. */
.nav-bar.icons { gap: 8px; }
.nav-item:hover {
  background: rgba(20, 28, 42, 0.45);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}
.nav-item:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.10);
  color: var(--text-primary, #fff);
  border-color: var(--focus-ring, rgba(82, 217, 255, 0.6));
  box-shadow: 0 0 12px rgba(82, 217, 255, 0.35);
}
.nav-item.primary {
  color: #9fc4ff;
  background: rgba(91, 157, 255, 0.10);
  border-color: rgba(91, 157, 255, 0.45);
}
.nav-item.primary:focus {
  background: rgba(91, 157, 255, 0.18);
  box-shadow: 0 0 16px rgba(91, 157, 255, 0.35);
}
.nav-item.danger {
  color: #ff9bab;
  background: rgba(255, 107, 129, 0.08);
  border-color: rgba(255, 107, 129, 0.40);
}
.nav-item.danger:focus {
  background: rgba(255, 107, 129, 0.16);
  box-shadow: 0 0 16px rgba(255, 107, 129, 0.32);
}

/* ---- List rows ---- See-through-first: rows ride lightly on the
   additive surface. No opaque slab — a thin hairline edge, gentle
   accent bloom on the leading edge, full glass when focused. */
.list { display: flex; flex-direction: column; gap: 12px; }
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 78px;
  padding: 12px 16px;
  background:
    radial-gradient(120% 130% at 8% -25%, var(--aa-bloom, rgba(124, 200, 255, 0.06)), transparent 55%),
    rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--r-md);
  position: relative;
  -webkit-backdrop-filter: blur(8px) saturate(130%);
  backdrop-filter: blur(8px) saturate(130%);
}
.row::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.16), transparent);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.row:focus {
  outline: none;
  border-color: var(--aa-ring, rgba(124, 200, 255, 0.55));
  background:
    radial-gradient(130% 120% at 10% -20%, var(--aa-bloom2, rgba(124, 200, 255, 0.14)), transparent 56%),
    rgba(255, 255, 255, 0.05);
  box-shadow:
    0 0 0 1px var(--aa-ring, rgba(124, 200, 255, 0.42)),
    0 0 20px var(--aa-glow, rgba(91, 184, 255, 0.32));
}
/* Signature: every leading icon is a luminous "medallion" — a soft
   light bloom over an elevated disc with a bright rim + outer glow.
   The brand-coloured glyph (Glass.icon) sits on it and carries the
   per-app colour, so the family is cohesive but never monotone. */
.row-icon {
  font-size: 22px;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.22), transparent 70%),
    rgba(255, 255, 255, 0.10);
  border: 1px solid var(--frost-border);
  box-shadow:
    0 0 16px var(--aa-glow-soft, rgba(91, 184, 255, 0.18)),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: var(--app-accent, var(--accent));
}
.row-icon .icon { filter: drop-shadow(0 1px 5px rgba(0, 0, 0, 0.55)); }
.row:focus .row-icon {
  border-color: var(--aa-ring, rgba(124, 200, 255, 0.5));
  box-shadow:
    0 0 20px var(--aa-glow, rgba(91, 184, 255, 0.42)),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.row-body { flex: 1; min-width: 0; }
.row-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.15px;
  color: var(--text-primary);
  /* Additive-display safety: luminous text glow gives the title its own
     light against varied real-world backgrounds. Brightness, not a dark
     fill, is what makes text legible on the see-through screen. */
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.22);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-sub {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-shadow: 0 0 10px rgba(220, 232, 245, 0.18);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--accent);
  background: rgba(82, 217, 255, 0.12);
  padding: 5px 10px;
  border-radius: 999px;
}

/* ---- Grid / tiles (media browsing — the dual-panel layout) ---- */
[data-list].grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}
.tile {
  display: flex;
  flex-direction: column;
  /* See-through-first: minimal fill + a soft corner bloom and a
     stronger backdrop blur so the content underneath stays readable
     when the world behind is busy. */
  background:
    radial-gradient(120% 110% at 85% -12%, var(--aa-bloom, rgba(124, 200, 255, 0.10)), transparent 58%),
    rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--r-md);
  overflow: hidden;
  text-align: left;
  padding: 0;
  position: relative;
  -webkit-backdrop-filter: blur(8px) saturate(130%);
  backdrop-filter: blur(8px) saturate(130%);
}
.tile-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #04070c;
  display: block;
}
.tile-ph {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--s-3), var(--s-1));
  color: var(--accent);
}
.tile-ph .icon { width: 34px; height: 34px; }
.tile-body { padding: 8px 11px 10px; min-width: 0; }
.tile-title {
  font-size: var(--fs-base);
  font-weight: 700;
  letter-spacing: -0.15px;
  color: var(--text-primary);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.22);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-sub {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  text-shadow: 0 0 10px rgba(220, 232, 245, 0.18);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-tag {
  position: absolute;
  left: 8px;
  top: 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 60, 90, 0.92);
  color: #fff;
}
.tile-wrap { position: relative; }
.tile:focus {
  outline: none;
  border-color: var(--aa-ring, rgba(124, 200, 255, 0.6));
  background:
    radial-gradient(120% 110% at 85% -12%, var(--aa-bloom2, rgba(124, 200, 255, 0.14)), transparent 58%),
    rgba(255, 255, 255, 0.05);
  box-shadow:
    0 0 0 1px var(--aa-ring, rgba(124, 200, 255, 0.5)),
    0 0 22px var(--aa-glow, rgba(91, 184, 255, 0.34));
  transform: translateY(-1px);
}

/* ---- Cards / stats ---- */
.card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--r-md);
  padding: 16px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.card:focus { border-color: var(--focus-ring); box-shadow: var(--focus-glow); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: linear-gradient(180deg, var(--s-3), var(--s-2));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--brand), var(--accent));
}
.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---- Detail body ---- */
.detail-title { font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -0.2px; }
.detail-meta { font-size: 13px; color: var(--text-secondary); margin: 10px 0 14px; }
.detail-body {
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 11;
  overflow: hidden;
}

/* ---- Pager indicator ---- */
.pager-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
  height: 38px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
}
.pager-bar:empty { height: 14px; }
/* Explicit, can't-miss page indicator. Arrows advertise Left/Right paging;
   Up/Down also auto-advances, so the user never has to discover anything. */
.pager-bar .pg-a {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--brand);
  font-size: 14px;
  line-height: 1;
}
.pager-bar .pg-a.off { color: var(--text-muted); opacity: 0.4; }
.pager-bar .pg-l { color: var(--text-primary); font-weight: 800; }
.pager-bar .pg-c {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ---- Action rail ----
   Same MRBD-native treatment as .nav-bar: the wrapper is pure layout
   (transparent, no border, no blur). Each .action is its own floating
   glass pill — separate, breathing, easy to hit. */
.action-rail {
  display: inline-flex;
  align-self: center;
  gap: 10px;
  flex-shrink: 0;
  margin: 8px auto 4px;
  background: transparent;
  border: 0;
}
.action-rail.icons .action { padding: 0; min-width: 74px; }
.action-rail.icons .action .icon { width: 34px; height: 34px; }
.action {
  flex: 0 0 auto;
  min-height: 74px;
  padding: 0 36px;
  background: rgba(8, 12, 22, 0.34);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--r-pill);
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.30),
              inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transition: background 140ms ease, border-color 140ms ease,
              transform 140ms ease;
}
.action:focus {
  outline: none;
  background: rgba(20, 28, 42, 0.45);
  border-color: var(--focus-ring, rgba(82, 217, 255, 0.6));
  box-shadow: 0 0 0 1px var(--focus-ring), 0 0 18px rgba(82, 217, 255, 0.32);
}
.action.on-up { color: var(--up); border-color: rgba(51, 217, 135, 0.4); }
.action.on-down { color: var(--down); border-color: rgba(113, 147, 255, 0.4); }
.action.on-save { color: var(--accent); border-color: rgba(82, 217, 255, 0.4); }

/* ---- Login / pair screen — branded, premium, fills the screen, all
   luminous (no QR: glasses have no camera; no dark-on-bright). ---- */
.pair-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 8px 4px;
}
.pair-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 22px 22px 26px;
  background: linear-gradient(180deg, var(--s-2), var(--s-1));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.pair-badge {
  width: 62px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(160deg, var(--s-3), var(--s-1));
  border: 1px solid var(--line-2);
  box-shadow: 0 0 26px rgba(91, 157, 255, 0.2);
}
.pair-badge .icon { width: 38px; height: 38px; }
.pair-h {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}
.pair-sub {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-secondary);
  max-width: 460px;
}
.pair-code {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 11px;
  color: #9fc4ff;
  background: linear-gradient(180deg, rgba(91, 157, 255, 0.12), rgba(91, 157, 255, 0.04));
  border: 1px solid rgba(91, 157, 255, 0.45);
  border-radius: var(--r-md);
  padding: 12px 20px 12px 31px;
  box-shadow: 0 0 26px rgba(91, 157, 255, 0.22);
}
.pair-url {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  word-break: break-all;
  text-shadow: 0 0 14px rgba(82, 217, 255, 0.4);
}
.pair-status {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.pair-guest {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  font-size: 16px;
  font-weight: 800;
  color: var(--accent);
  background: linear-gradient(180deg, rgba(82, 217, 255, 0.16), rgba(82, 217, 255, 0.06));
  border: 1px solid rgba(82, 217, 255, 0.5);
  border-radius: var(--r-md);
  box-shadow: 0 0 16px rgba(82, 217, 255, 0.22);
}
.pair-guest .icon { width: 18px; height: 18px; }
.pair-guest:focus {
  background: linear-gradient(180deg, rgba(82, 217, 255, 0.3), rgba(82, 217, 255, 0.12));
}

/* ---- Loading / error / empty ---- */
.center-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 32px;
}
/* Meta RBD signature: the cyan→purple→pink AI orb. One reusable
   component; .spinner aliases it so every app's loading state adopts
   the motif with no JS change. .ai-orb.static = non-spinning (empty/
   listening states). */
.spinner, .ai-orb {
  width: 58px; height: 58px;
  border-radius: 50%;
  background: conic-gradient(from 90deg,
    #52d9ff, #7c5cff, #ff8ab8, #ffb37a, #52d9ff);
  -webkit-mask: radial-gradient(circle, transparent 53%, #000 55%);
  mask: radial-gradient(circle, transparent 53%, #000 55%);
  filter: drop-shadow(0 0 12px rgba(124, 140, 255, 0.55))
          drop-shadow(0 0 4px rgba(255, 138, 184, 0.45));
  animation: spin 1.15s linear infinite;
}
.ai-orb.static { animation: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.state-icon {
  width: 104px;
  height: 104px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 30px;
  position: relative;
  /* A luminous medallion, not a dreary dark box — soft light bloom over
     an elevated disc, bright rim, accent halo. Invites action. */
  background:
    radial-gradient(circle at 50% 34%, var(--aa-medal, rgba(124, 200, 255, 0.22)), transparent 68%),
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.12), transparent 72%),
    linear-gradient(180deg, var(--s-3), var(--s-1));
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    0 0 40px var(--aa-glow-lg, rgba(91, 184, 255, 0.30)),
    0 0 0 6px var(--aa-bloom, rgba(91, 184, 255, 0.05)),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color: var(--app-accent, var(--accent));
}
.state-icon .icon { filter: drop-shadow(0 0 10px var(--aa-glow, rgba(91, 184, 255, 0.45))); }
.state-icon .icon { width: 48px; height: 48px; stroke-width: 1.6; }
.state-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  max-width: 440px;
  line-height: 1.55;
}

/* ---- Toast ---- MRBD-native: a floating, frosted, content-width
   pill that whispers state. Almost no fill — backdrop blur carries it. */
.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-150%);
  max-width: 520px;
  background: rgba(8, 12, 22, 0.40);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  z-index: 100;
  pointer-events: none;
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.32s cubic-bezier(0.5, 0, 0.2, 1);
}
.toast.visible { transform: translateX(-50%) translateY(0); }
.toast.error,
.toast.err {
  border-color: rgba(255, 107, 129, 0.6);
  color: #ffb6c0;
  box-shadow: 0 4px 22px rgba(255, 107, 129, 0.25);
}
.toast.success,
.toast.ok {
  border-color: rgba(106, 255, 180, 0.6);
  color: #b6ffd4;
  box-shadow: 0 4px 22px rgba(106, 255, 180, 0.25);
}

/* ---- Utility ---- */
.hidden { display: none !important; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-secondary); }
.spacer { flex: 1; }

/* ---- On-screen D-pad keyboard ---- */
/* ---- big-number picker ---- */
#__picker .content { align-items: center; justify-content: center; gap: 22px; }
.pk-wrap {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
.pk-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 132px;
  padding: 20px 22px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--s-2), var(--s-1));
}
.pk-seg:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 2px var(--focus-ring), 0 0 26px var(--aa-glow, rgba(82, 217, 255, 0.3));
}
.pk-val {
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.14);
}
.pk-seg:focus .pk-val { color: var(--app-accent, var(--focus-ring)); text-shadow: 0 0 22px var(--aa-glow, rgba(91, 157, 255, 0.45)); }
.pk-lab {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pk-hint { font-size: 13px; color: var(--text-muted); letter-spacing: 0.4px; }
.pk-done {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 30px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--s-3), var(--s-2));
  font: inherit;
  font-weight: 800;
  font-size: 17px;
  color: var(--text-primary);
}
.pk-done-k { color: var(--brand); font-size: 19px; }
.pk-done:focus {
  outline: none;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 2px var(--focus-ring), 0 0 22px var(--aa-glow, rgba(82, 217, 255, 0.28));
}
.kbd-display {
  min-height: 58px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  background: linear-gradient(180deg, var(--s-2), var(--s-1));
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  word-break: break-all;
  flex-shrink: 0;
}
.kbd-display.ph { color: var(--text-muted); font-weight: 500; }

/* Phone → glasses relay screen */
#__relay .content {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}
.relay-h {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}
.relay-p {
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-secondary);
  max-width: 460px;
}
.relay-url {
  font-size: 21px;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 14px rgba(82, 217, 255, 0.35);
  word-break: break-all;
}
.relay-code {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 10px;
  color: #fff;
  padding: 8px 14px 8px 24px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--s-3), var(--s-1));
}
.relay-status {
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.relay-btn {
  margin-top: 8px;
  min-height: 48px;
  padding: 0 22px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 980px;
}
.relay-btn:focus {
  outline: none;
  border-color: var(--focus-ring);
  color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--focus-ring);
}
.kbd { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.kbd-row { display: flex; gap: 7px; justify-content: center; }
.kbd-key {
  flex: 1;
  min-width: 0;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--s-3), var(--s-2));
  color: var(--text-primary);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 19px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease), box-shadow var(--ease), transform var(--ease);
}
.kbd-key.kbd-space { flex: 4; }
.kbd-key:focus {
  /* Keep the key letter luminous (dark ink on green = invisible on the
     waveguide). Highlight via a bright ring + glow instead. */
  background: linear-gradient(180deg, rgba(82, 217, 255, 0.26), rgba(82, 217, 255, 0.1));
  color: #eaf2ff;
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 2px var(--focus-ring), 0 0 22px rgba(82, 217, 255, 0.45);
  transform: translateY(-1px);
}

/* =========================================================================
   Premium layer v2 — media rows, richer hierarchy, clearer toolbar zone.
   Appended so it augments the base without touching existing selectors.
   ========================================================================= */
.row-thumb {
  width: 76px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--s-3), var(--s-2));
  border: 1px solid var(--line-2);
  /* On the additive waveguide a photo's dark regions go transparent and
     it reads muddy. Lift brightness/contrast/saturation so the image
     actually shows, and a defined frame so its bounds are visible even
     where the picture is dark. */
  filter: brightness(1.22) contrast(1.14) saturate(1.2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 2px 8px rgba(0, 0, 0, 0.5);
}
.row-thumb.sq { width: 50px; height: 50px; border-radius: 12px; }
.row.has-thumb { gap: 14px; min-height: 92px; }

.row-stat {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 50px;
  padding-left: 4px;
}
.row-stat .n { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; color: var(--text-primary); }
.row-stat .l { font-size: 9px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--text-muted); }
.row-stat.up .n { color: var(--brand); }

.row-title.two {
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: 16.5px;
  line-height: 1.32;
}

/* ---- Paginated reader (Reddit post: image + full body, no clamp) ---- */
.list.reader { flex: 1; min-height: 0; }
.reader-block {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 20px;
  background: linear-gradient(180deg, var(--s-2), var(--s-1));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.reader-title {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.26;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}
.reader-meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}
.reader-img {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: #05070b;
  border: 1px solid var(--line-2);
  /* Large hero: moderate lift (over-brightening a big image blooms on
     the waveguide) plus a visible frame. */
  filter: brightness(1.15) contrast(1.1) saturate(1.15);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.reader-text {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  overflow: hidden;
}
.reader-text.muted { color: var(--text-secondary); }

.nav-bar, .action-rail { position: relative; }
.nav-bar::before, .action-rail::before {
  content: "";
  position: absolute;
  left: 16%; right: 16%; top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-2), transparent);
}

.row:focus, .nav-item:focus, .action:focus, .tile:focus {
  transform: translateY(-1px) scale(1.012);
}
.nav-item:focus, .action:focus { border-color: var(--focus-ring); }
.header h1 { font-weight: 800; letter-spacing: -0.2px; }

.skeleton {
  height: 88px;
  border-radius: var(--r-md);
  margin-bottom: 8px;
  background: linear-gradient(100deg, var(--s-1) 30%, var(--s-3) 50%, var(--s-1) 70%);
  background-size: 220% 100%;
  animation: sk 1.25s ease-in-out infinite;
}
@keyframes sk { from { background-position: 200% 0; } to { background-position: -40% 0; } }

/* ---- Immersive: hide chrome so media fills the 600×600 display.
   Any key brings the controls back (handled in glass-core keydown). ---- */
.screen.immersive { padding: 0; }
.screen.immersive .header,
.screen.immersive .nav-bar,
.screen.immersive .action-rail,
.screen.immersive .pager-bar { display: none; }
.screen.immersive .content { padding: 0; gap: 0; }
.screen.immersive .yt-stage { border-radius: 0; border: 0; }

/* ---- Contrast presets (double-swipe-left cycles; per device) ----
   Standard = the :root defaults. Bright/Max lift luminance further and
   push image filters — for harsh lighting / low-contrast waveguides. */
html[data-contrast="bright"] {
  --text-secondary: #dde6f0;
  --text-muted: #b9c4d0;
  --line: rgba(255, 255, 255, 0.26);
  --line-2: rgba(255, 255, 255, 0.38);
  --s-hi: rgba(255, 255, 255, 0.10);
}
html[data-contrast="bright"] .row-thumb { filter: brightness(1.32) contrast(1.2) saturate(1.25); }
html[data-contrast="bright"] .reader-img { filter: brightness(1.24) contrast(1.16) saturate(1.2); }
html[data-contrast="max"] {
  --text-primary: #ffffff;
  --text-secondary: #eef3f9;
  --text-muted: #ced7e1;
  --line: rgba(255, 255, 255, 0.42);
  --line-2: rgba(255, 255, 255, 0.56);
  --s-hi: rgba(255, 255, 255, 0.14);
  --brand: #9fc4ff;
  --accent: #7fe4ff;
}
html[data-contrast="max"] .row-title,
html[data-contrast="max"] .reader-text,
html[data-contrast="max"] .reader-title,
html[data-contrast="max"] .row-sub { font-weight: 800; }
html[data-contrast="max"] .row-thumb { filter: brightness(1.45) contrast(1.28) saturate(1.3); }
html[data-contrast="max"] .reader-img { filter: brightness(1.35) contrast(1.22) saturate(1.25); }

/* ---- Keyboard: recent entries (one-tap repeat searches) ---- */
.kbd-recents { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; min-height: 0; }
.kbd-recents:empty { display: none; }
.kbd-recent {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(82, 217, 255, 0.1);
  border: 1px solid rgba(82, 217, 255, 0.32);
  border-radius: 999px;
}
