/* ===========================================================================
   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: 14px;
  --r-md: 20px;
  --r-lg: 26px;
  --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);
  --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;
}

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

/* ---- Screens ---- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 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 {
  display: flex;
  align-items: center;
  gap: 13px;
  height: 66px;
  flex-shrink: 0;
  padding: 0 18px;
  /* Liquid-glass slab: a soft top-left light bloom over the surface
     gradient (luminous, additive-safe — no dark frosting), a hairline
     inner top highlight, and a gentle lift shadow for real depth. */
  background:
    radial-gradient(120% 140% at 18% -10%, rgba(255, 255, 255, 0.07), transparent 60%),
    linear-gradient(180deg, var(--s-3), var(--s-1));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 6px 18px rgba(0, 0, 0, 0.34);
}
.header::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.26), transparent);
  opacity: 0.7;
}
.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() */
.app-badge {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: radial-gradient(120% 120% at 30% 25%, var(--s-3), var(--s-1));
  /* Neutral frame so the brand glyph carries the color — a green ring
     around an orange/red/blurple mark just clashes. */
  border: 1px solid var(--line-2);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.app-badge .icon { width: 30px; height: 30px; }
.header h1 {
  flex: 1;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.3px;
  padding-left: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.12);
}
.header:has(.app-badge) h1 { padding-left: 4px; }
.header-meta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}
.back-btn {
  background: var(--glass-1);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--text-primary);
  font-size: 20px;
  line-height: 1;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  flex-shrink: 0;
}

/* ---- Content ---- */
.content {
  flex: 1;
  min-height: 0;
  /* Wider side gutter so tiles float as discrete chips with true
     see-through space around them (additive display), instead of an
     edge-to-edge block that reads as one opaque panel. */
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

/* ---- 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 nav row: symbols are the source of truth — drop labels,
   make the glyphs big and centered. */
.nav-bar.icons .nav-item { gap: 0; padding: 0; }
.nav-bar.icons .nav-item .icon { width: 28px; height: 28px; }
.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 ---- */
.nav-bar {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  padding: 8px 4px 2px;
}
.nav-item {
  flex: 1;
  min-height: 56px;
  /* MRBD language: a translucent glass capsule, not a squared tab.
     High-alpha fill + backdrop blur stays legible on the additive
     display while reading as a true frosted pill. */
  background: var(--glass-2);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--text-primary);
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.nav-item:focus {
  background: rgba(31, 39, 51, 0.66);
  border-color: var(--focus-ring);
  box-shadow: var(--focus-glow);
}
/* Additive display: NEVER bright-fill + dark text (the text reads as
   transparent/black on-glass). Emphasis = luminous text + colored
   border + glow on the dark (transparent) base. */
.nav-item.primary {
  background: linear-gradient(180deg, rgba(91, 157, 255, 0.18), rgba(91, 157, 255, 0.07));
  color: #9fc4ff;
  border-color: rgba(91, 157, 255, 0.6);
  box-shadow: 0 0 16px rgba(91, 157, 255, 0.28);
  font-weight: 800;
}
.nav-item.primary:focus {
  background: linear-gradient(180deg, rgba(91, 157, 255, 0.28), rgba(91, 157, 255, 0.12));
}
.nav-item.danger {
  background: linear-gradient(180deg, rgba(255, 107, 129, 0.18), rgba(255, 107, 129, 0.07));
  color: #ff9bab;
  border-color: rgba(255, 107, 129, 0.6);
  box-shadow: 0 0 16px rgba(255, 107, 129, 0.26);
  font-weight: 800;
}

/* ---- List rows ---- */
.list { display: flex; flex-direction: column; gap: 11px; }
.row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 88px;
  padding: 14px 18px;
  background:
    radial-gradient(130% 120% at 12% -20%, rgba(255, 255, 255, 0.05), transparent 55%),
    linear-gradient(180deg, var(--s-2), var(--s-1));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  position: relative;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 5px 16px rgba(0, 0, 0, 0.3);
}
.row::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: var(--s-hi);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.row:focus { background: linear-gradient(180deg, #1b212c, var(--s-2)); }
.row-icon {
  font-size: 22px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--s-3);
  border-radius: 10px;
  /* Idle chrome is calm cyan; neon green is reserved for focus/active/
     live so it reads as emphasis, not the ambient colour. */
  color: var(--accent);
}
.row-body { flex: 1; min-width: 0; }
.row-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  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;
  /* Liquid-glass tile: surface gradient + a soft corner light bloom so
     a label-only tile still has life (not a 70%-empty box), plus depth. */
  background:
    radial-gradient(135% 120% at 85% -15%, rgba(255, 255, 255, 0.06), transparent 58%),
    linear-gradient(180deg, var(--s-2), var(--s-1));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  text-align: left;
  padding: 0;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 6px 18px rgba(0, 0, 0, 0.32);
}
.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-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-sub {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  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 { border-color: var(--focus-ring); }

/* ---- Cards / stats ---- */
.card {
  background:
    radial-gradient(120% 130% at 15% -15%, rgba(255, 255, 255, 0.06), transparent 58%),
    linear-gradient(180deg, var(--s-3), var(--s-2));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 6px 18px rgba(0, 0, 0, 0.32);
}
.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: 8px;
  background: linear-gradient(180deg, var(--s-3), var(--s-2));
  border: 1px solid var(--line-2);
  color: var(--brand);
  font-size: 16px;
  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 ---- */
.action-rail { display: flex; gap: 8px; flex-shrink: 0; }
/* Symbol-only rail: bigger glyphs, no text — cleaner, less to read. */
.action-rail.icons .action { gap: 0; padding: 0; }
.action-rail.icons .action .icon { width: 27px; height: 27px; }
.action {
  flex: 1;
  min-height: 64px;
  background: linear-gradient(180deg, var(--s-3), var(--s-2));
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.action:focus { background: linear-gradient(180deg, #1c2230, var(--s-3)); }
.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;
}
.spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.07);
  border-top-color: var(--brand);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s cubic-bezier(0.5, 0.1, 0.3, 1) infinite;
  box-shadow: 0 0 18px rgba(91, 157, 255, 0.22);
}
@keyframes spin { to { transform: rotate(360deg); } }
.state-icon {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  background: linear-gradient(160deg, var(--s-3), var(--s-1));
  border: 1px solid var(--line-2);
  box-shadow: 0 0 30px rgba(91, 157, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: var(--brand);
}
.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 ---- */
.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(-150%);
  max-width: 536px;
  background: linear-gradient(180deg, var(--s-3), var(--s-2));
  color: var(--text-primary);
  border: 1px solid var(--brand);
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  z-index: 100;
  pointer-events: none;
  box-shadow: 0 0 26px rgba(91, 157, 255, 0.28);
  transition: transform 0.32s cubic-bezier(0.5, 0, 0.2, 1);
}
.toast.visible { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--danger); box-shadow: 0 0 26px rgba(255, 107, 129, 0.28); }
.toast.success { border-color: var(--up); }

/* ---- 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(--brand);
  box-shadow: 0 0 0 2px var(--focus-ring), 0 0 26px 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(--brand); text-shadow: 0 0 22px 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(--brand);
  box-shadow: 0 0 0 2px var(--focus-ring), 0 0 22px 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(--brand);
  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;
}
