:root {
  color-scheme: dark;
  --page: #0b121b;
  --card: #112031;
  --plot: #101b29;
  --border: #243447;
  --text: #e9f1fa;
  --muted: #9aafc4;
  --focus: #acf4ee;
  --six: #4edec5;
  --twelve: #a9a2ff;
  --twenty-four: #ffb76e;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-synthesis: none;
  background: var(--page);
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; }
h1, h2, h3, p { margin: 0; }

body main.dashboard {
  max-width: 1600px;
  margin: 0 auto;
  padding: 22px 22px 26px;
}

main.dashboard > header.battle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.dashboard > .battle-header h1 { margin: 0; font-size: clamp(25px, 2.4vw, 35px); line-height: 1.1; letter-spacing: -.04em; }
.back-link { color: var(--muted); text-decoration: none; white-space: nowrap; font-size: 12px; }
.back-link:hover { color: var(--focus); }

.battle-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 12px;
}

.battle-controls .control-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #111c29;
}

main.dashboard .battle-controls .control-group > button {
  padding: 4px 12px;
  min-height: 31px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}

main.dashboard .battle-controls .control-group > button:hover { color: var(--text); background: #192b3c; }
main.dashboard .battle-controls .control-group > button[aria-pressed="true"] { color: #e0fffa; background: #203c49; border-color: #3a6670; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.range-control { margin-left: auto; }

.charts {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
}

.charts-header {
  padding: 11px 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 20px;
  row-gap: 6px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(110deg, #182a3c, #142335 38%, #112031);
}

.dashboard h2 { font-size: 20px; line-height: 1.1; letter-spacing: -.027em; }
#market-label, .status, .charts-footer { font-size: 12px; color: var(--muted); }
#market-label { margin-top: 3px; }
.status { margin-left: auto; font-variant-numeric: tabular-nums; }
.status[data-level="error"] { color: #ffada9; }
.window-key, .readout { display: flex; align-items: center; gap: 14px; font-variant-numeric: tabular-nums; }
.window-key { gap: 5px; }
.six { --window-color: var(--six); color: var(--window-color); }
.twelve { --window-color: var(--twelve); color: var(--window-color); }
.twenty-four { --window-color: var(--twenty-four); color: var(--window-color); }
main.dashboard .charts-header .window-key > button {
  padding: 4px 7px;
  min-height: 28px;
  border: 1px solid #3a4e65;
  border-radius: 5px;
  background: #203248;
  color: var(--window-color);
  cursor: pointer;
  white-space: nowrap;
  font-size: 11px;
}
main.dashboard .charts-header .window-key > button:hover { border-color: var(--window-color); }
main.dashboard .charts-header .window-key > button[aria-pressed="false"] {
  background: #142334;
  color: var(--muted);
  border-color: #2a3c51;
}
.window-key button::before { content: ""; display: inline-block; width: 12px; height: 2px; background: var(--window-color); vertical-align: 3px; margin-right: 4px; }
.window-key button[aria-pressed="false"]::before { opacity: .24; }

.lane + .lane { border-top: 1px solid var(--border); }
.lane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 6px 14px 4px;
  min-height: 33px;
}
.lane-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.dashboard h3 { font-size: 13px; line-height: 1.15; letter-spacing: -.008em; }
.lane-detail, .readout { color: var(--muted); font-size: 11px; }
.j-mode {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #101d2c;
}
main.dashboard .lane .j-mode > button {
  padding: 3px 7px;
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  line-height: 1.1;
  white-space: nowrap;
}
main.dashboard .lane .j-mode > button:hover { color: var(--text); }
main.dashboard .lane .j-mode > button[aria-pressed="true"] {
  color: #e0fffa;
  background: #203c49;
  border-color: #3a6670;
}
.j-weight-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 14px;
  padding: 2px 14px 5px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.j-weight-readout[hidden] { display: none; }
.j-weight-readout > span { white-space: nowrap; }
.j-weight-readout b { margin-right: 4px; font-weight: 650; }
.readout span { white-space: nowrap; }
.readout strong { font-weight: 650; }
.readout [data-present="false"] { color: #8496a9; }
.readout .coverage-meter { color: var(--muted); font-size: 10px; }
.readout .price-change[data-direction="up"] { color: #53d9a9; }
.readout .price-change[data-direction="down"] { color: #fa8b95; }
.readout time { color: var(--muted); white-space: nowrap; }
.plot { position: relative; height: 128px; background: var(--plot); cursor: crosshair; }
.lane[data-series="price"] .plot { height: clamp(206px, 27vh, 278px); }
.lane[data-series="cvd"] .plot { height: 141px; }
.plot:focus-visible { outline-offset: -2px; }
canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
.charts-footer { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 14px; border-top: 1px solid var(--border); }
.coverage-key { margin-left: auto; }

@media (max-width: 760px) {
  body main.dashboard { padding: 16px 10px; }
  .range-control { margin-left: 0; }
  .battle-controls { gap: 6px; }
  main.dashboard .battle-controls .control-group > button { padding-inline: 8px; }
  .charts-header, .lane-header, .charts-footer, .j-weight-readout { padding-inline: 11px; }
  .status { flex-basis: 100%; margin: 0; }
  .plot { height: 118px; }
  .lane[data-series="cvd"] .plot { height: 131px; }
  .coverage-key { margin-left: 0; }
}

@media (max-width: 460px) {
  main.dashboard > header.battle-header { gap: 8px; align-items: baseline; }
  .back-link { font-size: 10px; }
  .lane-title { gap: 3px 7px; }
  .readout { gap: 8px; }
  .window-key { gap: 3px; }
  main.dashboard .charts-header .window-key > button { padding-inline: 5px; }
}
