/* SPY wheel backtest: fintech product theme.
   Colour carries meaning: blue = put phase (holding cash), pink = call phase (holding shares).
   Chart colours were checked for colour-blind separation on the panel colour. */
:root {
  --bg: #0a1020;
  --bg-deep: #060a14;
  --panel: #0f1729;
  --panel-2: #141e34;
  --line: #1e2942;
  --line-2: #2b3857;
  --ink: #e7ecf6;
  --ink-2: #a6b0c6;
  --ink-3: #7d89a4;
  --put: #3d8be0;
  --call: #d4609f;
  --theta: #1fa58c;
  --gamma: #d4692f;
  --vega: #9579e8;
  --pos: #5fd0a8;
  --neg: #f28d9e;
  --wheel: linear-gradient(90deg, var(--put), var(--call));
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;
  --wide: 1140px;
  --text: 70ch;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: var(--sans); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 520px at 78% -6%, rgba(212, 96, 159, .16), transparent 62%),
    radial-gradient(820px 520px at 8% -10%, rgba(61, 139, 224, .20), transparent 60%),
    linear-gradient(180deg, var(--bg) 0, var(--bg-deep) 100%) fixed;
  background-color: var(--bg);
  min-height: 100vh;
}
::selection { background: rgba(61, 139, 224, .35); }
a { color: #8ec0f5; text-decoration-color: rgba(142, 192, 245, .4); text-underline-offset: 3px; }
a:hover { color: #b7d6f8; }
:focus-visible { outline: 2px solid var(--put); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 16, 32, .72); backdrop-filter: blur(16px) saturate(150%); -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.topbar-in { max-width: var(--wide); margin: 0 auto; padding: 0 24px; height: 60px; display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; font-weight: 600; letter-spacing: -.01em; flex: none; }
.topbar nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a {
  color: var(--ink-3); text-decoration: none; font-size: .86rem; padding: 6px 11px; border-radius: 999px; white-space: nowrap;
  transition: color .15s, background-color .15s;
}
.topbar nav a:hover { color: var(--ink); }
.topbar nav a.active { color: var(--ink); background: rgba(255, 255, 255, .07); }
.home { flex: none; font-size: .86rem; color: var(--ink-2); text-decoration: none; border: 1px solid var(--line-2); padding: 6px 13px; border-radius: 999px; }
.home:hover { color: var(--ink); border-color: var(--ink-3); }

/* ---------------------------------------------------------------- layout + type */
main { max-width: var(--wide); margin: 0 auto; padding: 0 24px 120px; }
section { padding-top: 96px; }
h1 { font-size: clamp(2.5rem, 5.4vw, 4rem); font-weight: 600; letter-spacing: -.035em; line-height: 1.02; margin: 10px 0 18px; }
h2 { font-size: clamp(1.7rem, 3vw, 2.2rem); font-weight: 600; letter-spacing: -.025em; line-height: 1.15; margin-bottom: 24px; }
h2 .part {
  display: block; width: max-content; font-size: .9rem; font-weight: 500; letter-spacing: 0; margin-bottom: 10px;
  background: var(--wheel); -webkit-background-clip: text; background-clip: text; color: transparent;
}
section > h2:first-child { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; margin: 44px 0 12px; color: var(--ink); }
p { max-width: var(--text); font-size: 1.04rem; color: var(--ink-2); margin-bottom: 14px; }
p strong, li strong { color: var(--ink); font-weight: 600; }
em { color: var(--ink); font-style: italic; }
code { font-family: var(--mono); font-size: .86em; color: var(--ink); background: rgba(255, 255, 255, .06); padding: 1px 6px; border-radius: 5px; }
.note { font-size: .88rem; color: var(--ink-3); margin-top: 12px; }
.num-r { text-align: right; }
.neg { color: var(--neg); }
.pos { color: var(--pos); }

/* ---------------------------------------------------------------- hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); grid-template-areas: 'head ring' 'body ring'; column-gap: 48px; align-items: center; padding-top: 72px; }
.hero-head { grid-area: head; align-self: end; }
.hero-body { grid-area: body; align-self: start; }
.kicker { font-size: .9rem; color: var(--ink-3); margin: 0; }
.lede { font-size: 1.2rem; color: var(--ink); line-height: 1.5; max-width: 34ch; margin-bottom: 22px; }
.hero-body p { font-size: 1rem; }
.badge {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px;
  font-size: .8rem; color: var(--ink-2); padding: 6px 12px 6px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .04); border: 1px solid var(--line-2);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--theta); box-shadow: 0 0 10px var(--theta); }
.ring-fig { grid-area: ring; position: relative; margin: 0; }
#ring { width: 100%; max-width: 500px; display: block; margin: 0 auto; overflow: visible; }
#ring .seg { transform-box: view-box; transform-origin: 0 0; cursor: pointer; transition: opacity .15s; }
#ring .seg.dim { opacity: .28; }
#ring .center-big { font: 600 34px var(--sans); letter-spacing: -.03em; fill: var(--ink); }
#ring .center-small { font: 500 14px var(--sans); fill: var(--ink-2); }
#ring .center-label { font: 400 12px var(--sans); fill: var(--ink-3); }
#ring .month { font: 400 10.5px var(--sans); fill: var(--ink-3); }
@media (prefers-reduced-motion: no-preference) {
  #ring.animate .seg { animation: segIn .55s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 16ms + 120ms); }
  #ring.animate .mark { animation: fadeIn .4s ease both; animation-delay: calc(var(--i) * 16ms + 500ms); }
}
@keyframes segIn { from { transform: scale(.82) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.ring-tip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 210px; max-width: 260px;
  background: rgba(8, 13, 26, .96); border: 1px solid var(--line-2); border-radius: var(--r-md);
  padding: 10px 12px; font-size: .82rem; color: var(--ink-2); box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
}
.ring-tip b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.ring-tip .row { display: flex; justify-content: space-between; gap: 12px; }
.ring-tip .row span:last-child { color: var(--ink); font-family: var(--mono); font-size: .78rem; }
.ring-key { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-top: 14px; font-size: .8rem; color: var(--ink-2); }
.ring-key span { display: inline-flex; align-items: center; gap: 7px; }
.ring-key .ring-hint { flex-basis: 100%; justify-content: center; color: var(--ink-3); text-align: center; }
.sw { width: 14px; height: 6px; border-radius: 3px; display: inline-block; }
.sw.put { background: var(--put); }
.sw.call { background: var(--call); }
.sw.wheel { background: var(--wheel); }
.sw.bench { background: var(--ink-3); height: 2px; }
.sw.bench.dashed { background: repeating-linear-gradient(90deg, var(--ink-3) 0 4px, transparent 4px 7px); }
.mk { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.mk.fill { background: var(--ink); }
.mk.hollow { border: 1.5px solid var(--ink); }

/* stats strip: one instrument panel, not a row of cards */
.stats-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 48px;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: rgba(15, 23, 41, .7); overflow: hidden;
}
.stat { padding: 18px 20px; border-right: 1px solid var(--line); margin-right: -1px; }
.stat .nw { white-space: nowrap; }
.stat .lbl { font-size: .8rem; color: var(--ink-3); margin-top: 4px; }
.stat .num { font-size: 1.45rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- lesson pieces */
.wheel-diagram { display: grid; grid-template-columns: minmax(0, 1fr) minmax(170px, .85fr) minmax(0, 1fr); gap: 16px; align-items: center; margin: 22px 0 30px; }
.wd-state { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; position: relative; overflow: hidden; }
.wd-state::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--put); }
.wd-state:last-child::before { background: var(--call); }
.wd-title { font-size: .85rem; font-weight: 500; color: var(--ink-3); margin-bottom: 8px; }
.wd-trade { font-size: 1.02rem; color: var(--ink); line-height: 1.5; margin-bottom: 10px; }
.wd-loop { font-size: .84rem; color: var(--ink-3); line-height: 1.45; }
.wd-arrows { display: flex; flex-direction: column; gap: 22px; }
.wd-arrow { position: relative; font-size: .8rem; color: var(--ink-2); line-height: 1.4; text-align: center; padding: 0 6px; }
.wd-arrow strong { color: var(--ink); }
.wd-arrow::after { content: ""; display: block; height: 2px; margin-top: 8px; border-radius: 2px; background: linear-gradient(90deg, var(--put), var(--call)); }
.wd-arrow.left::after { background: linear-gradient(90deg, var(--put), var(--call)); transform: scaleX(-1); }
.wd-arrow.right::before, .wd-arrow.left::before { position: absolute; bottom: -9px; font-size: 1rem; line-height: 1; }
.wd-arrow.right::before { content: "›"; right: 0; color: var(--call); }
.wd-arrow.left::before { content: "‹"; left: 0; color: var(--put); }
.formula {
  font-family: var(--mono); font-size: .84rem; line-height: 1.85; color: var(--ink); white-space: pre-wrap; max-width: 76ch;
  background: var(--panel); border: 1px solid var(--line); border-left: 2px solid var(--put); border-radius: var(--r-md);
  padding: 14px 18px; margin: 6px 0 18px;
}
.greek-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.greek-grid .chart-wrap { margin-top: 0; }
.greek-notes { margin-top: 20px; }
.cycle-steps { list-style: none; margin: 14px 0 18px; padding-left: 0; counter-reset: step; max-width: var(--text); }
.cycle-steps li { position: relative; padding: 0 0 18px 30px; color: var(--ink-2); font-size: 1rem; }
.cycle-steps li::before {
  content: ""; position: absolute; left: 4px; top: 7px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--call);
}
.cycle-steps li:first-child::before { border-color: var(--put); }
.cycle-steps li::after { content: ""; position: absolute; left: 9px; top: 21px; bottom: 2px; width: 2px; background: var(--line-2); }
.cycle-steps li:last-child::after { display: none; }
.cycle-steps li b { font-family: var(--mono); font-size: .8rem; font-weight: 500; color: var(--ink); margin-right: 8px; }

/* ---------------------------------------------------------------- controls */
.pv-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 14px; }
.ctl { display: inline-flex; align-items: center; gap: 9px; font-size: .86rem; color: var(--ink-2); white-space: nowrap; }
select, .pv-controls button, .filters button {
  font: 500 .84rem var(--sans); color: var(--ink); background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 8px 12px; cursor: pointer;
}
select { appearance: none; -webkit-appearance: none; padding-right: 34px; max-width: 100%;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
select:hover, .pv-controls button:hover, .filters button:hover { border-color: var(--ink-3); }
.filters { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 12px; padding: 4px; width: max-content; max-width: 100%;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.filters button { border: none; background: transparent; color: var(--ink-3); border-radius: 8px; padding: 7px 12px; }
.filters button.on { background: var(--panel-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; border: 1.5px solid var(--ink-3); border-radius: 5px; background: transparent; cursor: pointer; }
input[type=checkbox]:checked { border-color: var(--put); background: var(--put) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 22px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--put), var(--call)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--put), var(--call)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--ink); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--ink-3); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 3px solid var(--bg); }
.ctl input[type=range] { width: 150px; }
.pv-controls #pvRange { flex: 1 1 260px; }
.pv-date { font-family: var(--mono); font-size: .95rem; color: var(--ink); min-width: 10ch; }

/* ---------------------------------------------------------------- panels: charts, tiles, tables */
.chart-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px 14px; margin-top: 16px; }
.chart-wrap canvas { display: block; max-width: 100%; }
.chart-wrap canvas + canvas { margin-top: 8px; }
.chart-legend { display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; font-size: .82rem; color: var(--ink-2); }
.chart-legend span, .chart-legend label { display: inline-flex; align-items: center; gap: 8px; }
.chart-legend label { color: var(--ink-3); cursor: pointer; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.two-col > .chart-wrap, .two-col > .table-wrap { margin-top: 0; }
.chart-wrap + .two-col, .chart-wrap + .table-wrap { margin-top: 16px; }

.pv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 8px; }
.pv-cell { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.pv-cell .k { font-size: .76rem; color: var(--ink-3); }
.pv-cell .v { font-family: var(--mono); font-size: .92rem; color: var(--ink); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-cell.key { background: linear-gradient(var(--panel-2), var(--panel-2)) padding-box, var(--wheel) border-box; border: 1px solid transparent; }
.pv-grid.small { margin-top: 12px; }
.pv-grid.small .pv-cell .v { white-space: normal; font-size: .86rem; }
.pv-sub { font-size: .95rem; font-weight: 600; margin: 22px 0 10px; color: var(--ink); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
.table-wrap.tall { max-height: 560px; }
table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: .78rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
thead th {
  position: sticky; top: 0; z-index: 1; text-align: left; font: 500 .76rem var(--sans); color: var(--ink-3);
  padding: 11px 14px; background: var(--panel-2); border-bottom: 1px solid var(--line-2);
}
tbody td { padding: 9px 14px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255, 255, 255, .025); color: var(--ink); }
.cmp td:first-child { font-family: var(--sans); font-size: .86rem; color: var(--ink); }
.cmp th:not(:first-child), .cmp td:not(:first-child) { text-align: right; }
.cmp tr.hl td { background: rgba(61, 139, 224, .09); color: var(--ink); }
.cmp tr.hl td:first-child { box-shadow: inset 2px 0 0 var(--put); }
.side-BUY, .side-SELL { color: var(--ink); }
.side-ASSIGN, .side-ASSIGNED, .side-CALLED, .side-EARLY { color: #f0a77a; }
.side-EXPIRE, .side-EXPIRED { color: var(--ink-3); }
.side-SKIP, .side-SKIPPED { color: var(--ink-3); font-style: italic; }
.side-DIVIDEND, .side-INTEREST, .side-DEPOSIT { color: var(--pos); }
.phase { display: inline-flex; align-items: center; gap: 7px; }
.phase::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--put); }
.phase.CALL::before { background: var(--call); }

.tests { max-width: var(--text); margin: 0 0 16px 1.4em; color: var(--ink-2); font-size: 1.04rem; }
.tests li { padding-left: 6px; margin-bottom: 8px; }
.tests li::marker { color: var(--ink-3); font-weight: 600; }
.verdict {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px 24px 10px; margin: 20px 0; overflow: hidden;
}
.verdict::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--wheel); }
.verdict p { font-size: 1rem; }

/* ---------------------------------------------------------------- footer + data page */
footer { max-width: var(--wide); margin: 0 auto; padding: 28px 24px 40px; border-top: 1px solid var(--line); display: flex; gap: 20px; font-size: .84rem; color: var(--ink-3); }
footer span { margin-right: auto; }
footer a { color: var(--ink-2); text-decoration: none; }
footer a:hover { color: var(--ink); }
.disconnect-box { margin-top: 24px; padding: 56px 24px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--r-lg); background: rgba(15, 23, 41, .6); }
.disconnect-box .glyph { width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 50%; border: 3px dashed var(--ink-3); opacity: .7; }
.disconnect-box h3 { margin: 0; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'head' 'ring' 'body'; row-gap: 24px; padding-top: 40px; }
  #ring { max-width: 380px; }
}
@media (max-width: 700px) {
  .topbar-in { padding: 0 14px; gap: 12px; }
  .brand span, .home { display: none; }
  main { padding: 0 16px 80px; }
  section { padding-top: 64px; }
  .two-col, .greek-grid, .wheel-diagram { grid-template-columns: minmax(0, 1fr); }
  .wd-arrows { gap: 14px; }
  .wd-arrow.right::after { transform: none; }
  .chart-wrap { padding: 14px 12px 10px; border-radius: var(--r-md); }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-bottom: 1px solid var(--line); }
  .stat .num { font-size: 1.2rem; }
  footer { flex-wrap: wrap; padding: 24px 16px 32px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
