:root {
    --bg: #ffffff;
    --fg: #131722;
    --muted: #787b86;
    --line: #e0e3eb;
    --grid: #f0f3fa;
    --accent: #2962ff;
    --up: #089981;
    --down: #f23645;
    --chip: #f0f3fa;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #131722;
        --fg: #d1d4dc;
        --muted: #787b86;
        --line: #2a2e39;
        --grid: #1e222d;
        --accent: #2962ff;
        --up: #089981;
        --down: #f23645;
        --chip: #1e222d;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--fg);
    font: 14px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
}

.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--line);
}

.pick {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.exchange {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .04em;
}

.symbol {
    width: 12ch;
    padding: 2px 4px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--fg);
    font: inherit;
    font-size: 17px;
    font-weight: 600;
}

.symbol:hover { border-color: var(--line); }
.symbol:focus { border-color: var(--accent); outline: none; }

.tfs {
    display: flex;
    gap: 2px;
}

.tfs button {
    padding: 4px 10px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    cursor: pointer;
}

.tfs button:hover { background: var(--chip); color: var(--fg); }
.tfs button[aria-pressed="true"] { background: var(--chip); color: var(--accent); font-weight: 600; }

.stats {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-variant-numeric: tabular-nums;
}

.stats .label { color: var(--muted); font-size: 12px; }
.last { font-size: 17px; font-weight: 600; }
.change.up { color: var(--up); }
.change.down { color: var(--down); }

.main {
    position: relative;
    flex: 1;
    min-height: 0;
}

.chart {
    position: absolute;
    inset: 0;
}

.legend {
    position: absolute;
    top: 8px;
    left: 16px;
    z-index: 2;
    pointer-events: none;
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.legend b { color: var(--fg); font-weight: 500; margin-right: 8px; }

.status {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    pointer-events: none;
}

.status[hidden] { display: none; }
