:root {
  color-scheme: light;
  font: 14px/1.45 Inter, "PingFang SC", "Hiragino Sans GB", -apple-system, sans-serif;
  --paper: #f2f5f6;
  --ink: #122733;
  --muted: #596b75;
  --line: #e0e7e9;
  --teal: #007d71;
  --gold: #a97029;
  --number: "IBM Plex Mono", "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid #137dba; outline-offset: 3px; }
.numeric { font-family: var(--number); font-variant-numeric: tabular-nums; }
.frame { max-width: 1440px; margin: 0 auto; padding-inline: 32px; }
.topbar { color: #c0ced4; background: #132b39; border-bottom: 1px solid #203d4e; }
.topbar-inner { min-height: 61px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand, .data-status { display: flex; align-items: center; gap: 11px; }
.brand strong { color: #fff; font-size: 21px; letter-spacing: -.5px; }
.brand-divider { width: 1px; height: 16px; background: #40606e; margin-inline: 2px; }
.brand-mark { width: 30px; height: 30px; display: flex; gap: 2px; align-items: flex-end; justify-content: center; padding-bottom: 8px; background: #214655; border-radius: 8px; }
.brand-mark i { display: block; width: 3px; height: 6px; border-radius: 1px; background: #77d8ba; }
.brand-mark i:nth-child(2) { height: 10px; }
.brand-mark i:nth-child(3) { height: 8px; }
.brand-mark i:nth-child(4) { height: 15px; background: #ffcd82; }
.data-status { gap: 8px; font-size: 12px; white-space: nowrap; }
.data-status strong { font-family: var(--number); color: #f4f9fa; font-weight: 500; }
.status-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: #889ca6; }
.data-status .status-dot.ready { background: #77d8ba; box-shadow: 0 0 0 3px #77d8ba27; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding-block: 28px 24px; }
h1, h2, p { margin: 0; }
h1 { font-size: 34px; font-weight: 700; letter-spacing: -.065em; line-height: 1.15; }
.page-heading p { margin-top: 8px; color: var(--muted); font-size: 13px; }
.page-heading p span { margin-inline: 4px; }
h2 { font-size: 18px; letter-spacing: -.03em; }
.muted { margin-top: 5px; color: var(--muted); font-size: 12px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 282px; gap: 18px; align-items: stretch; }
.panel { min-width: 0; background: #fff; border: 1px solid #dfe7ea; border-radius: 14px; box-shadow: 0 2px 7px #193c4f08; }
.performance, .controls, .ranking { padding: 20px 21px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.range { display: flex; padding: 3px; gap: 2px; border-radius: 8px; background: #edf2f3; align-items: center; }
.range button { background: transparent; color: #4d616a; border: 0; border-radius: 5px; padding: 5px 9px; font-size: 12px; white-space: nowrap; }
.range button[aria-pressed="true"] { background: #fff; color: #173a46; font-weight: 700; box-shadow: 0 1px 3px #153a5621; }
.range button:hover { color: var(--teal); }
.metrics { display: grid; grid-template-columns: 1fr 1fr .8fr; gap: 12px; margin-top: 19px; }
.metrics > div { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid #e8edef; background: #f8fafb; border-radius: 9px; }
.metrics span { font-size: 12px; color: var(--muted); }
.metrics strong { font-size: clamp(17px, 2.15vw, 26px); line-height: 1.2; letter-spacing: -.06em; font-weight: 600; }
.metrics .positive { color: var(--teal); }
.metrics .negative { color: #b13e39; }
.chart-box { position: relative; height: 252px; margin-top: 15px; }
canvas { width: 100%; height: 100%; display: block; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: var(--muted); background: #f8fafb; border-radius: 9px; font-size: 13px; }
.chart-tip { position: absolute; z-index: 1; top: 12px; min-width: 174px; border: 1px solid #dfe8e9; background: #fffffffa; padding: 9px 11px; border-radius: 8px; font-size: 11px; pointer-events: none; box-shadow: 0 3px 16px #132b391a; }
.chart-tip strong { display: block; padding-bottom: 4px; }
.chart-tip div { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.chart-tip b { color: var(--ink); }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 15px; font-size: 12px; color: var(--muted); padding: 7px 0 0 4px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { width: 14px; height: 2px; border-radius: 1px; }
.strategy-key { background: var(--teal); }
.benchmark-key { background: var(--gold); }
.legend-note { margin-left: auto; }

.button { min-height: 34px; padding: 7px 11px; border: 1px solid transparent; border-radius: 7px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.button span[aria-hidden] { margin-left: 3px; }
.secondary { color: #213e4d; border-color: #d8e2e6; background: #fff; }
.secondary:hover:enabled { background: #eef6f7; border-color: #a9c7cb; }
.primary { color: #fff; background: #076d64; }
.primary:hover:enabled { background: #075a53; }
.controls form { display: grid; gap: 9px; margin-top: 17px; }
.controls form > label:first-child { color: #344e5a; font-size: 12px; font-weight: 600; }
.number-field { display: flex; align-items: center; border: 1px solid #d6e2e6; border-radius: 7px; padding: 0 11px 0 0; color: var(--muted); }
.number-field:focus-within { outline: 2px solid #137dba; outline-offset: 2px; }
.number-field input { width: 100%; background: transparent; border: 0; outline: 0; padding: 9px 10px; color: var(--ink); font: 15px var(--number); }
.number-field input:focus-visible { outline: 0; }
.number-field span { font-size: 12px; margin-left: 7px; }
.check { display: flex; align-items: center; gap: 7px; color: #455c67; font-size: 12px; margin-block: 4px; }
.check input { accent-color: var(--teal); margin: 0; width: 14px; height: 14px; }
.controls .button { height: 37px; width: 100%; }
.play { display: inline-block; width: 0; height: 0; border-block: 4px solid transparent; border-left: 6px solid #fff; margin-right: 7px; }
.job { margin-top: 17px; background: #f4f8f8; border: 1px solid #e1ebeb; border-radius: 8px; padding: 10px; color: #2e4651; }
.job-head { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.job-head .ready { background: #12816a; }
.job-head .working { background: transparent; border: 1px solid #9abeba; border-top-color: var(--teal); width: 11px; height: 11px; animation: spin .75s linear infinite; }
.job-head .error { background: #b13e39; }
.job-message { color: #983d37; margin: 5px 0 0 14px; font-size: 11px; overflow-wrap: anywhere; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .job-head .working { animation: none; } }
details { margin-top: 6px; font-size: 11px; color: var(--muted); }
summary { cursor: pointer; }
pre { margin: 6px 0 0; overflow: auto; max-height: 145px; padding: 7px; border-radius: 5px; background: #152e3b; color: #e1edef; font: 10px/1.5 var(--number); white-space: pre-wrap; overflow-wrap: anywhere; }
.controls-note { margin-top: 11px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.ranking { margin-block: 18px 30px; }
.table-actions { display: flex; gap: 8px; }
.table-actions input { width: 146px; min-height: 34px; padding: 6px 9px; color: var(--ink); background: #fff; border: 1px solid #d8e2e6; border-radius: 7px; font-size: 12px; }
.table-wrap { overflow: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; max-height: 360px; }
table { width: 100%; border-spacing: 0; text-align: left; }
th { position: sticky; top: 0; padding: 8px 13px; background: #f4f7f8; font-size: 12px; color: #415a65; font-weight: 600; border-bottom: 1px solid var(--line); }
td { padding: 7px 13px; border-bottom: 1px solid #edf1f2; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f4faf9; }
th:first-child { width: 18%; }
th:last-child, td:last-child { text-align: right; }
td:nth-child(2) { color: #164958; font-weight: 600; }
.table-empty, .table-footer { margin-top: 8px; font-size: 12px; color: var(--muted); }
.table-empty { text-align: center; padding: 12px 0; }

@media (max-width: 940px) {
  .frame { padding-inline: 20px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 238px; gap: 12px; }
  .performance, .controls, .ranking { padding: 16px; }
}
@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  .controls form { grid-template-columns: 1fr 1fr; align-items: center; }
  .number-field { grid-row: 2; }
  .check { grid-column: 2; grid-row: 2; }
  .legend-note { display: none !important; }
}
