/* ═══════════════════════════════════════════════════════════════════════════
   REELYZER v3 — Shared Design System
   Single stylesheet for all v3 pages.
   Pages link only this file + an optional <style> block for page-specifics.
   ─────────────────────────────────────────────────────────────────────────
   Structure:
     1. Design Tokens (dark + light)
     2. Legacy aliases (--obsidian, --graphite, etc.)
     3. Reset
     4. Typography base
     5. Body + per-theme backgrounds
     6. Shell grid + nav
     7. Main area
     8. Cards (.rly-card, .rly-card.dark)
     9. Stats bar
    10. Profile card
    11. Mini card + bench list
    12. Inbox / framework-match list
    13. Score ring
    14. Calendar
    15. Todos / setup card
    16. Utility: buttons, pills, badges, search, skeleton
    17. Page header pattern
    18. Form elements
    19. Tables
    20. Theme transition (colour/surface only — never layout)
    21. Responsive
    22. Reduced-motion
═══════════════════════════════════════════════════════════════════════════ */

/* ─── 1. Design Tokens — canonical live in design-tokens.css ─────────── */
/* Dark-mode only. Light mode deprecated 2026-04-18 (no paying user demand).  */

@import url('./css/design-tokens.css');

:root {
  /* Legacy aliases — every older screen still references --bg / --card / --text-*  */
  /* Re-expressed against the canonical OKLCH tokens so nothing breaks.             */
  --bg:             var(--gray-0);
  --bg-inset:       var(--gray-3);
  --card:           var(--gray-1);
  --card-solid:     var(--gray-1);
  --border:         var(--gray-2);
  --border-top:     var(--gray-3);
  --border-strong:  var(--gray-4);
  --text-1:         var(--gray-9);
  --text-2:         var(--gray-7);
  --text-3:         var(--gray-6);
  --text-4:         var(--gray-5);
  --accent-bdr:     var(--accent-border);
  --dark-card:      var(--gray-2);
  --dark-border:    var(--gray-3);
  --r:              var(--r-md);
  /* --r-sm, --r-xs, --r-pill come from design-tokens.css */
  --nav-bg:         var(--gray-0);
  --nav-border:     var(--gray-2);
  --nav-text:       var(--gray-6);
  --nav-hover-bg:   var(--gray-2);
  --nav-hover-text: var(--gray-9);
}

/* ─── 2. Legacy aliases ──────────────────────────────────────────────── */
/* Map v1/v2 old names onto the new token system so any copied snippet     */
/* still resolves to a sensible value.                                     */

:root {
  --obsidian:    var(--bg);
  --graphite:    var(--card-solid);
  --slate:       var(--bg-inset);
  --iron:        var(--border);
  --bone:        var(--text-1);
  --ash:         var(--text-2);
  --fog:         var(--text-3);
  --orange:      var(--accent);      /* legacy alias: now cyan/blue */
  --orange-hover:var(--accent-text);
  --rust:        var(--accent-bg);
  --vital:       var(--success);
  --r-md:        8px;
  --r-lg:        12px;
  --r-xl:        16px;
  --t-fast:      120ms ease;
}

/* ─── 3. Reset ───────────────────────────────────────────────────────── */

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

.hidden { display: none !important; }

/* ─── 4. Typography base ─────────────────────────────────────────────── */

html { font-size: 14px; }

body {
  /* Mobile-first: natural scroll. Desktop shell locks overflow via media query below. */
  height: auto;
  overflow: visible;
  background-color: var(--bg);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  font-feature-settings: 'ss01', 'ss03', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (min-width: 700px) {
  body {
    height: 100vh;
    overflow: hidden;
  }
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
a, button, [role="button"] { -webkit-tap-highlight-color: transparent; }

/* ─── 5. Body background (dark only) ─────────────────────────────────── */

body {
  background-image:
    radial-gradient(ellipse 1000px 760px at 18% 0%, oklch(79% 0.11 200 / 0.10) 0%, transparent 64%),
    radial-gradient(ellipse 620px 520px at 82% 90%, hsl(220 45% 52% / 0.045) 0%, transparent 60%);
}

/* ─── 6. Shell grid + nav ────────────────────────────────────────────── */

.db-shell {
  display: grid;
  grid-template-columns: 1fr;
  height: auto;
  overflow: visible;
  transition: grid-template-columns 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 700px) {
  .db-shell {
    grid-template-columns: 216px 1fr;
    height: 100vh;
    overflow: hidden;
  }
}

.db-shell.nav-collapsed {
  grid-template-columns: 72px 1fr;
  overflow: hidden;
}

/* Nav — always dark regardless of page theme
   v4 Port: glassy transparent bg, subtle blur, hairline border */
.db-nav {
  grid-column: 1;
  grid-row: 1;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  background: hsl(0 0% 4% / 0.62);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-right: 1px solid hsl(0 0% 100% / 0.06);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  z-index: 10;
  transition:
    background 240ms ease,
    border-color 240ms ease,
    padding 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.db-nav-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.4);
  margin-left: auto;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.db-nav-toggle:hover {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
}
.db-nav-toggle svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Text/label collapse helpers */
.db-nav-text   { white-space: nowrap; overflow: hidden; max-width: 160px; opacity: 1; transition: opacity 160ms, max-width 220ms cubic-bezier(0.22,1,0.36,1); }
.db-brand-text { white-space: nowrap; overflow: hidden; max-width: 100px;  opacity: 1; transition: opacity 160ms, max-width 220ms cubic-bezier(0.22,1,0.36,1); }
.db-nav-label  { white-space: nowrap; overflow: hidden; max-height: 36px;  opacity: 1; transition: opacity 160ms, max-height 220ms cubic-bezier(0.22,1,0.36,1), padding 220ms cubic-bezier(0.22,1,0.36,1); }
.db-user-info  { overflow: hidden; max-width: 140px; opacity: 1; min-width: 0; transition: opacity 160ms, max-width 220ms cubic-bezier(0.22,1,0.36,1); }

/* ─── Rail-style collapsed nav ────────────────────────────────────────────
   72px wide · each link is a 44×44 glass pill · icons perfectly centered.
   No hover-expand (sticky glitches removed). Click the toggle button to
   expand to 216px with labels. Nav lives in the grid flow — no
   position:absolute gymnastics. */
.db-shell.nav-collapsed .db-nav {
  padding: 20px 14px;
  transition:
    padding 220ms cubic-bezier(0.22,1,0.36,1),
    box-shadow 220ms;
}
.db-shell.nav-collapsed .db-nav-toggle   { margin: 0 auto 12px; opacity: 0.35; }
.db-shell.nav-collapsed .db-nav-toggle:hover { opacity: 1; }
.db-shell.nav-collapsed .db-nav-toggle svg { transform: rotate(180deg); }
.db-shell.nav-collapsed .db-nav-text     { opacity: 0; max-width: 0; }
.db-shell.nav-collapsed .db-brand-text   { opacity: 0; max-width: 0; }
.db-shell.nav-collapsed .db-brand        { padding: 4px 0 20px; justify-content: center; }
.db-shell.nav-collapsed .db-nav-link     { padding: 0; gap: 0; width: 44px; height: 44px; justify-content: center; margin: 0 auto; }
.db-shell.nav-collapsed .db-nav-label    { opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; }
.db-shell.nav-collapsed .db-user-info    { opacity: 0; max-width: 0; }
.db-shell.nav-collapsed .db-user-chip    { padding: 8px 0; gap: 0; justify-content: center; }

/* Brand */
.db-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 24px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #FFF;
  text-decoration: none;
  transition:
    padding 220ms cubic-bezier(0.22, 1, 0.36, 1),
    gap 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
/* v4 Port: gelber Punkt vor wordmark — filled circle, nicht Text-"." */
.db-brand-dot {
  order: -1;
  width: 8px;
  height: 8px;
  border-radius: 100px;
  background: var(--accent);
  color: transparent;
  font-size: 0;
  line-height: 0;
  margin: 0;
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--accent-bg);
}

/* Nav section label */
.db-nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.28);
  padding: 16px 10px 6px;
}

/* Nav list */
.db-nav-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }

.db-nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  height: 44px;
  width: 100%;
  border-radius: 12px;
  color: var(--nav-text);
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid transparent;
  box-sizing: border-box;
  /* padding + gap + width animated on the same cubic-bezier as the nav
     width transition so everything glides in perfect lockstep. Without
     this the icons snap when switching between rail (44×44 pill) and
     expanded (216px row) states. */
  transition:
    background 240ms ease,
    border-color 240ms ease,
    color 240ms ease,
    padding 220ms cubic-bezier(0.22, 1, 0.36, 1),
    gap 220ms cubic-bezier(0.22, 1, 0.36, 1),
    width 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
/* Icon sits in a fixed 22px slot so it's always visually centered in
   the 44px pill height — same offset in collapsed and expanded state. */
.db-nav-link svg { width: 18px; height: 18px; stroke-width: 1.6; flex-shrink: 0; display: block; }
.db-nav-link:hover  { background: var(--nav-hover-bg); color: var(--nav-hover-text); }
.db-nav-link.active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-bdr); }
.db-nav-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.db-nav-spacer { flex: 1; }

.db-nav-footer {
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* User chip */
.db-user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  margin-top: 6px;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 150ms,
    padding 220ms cubic-bezier(0.22, 1, 0.36, 1),
    gap 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
.db-user-chip:hover {
  background: hsl(0 0% 100% / 0.06);
}
.db-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-bg);
  border: 1px solid var(--accent-bdr);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--accent-text);
  flex-shrink: 0;
  text-transform: uppercase;
}
.db-user-name { font-size: 12px; font-weight: 600; color: #FFF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-user-role { font-size: 10px; color: rgba(255,255,255,0.32); }

/* ─── Rank + Credits Nav Widget ─────────────────────────────────────── */

.ck-nav-rank {
  padding: 10px 10px 8px;
  border-radius: var(--r-sm);
  background: hsl(0 0% 100% / 0.04);
  border: 1px solid hsl(0 0% 100% / 0.07);
  margin-bottom: 2px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: opacity 160ms;
}

.ck-nav-rank-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.ck-nav-rank-label {
  font-size: 11px;
  font-weight: 700;
  color: hsl(0 0% 100% / 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ck-nav-plan-pill {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 100px;
  background: var(--accent-bg);
  color: var(--accent-text);
  border: 1px solid var(--accent-bdr);
  flex-shrink: 0;
}

.ck-nav-rank-bar-wrap {
  height: 3px;
  border-radius: 100px;
  background: hsl(0 0% 100% / 0.08);
  overflow: hidden;
}

.ck-nav-rank-bar {
  height: 100%;
  border-radius: 100px;
  background: var(--accent);
  width: 0%;
  transition: width 600ms var(--ease-snap);
  box-shadow: 0 0 4px var(--accent-bg);
}

.ck-nav-rank-sub {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: hsl(0 0% 100% / 0.32);
}

/* Hide widget label/sub when nav is collapsed */
.db-shell.nav-collapsed .ck-nav-rank { display: none; }
.db-shell.nav-collapsed .db-nav:hover .ck-nav-rank { display: block; }

/* ─── 7. Main area ───────────────────────────────────────────────────── */

.db-main {
  grid-column: 2;
  padding: 22px 24px 0;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100vh;
  gap: 14px;
}

/* Header */
.db-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.db-welcome-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-1);
  line-height: 1.1;
}
.db-welcome-sub {
  font-size: var(--text-base);
  color: var(--text-3);
  margin-top: 4px;
}
.db-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Search bar */
.db-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  width: 190px;
  cursor: pointer;
  flex-shrink: 0;
}
.db-search:hover { border-color: var(--border-strong); }
.db-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); outline: none; }
.db-search svg { width: 13px; height: 13px; stroke: var(--text-4); flex-shrink: 0; }
.db-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-1);
  font-family: inherit;
  font-size: var(--text-base);
  outline: none;
  min-width: 0;
}
.db-search-input::placeholder { color: var(--text-4); }
.db-search-kbd {
  font-size: 10px;
  color: var(--text-4);
  font-family: 'Geist Mono', monospace;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Content grid */
.db-content {
  display: grid;
  grid-template-columns: 252px 1fr;
  gap: 14px;
  flex: 1;
  min-height: 0;
  padding-bottom: 18px;
}
.db-left-col   { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.db-right-area { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.db-cards-row  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; flex-shrink: 0; }

/* ─── 8. Card base ───────────────────────────────────────────────────── */

/* ── 3D TILT CARD SYSTEM ─────────────────────────────────────────────────
   JS (shell.js) sets CSS custom props on each card on pointermove:
     --rx (rotateX deg), --ry (rotateY deg),
     --mx / --my (0→1 normalised mouse pos) for the gloss sweep.
   ─────────────────────────────────────────────────────────────────────── */

.rly-card {
  background: var(--card);
  border-radius: var(--r);
  border: 1px solid var(--border);
  border-top-color: var(--border-top);
  position: relative;
  overflow: hidden;

  opacity: 0;
  animation: rly-enter 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;

  will-change: transform;
  transition:
    background        240ms ease,
    border-color      260ms ease,
    box-shadow        220ms ease,
    transform         220ms cubic-bezier(0.22, 1, 0.36, 1);

  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  box-shadow:
    0 1px 0   rgba(255,255,255,0.10) inset,
    0 8px 24px rgba(0,0,0,0.30),
    0 0 0 0.5px rgba(255,255,255,0.07);
}

/* Gloss reflection layer — position reacts to mouse X/Y via JS inline style */
.rly-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 300ms ease;
  background: radial-gradient(
    ellipse 80% 60% at calc(var(--mx, 0.5) * 100%) calc(var(--my, 0.5) * 100%),
    rgba(255,255,255,0.18) 0%,
    rgba(255,255,255,0.06) 35%,
    transparent 70%
  );
}

/* Top-edge specular streak */
.rly-card::after {
  content: '';
  position: absolute;
  top: 0; left: 8%; right: 8%; height: 1px;
  border-radius: 100%;
  pointer-events: none; z-index: 3;
  transition: opacity 280ms ease;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,255,255,0.20) 35%,
    rgba(255,255,255,0.38) 50%,
    rgba(255,255,255,0.20) 65%,
    transparent 100%
  );
  opacity: 0.6;
}

.rly-card:hover {
  border-color:     hsl(0 0% 100% / 0.18);
  border-top-color: hsl(0 0% 100% / 0.30);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0   rgba(255,255,255,0.12) inset,
    0 10px 28px rgba(0,0,0,0.34),
    0 0 0 0.5px rgba(255,255,255,0.10);
}

.rly-card:hover::before { opacity: 1; }
.rly-card:hover::after  { opacity: 1; }

/* Stagger delays for card rows */
.db-cards-row .rly-card:nth-child(1) { animation-delay: 140ms; }
.db-cards-row .rly-card:nth-child(2) { animation-delay: 185ms; }
.db-cards-row .rly-card:nth-child(3) { animation-delay: 230ms; }
.rly-calendar-card { animation-delay: 270ms; flex: 1; min-height: 0; }

@keyframes rly-enter {
  from { opacity: 0; transform: translateY(14px) scale(0.982); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Cards enter once and stay still. Idle float removed 2026-04-24:
   the infinite translateY conflicted with hover transform on iOS Safari
   and read as jitter while scrolling on mobile. */
.rly-card:not(:hover) {
  animation: rly-enter 420ms var(--ease-snap) forwards;
}

/* Card inner layout */
.rly-card-inner  { padding: 18px 18px 16px; height: 100%; display: flex; flex-direction: column; position: relative; z-index: 1; }
.rly-card-head   { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-shrink: 0; }
.rly-card-title  { font-size: 11px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); }
.rly-card-sub    { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Dark card variant */
.rly-card.dark {
  border-color: var(--dark-border);
  border-top-color: rgba(255,255,255,0.12);
  color: white;
  background: linear-gradient(160deg, hsl(0 0% 13%) 0%, hsl(0 0% 9%) 100%);
  box-shadow:
    0 1px 0   rgba(255,255,255,0.08) inset,
    1px 0 0   rgba(255,255,255,0.03) inset,
    0 10px 28px rgba(0,0,0,0.38),
    0 0 0 0.5px rgba(255,255,255,0.06);
}
.rly-card.dark:hover {
  box-shadow:
    0 1px 0   rgba(255,255,255,0.12) inset,
    1px 0 0   rgba(255,255,255,0.05) inset,
    0 12px 34px rgba(0,0,0,0.42),
    0 0 0 0.5px rgba(255,255,255,0.10);
}
.rly-card.dark .rly-card-title { color: rgba(255,255,255,0.38); }
.rly-card.dark .rly-card-sub   { color: rgba(255,255,255,0.32); }

/* ─── 9. Stats bar ───────────────────────────────────────────────────── */

.db-stats-bar {
  display: flex;
  align-items: stretch;
  background: var(--card);
  border-radius: var(--r);
  border: 1px solid var(--border);
  border-top-color: var(--border-top);
  flex-shrink: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  animation: rly-enter 300ms cubic-bezier(0.22,1,0.36,1) 30ms forwards;
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.1) inset,
    0 8px 24px rgba(0,0,0,0.30),
    0 0 0 0.5px rgba(255,255,255,0.07);
}

.db-stat-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  position: relative;
}
.db-stat-item + .db-stat-item::before {
  content: '';
  position: absolute;
  left: 0; top: 18%; bottom: 18%;
  width: 1px;
  background: var(--border);
}

.db-stat-icon-wrap {
  width: 36px; height: 36px;
  border-radius: var(--r-xs);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 17px;
  border: 1px solid transparent;
  background: var(--accent-bg);
  border-color: var(--accent-bdr);
}

.db-stat-body { min-width: 0; }
.db-stat-num {
  font-family: 'Geist Mono', monospace;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--text-1);
  display: block;
  text-rendering: geometricPrecision;
}
.db-stat-num.amber { color: var(--accent-text); }
.db-stat-label { font-size: var(--text-xs); color: var(--text-3); font-weight: 500; margin-top: 3px; display: block; white-space: nowrap; }
.db-stat-cta   { margin-left: auto; flex-shrink: 0; display: flex; gap: 5px; }

/* ─── 10. Profile card ───────────────────────────────────────────────── */

.db-profile-card {
  border-radius: var(--r);
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.08);
  border-top-color: rgba(255,255,255,0.13);
  opacity: 0;
  transform: translateY(8px);
  animation: rly-enter 320ms cubic-bezier(0.22,1,0.36,1) 75ms forwards;
  transition: background 240ms ease, box-shadow 240ms ease, border-color 240ms ease, color 240ms ease;
  background: linear-gradient(150deg, hsl(222 45% 14%) 0%, hsl(210 40% 10%) 60%, hsl(200 38% 8%) 100%);
  color: white;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 10px 28px rgba(0,0,0,0.28);
}
.db-profile-card::before {
  content: '';
  position: absolute;
  bottom: -40px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-bg) 0%, transparent 70%);
  pointer-events: none;
}
.db-profile-avatar-big {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(180 50% 38%), hsl(220 60% 48%));
  border: 2.5px solid var(--border-top);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: white;
  margin-bottom: 12px;
  position: relative; z-index: 1;
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.db-profile-name   { font-size: 14px; font-weight: 700; color: white; margin-bottom: 2px; position: relative; z-index: 1; }
.db-profile-handle { font-size: var(--text-xs); color: rgba(255,255,255,0.45); margin-bottom: 14px; position: relative; z-index: 1; }
.db-profile-stats  { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 14px; position: relative; z-index: 1; }
.db-profile-stat   { background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.08); border-top-color: rgba(255,255,255,0.13); border-radius: var(--r-xs); padding: 8px 10px; }
.db-profile-stat-val   { font-family: 'Geist Mono', monospace; font-size: 16px; font-weight: 700; color: white; letter-spacing: -0.02em; }
.db-profile-stat-label { font-size: 9px; color: rgba(255,255,255,0.38); text-transform: uppercase; letter-spacing: 0.07em; margin-top: 2px; }
.db-profile-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 10px 0;
  background: linear-gradient(170deg, oklch(82% 0.09 200) 0%, oklch(68% 0.10 205) 100%);
  color: hsl(0 0% 5%);
  border: none; border-top: 1px solid oklch(88% 0.07 200 / 0.7);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0.01em;
  position: relative; z-index: 1;
  box-shadow: 0 2px 8px oklch(68% 0.10 205 / 0.28), 0 1px 0 oklch(88% 0.07 200 / 0.62) inset;
  transition: filter 100ms, transform 80ms, box-shadow 100ms;
}
.db-profile-btn:hover { filter: brightness(1.07); box-shadow: 0 4px 18px oklch(68% 0.10 205 / 0.34), 0 1px 0 oklch(88% 0.07 200 / 0.66) inset; }
.db-profile-btn:active { transform: scale(0.98); }

/* ─── 11. Mini card + bench list ──────────────────────────────────────── */

.db-mini-card {
  background: var(--card);
  border-radius: var(--r);
  border: 1px solid var(--border);
  border-top-color: var(--border-top);
  flex: 1; min-height: 0;
  overflow: hidden;
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(8px);
  animation: rly-enter 320ms cubic-bezier(0.22,1,0.36,1) 120ms forwards;
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, 0 4px 24px rgba(0,0,0,0.45), 0 0 0 0.5px rgba(255,255,255,0.07);
}

.db-mini-card-head  { padding: 14px 16px 10px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; border-bottom: 1px solid var(--border); }
.db-mini-card-title { font-size: 10px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-3); }
.db-mini-card-body  { padding: 8px 16px 12px; overflow: hidden; flex: 1; }

.db-bench-list { display: flex; flex-direction: column; gap: 0; }
.db-bench-item { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.db-bench-item:last-child { border-bottom: none; }
.db-bench-av   { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-inset); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--text-3); flex-shrink: 0; text-transform: uppercase; }
.db-bench-body { flex: 1; min-width: 0; }
.db-bench-name { font-size: 12px; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-bench-meta { font-size: 10px; color: var(--text-3); }
.db-bench-delta { font-family: 'Geist Mono', monospace; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.db-bench-delta.pos  { color: var(--success); }
.db-bench-delta.neg  { color: var(--danger); }
.db-bench-delta.flat { color: var(--text-4); }

/* ─── 12. Inbox / framework-match list ───────────────────────────────── */

.db-inbox-list  { display: flex; flex-direction: column; gap: 0; flex: 1; }
.db-inbox-item  { display: flex; align-items: flex-start; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.db-inbox-item:last-child { border-bottom: none; }
.db-inbox-icon  { width: 26px; height: 26px; border-radius: var(--r-xs); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }
.db-inbox-icon svg { width: 12px; height: 12px; stroke-width: 2; }
.db-inbox-icon.match     { background: var(--accent-bg); border: 1px solid var(--accent-bdr); color: var(--accent-text); }
.db-inbox-icon.alert     { background: hsl(352 90% 60% / 0.12); border: 1px solid hsl(352 90% 60% / 0.25); color: var(--danger); }
.db-inbox-icon.milestone { background: hsl(150 60% 45% / 0.12); border: 1px solid hsl(150 60% 45% / 0.25); color: var(--success); }
.db-inbox-body  { flex: 1; min-width: 0; }
.db-inbox-title { font-size: 12px; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 1px; }
.db-inbox-sub   { font-size: var(--text-xs); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-inbox-badge { display: inline-flex; padding: 1px 6px; border-radius: 100px; font-size: 9px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; flex-shrink: 0; align-self: center; }
.db-inbox-badge.new   { background: var(--accent-bg); border: 1px solid var(--accent-bdr); color: var(--accent-text); }
.db-inbox-badge.tried { background: hsl(150 60% 45% / 0.12); border: 1px solid hsl(150 60% 45% / 0.25); color: var(--success); }

/* ─── 13. Score ring ──────────────────────────────────────────────────── */

.rly-ring-wrap   { position: relative; width: 96px; height: 96px; margin: 0 auto 8px; flex-shrink: 0; }
.rly-ring        { width: 96px; height: 96px; transform: rotate(-90deg); }
.rly-ring-bg     { fill: none; stroke: var(--bg-inset); stroke-width: 7; }
.rly-ring-fill   { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 201.1; stroke-dashoffset: 201.1; transition: stroke-dashoffset 900ms cubic-bezier(0.22, 1, 0.36, 1) 300ms; filter: drop-shadow(0 0 5px oklch(79% 0.11 200 / 0.36)); }
.rly-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rly-ring-score  { font-family: 'Geist Mono', monospace; font-size: 26px; font-weight: 700; color: var(--text-1); letter-spacing: -0.04em; line-height: 1; }
.rly-ring-unit   { font-size: 10px; color: var(--text-3); font-weight: 500; margin-top: 2px; }

.rly-progress-track { height: 5px; background: var(--bg-inset); border-radius: 100px; overflow: hidden; }
.rly-progress-fill  { height: 100%; border-radius: 100px; background: var(--accent); width: 0%; transition: width 700ms cubic-bezier(0.22, 1, 0.36, 1) 200ms; }

/* ─── 14. Calendar ────────────────────────────────────────────────────── */

.db-cal-head      { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; margin-bottom: 10px; }
.db-cal-week      { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.db-cal-day       { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.db-cal-day-label { font-size: 10px; font-weight: 600; color: var(--text-4); letter-spacing: 0.04em; text-transform: uppercase; }
.db-cal-day-cell  {
  width: 100%; min-height: 50px;
  border-radius: var(--r-xs);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 4px; cursor: pointer;
}
.db-cal-day-cell:hover { border-color: var(--border-strong); background: hsl(0 0% 14% / 0.7); }
.db-cal-day-cell.today { border-color: var(--accent-bdr); background: var(--accent-bg); }
.db-cal-day-num   { font-size: 12px; font-weight: 600; color: var(--text-2); }
.db-cal-day-cell.today .db-cal-day-num { color: var(--accent-text); font-weight: 700; }
.db-cal-add       { font-size: 16px; color: var(--text-4); line-height: 1; transition: color 100ms; }
.db-cal-day-cell:hover .db-cal-add { color: var(--accent); }
.db-cal-task-dot  { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* ─── 15. Todos / setup card ──────────────────────────────────────────── */

.db-todo-progress-meta  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.db-todo-progress-label { font-size: 11px; color: rgba(255,255,255,0.38); }
.db-todo-progress-pct   { font-size: 11px; font-weight: 600; font-family: 'Geist Mono', monospace; color: var(--accent); }
.db-todo-list  { display: flex; flex-direction: column; gap: 0; flex: 1; margin-top: 10px; }
.db-todo-item  { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
.db-todo-item:last-child { border-bottom: none; }
.db-todo-check { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; border: 1.5px solid rgba(255,255,255,0.2); background: transparent; display: flex; align-items: center; justify-content: center; }
.db-todo-check.done { background: var(--accent); border-color: var(--accent); }
.db-todo-check svg  { width: 8px; height: 8px; stroke: hsl(0 0% 6%); stroke-width: 2.5; }
.db-todo-label      { flex: 1; font-size: 12px; color: rgba(255,255,255,0.78); }
.db-todo-label.done { color: rgba(255,255,255,0.28); text-decoration: line-through; text-decoration-color: rgba(255,255,255,0.2); }
.db-todo-cta        { font-size: 10px; font-weight: 500; color: var(--accent-text); text-decoration: none; flex-shrink: 0; opacity: 0; transition: opacity 100ms; }
.db-todo-item:hover .db-todo-cta { opacity: 1; }

/* ─── 16. Utility ─────────────────────────────────────────────────────── */

/* Buttons */
.db-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  white-space: nowrap;
  transition: background 100ms, border-color 100ms, color 100ms, transform 80ms;
}
.db-btn svg { width: 12px; height: 12px; stroke-width: 2; flex-shrink: 0; }
.db-btn:hover { color: var(--text-1); border-color: var(--border-strong); background: hsl(0 0% 14% / 0.7); }
.db-btn:active { transform: scale(0.97); }
.db-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.db-btn-amber {
  background: var(--accent);
  color: var(--accent-on);
  border-color: transparent;
  font-weight: 700;
}
.db-btn-amber:hover { filter: brightness(1.07); background: var(--accent); }

.db-btn-danger {
  background: hsl(352 100% 66% / 0.12);
  color: var(--danger);
  border-color: hsl(352 100% 66% / 0.25);
  font-weight: 600;
}
.db-btn-danger:hover { background: hsl(352 100% 66% / 0.2); }

/* Pills + badges */
.db-pill        { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 100px; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.db-pill-amber  { background: var(--accent-bg); border: 1px solid var(--accent-bdr); color: var(--accent-text); }
.db-pill-green  { background: hsl(150 60% 45% / 0.12); border: 1px solid hsl(150 60% 45% / 0.25); color: var(--success); }
.db-pill-red    { background: hsl(352 90% 60% / 0.12); border: 1px solid hsl(352 90% 60% / 0.25); color: var(--danger); }
.db-pill-blue   { background: hsl(220 70% 60% / 0.12); border: 1px solid hsl(220 70% 60% / 0.25); color: hsl(220 65% 65%); }

.rly-badge {
  display: inline-flex; align-items: center;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  font-size: 9px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  background: var(--accent-bg);
  border: 1px solid var(--accent-bdr);
  color: var(--accent-text);
}

/* Skeleton loader */
.db-skel {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-inset) 0%, var(--border) 50%, var(--bg-inset) 100%);
  background-size: 200% 100%;
  animation: rly-shimmer 1.4s ease-in-out infinite;
}
@keyframes rly-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── 17. Page header pattern ─────────────────────────────────────────── */

.page-header {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 2px;
}
.page-header-left {}
.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-1);
  line-height: 1.15;
}
.page-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
}
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Divider */
.rly-divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* ─── 18. Form elements ───────────────────────────────────────────────── */

.rly-input,
.rly-select,
.rly-textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-inset);
  color: var(--text-1);
  font-family: inherit;
  font-size: 16px; /* ≥16px prevents iOS auto-zoom on focus */
  outline: none;
  transition: border-color 160ms, box-shadow 160ms, background 180ms;
  -webkit-appearance: none;
  appearance: none;
}
@media (min-width: 700px) {
  .rly-input,
  .rly-select,
  .rly-textarea {
    font-size: 13px; /* restore compact size on desktop */
  }
}
.rly-input::placeholder,
.rly-textarea::placeholder { color: var(--text-4); }
.rly-input:hover,
.rly-select:hover,
.rly-textarea:hover { border-color: var(--border-strong); }
.rly-input:focus,
.rly-select:focus,
.rly-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
  background: var(--card);
}

.rly-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.rly-textarea { resize: vertical; min-height: 80px; }

.rly-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}

.rly-field { display: flex; flex-direction: column; gap: 0; }
.rly-field + .rly-field { margin-top: 14px; }

.rly-field-hint {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 5px;
}
.rly-field-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 5px;
}

/* Input with icon slot */
.rly-input-wrap { position: relative; }
.rly-input-wrap .rly-input { padding-left: 34px; }
.rly-input-wrap .rly-input-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  stroke: var(--text-3);
  pointer-events: none;
}

/* ─── 19. Tables ──────────────────────────────────────────────────────── */

.rly-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--border);
}

.rly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.rly-table thead th {
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg-inset);
  white-space: nowrap;
}

.rly-table tbody td {
  padding: 10px 14px;
  color: var(--text-1);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.rly-table tbody tr:last-child td { border-bottom: none; }

.rly-table tbody tr { transition: background 80ms; }
.rly-table tbody tr:hover { background: hsl(0 0% 100% / 0.03); }

.rly-table .mono {
  font-family: 'Geist Mono', monospace;
  letter-spacing: -0.02em;
}
.rly-table .text-muted { color: var(--text-3); }
.rly-table .text-right { text-align: right; }

/* ─── 21. Responsive ─────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .db-content { grid-template-columns: 224px 1fr; }
}
@media (max-width: 900px) {
  .db-cards-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  /* .db-shell, body: defaults are already mobile-safe (height:auto, overflow:visible) */
  .db-nav { display: none; }
  .db-main { grid-column: 1; padding: 14px 14px calc(96px + env(safe-area-inset-bottom, 0px)); overflow-y: visible; overflow-x: clip; height: auto; }
  .db-content { grid-template-columns: 1fr; height: auto; }
  .db-left-col { display: contents; }
  .db-cards-row { grid-template-columns: 1fr; }
  .rly-calendar-card { min-height: 240px; flex: none; }
  .db-header { flex-wrap: wrap; }
  .db-welcome-title { font-size: 24px; }
  .page-title { font-size: 20px; }
  .page-header { flex-wrap: wrap; }
}

/* ─── Mobile Floating Island Nav ────────────────────────────────────────── */

.ck-mobile-nav {
  display: none;
}

@media (max-width: 700px) {

  /* Floating island — centered pill above content */
  .ck-mobile-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    width: calc(100% - 32px);
    max-width: 380px;
    background: hsl(0 0% 9% / 0.85);
    border: 1px solid hsl(0 0% 100% / 0.1);
    border-radius: 100px;
    padding: 8px 8px;
    gap: 2px;
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    box-shadow:
      0 2px 8px hsl(0 0% 0% / 0.45),
      0 0 0 0.5px hsl(0 0% 100% / 0.06) inset,
      0 1px 0 hsl(0 0% 100% / 0.08) inset;
  }

  .ck-mobile-nav-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px 6px;
    border-radius: 100px;
    color: hsl(0 0% 100% / 0.38);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    transition:
      color 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
      background 200ms ease,
      transform 150ms cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
  }

  .ck-mobile-nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 1.75;
    transition: inherit;
  }

  /* Hide labels — icons only. Clean. */
  .ck-mobile-nav-item span {
    display: none;
  }

  .ck-mobile-nav-item:active {
    transform: scale(0.88);
  }

  /* Active state — restrained product accent, no mobile flash */
  .ck-mobile-nav-item.active {
    color: var(--accent-text);
    background: var(--accent-bg);
    border: 1px solid var(--accent-border);
    box-shadow: inset 0 0 0 1px oklch(79% 0.11 200 / 0.05);
  }

  .ck-mobile-nav-item.active svg {
    stroke: currentColor;
  }

  .ck-mobile-nav-item:focus,
  .ck-mobile-nav-item:focus-visible {
    outline: none;
  }

  /* Hover — subtle bg for non-active */
  .ck-mobile-nav-item:not(.active):hover {
    color: hsl(0 0% 100% / 0.75);
    background: hsl(0 0% 100% / 0.07);
  }

  .ck-mobile-nav-item:focus-visible { outline: none; }
}

/* ─── 22. Reduced motion ─────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .rly-card, .db-stats-bar, .db-profile-card, .db-mini-card,
  .rly-ring-fill, .rly-progress-fill, .db-skel,
  body, .db-btn, .db-search,
  .rly-input, .rly-select, .rly-textarea { animation: none !important; transition: none !important; }
  .rly-card, .db-stats-bar, .db-profile-card, .db-mini-card { opacity: 1; transform: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANALYZE PAGE — Ring-Cards + shared analyze components
   These were in v2/style.css but are needed by all pages that use ring UI.
═══════════════════════════════════════════════════════════════════════════ */

/* Metric colors (v2 vars — kept as-is for app.js compatibility) */
:root {
  --hook:      hsl(174 100% 45%);
  --retention: hsl(213 100% 65%);
  --script:    hsl(264 90% 70%);
  --viral:     hsl(333 100% 65%);
}

.section-heading {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-3); font-weight: 600; margin: 28px 0 12px;
}

.ring-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 28px;
}
@media (max-width: 900px) { .ring-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .ring-grid { grid-template-columns: 1fr; } }

.ring-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-top-color: var(--border-top);
  border-radius: var(--r);
  padding: 20px 16px 16px;
  text-align: center;
  opacity: 0; transform: translateY(10px);
  animation: rly-enter 500ms cubic-bezier(0.22,1,0.36,1) forwards;
  transition: transform 280ms cubic-bezier(0.22,1,0.36,1), border-color 200ms;
  backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset, 0 4px 20px rgba(0,0,0,0.4);
}
.ring-card:nth-child(1) { animation-delay: 0ms; }
.ring-card:nth-child(2) { animation-delay: 70ms; }
.ring-card:nth-child(3) { animation-delay: 140ms; }
.ring-card:nth-child(4) { animation-delay: 210ms; }
.ring-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }

.ring-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-3); font-weight: 600; margin-bottom: 12px;
}
.ring-wrap { position: relative; width: 140px; height: 140px; margin: 0 auto 12px; }
.ring-svg { transform: rotate(-90deg); display: block; }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.ring-fg {
  fill: none; stroke-width: 8; stroke-linecap: round;
  stroke-dasharray: 402; stroke-dashoffset: 402;
  transition: stroke-dashoffset 1100ms cubic-bezier(0.22,1,0.36,1) 300ms;
}
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-score { font-size: 32px; font-weight: 700; line-height: 1; letter-spacing: -0.04em; color: var(--text-1); }
.ring-max   { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.ring-delta {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 11px; padding-top: 10px;
  border-top: 1px solid var(--border);
  min-height: 30px; color: var(--text-3);
}

/* Metric stroke colors */
.m-hook .ring-fg      { stroke: var(--hook);      filter: drop-shadow(0 0 8px hsl(174 100% 45% / 0.4)); }
.m-retention .ring-fg { stroke: var(--retention); filter: drop-shadow(0 0 8px hsl(213 100% 65% / 0.35)); }
.m-script .ring-fg    { stroke: var(--script);    filter: drop-shadow(0 0 8px hsl(264 90% 70% / 0.35)); }
.m-viral .ring-fg     { stroke: var(--viral);     filter: drop-shadow(0 0 8px hsl(333 100% 65% / 0.35)); }

.delta-up      { color: var(--success); font-weight: 600; }
.delta-down    { color: var(--danger);  font-weight: 600; }
.delta-neutral { color: var(--text-3); }
.delta-label   { color: var(--text-3); }
.pr-callout    { font-size: 10px; font-weight: 700; color: var(--accent); text-align: center; padding: 6px 0 2px; letter-spacing: 0.02em; }

/* Generic .card (used in analyze result sections) */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px 22px;
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}

/* Progress/step UI (analyze progress state) */
.step {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.step:last-child { border-bottom: none; }
.step-icon {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-inset); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); font-size: 12px;
}
.step.done .step-icon   { background: var(--success); border-color: var(--success); color: #fff; }
.step.active .step-icon { background: var(--accent-bg); border-color: var(--accent-bdr); color: var(--accent-text); }
.step-body { flex: 1; min-width: 0; }
.step-label { font-size: 13px; font-weight: 600; color: var(--text-1); }
.step-desc  { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.step-timer { font-size: 11px; color: var(--accent-text); font-family: 'Geist Mono', monospace; }

/* Error banner */
.error-banner {
  background: hsl(352 100% 66% / 0.10);
  border: 1px solid hsl(352 100% 66% / 0.35);
  color: var(--danger);
  padding: 14px 18px; border-radius: var(--r-sm);
  font-size: 13px; margin-bottom: 20px;
}

/* URL row */
.url-row { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; }
.url-row .rly-input { flex: 1; }

/* Progress preview */
.progress-preview {
  display: grid; grid-template-columns: 80px 1fr; gap: 16px;
  padding: 16px; background: var(--bg-inset);
  border: 1px solid var(--border); border-left: 2px solid var(--accent);
  border-radius: var(--r-sm); margin: 16px 0 20px;
}
.pp-thumb {
  width: 80px; height: 142px; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.pp-body { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pp-creator { font-size: var(--text-base); color: var(--text-1); display: flex; align-items: baseline; gap: 8px; }
.pp-handle  { color: var(--text-3); font-size: var(--text-xs); font-family: 'Geist Mono', monospace; }
.pp-caption { font-size: var(--text-xs); color: var(--text-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pp-stats   { display: flex; flex-wrap: wrap; gap: 10px; }
.pp-stat    { font-size: var(--text-xs); color: var(--text-3); display: flex; gap: 4px; }
.pp-stat strong { color: var(--text-1); font-weight: 600; }

/* ══════════════════════════════════════════════════════════════════════════
   2030 Shell — unified sidebar + mobile hub pill + command hub
   Replaces the old .ck-mobile-nav / .ck-mehr-drawer patterns.
   ════════════════════════════════════════════════════════════════════════ */

/* ─── Prevent flash of hardcoded nav before JS rebuild ──────────────────── */
.db-nav:not([data-ready]) .db-nav-list,
.db-nav:not([data-ready]) .db-nav-label { visibility: hidden; }

/* ─── Desktop sidebar refinements for the 5-item model ──────────────────── */
.db-nav-list.db-nav-primary { gap: 2px; margin-top: 4px; }
.db-nav-primary .db-nav-link {
  font-size: 13.5px;
  letter-spacing: -0.005em;
}
.db-nav-primary .db-nav-link svg {
  color: rgba(255,255,255,0.55);
  transition: color 240ms ease, transform 240ms cubic-bezier(0.22,1,0.36,1);
}
.db-nav-primary .db-nav-link:hover svg { color: var(--text-1); }
.db-nav-primary .db-nav-link.active {
  background: linear-gradient(180deg, var(--accent-bg), oklch(79% 0.11 200 / 0.05));
  border-color: var(--accent-border);
  color: var(--accent-text);
  box-shadow:
    inset 0 1px 0 hsl(0 0% 100% / 0.05),
    0 4px 14px oklch(79% 0.11 200 / 0.08);
}
.db-nav-primary .db-nav-link.active svg { color: var(--accent); }

/* Hub button — same shape as nav link, monochrome, with ⌘K kbd */
.db-nav-hub {
  margin-top: 6px;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
/* In the collapsed rail the hub inherits 44×44 from .db-nav-link — don't
   let the desktop hub rule force width: 100% back on. */
.db-shell.nav-collapsed .db-nav-hub { width: 44px; }
.db-nav-hub .db-nav-kbd {
  margin-left: auto;
  font: 600 10px/1 'Geist Mono', monospace;
  padding: 3px 6px;
  border-radius: 4px;
  background: hsl(0 0% 100% / 0.06);
  color: var(--text-3);
  border: 1px solid hsl(0 0% 100% / 0.08);
  letter-spacing: 0.04em;
}
.db-shell.nav-collapsed .db-nav-hub .db-nav-kbd { display: none; }
.db-shell.nav-collapsed .db-nav:hover .db-nav-hub .db-nav-kbd { display: inline-block; }

/* ─── Mobile floating hub pill (replaces .ck-mobile-nav) ────────────────── */
.rly-pill { display: none; }

@media (max-width: 700px) {
  /* Suppress legacy mobile nav if any still lingers */
  .ck-mobile-nav { display: none !important; }
  .ck-mehr-drawer, .ck-mehr-backdrop { display: none !important; }

  .rly-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    position: fixed;
    left: 50%;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 180;
    padding: 6px;
    border-radius: 999px;
    background:
      linear-gradient(180deg, hsl(0 0% 100% / 0.04), hsl(0 0% 100% / 0) 60%),
      hsl(0 0% 8% / 0.72);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid hsl(0 0% 100% / 0.08);
    box-shadow:
      0 1px 0 hsl(0 0% 100% / 0.06) inset,
      0 10px 28px hsl(0 0% 0% / 0.55),
      0 2px 6px hsl(0 0% 0% / 0.45);
    max-width: calc(100vw - 28px);
    opacity: 1;
    transition: opacity 280ms ease, transform 280ms cubic-bezier(0.22,1,0.36,1);
    will-change: opacity, transform;
  }
  .rly-pill-dim { opacity: 0.55; transform: translateX(-50%) translateY(2px); }

  .rly-pill-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    color: hsl(0 0% 100% / 0.48);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    font: 600 12px/1 var(--font-sans);
    letter-spacing: -0.01em;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none; user-select: none;
    -webkit-touch-callout: none;
    transition:
      width 360ms cubic-bezier(0.34, 1.4, 0.5, 1),
      background 240ms ease,
      color 240ms ease,
      box-shadow 280ms ease;
    overflow: hidden;
    flex-shrink: 0;
  }
  .rly-pill-item svg {
    width: 20px; height: 20px;
    stroke-width: 1.75;
    flex-shrink: 0;
    pointer-events: none;
  }
  .rly-pill-label {
    max-width: 0;
    opacity: 0;
    white-space: nowrap;
    pointer-events: none;
    transition: max-width 360ms var(--ease-snap), opacity 240ms ease, margin 320ms ease;
  }
  .rly-pill-item.active {
    width: auto;
    padding: 0 16px 0 14px;
    min-width: 44px;
    color: var(--accent-text);
    background: var(--accent-bg);
    border: 1px solid var(--accent-border);
    box-shadow:
      inset 0 0 0 1px oklch(79% 0.11 200 / 0.05),
      0 8px 22px hsl(0 0% 0% / 0.18);
  }
  .rly-pill-item.active .rly-pill-label {
    max-width: 90px;
    opacity: 1;
    margin-left: 8px;
  }
  .rly-pill-item:not(.active):active { transform: translateY(1px); }
  .rly-pill-item:not(.active):hover { color: var(--text-1); background: hsl(0 0% 100% / 0.06); }
  .rly-pill-item:focus,
  .rly-pill-item:focus-visible { outline: none; }

  .rly-pill-hub {
    color: hsl(0 0% 100% / 0.55);
  }
  .rly-pill-hub:active { transform: scale(0.9); }

  /* Body padding so fixed pill doesn't overlap content */
  body:has(.rly-pill) .db-main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}

/* ─── Command Hub (⌘K on desktop, bottom sheet on mobile) ───────────────── */
.rly-hub-root {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 260ms ease;
}
.rly-hub-root[data-open] { pointer-events: auto; opacity: 1; }

.rly-hub-backdrop {
  position: absolute;
  inset: 0;
  background: hsl(0 0% 0% / 0.55);
  backdrop-filter: blur(6px) saturate(130%);
  -webkit-backdrop-filter: blur(6px) saturate(130%);
  opacity: 0;
  transition: opacity 280ms ease;
}
.rly-hub-root[data-open] .rly-hub-backdrop { opacity: 1; }

.rly-hub-sheet {
  position: absolute;
  background: hsl(0 0% 7% / 0.92);
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border: 1px solid hsl(0 0% 100% / 0.08);
  box-shadow:
    0 12px 34px hsl(0 0% 0% / 0.38),
    inset 0 1px 0 hsl(0 0% 100% / 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}
/* Desktop — centered modal */
@media (min-width: 701px) {
  .rly-hub-sheet {
    top: 14vh;
    left: 50%;
    transform: translateX(-50%) translateY(8px) scale(0.98);
    width: min(720px, calc(100vw - 48px));
    max-height: 72vh;
    border-radius: var(--r-xl);
    opacity: 0;
    transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), opacity 220ms ease;
  }
  .rly-hub-root[data-open] .rly-hub-sheet {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
  }
  .rly-hub-handle { display: none; }
}

/* Mobile — bottom sheet */
@media (max-width: 700px) {
  .rly-hub-sheet {
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 86vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .rly-hub-root[data-open] .rly-hub-sheet { transform: translateY(0); }
}

.rly-hub-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: hsl(0 0% 100% / 0.18);
  margin: 10px auto 2px;
  flex-shrink: 0;
}

.rly-hub-head { padding: 14px 16px 10px; flex-shrink: 0; }
.rly-hub-search-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: hsl(0 0% 100% / 0.05);
  border: 1px solid hsl(0 0% 100% / 0.08);
  border-radius: 12px;
  transition: border-color 200ms, background 200ms;
}
.rly-hub-search-wrap:focus-within {
  border-color: oklch(79% 0.11 200 / 0.28);
  background: oklch(79% 0.11 200 / 0.06);
}
.rly-hub-search-icon { color: var(--text-3); flex-shrink: 0; }
.rly-hub-search {
  flex: 1;
  border: 0; background: transparent;
  font: 500 15px/1.2 var(--font-sans);
  color: var(--text-1);
  outline: none;
  -webkit-appearance: none; appearance: none;
  letter-spacing: -0.005em;
}
.rly-hub-search::placeholder { color: var(--text-3); }
.rly-hub-kbd {
  font: 600 10px/1 'Geist Mono', monospace;
  padding: 3px 6px;
  border-radius: 4px;
  background: hsl(0 0% 100% / 0.06);
  color: var(--text-3);
  border: 1px solid hsl(0 0% 100% / 0.08);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.rly-hub-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px 24px;
  overscroll-behavior: contain;
}

.rly-hub-section { margin-top: 14px; }
.rly-hub-section-label {
  font: 600 10px/1 var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  padding: 10px 4px 8px;
}

.rly-hub-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.rly-hub-action {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, oklch(79% 0.11 200 / 0.10), oklch(79% 0.11 200 / 0.04));
  border: 1px solid oklch(79% 0.11 200 / 0.25);
  border-radius: 12px;
  color: var(--accent-text);
  font: 600 13px/1.2 var(--font-sans);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 200ms, border-color 200ms, transform 140ms;
}
.rly-hub-action:hover { background: oklch(79% 0.11 200 / 0.18); }
.rly-hub-action:active { transform: scale(0.97); }
.rly-hub-action svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }

.rly-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
}
.rly-hub-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 14px;
  background: hsl(0 0% 100% / 0.02);
  border: 1px solid hsl(0 0% 100% / 0.06);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text-2);
  transition: background 200ms, border-color 200ms, color 200ms, transform 140ms;
  -webkit-tap-highlight-color: transparent;
}
.rly-hub-item:hover {
  background: hsl(0 0% 100% / 0.05);
  border-color: hsl(0 0% 100% / 0.12);
  color: var(--text-1);
}
.rly-hub-item:active { transform: scale(0.97); }
.rly-hub-item.active {
  background: oklch(79% 0.11 200 / 0.10);
  border-color: oklch(79% 0.11 200 / 0.35);
  color: var(--accent-text);
}
.rly-hub-item-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: hsl(0 0% 100% / 0.04);
  border: 1px solid hsl(0 0% 100% / 0.06);
  border-radius: 10px;
  color: inherit;
}
.rly-hub-item.active .rly-hub-item-icon {
  background: oklch(79% 0.11 200 / 0.14);
  border-color: oklch(79% 0.11 200 / 0.24);
  color: var(--accent);
}
.rly-hub-item-icon svg { width: 18px; height: 18px; }
.rly-hub-item-label {
  font: 600 13px/1.2 var(--font-sans);
  letter-spacing: -0.005em;
}

/* Prevent body scroll when hub open */
body.rly-hub-locked { overflow: hidden; }

/* Design Sprint 2 shared cockpit utilities (safe additive layer hooks) */
:root {
  --rly-cockpit-border: rgba(255,255,255,0.095);
  --rly-cockpit-inset: inset 0 1px 0 rgba(255,255,255,0.10), inset 0 -1px 0 rgba(0,0,0,0.20);
  --rly-cockpit-shadow: 0 18px 44px -32px rgba(0,0,0,0.94);
}

.rly-cockpit-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.075), rgba(255,255,255,0.018)), rgba(12,15,21,0.82);
  border: 1px solid var(--rly-cockpit-border);
  box-shadow: var(--rly-cockpit-inset), var(--rly-cockpit-shadow);
}

.skel,
.skeleton,
.loading-placeholder {
  color: rgba(246,248,252,0.28) !important;
  background: linear-gradient(90deg, rgba(255,255,255,0.035), rgba(255,255,255,0.07), rgba(255,255,255,0.035));
  background-size: 220% 100%;
}

.empty-state,
.error-state,
.loading-state {
  border: 1px dashed rgba(255,255,255,0.13);
  background: rgba(255,255,255,0.026);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
