:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --link: #1c5cab;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5;
    --series-2: #d95926;
    --link: #86b6ef;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --text-primary: #f0efec;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5;
  --series-2: #d95926;
  --link: #86b6ef;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--link); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 900px) { .wrap { padding: 0 32px; } }

.masthead { padding: 20px 0 32px; border-bottom: 1px solid var(--border); background: var(--surface); }
.topnav { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 14px; margin-bottom: 36px; }
.topnav a { color: var(--text-secondary); text-decoration: none; }
.topnav a:hover { color: var(--text-primary); }
#theme-toggle {
  margin-left: auto; font: inherit; font-size: 13px; color: var(--text-secondary);
  background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 3px 10px; cursor: pointer;
}
h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.01em; }
.lede { font-size: 18px; color: var(--text-secondary); margin: 0 0 28px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--page); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.tile-label { font-size: 14px; color: var(--text-secondary); }
.tile-value { font-size: 44px; font-weight: 600; line-height: 1.15; margin: 4px 0; }
.tile-note { font-size: 13px; color: var(--text-muted); }
.repro { font-size: 14px; color: var(--text-secondary); margin: 0; }

section { padding: 40px 0 8px; }
h2 { font-size: 24px; margin: 0 0 12px; }
section > p { color: var(--text-secondary); }

.card { margin: 24px 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 18px 12px; }
.card figcaption h3 { font-size: 17px; margin: 0 0 4px; }
.card figcaption p { font-size: 14px; color: var(--text-secondary); margin: 0 0 12px; }
.chart { width: 100%; position: relative; }
.chart.square { max-width: 560px; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 32px; }
@media (min-width: 900px) { .pair.wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.panel h4 { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 6px 0 4px; }
.chart .region { fill: var(--text-muted); font-size: 12px; font-variant-numeric: normal; }
.chart .bar.s1 { fill: var(--series-1); }
.chart .bar.s2 { fill: var(--series-2); }
.chart .bar.active { opacity: 0.7; }
.chart .zero { stroke: var(--text-muted); stroke-width: 1; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .label { fill: var(--text-secondary); font-size: 13px; font-variant-numeric: normal; }
.chart .value { fill: var(--text-primary); font-size: 12px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .ref { stroke: var(--axis); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .err { stroke-width: 2; stroke-linecap: round; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:focus { outline: none; }
.chart .mark.active .dot, .chart .dot.active { stroke: var(--text-primary); }
.s1 { fill: var(--series-1); }
.s2 { fill: var(--series-2); }
.err.s1 { stroke: var(--series-1); }
.err.s2 { stroke: var(--series-2); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--text-secondary); margin: 0 0 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend i.s1 { background: var(--series-1); }
.legend i.s2 { background: var(--series-2); }

.controls { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 10px; font-size: 14px; color: var(--text-secondary); }
.controls label { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 200px; }
.controls select {
  font: inherit; font-size: 14px; color: var(--text-primary); background: var(--page);
  border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; max-width: 100%;
}
.summary { font-size: 14px; color: var(--text-primary); margin: 0 0 8px; min-height: 1.5em; }

.table-view { margin-top: 10px; font-size: 13px; }
.table-view summary { cursor: pointer; color: var(--text-secondary); }
.table-view > div { overflow-x: auto; }
table { border-collapse: collapse; margin-top: 8px; width: 100%; }
th, td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--grid); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 600; }

.refs { font-size: 14px; color: var(--text-secondary); padding-left: 22px; }
.refs li { margin-bottom: 8px; }
main { padding-bottom: 48px; }

.tooltip {
  position: fixed; z-index: 10; pointer-events: none; max-width: 300px;
  background: var(--surface); color: var(--text-secondary); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.4;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.tooltip strong { color: var(--text-primary); font-size: 15px; font-variant-numeric: tabular-nums; }
.tooltip .row { display: flex; align-items: center; gap: 6px; }
.tooltip .key { width: 12px; height: 2px; display: inline-block; }
.tooltip .key.s1 { background: var(--series-1); }
.tooltip .key.s2 { background: var(--series-2); }

h3.sub { font-size: 18px; margin: 28px 0 8px; }

/* Architecture diagram: a column of stages on narrow screens, two lanes on wide ones. */
.arch { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; }
.stage {
  position: relative; background: var(--page); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px 12px;
}
.stage svg { display: block; width: 120px; height: 44px; margin-bottom: 6px; }
.stage h4 { margin: 0 0 4px; font-size: 14px; }
.stage p { margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.45; }
.stage::after {
  content: "\2193"; position: absolute; left: 50%; bottom: -21px; transform: translateX(-50%);
  color: var(--text-muted); font-size: 16px; line-height: 20px;
}
.s-head::after { content: none; }
.s-encoder::after { content: none; }
.s-phase::before {
  content: "In parallel, from the EEG window"; display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px;
}
.s-input { order: 1; } .s-temporal { order: 2; } .s-spatial { order: 3; } .s-encoder { order: 4; } .s-phase { order: 5; } .s-head { order: 6; }
@media (min-width: 900px) {
  .arch { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px 28px; }
  .s-input { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
  .s-temporal { grid-column: 2; grid-row: 1; }
  .s-spatial { grid-column: 3; grid-row: 1; }
  .s-encoder { grid-column: 4; grid-row: 1; }
  .s-phase { grid-column: 2 / span 3; grid-row: 2; }
  .s-head { grid-column: 5; grid-row: 1 / span 2; align-self: center; }
  .stage::after { content: "\2192"; left: auto; right: -22px; top: 50%; bottom: auto; transform: translateY(-50%); }
  .s-encoder::after, .s-phase::after { content: "\2192"; }
  .s-head::after { content: none; }
  .s-phase::before { content: "In parallel"; }
}
.g-line, .g-line2, .g-arc { fill: none; stroke-width: 2; stroke-linecap: round; }
.g-line { stroke: var(--series-1); }
.g-line2 { stroke: var(--series-2); }
.g-arc { stroke: var(--axis); }
.g-dot { fill: var(--series-1); }
.g-tok { fill: var(--series-1); }
.g-k1 { fill: var(--series-1); }
.g-k2 { fill: var(--series-1); opacity: 0.6; }
.g-k3 { fill: var(--series-1); opacity: 0.3; }
.chart .trace { fill: none; stroke: var(--text-secondary); stroke-width: 1.5; stroke-linejoin: round; }
.chart .tick { stroke: var(--axis); stroke-width: 1; }
.chart .tick.sel { stroke: var(--text-primary); stroke-width: 2; }
.chart .band { fill: var(--series-1); }
.chart .patch { fill: var(--series-2); }
.legend i.band1 { background: var(--series-1); border-radius: 2px; }
.legend i.band2 { background: var(--series-1); opacity: 0.55; border-radius: 2px; }
.legend i.band3 { background: var(--series-1); opacity: 0.25; border-radius: 2px; }
.legend i.patch { background: var(--series-2); border-radius: 2px; }
