/* Edge Lab dashboard: liquid glass over a dark aurora, light variant for daylight.
   Three window colours carry meaning everywhere: train (cyan), held (amber), blind (violet). */
:root {
  color-scheme: dark;
  --bg0: #050913;
  --bg1: #0A1326;
  --a1: rgba(0, 200, 255, 0.46);
  --a2: rgba(120, 84, 255, 0.5);
  --a3: rgba(255, 64, 170, 0.28);
  --ink: #EAF3FF;
  --muted: #9CB1C9;
  --faint: rgba(255, 255, 255, 0.1);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-hi: rgba(255, 255, 255, 0.13);
  --rim1: rgba(255, 255, 255, 0.55);
  --rim2: rgba(255, 255, 255, 0.07);
  --rim3: rgba(255, 255, 255, 0.04);
  --rim4: rgba(255, 255, 255, 0.28);
  --spec: rgba(255, 255, 255, 0.2);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.75);
  --line: #7EE8FF;
  --glow: rgba(79, 216, 255, 0.9);
  --train: #4FD8FF;
  --held: #FFC45C;
  --blind: #B892FF;
  --good: #52F2B4;
  --warn: #FFC45C;
  --bad: #A5B7CC;
  --grid: rgba(255, 255, 255, 0.045);
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", system-ui, "Helvetica Neue", sans-serif;
  --round: ui-rounded, "SF Pro Rounded", var(--ui);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg0: #D5E3F3;
    --bg1: #E6EEF8;
    --a1: rgba(60, 200, 255, 0.55);
    --a2: rgba(150, 120, 255, 0.42);
    --a3: rgba(255, 140, 200, 0.36);
    --ink: #0A1A2C;
    --muted: #3D5269;
    --faint: rgba(10, 26, 44, 0.11);
    --glass: rgba(255, 255, 255, 0.5);
    --glass-hi: rgba(255, 255, 255, 0.78);
    --rim1: rgba(255, 255, 255, 0.95);
    --rim2: rgba(255, 255, 255, 0.28);
    --rim3: rgba(255, 255, 255, 0.14);
    --rim4: rgba(255, 255, 255, 0.85);
    --spec: rgba(255, 255, 255, 0.85);
    --shadow: 0 16px 34px -16px rgba(24, 56, 100, 0.5);
    --line: #0B5FD6;
    --glow: rgba(11, 95, 214, 0.45);
    --train: #0A84B5;
    --held: #A86C00;
    --blind: #7440D2;
    --good: #08764A;
    --warn: #865600;
    --bad: #4E6279;
    --grid: rgba(10, 26, 44, 0.05);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg0);
  color: var(--ink);
  font: 16px/1.5 var(--ui);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

/* backdrop: static on purpose, so the blur under the glass never repaints while you scroll */
.aurora {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(62% 38% at 14% 6%, var(--a1), transparent 70%),
    radial-gradient(56% 36% at 96% 28%, var(--a2), transparent 70%),
    radial-gradient(64% 40% at 24% 74%, var(--a3), transparent 72%),
    radial-gradient(52% 34% at 94% 96%, var(--a1), transparent 70%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
}
.grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(120% 75% at 50% 0%, #000 15%, transparent 78%);
  mask-image: radial-gradient(120% 75% at 50% 0%, #000 15%, transparent 78%);
}

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right)) calc(112px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

/* ---------- the glass ---------- */
.glass, .row {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border-radius: 24px;
  box-shadow: var(--shadow), inset 0 1px 0 var(--spec);
}
/* specular rim: a 1px gradient edge that is bright where the light hits */
.glass::before, .row::before {
  content: "";
  position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, var(--rim1), var(--rim2) 36%, var(--rim3) 64%, var(--rim4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
/* soft refraction glow from the top-left corner */
.glass::after, .row::after {
  content: "";
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(110% 60% at 10% -8%, var(--spec), transparent 52%);
  opacity: 0.55;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .row { background: color-mix(in srgb, var(--bg1) 86%, var(--ink) 8%); }
}
.pad { padding: 16px; }

/* bars float over the content, so they get extra tint: readable even where the blur is unavailable */
.top, .tabs { background: color-mix(in srgb, var(--bg1) 66%, transparent); }

/* ---------- header ---------- */
.top {
  position: sticky; top: max(10px, env(safe-area-inset-top)); z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: max(10px, env(safe-area-inset-top));
  padding: 10px 16px 10px 18px;
  border-radius: 999px;
}
h1 { font: 700 20px/1.1 var(--round); margin: 0; letter-spacing: -0.02em; white-space: nowrap; }
.badge { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; color: var(--muted); text-align: right; line-height: 1.25; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--held); box-shadow: 0 0 10px var(--held); }
.badge[data-kind="real"] .dot { background: var(--good); box-shadow: 0 0 10px var(--good); }

section { padding: 30px 0 0; scroll-margin-top: 84px; }
section.hero { padding-top: 18px; }
h2 { font: 700 22px/1.2 var(--round); margin: 0 0 4px 4px; letter-spacing: -0.015em; }
h3 { font: 600 17px/1.3 var(--ui); margin: 0; overflow-wrap: break-word; }
.note { color: var(--muted); font-size: 14px; margin: 6px 0 0 4px; max-width: 62ch; }
.err { color: var(--bad); }
code { font-size: 0.92em; }

/* ---------- hero: the lens ---------- */
.lens { padding: 20px 16px 16px; border-radius: 30px; }
.lens h2 { font-size: 26px; margin: 0 0 10px; }
.hud {
  position: absolute; inset: 10px; pointer-events: none; opacity: 0.6;
  background:
    linear-gradient(var(--line), var(--line)) top left / 14px 1.5px no-repeat,
    linear-gradient(var(--line), var(--line)) top left / 1.5px 14px no-repeat,
    linear-gradient(var(--line), var(--line)) top right / 14px 1.5px no-repeat,
    linear-gradient(var(--line), var(--line)) top right / 1.5px 14px no-repeat,
    linear-gradient(var(--line), var(--line)) bottom left / 14px 1.5px no-repeat,
    linear-gradient(var(--line), var(--line)) bottom left / 1.5px 14px no-repeat,
    linear-gradient(var(--line), var(--line)) bottom right / 14px 1.5px no-repeat,
    linear-gradient(var(--line), var(--line)) bottom right / 1.5px 14px no-repeat;
}
.lede { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 14px; max-width: 62ch; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 11px var(--ui); fill: var(--muted); }
.chart .endv { font: 600 14px var(--round); fill: var(--ink); }
.w-train { fill: var(--train); opacity: 0.1; }
.w-held { fill: var(--held); opacity: 0.12; }
.w-blind { fill: var(--blind); opacity: 0.16; }
.divider { stroke: var(--ink); stroke-opacity: 0.22; stroke-dasharray: 2 4; }
.zero { stroke: var(--muted); stroke-opacity: 0.55; stroke-dasharray: 3 5; }
.area { opacity: 0; animation: rise 0.9s 0.35s ease-out forwards; }
.glowline { fill: none; stroke: var(--line); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; animation: rise 0.9s 0.35s ease-out forwards; }
.glowline { --o: 0.55; }
.line { fill: none; stroke: var(--line); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 0.9s ease-out forwards; }
.dotend { fill: var(--line); }
.chip { fill: var(--bg1); fill-opacity: 0.78; stroke: var(--line); stroke-opacity: 0.55; stroke-width: 1; }
.ping { fill: none; stroke: var(--line); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; animation: ping 1.1s 0.85s ease-out 1 forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes rise { to { opacity: var(--o, 1); } }
@keyframes ping { 0% { opacity: 0.9; transform: scale(1); } 100% { opacity: 0; transform: scale(4.2); } }
@media (prefers-reduced-motion: reduce) {
  .line { animation: none; stroke-dashoffset: 0; }
  .area, .glowline { animation: none; opacity: var(--o, 1); }
  .ping { display: none; }
}

/* the blind window, sealed: frosted glass laid over the part of the chart nobody has seen */
.seal {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border-radius: 14px;
  color: var(--blind); font-size: 12px; font-weight: 600;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 5px, transparent 5px 11px),
    linear-gradient(165deg, color-mix(in srgb, var(--blind) 30%, transparent), color-mix(in srgb, var(--blind) 8%, transparent));
  -webkit-backdrop-filter: blur(12px) saturate(170%);
  backdrop-filter: blur(12px) saturate(170%);
  box-shadow: inset 0 1px 0 var(--spec), inset 0 0 0 1px color-mix(in srgb, var(--blind) 50%, transparent), 0 0 26px -6px var(--blind);
}
.seal svg { width: 22px; height: 22px; }

.wins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.win {
  position: relative;
  padding: 14px 10px 10px 12px;
  border-radius: 18px;
  background: var(--faint);
  box-shadow: inset 0 1px 0 var(--spec);
}
.win::before {
  content: ""; position: absolute; left: 12px; top: 0; width: 22px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--c); box-shadow: 0 0 12px var(--c);
}
.win b { display: block; font: 600 22px/1.15 var(--round); letter-spacing: -0.01em; }
.win span { display: block; font-size: 12px; line-height: 1.3; color: var(--muted); margin-top: 2px; }
.win.sealed b { display: flex; align-items: center; gap: 5px; color: var(--blind); font-size: 17px; font-weight: 600; padding-top: 3px; }
.win.sealed b svg { width: 17px; height: 17px; flex: none; }

/* ---------- checks ---------- */
.checks { margin: 10px 0 0; padding: 4px 16px; }
.check { padding: 12px 0; }
.check + .check { border-top: 1px solid var(--faint); }
.check dt { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 600; }
.check dd { margin: 3px 0 0; }
.st {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 2px 10px 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, currentColor 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 40%, transparent);
}
.st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.st.good { color: var(--good); }
.st.bad { color: var(--bad); }
.st.warn { color: var(--warn); }

/* ---------- strategy list ---------- */
.rows { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 20px;
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.18s ease, box-shadow 0.18s ease;
}
.row:active { background: var(--glass-hi); }
.row[aria-pressed="true"] {
  background: var(--glass-hi);
  box-shadow: var(--shadow), inset 0 1px 0 var(--spec), 0 0 0 1.5px var(--line), 0 0 22px -4px var(--glow);
}
.row:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.why { grid-column: 1; font-size: 14px; color: var(--muted); }
.side { grid-row: 1 / span 2; grid-column: 2; text-align: right; font-size: 13px; color: var(--muted); line-height: 1.7; }
.pill {
  display: inline-block;
  padding: 2px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: color-mix(in srgb, currentColor 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 45%, transparent), 0 0 14px -6px currentColor;
}
.pill.good { color: var(--good); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--bad); }

/* ---------- validator measurements ---------- */
.meas { margin: 14px 0 0; }
.meas p { margin: 0 0 6px; font-weight: 600; }
.bar { position: relative; height: 9px; border-radius: 999px; background: var(--faint); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25); }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; box-shadow: 0 0 12px -1px currentColor; }
.bar u { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 1px; background: var(--ink); opacity: 0.6; text-decoration: none; }
.meas p.bar-note { font-size: 14px; font-weight: 400; color: var(--muted); margin: 6px 0 16px; }
.pad > .note:first-child { margin-left: 0; margin-top: 0; }
.pad > .note { margin-left: 0; }
table { border-collapse: collapse; width: 100%; margin-top: 8px; }
th, td { padding: 9px 0; border-top: 1px solid var(--faint); text-align: right; font-weight: 400; }
th:first-child, td:first-child { text-align: left; }
thead th { border-top: 0; color: var(--muted); font-size: 13px; }

footer.foot { margin-top: 30px; padding: 16px 18px 12px; border-radius: 22px; font-size: 13px; color: var(--muted); }
footer p { margin: 0 0 8px; max-width: 62ch; }

/* ---------- floating tab bar ---------- */
.tabs {
  position: fixed; z-index: 20;
  left: 50%; transform: translateX(-50%);
  bottom: max(14px, env(safe-area-inset-bottom));
  width: min(calc(100% - 28px), 400px);
  display: flex; gap: 2px; padding: 5px;
  border-radius: 999px;
}
.tabs a {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 4px 6px;
  border-radius: 999px;
  color: var(--muted); font-size: 11px; font-weight: 500; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.tabs a svg { width: 22px; height: 22px; }
.tabs a[aria-current="true"] {
  color: var(--ink);
  background: var(--glass-hi);
  box-shadow: inset 0 1px 0 var(--spec), 0 0 18px -5px var(--glow);
}
.tabs a:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.tabs a[aria-current="true"] svg { color: var(--line); }

@media (min-width: 560px) {
  .tabs { width: 400px; }
}

/* ---------- 5m / 15m section ---------- */
#micro .seg { display: flex; gap: 4px; padding: 4px; margin: 10px 0 14px; width: max-content; max-width: 100%; border-radius: 999px; background: var(--glass); box-shadow: inset 0 0 0 1px var(--rim2); }
#micro .seg button { border: 0; border-radius: 999px; padding: 8px 18px; font: 600 14px/1 var(--round); color: var(--muted); background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#micro .seg button[aria-pressed="true"] { color: var(--ink); background: var(--glass-hi); box-shadow: inset 0 1px 0 var(--spec), 0 0 0 1.5px var(--line), 0 0 18px -4px var(--glow); }
#micro .seg button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
#micro .sub { font: 600 17px/1.3 var(--round); margin: 22px 0 8px 4px; }
#micro .lens .wins { margin-bottom: 4px; }
.cal { display: grid; grid-template-columns: 64px 1fr 40px; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; color: var(--muted); }
.cal span:last-child { text-align: right; color: var(--ink); font-weight: 600; }
.row.static { cursor: default; }
.row.static:active { background: transparent; }
#micro .nc { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--faint); font-size: 14px; color: var(--muted); }
