/* =========================================================================
   Stake for CAKE - design system

   The palette is taken from the pixel-art cake in the favicon: sponge cream
   (#FEFFC1), butter-gold crumb (#FDDC73), terracotta crust (#A66458) and
   cocoa crust shadow (#7D3C2A).

   LIGHT-FIRST: cream ground, cocoa ink, chocolate-brown for every interactive
   thing, butter gold reserved for fills and highlights. Gold measures only
   1.26:1 against the cream ground, so it can never carry text or a thin mark -
   --gold-text is the legible stand-in, --gold-fill is the literal butter gold.

   A cocoa dark theme is kept under [data-theme="dark"].

   Every ink token clears 4.5:1 on every surface in its own theme (worst is
   4.80). Chart hues are a SEPARATE validated set (--viz-*) - never reuse a UI
   accent as a data colour.
   ========================================================================= */

:root {
  /* --- Surfaces: sponge, lightest to deepest ------------------------- */
  --bg: #fdf8e8;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7efd8;
  --surface-3: #f0e7ce;
  --border: #e6d8b6;
  --border-strong: #cdb98e;

  /* --- Ink (cocoa family) ------------------------------------------- */
  --text: #2b1710;
  --text-secondary: #6b4a38;
  --text-muted: #7a5c49;

  /* --- Brand: chocolate is the interactive colour ------------------- */
  --accent: #7d3c2a;
  --accent-bright: #97472f;
  --accent-deep: #5e2c1e;
  --accent-hover: #a2523a;
  --ink-on-accent: #fffdf5;
  --gold-fill: #fddc73;
  --gold-text: #7a5709;
  --terracotta: #a24e36;
  --cocoa: #7d3c2a;
  --cream: #feffc1;

  /* --- Status ------------------------------------------------------- */
  --good: #256b42;
  --warn: #8a5a0b;
  --danger: #a8231c;

  /* --- Data visualisation -------------------------------------------
     One set, validated against BOTH surfaces: light (band L 0.43-0.77 on
     #ffffff) and dark (band L 0.48-0.67 on #201410). Chroma >= 0.1, worst
     adjacent CVD dE 9.2, all >= 3:1 in each. Do not eyeball a change -
     re-run scripts/validate_palette.js for both modes. */
  --viz-1: #6b7be0; /* active stake  - periwinkle: the one cool
                       hue, and it has to stay cool. Terracotta and gold
                       sit only dE 9-12 apart even for full colour vision,
                       so an all-warm chart palette is unreadable. */
  --viz-2: #bc8829; /* blocks minted */
  --viz-3: #189a86; /* delegators    */
  --viz-4: #b96bc9; /* spare         */
  --viz-grid: #eadfc4;

  /* --- Type --------------------------------------------------------- */
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* --- Space (4/8 rhythm) ------------------------------------------- */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* --- Shape & depth ------------------------------------------------ */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(70, 40, 25, 0.10);
  --shadow-2: 0 8px 24px -10px rgba(70, 40, 25, 0.18);
  --shadow-3: 0 20px 50px -22px rgba(70, 40, 25, 0.28);
  --glow-accent: 0 1px 2px rgba(70, 34, 20, 0.18), 0 10px 28px -12px rgba(125, 60, 42, 0.45);
  --glow-accent-hover: 0 1px 2px rgba(70, 34, 20, 0.22), 0 14px 34px -12px rgba(125, 60, 42, 0.55);
  --hero-wash-a: rgba(253, 220, 115, 0.34);
  --hero-wash-b: rgba(200, 130, 105, 0.13);
  --wordmark: linear-gradient(120deg, #a24e36 5%, #7d3c2a 50%, #5e2c1e 95%);

  --nav-h: 68px;
  --wrap: 1180px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 200ms;

  /* --- z-index scale ------------------------------------------------ */
  --z-base: 0;
  --z-sticky: 40;
  --z-nav: 60;
  --z-overlay: 100;
  --z-modal: 110;
  --z-toast: 200;

  color-scheme: light;
}

/* Light mode: the site is deliberately dark-first, but respect an explicit
   opt-out so the page is still readable for anyone who forces light. */
/* The original cocoa dark theme, kept as an explicit opt-out. Not wired to
   prefers-color-scheme on purpose: this site is light-first, and honouring the
   OS setting would hand most visitors the theme we moved away from. */
:root[data-theme="dark"] {
  --bg: #140d0a;
  --bg-elevated: #1a100c;
  --surface: #201410;
  --surface-2: #2a1b15;
  --surface-3: #382419;
  --border: #3d2820;
  --border-strong: #543729;

  --text: #f7efd6;
  --text-secondary: #c9b49a;
  --text-muted: #ad9a83;

  --accent: #fddc73;
  --accent-bright: #ffe89a;
  --accent-deep: #c9a23f;
  --accent-hover: #fff0bd;
  --ink-on-accent: #241408;
  --gold-fill: #fddc73;
  --gold-text: #fddc73;
  --terracotta: #d9967f;

  --good: #6fd68a;
  --warn: #f0913d;
  --danger: #f26b6b;

  --viz-grid: #33211a;
  --glow-accent: 0 0 0 1px rgba(253, 220, 115, 0.3), 0 12px 40px -14px rgba(253, 220, 115, 0.45);
  --glow-accent-hover: 0 0 0 1px rgba(255, 232, 154, 0.45), 0 16px 46px -14px rgba(253, 220, 115, 0.55);
  --hero-wash-a: rgba(253, 220, 115, 0.16);
  --hero-wash-b: rgba(217, 150, 127, 0.14);
  --wordmark: linear-gradient(120deg, #fddc73 8%, #feffc1 45%, #c9a23f 95%);
  --shadow-1: 0 1px 2px rgba(70, 40, 25, 0.10);
  --shadow-2: 0 8px 24px -10px rgba(70, 40, 25, 0.18);
  --shadow-3: 0 20px 50px -22px rgba(70, 40, 25, 0.28);
  color-scheme: dark;
}

/* ========================================================================= */
/* Reset & base                                                              */
/* ========================================================================= */

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

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-3);
}

h1 { font-size: clamp(2.5rem, 7vw, 4.75rem); letter-spacing: -0.04em; }
h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); }

p { margin: 0 0 var(--s-4); max-width: 68ch; }

a { color: var(--accent-bright); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--text); }

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

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

button { font: inherit; cursor: pointer; }

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

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

.skip-link {
  position: absolute; left: var(--s-4); top: -100px;
  background: var(--accent); color: var(--ink-on-accent);
  padding: var(--s-3) var(--s-4); border-radius: var(--r-sm);
  z-index: var(--z-toast); font-weight: 600;
}
.skip-link:focus { top: var(--s-4); }

/* ========================================================================= */
/* Layout                                                                    */
/* ========================================================================= */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--s-5);
}

.section { padding-block: var(--s-8); position: relative; }
.section--tight { padding-block: var(--s-7); }

.section-head { margin-bottom: var(--s-7); max-width: 62ch; }
.section-head p { color: var(--text-secondary); margin-bottom: 0; }

.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: var(--s-3);
}
.eyebrow::before {
  content: ""; width: 22px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent));
}

.grid { display: grid; gap: var(--s-4); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* ========================================================================= */
/* Buttons                                                                   */
/* ========================================================================= */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  min-height: 48px;
  padding: var(--s-3) var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-weight: 600; font-size: 0.95rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
  touch-action: manipulation;
  white-space: nowrap;
}

.btn:active:not(:disabled) { transform: scale(0.975); }

.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  color: var(--ink-on-accent);
  box-shadow: var(--glow-accent);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--accent-hover), var(--accent-bright));
  color: var(--ink-on-accent);
  box-shadow: var(--glow-accent-hover);
}

.btn-ghost {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }

.btn-quiet {
  background: transparent; border-color: transparent; color: var(--text-secondary);
  min-height: 44px; padding-inline: var(--s-3);
}
.btn-quiet:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }

.btn-block { width: 100%; }
.btn .icon { width: 18px; height: 18px; flex: none; }

.btn-spinner {
  width: 16px; height: 16px; flex: none;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================================================= */
/* Navigation                                                                */
/* ========================================================================= */

.nav {
  position: sticky; top: 0; z-index: var(--z-nav);
  height: var(--nav-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav.is-scrolled {
  border-bottom-color: var(--border);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
}

.nav-inner {
  display: flex; align-items: center; gap: var(--s-4);
  width: 100%; max-width: var(--wrap); margin-inline: auto;
  padding-inline: var(--s-5);
}

.brand {
  display: inline-flex; align-items: center; gap: var(--s-3);
  min-height: 44px;
  color: var(--text); font-family: var(--font-display);
  font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em;
  margin-right: auto;
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; flex: none;
  border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--surface-3), var(--surface));
  border: 1px solid var(--border-strong);
}
.brand-mark svg { width: 20px; height: 20px; color: var(--accent); }
.brand-ticker {
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600;
  color: var(--accent); letter-spacing: 0.08em;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: var(--r-pill); padding: 2px 8px;
}

.nav-links { display: flex; align-items: center; gap: var(--s-1); }
.nav-links a {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding-inline: var(--s-3);
  border-radius: var(--r-sm);
  color: var(--text-secondary); font-size: 0.925rem; font-weight: 500;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); }
.nav-links a.is-active { color: var(--text); }
.nav-links a.is-active::after {
  content: ""; position: absolute; bottom: 4px; left: 50%;
  transform: translateX(-50%);
  width: 16px; height: 2px; border-radius: 2px; background: var(--accent);
}

.nav-toggle {
  display: none;
  width: 44px; height: 44px; flex: none;
  align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
}
.nav-toggle .icon { width: 22px; height: 22px; }

@media (max-width: 900px) {
  .nav-links {
    position: fixed; inset: var(--nav-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: var(--s-3) var(--s-5) var(--s-5);
    box-shadow: var(--shadow-3);
    transform: translateY(-8px);
    opacity: 0; visibility: hidden;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur);
  }
  .nav-links.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { min-height: 52px; font-size: 1rem; }
  .nav-links a.is-active::after { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav .btn-primary { display: none; }
  .nav-links .btn-primary { display: inline-flex; margin-top: var(--s-3); }
}
@media (min-width: 901px) {
  .nav-links .btn-primary { display: none; }
}

/* ========================================================================= */
/* Hero                                                                      */
/* ========================================================================= */

.hero {
  position: relative;
  padding-block: clamp(var(--s-7), 9vh, var(--s-8)) var(--s-7);
  overflow: hidden;
  isolation: isolate;
}

.hero-bg {
  position: absolute; inset: -20% -10% auto; height: 780px;
  z-index: -1; pointer-events: none;
}
/* Chain-lattice backdrop: a hex grid fading out, plus two soft light wells. */
.hero-bg::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.5;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 10%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 10%, transparent 72%);
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 46% 46% at 22% 18%, var(--hero-wash-a), transparent 68%),
    radial-gradient(ellipse 40% 40% at 82% 8%, var(--hero-wash-b), transparent 66%);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: var(--s-8);
  align-items: center;
}
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--s-7); }
}

.hero h1 { margin-bottom: var(--s-4); }
.hero h1 .accent {
  background: var(--wordmark);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lede {
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 54ch;
  margin-bottom: var(--s-6);
}

.hero-cta { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-bottom: var(--s-5); }

.hero-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 6px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.chip b { color: var(--text); font-weight: 600; }
.chip .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent);
}
.chip .dot.is-stale { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
.chip .dot.is-live { animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--good) 4%, transparent); }
}

/* --- Hero card: the pool at a glance ------------------------------------ */
.hero-card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--s-6);
  box-shadow: var(--shadow-3);
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 55%, transparent), transparent);
}
.hero-card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-3); margin-bottom: var(--s-5);
}
.hero-card-head h2 {
  font-size: 0.8rem; font-family: var(--font-mono); font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted); margin: 0;
}

/* Hero figure - exactly one per view. */
.hero-figure { margin-bottom: var(--s-5); }
.hero-figure .label {
  display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: var(--s-1);
}
.hero-figure .value {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 3.25rem);
  font-weight: 700; line-height: 1; letter-spacing: -0.03em;
  color: var(--text);
  display: flex; align-items: baseline; gap: var(--s-2);
}
.hero-figure .value .unit {
  font-family: var(--font-mono); font-size: 0.95rem; font-weight: 500;
  color: var(--text-muted); letter-spacing: 0;
}

.hero-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); }
.hero-mini > div { min-width: 0; }
.hero-mini .label {
  display: block; font-size: 0.72rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px;
}
.hero-mini .value {
  font-family: var(--font-mono); font-size: 1.05rem; font-weight: 600;
  color: var(--text); font-variant-numeric: tabular-nums;
}

/* ========================================================================= */
/* Cards, stat tiles & meters                                                */
/* ========================================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.stat {
  display: flex; flex-direction: column; gap: var(--s-2);
  position: relative; overflow: hidden;
}
.stat:hover { border-color: var(--border-strong); }
.stat-top { display: flex; align-items: center; gap: var(--s-2); }
.stat-icon {
  width: 32px; height: 32px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent-bright);
}
.stat-icon .icon { width: 17px; height: 17px; }
.stat-icon.is-gold { color: var(--gold-text); }
.stat-icon.is-teal { color: var(--terracotta); }
.stat-icon.is-pink { color: var(--terracotta); }
.stat-label {
  font-size: 0.82rem; color: var(--text-secondary); font-weight: 500;
}
.stat-value {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.2vw, 2.15rem);
  font-weight: 700; line-height: 1.05; letter-spacing: -0.03em;
  color: var(--text);
}
.stat-sub {
  font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--text-muted); font-variant-numeric: tabular-nums;
}

/* Meter: fill carries severity, track is a lighter step of the same ramp. */
.meter { display: flex; flex-direction: column; gap: var(--s-2); }
.meter-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3);
}
.meter-head .name { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; }
.meter-head .num {
  font-family: var(--font-mono); font-size: 0.95rem; font-weight: 600;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.meter-track {
  height: 10px; border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.meter-fill {
  height: 100%; border-radius: var(--r-pill);
  background: var(--accent);
  width: 0;
  transition: width 900ms var(--ease), background var(--dur) var(--ease);
}
.meter-fill.is-warn { background: var(--warn); }
.meter-fill.is-danger { background: var(--danger); }
.meter-foot {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: 0.78rem; color: var(--text-muted);
}
.meter-foot .icon { width: 14px; height: 14px; flex: none; }

/* ========================================================================= */
/* Charts                                                                    */
/* ========================================================================= */

.chart-card { padding: var(--s-5); }
.chart-head { margin-bottom: var(--s-4); }
.chart-head h3 { margin-bottom: 2px; font-size: 1.05rem; }
.chart-head .sub { font-size: 0.83rem; color: var(--text-muted); margin: 0; }

.chart-shell { position: relative; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }

.chart-svg .grid-line { stroke: var(--viz-grid); stroke-width: 1; }
.chart-svg .axis-text {
  fill: var(--text-muted); font-family: var(--font-mono);
  font-size: 10px; font-variant-numeric: tabular-nums;
}
.chart-svg .bar { fill: var(--viz-2); transition: opacity var(--dur) var(--ease); }
.chart-svg .line { fill: none; stroke: var(--viz-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .area { fill: var(--viz-1); opacity: 0.08; }
.chart-svg .end-dot { fill: var(--viz-1); stroke: var(--surface); stroke-width: 2; }
.chart-svg .hit { fill: transparent; cursor: pointer; }
.chart-svg .hit:hover ~ .bar { opacity: 1; }
.chart-svg.is-dim .bar { opacity: 0.42; }
.chart-svg .bar.is-active { opacity: 1; }
.chart-svg .crosshair { stroke: var(--border-strong); stroke-width: 1; }
.chart-svg .direct-label {
  fill: var(--text); font-family: var(--font-mono); font-size: 11px;
  font-weight: 600; font-variant-numeric: tabular-nums;
}

.chart-tip {
  position: absolute; z-index: var(--z-sticky);
  min-width: 148px;
  padding: var(--s-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  pointer-events: none;
  opacity: 0; transform: translate(-50%, -108%);
  transition: opacity 120ms var(--ease);
  font-size: 0.8rem;
}
.chart-tip.is-visible { opacity: 1; }
.chart-tip .tip-epoch {
  font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: var(--s-2);
}
.chart-tip .tip-row {
  display: flex; align-items: center; gap: var(--s-2);
  justify-content: space-between;
}
.chart-tip .tip-row + .tip-row { margin-top: var(--s-1); }
.chart-tip .tip-key { display: inline-flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.chart-tip .swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.chart-tip .tip-val {
  font-family: var(--font-mono); font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums;
}

.chart-legend {
  display: flex; flex-wrap: wrap; gap: var(--s-4);
  margin-top: var(--s-3); font-size: 0.8rem; color: var(--text-secondary);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .swatch { width: 10px; height: 10px; border-radius: 2px; }

/* Table view - the accessible twin of every chart. */
.table-toggle {
  margin-top: var(--s-3);
  display: inline-flex; align-items: center; gap: var(--s-2);
  background: none; border: 0; padding: var(--s-2) 0;
  color: var(--accent-bright); font-size: 0.82rem; font-weight: 500;
  min-height: 44px;
}
.table-toggle:hover { color: var(--text); }
.table-toggle .icon { width: 15px; height: 15px; transition: transform var(--dur) var(--ease); }
.table-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }

.data-table-wrap { margin-top: var(--s-3); max-height: 320px; overflow: auto; border-radius: var(--r-md); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.data-table th, .data-table td {
  padding: var(--s-2) var(--s-3); text-align: right;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums; font-family: var(--font-mono);
}
.data-table th {
  position: sticky; top: 0; background: var(--surface-2);
  color: var(--text-secondary); font-weight: 600; text-align: right;
  font-family: var(--font-body); font-size: 0.78rem;
}
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table tbody tr:last-child td { border-bottom: 0; }

.chart-empty {
  display: grid; place-items: center; gap: var(--s-2);
  min-height: 200px; text-align: center;
  color: var(--text-muted); font-size: 0.9rem;
}
.chart-empty .icon { width: 26px; height: 26px; opacity: 0.5; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ========================================================================= */
/* Wallet / resource grids                                                   */
/* ========================================================================= */

.tile {
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
a.tile:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  transform: translateY(-2px);
}
.tile-top { display: flex; align-items: center; gap: var(--s-3); }
.tile-icon {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--accent-bright);
}
.tile-icon .icon { width: 19px; height: 19px; }
.tile h3 { margin: 0; font-size: 1rem; }
.tile p { margin: 0; font-size: 0.875rem; color: var(--text-secondary); }
.tile-foot {
  margin-top: auto; padding-top: var(--s-3);
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.82rem; font-weight: 500; color: var(--accent-bright);
}
.tile-foot .icon { width: 14px; height: 14px; transition: transform var(--dur) var(--ease); }
a.tile:hover .tile-foot .icon { transform: translateX(3px); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.badge-good { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.badge-info { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-bright); }
.badge-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.badge .icon { width: 11px; height: 11px; }

/* ========================================================================= */
/* Steps (how delegation works)                                              */
/* ========================================================================= */

.steps { counter-reset: step; display: grid; gap: var(--s-4); }
.step {
  display: grid; grid-template-columns: 44px 1fr; gap: var(--s-4);
  align-items: start;
}
.step-num {
  counter-increment: step;
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--font-mono); font-weight: 700; color: var(--accent-bright);
}
.step-num::before { content: counter(step, decimal-leading-zero); }
.step h3 { font-size: 1rem; margin-bottom: 2px; }
.step p { margin: 0; font-size: 0.9rem; color: var(--text-secondary); }

/* ========================================================================= */
/* Delegate modal                                                            */
/* ========================================================================= */

.overlay {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  background: rgba(10, 6, 4, 0.74);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity 220ms var(--ease), visibility 220ms;
}
.overlay.is-open { opacity: 1; visibility: visible; }

.modal {
  position: fixed; z-index: var(--z-modal);
  left: 50%; top: 50%;
  width: min(520px, calc(100vw - 32px));
  max-height: min(86dvh, 760px);
  display: flex; flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  opacity: 0; visibility: hidden;
  transform: translate(-50%, -46%) scale(0.97);
  transition: opacity 220ms var(--ease), transform 220ms var(--ease), visibility 220ms;
}
.modal.is-open {
  opacity: 1; visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

@media (max-width: 560px) {
  .modal {
    top: auto; bottom: 0; left: 0;
    width: 100%; max-height: 92dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    transform: translateY(16px);
  }
  .modal.is-open { transform: none; }
}

.modal-head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-5) var(--s-5) var(--s-4);
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 1.15rem; flex: 1; }
.modal-back, .modal-close {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-secondary);
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.modal-back:hover, .modal-close:hover { color: var(--text); background: var(--surface-3); }
.modal-back .icon, .modal-close .icon { width: 18px; height: 18px; }
.modal-back[hidden] { display: none; }

.modal-body { padding: var(--s-5); overflow-y: auto; flex: 1; }
.modal-foot {
  padding: var(--s-4) var(--s-5) var(--s-5);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: var(--s-3);
}

.wallet-list { display: grid; gap: var(--s-2); }
.wallet-btn {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; min-height: 60px;
  padding: var(--s-3) var(--s-4);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--text);
  text-align: left;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}
.wallet-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-2); }
.wallet-btn:active:not(:disabled) { transform: scale(0.99); }
.wallet-btn img, .wallet-btn .wallet-fallback {
  width: 32px; height: 32px; flex: none; border-radius: 8px;
  object-fit: contain; background: var(--surface-3);
}
.wallet-fallback {
  display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem;
  color: var(--text-secondary);
}
.wallet-meta { flex: 1; min-width: 0; }
.wallet-name { font-weight: 600; font-size: 0.95rem; display: block; }
.wallet-sub {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted);
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wallet-btn .chevron { width: 16px; height: 16px; flex: none; color: var(--text-muted); }

.empty-wallets {
  text-align: center; padding: var(--s-5) var(--s-3);
}
.empty-wallets .icon { width: 34px; height: 34px; color: var(--text-muted); margin-bottom: var(--s-3); }
.empty-wallets p { margin: 0 auto var(--s-4); color: var(--text-secondary); font-size: 0.9rem; max-width: 40ch; }

/* Review panel */
.review-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-4); padding: var(--s-3) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.review-row:last-child { border-bottom: 0; }
.review-row .k { color: var(--text-secondary); }
.review-row .v {
  font-family: var(--font-mono); font-weight: 600; color: var(--text);
  font-variant-numeric: tabular-nums; text-align: right;
  overflow-wrap: anywhere;
}
.review-row.is-total .v { color: var(--accent); font-size: 1.05rem; }

.cert-list { list-style: none; margin: 0 0 var(--s-4); padding: 0; display: grid; gap: var(--s-2); }
.cert-list li {
  display: flex; align-items: flex-start; gap: var(--s-2);
  font-size: 0.88rem; color: var(--text-secondary);
}
.cert-list .icon { width: 16px; height: 16px; flex: none; color: var(--good); margin-top: 3px; }

.notice {
  display: flex; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.86rem; color: var(--text-secondary);
  margin-bottom: var(--s-4);
}
.notice .icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice p { margin: 0; }
.notice strong { color: var(--text); }
.notice-info { border-color: color-mix(in srgb, var(--accent) 34%, transparent); }
.notice-info .icon { color: var(--accent-bright); }
.notice-warn { border-color: color-mix(in srgb, var(--warn) 36%, transparent); }
.notice-warn .icon { color: var(--warn); }
.notice-error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.notice-error .icon { color: var(--danger); }
.notice-good { border-color: color-mix(in srgb, var(--good) 36%, transparent); }
.notice-good .icon { color: var(--good); }

/* Progress / result states */
.flow-state { text-align: center; padding: var(--s-5) var(--s-3); }
.flow-icon {
  width: 64px; height: 64px; margin: 0 auto var(--s-4);
  display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
}
.flow-icon .icon { width: 30px; height: 30px; color: var(--accent-bright); }
.flow-icon.is-good { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.flow-icon.is-good .icon { color: var(--good); }
.flow-icon.is-error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.flow-icon.is-error .icon { color: var(--danger); }
.flow-state h3 { margin-bottom: var(--s-2); }
.flow-state p { margin: 0 auto var(--s-4); color: var(--text-secondary); max-width: 42ch; font-size: 0.92rem; }

.flow-steps { list-style: none; margin: var(--s-5) 0 0; padding: 0; display: grid; gap: var(--s-3); text-align: left; }
.flow-steps li {
  display: flex; align-items: center; gap: var(--s-3);
  font-size: 0.88rem; color: var(--text-muted);
}
.flow-steps .marker {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: grid; place-items: center;
}
.flow-steps .marker .icon { width: 12px; height: 12px; opacity: 0; }
.flow-steps li.is-active { color: var(--text); }
.flow-steps li.is-active .marker { border-color: var(--accent); }
.flow-steps li.is-active .marker::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); animation: pulse-dot 1.1s var(--ease) infinite;
}
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.flow-steps li.is-done { color: var(--text-secondary); }
.flow-steps li.is-done .marker { border-color: var(--good); background: var(--good); }
.flow-steps li.is-done .marker .icon { opacity: 1; color: var(--ink-on-accent); }

.tx-link {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--font-mono); font-size: 0.8rem;
  padding: var(--s-2) var(--s-3);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow-wrap: anywhere;
}

/* ========================================================================= */
/* Footer                                                                    */
/* ========================================================================= */

.footer {
  border-top: 1px solid var(--border);
  padding-block: var(--s-8) var(--s-6);
  margin-top: var(--s-8);
  background: var(--bg-elevated);
}
.footer-grid {
  display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: var(--s-6); margin-bottom: var(--s-7);
}
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: var(--s-5); } }
.footer h4 {
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--text-muted); margin: 0 0 var(--s-3);
}
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-1); }
.footer ul a {
  display: inline-flex; align-items: center; min-height: 32px;
  color: var(--text-secondary); font-size: 0.9rem;
}
.footer ul a:hover { color: var(--text); }
.footer-about p { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: var(--s-4); }

.pool-id {
  display: block;
  font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--text-muted); overflow-wrap: anywhere;
  padding: var(--s-2) var(--s-3);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.socials { display: flex; gap: var(--s-2); }
.socials a {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text-secondary);
}
.socials a:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.socials .icon { width: 19px; height: 19px; }

.footer-bottom {
  display: flex; flex-wrap: wrap; gap: var(--s-3);
  align-items: center; justify-content: space-between;
  padding-top: var(--s-5); border-top: 1px solid var(--border);
  font-size: 0.82rem; color: var(--text-muted);
}
.footer-bottom p { margin: 0; }

/* ========================================================================= */
/* Toast                                                                     */
/* ========================================================================= */

.toast-region {
  position: fixed; z-index: var(--z-toast);
  left: 50%; bottom: var(--s-5); transform: translateX(-50%);
  display: grid; gap: var(--s-2);
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  font-size: 0.88rem;
  animation: toast-in 240ms var(--ease);
}
.toast .icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.is-good .icon { color: var(--good); }
.toast.is-error .icon { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ========================================================================= */
/* Utilities & motion                                                        */
/* ========================================================================= */

.reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity 520ms var(--ease), transform 520ms var(--ease);
}
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

[hidden] { display: none !important; }

.stack-4 > * + * { margin-top: var(--s-4); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
