:root,
[data-theme="midnight"] {
    --bg: #060c12;
    --panel: rgba(11, 17, 25, 0.9);
    --panel-strong: rgba(14, 22, 32, 0.95);
    --line: rgba(126, 156, 189, 0.18);
    --text: #ebf4ff;
    --muted: #91a2b8;
    --accent: #4d8ef7;
    --accent-strong: #2d6fe0;
    --warn: #ff8f5a;
    --chip: rgba(22, 34, 47, 0.92);
    --price: rgba(255,170,80,0.9);
    --price-dim: rgba(255,170,80,0.5);
    --reg: rgba(77,142,247,0.9);
    --channel: rgba(77,142,247,0.4);
    --sell: rgba(239,68,68,0.7);
    --sell-dim: rgba(239,68,68,0.4);
    --bench: rgba(250,204,21,0.85);
    --buy-line: rgba(57,217,138,0.7);
    --cutoff-line: rgba(180,120,255,0.6);
    --grid: rgba(255,255,255,0.04);
    --axis: #94a3b8;
    --positive: rgba(57,217,138,0.8);
    --negative: rgba(239,68,68,0.8);
    --growth-stat: rgba(77,142,247,0.5);
    --variance-stat: rgba(250,204,21,0.5);
    --bg-gradient: radial-gradient(circle at top, #0f1a2f 0, #060c12 42%, #03070b 100%);
    --bg-glow1: rgba(77, 142, 247, 0.16);
    --bg-glow2: rgba(57, 217, 138, 0.10);
    --bg-glow3: rgba(255, 143, 90, 0.06);
}

[data-theme="ember"] {
    --bg: #110a06;
    --panel: rgba(25, 14, 8, 0.9);
    --panel-strong: rgba(32, 18, 10, 0.95);
    --line: rgba(189, 150, 126, 0.18);
    --text: #fff1e6;
    --muted: #b8a291;
    --accent: #5b9cf5;
    --accent-strong: #3a7de0;
    --warn: #ff5a5a;
    --chip: rgba(47, 28, 16, 0.92);
    --price: rgba(255,170,80,0.9);
    --price-dim: rgba(255,170,80,0.5);
    --reg: rgba(91,156,245,0.9);
    --channel: rgba(91,156,245,0.4);
    --sell: rgba(239,68,68,0.7);
    --sell-dim: rgba(239,68,68,0.4);
    --bench: rgba(250,204,21,0.85);
    --buy-line: rgba(57,217,138,0.7);
    --cutoff-line: rgba(180,120,255,0.6);
    --grid: rgba(255,255,255,0.04);
    --axis: #b8a291;
    --positive: rgba(255,143,90,0.8);
    --negative: rgba(239,68,68,0.8);
    --growth-stat: rgba(91,156,245,0.5);
    --variance-stat: rgba(250,204,21,0.5);
    --bg-gradient: radial-gradient(circle at top, #2f1a0f 0, #110a06 42%, #0b0603 100%);
    --bg-glow1: rgba(91, 156, 245, 0.14);
    --bg-glow2: rgba(57, 217, 138, 0.10);
    --bg-glow3: rgba(239, 68, 68, 0.05);
}

[data-theme="arctic"] {
    --bg: #060d14;
    --panel: rgba(8, 18, 30, 0.9);
    --panel-strong: rgba(10, 22, 38, 0.95);
    --line: rgba(130, 170, 220, 0.18);
    --text: #e6f0ff;
    --muted: #8aa8c8;
    --accent: #5bc0eb;
    --accent-strong: #3a9fd4;
    --warn: #ff8f5a;
    --chip: rgba(14, 30, 50, 0.92);
    --price: rgba(255,170,80,0.9);
    --price-dim: rgba(255,170,80,0.5);
    --reg: rgba(70,140,240,0.9);
    --channel: rgba(70,140,240,0.4);
    --sell: rgba(255,100,120,0.7);
    --sell-dim: rgba(255,100,120,0.4);
    --bench: rgba(180,230,150,0.85);
    --buy-line: rgba(57,217,138,0.7);
    --cutoff-line: rgba(180,120,255,0.6);
    --grid: rgba(255,255,255,0.04);
    --axis: #8aa8c8;
    --positive: rgba(91,192,235,0.8);
    --negative: rgba(255,100,120,0.8);
    --growth-stat: rgba(70,140,240,0.5);
    --variance-stat: rgba(180,230,150,0.5);
    --bg-gradient: radial-gradient(circle at top, #0f2035 0, #060d14 42%, #030810 100%);
    --bg-glow1: rgba(70, 140, 240, 0.14);
    --bg-glow2: rgba(57, 217, 138, 0.10);
    --bg-glow3: rgba(160, 210, 255, 0.05);
}

[data-theme="violet"] {
    --bg: #0c0612;
    --panel: rgba(18, 10, 28, 0.9);
    --panel-strong: rgba(22, 14, 35, 0.95);
    --line: rgba(160, 130, 200, 0.18);
    --text: #f0e6ff;
    --muted: #a891c8;
    --accent: #8b9cf7;
    --accent-strong: #6b7ce0;
    --warn: #ff8f5a;
    --chip: rgba(35, 20, 55, 0.92);
    --price: rgba(255,170,80,0.9);
    --price-dim: rgba(255,170,80,0.5);
    --reg: rgba(120,140,255,0.9);
    --channel: rgba(120,140,255,0.4);
    --sell: rgba(255,100,130,0.7);
    --sell-dim: rgba(255,100,130,0.4);
    --bench: rgba(255,220,100,0.85);
    --buy-line: rgba(57,217,138,0.7);
    --cutoff-line: rgba(180,120,255,0.6);
    --grid: rgba(255,255,255,0.04);
    --axis: #a891c8;
    --positive: rgba(180,126,255,0.8);
    --negative: rgba(255,100,130,0.8);
    --growth-stat: rgba(120,140,255,0.5);
    --variance-stat: rgba(255,220,100,0.5);
    --bg-gradient: radial-gradient(circle at top, #1e1030 0, #0c0612 42%, #06030b 100%);
    --bg-glow1: rgba(120, 140, 255, 0.16);
    --bg-glow2: rgba(57, 217, 138, 0.10);
    --bg-glow3: rgba(255, 100, 130, 0.05);
}

[data-theme="daylight"] {
    --bg: #ffffff;
    --panel: #ffffff;
    --panel-strong: #f8fafb;
    --line: #e2e8f0;
    --text: #1a1a2e;
    --muted: #64748b;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --warn: #ea580c;
    --chip: #f1f5f9;
    --price: rgba(230,130,40,0.9);
    --price-dim: rgba(230,130,40,0.45);
    --reg: rgba(37,99,235,0.85);
    --channel: rgba(37,99,235,0.35);
    --sell: rgba(220,38,38,0.75);
    --sell-dim: rgba(220,38,38,0.35);
    --bench: rgba(180,120,0,0.85);
    --buy-line: rgba(22,163,74,0.8);
    --cutoff-line: rgba(140,80,220,0.7);
    --grid: rgba(0,0,0,0.07);
    --axis: #64748b;
    --positive: rgba(22,130,60,0.9);
    --negative: rgba(200,30,30,0.9);
    --growth-stat: rgba(37,99,235,0.7);
    --variance-stat: rgba(180,120,0,0.7);
    --bg-gradient: #ffffff;
    --bg-glow1: transparent;
    --bg-glow2: transparent;
    --bg-glow3: transparent;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    background: var(--bg-gradient);
}

body {
    color: var(--text);
    font-family: "Segoe UI", "SF Pro Display", "Helvetica Neue", sans-serif;
    min-height: 100vh;
}

body::before {
    background:
        radial-gradient(circle at 15% 20%, var(--bg-glow1), transparent 28%),
        radial-gradient(circle at 85% 10%, var(--bg-glow2), transparent 24%),
        linear-gradient(180deg, var(--bg-glow3), transparent 42%);
    content: "";
    inset: 0;
    pointer-events: none;
    position: fixed;
}

.app-shell {
    position: relative;
    z-index: 1;
}

.header {
    align-items: flex-start;
    backdrop-filter: blur(14px);
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 20px;
    justify-content: space-between;
    padding: 20px 24px 18px;
    position: relative;
    z-index: 10;
}

.title-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.eyebrow {
    color: var(--accent);
    display: inline-flex;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-decoration: none;
    text-transform: uppercase;
    width: fit-content;
}

.eyebrow:hover {
    color: var(--text);
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.subhead {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
    max-width: 640px;
}

.controls {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: flex-end;
}

.controls label,
.control-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

select {
    appearance: none;
    background: var(--panel-strong);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    min-width: 104px;
    padding: 10px 14px;
}

select:hover {
    border-color: var(--accent);
}

.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.stat {
    background: var(--chip);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    padding: 8px 12px;
}

.stat span {
    color: var(--text);
    font-weight: 700;
}

.toolbar {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 12px 24px;
}

.sector-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sector-btn {
    background: var(--chip);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 7px 12px;
    transition:
        border-color 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease,
        background 0.16s ease;
}

.sector-btn:hover {
    color: var(--text);
    transform: translateY(-1px);
}

.sector-btn.active {
    background: color-mix(in srgb, var(--accent) 10%, var(--chip));
    border-color: color-mix(in srgb, var(--accent) 34%, transparent);
    color: var(--text);
}

.chart-wrap {
    padding: 0 14px 14px;
}

.chart-panel {
    position: relative;
}

#chart,
.loading,
.error {
    border: 1px solid var(--line);
    border-radius: 18px;
}

.app-shell:not(.tv-shell) #chart,
.app-shell:not(.tv-shell) .loading,
.app-shell:not(.tv-shell) .error {
    min-height: calc(100vh - 220px);
}

#chart {
    background: var(--panel);
    overflow: hidden;
    transition:
        filter 0.16s ease,
        opacity 0.16s ease;
    width: 100%;
}

#chart.chart-loading {
    filter: blur(1px) saturate(0.8);
    opacity: 0.28;
}

.loading,
.error {
    align-items: center;
    background: var(--panel);
    backdrop-filter: blur(6px);
    color: var(--muted);
    display: flex;
    font-size: 17px;
    gap: 14px;
    justify-content: center;
    inset: 0;
    position: absolute;
    z-index: 1;
}

.spinner {
    animation: spin 0.8s linear infinite;
    border: 3px solid var(--line);
    border-radius: 50%;
    border-top-color: var(--accent);
    height: 24px;
    width: 24px;
}

.footer-note {
    color: rgba(145, 162, 184, 0.82);
    font-size: 12px;
    padding: 0 24px 22px;
}

.footer-note a {
    color: var(--accent);
    text-decoration: none;
}

.footer-note a:hover {
    color: var(--text);
}

.simple-home-shell {
    display: flex;
    justify-content: center;
    padding: 48px 24px;
}

.simple-home-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-width: 720px;
    padding: 32px;
    width: 100%;
}

.simple-home-card .subhead a,
.simple-route-list a {
    color: var(--accent);
    text-decoration: none;
}

.simple-home-card .subhead a:hover,
.simple-route-list a:hover {
    color: var(--text);
}

.simple-home-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.simple-home-section h2 {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.simple-route-list {
    list-style: none;
}

.simple-route-list li {
    align-items: baseline;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 14px 0;
}

.simple-route-list li:last-child {
    border-bottom: 1px solid var(--line);
}

.simple-route-list a {
    font-size: 16px;
    font-weight: 600;
}

.route-path {
    color: var(--muted);
    flex-shrink: 0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
}

.simple-home-note {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.ath-shell {
    min-height: 100vh;
}

.ath-main {
    margin: 0 auto;
    max-width: 1180px;
    padding: 24px;
}

.ath-summary {
    align-items: flex-end;
    background: var(--chip);
    border: 1px solid var(--line);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 132px;
    padding: 12px 14px;
    text-align: right;
}

.ath-summary span {
    color: var(--text);
    font-size: 28px;
    font-weight: 750;
    letter-spacing: -0.04em;
    line-height: 1;
}

.ath-summary small {
    color: var(--muted);
    font-size: 12px;
}

.ath-time-control {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
    padding: 18px;
}

.ath-time-top,
.ath-time-bottom {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.ath-time-top label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ath-time-top output {
    color: var(--text);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    font-weight: 700;
}

.ath-time-stepper {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: 36px minmax(0, 1fr) 36px;
}

.ath-time-stepper button {
    align-items: center;
    background: var(--chip);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 18px;
    font-weight: 800;
    height: 36px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 36px;
}

.ath-time-stepper button:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.ath-time-stepper button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.ath-time-control input[type="range"] {
    accent-color: var(--accent);
    cursor: pointer;
    width: 100%;
}

.ath-time-bottom {
    color: var(--muted);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
}

.ath-time-bottom a {
    color: var(--accent);
    font-family: "Segoe UI", "SF Pro Display", "Helvetica Neue", sans-serif;
    font-weight: 700;
    text-decoration: none;
}

.ath-time-bottom a:hover {
    color: var(--text);
}

.ath-filter-control,
.ath-hold-control {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
    padding: 18px;
}

.ath-filter-header,
.ath-filter-bottom,
.ath-hold-header,
.ath-hold-bottom {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.ath-filter-header label,
.ath-hold-header label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ath-filter-header output,
.ath-hold-header output {
    color: var(--text);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    font-weight: 700;
}

.ath-filter-sliders {
    display: grid;
    gap: 8px;
}

.ath-filter-sliders input[type="range"] {
    accent-color: var(--accent);
    cursor: pointer;
    width: 100%;
}

.ath-filter-sliders input[type="range"]:last-child {
    accent-color: var(--bench);
}

.ath-hold-control input[type="range"] {
    accent-color: var(--accent);
    cursor: pointer;
    width: 100%;
}

.ath-filter-inputs {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ath-filter-inputs label {
    display: grid;
    gap: 6px;
}

.ath-filter-inputs span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ath-filter-inputs input {
    background: var(--chip);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    min-width: 0;
    padding: 10px 12px;
    width: 100%;
}

.ath-filter-inputs input:focus {
    border-color: var(--accent);
    outline: none;
}

.ath-filter-bottom,
.ath-hold-bottom {
    color: var(--muted);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
}

.ath-filter-bottom a,
.ath-hold-bottom a {
    color: var(--accent);
    font-family: "Segoe UI", "SF Pro Display", "Helvetica Neue", sans-serif;
    font-weight: 700;
    text-decoration: none;
}

.ath-filter-bottom a:hover,
.ath-hold-bottom a:hover {
    color: var(--text);
}

.ath-chart-card,
.ath-table-card,
.ath-empty {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
}

.ath-chart-card {
    margin-bottom: 16px;
    padding: 18px;
}

.ath-chart-header {
    align-items: flex-start;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin-bottom: 10px;
}

.ath-chart-header h2 {
    font-size: 18px;
    letter-spacing: -0.02em;
    margin: 0 0 4px;
}

.ath-chart-header p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
    max-width: 640px;
}

.ath-chart-legend {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 2px;
}

.ath-chart-legend span {
    align-items: center;
    display: inline-flex;
    gap: 6px;
    white-space: nowrap;
}

.ath-chart-legend i {
    border-radius: 999px;
    display: inline-block;
    height: 3px;
    width: 22px;
}

.ath-legend-equal {
    background: rgba(57, 217, 138, 0.95);
}

.ath-legend-cap {
    background: rgba(250, 204, 21, 0.95);
}

.ath-legend-benchmark {
    background: rgba(77, 142, 247, 0.95);
}

.ath-cohort-chart {
    height: 420px;
    min-height: 360px;
    width: 100%;
}

.ath-table-wrap {
    overflow-x: auto;
}

.ath-table-actions {
    align-items: center;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    display: flex;
    font-size: 12px;
    gap: 12px;
    justify-content: space-between;
    padding: 12px 16px;
}

.ath-table-actions > span {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-weight: 750;
}

.ath-table-actions > div {
    display: flex;
    gap: 8px;
}

.ath-table-actions button {
    background: var(--chip);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
    min-width: 54px;
    padding: 7px 10px;
}

.ath-table-actions button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.ath-table {
    border-collapse: collapse;
    min-width: 940px;
    width: 100%;
}

.ath-table th,
.ath-table td {
    border-bottom: 1px solid var(--line);
    padding: 14px 16px;
    text-align: left;
    vertical-align: middle;
}

.ath-table th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ath-table tbody tr:last-child td {
    border-bottom: 0;
}

.ath-table tbody tr:hover {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.ath-row-muted {
    opacity: 0.42;
}

.ath-toggle {
    align-items: center;
    color: var(--muted);
    display: inline-flex;
    gap: 8px;
    white-space: nowrap;
}

.ath-toggle input {
    accent-color: var(--accent);
    cursor: pointer;
    height: 16px;
    margin: 0;
    width: 16px;
}

.ath-toggle span {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
    font-weight: 750;
}

.ath-symbol {
    color: var(--accent);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-weight: 750;
    text-decoration: none;
}

.ath-symbol:hover {
    color: var(--text);
}

.ath-number {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    white-space: nowrap;
}

.ath-muted {
    color: var(--muted);
}

.ath-positive {
    color: var(--positive);
}

.ath-negative {
    color: var(--negative);
}

.ath-empty {
    padding: 32px;
}

.ath-empty h2 {
    font-size: 22px;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}

.ath-empty p {
    color: var(--muted);
    line-height: 1.6;
    max-width: 620px;
}

.home-shell {
    margin: 0 auto;
    max-width: 1220px;
    padding: 24px;
}

.home-hero {
    backdrop-filter: blur(16px);
    background:
        linear-gradient(135deg, rgba(77, 142, 247, 0.16), rgba(57, 217, 138, 0.08)),
        var(--panel);
    border: 1px solid var(--line);
    border-radius: 28px;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 18px;
    overflow: hidden;
    padding: 28px;
    position: relative;
}

.home-hero::after {
    background:
        radial-gradient(circle at top right, rgba(255, 143, 90, 0.22), transparent 30%),
        radial-gradient(circle at bottom left, rgba(91, 192, 235, 0.18), transparent 28%);
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.home-hero > * {
    position: relative;
    z-index: 1;
}

.home-hero h1 {
    font-size: clamp(30px, 4vw, 46px);
    letter-spacing: -0.05em;
    line-height: 1.02;
    max-width: 760px;
}

.home-hero .subhead {
    font-size: 15px;
    max-width: 680px;
}

.home-badges {
    align-content: flex-start;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    max-width: 320px;
}

.home-badge {
    backdrop-filter: blur(10px);
    background: rgba(5, 10, 18, 0.38);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    padding: 10px 14px;
    white-space: nowrap;
}

.home-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    margin-bottom: 12px;
}

.tool-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 36%),
        var(--panel);
    border: 1px solid var(--line);
    border-radius: 24px;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 14px;
    grid-column: span 4;
    min-height: 230px;
    padding: 22px;
    position: relative;
    text-decoration: none;
    transition:
        border-color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease;
}

.tool-card:hover {
    background:
        linear-gradient(180deg, rgba(77, 142, 247, 0.08), transparent 38%),
        var(--panel);
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    box-shadow: 0 18px 50px rgba(3, 7, 11, 0.28);
    transform: translateY(-2px);
}

.tool-card-feature {
    background:
        radial-gradient(circle at top right, rgba(77, 142, 247, 0.14), transparent 34%),
        linear-gradient(180deg, rgba(255, 170, 80, 0.08), transparent 48%),
        var(--panel);
    grid-column: span 12;
    min-height: 210px;
}

.tool-card-feature h2 {
    font-size: clamp(26px, 3vw, 36px);
    line-height: 1.02;
    max-width: 720px;
}

.tool-card-top {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.tool-card-kicker,
.tool-card-route,
.tool-card-cta {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tool-card-kicker {
    color: var(--accent);
}

.tool-card-route {
    color: var(--muted);
}

.tool-card h2 {
    font-size: 22px;
    letter-spacing: -0.04em;
}

.tool-card p {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
    max-width: 56ch;
}

.tool-card-cta {
    color: var(--text);
    margin-top: auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Theme picker ── */
.theme-picker {
    position: relative;
}

.theme-btn {
    align-items: center;
    background: var(--chip);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    font-size: 13px;
    gap: 6px;
    padding: 6px 10px;
    transition: border-color 0.12s;
}

.theme-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}

.theme-btn-swatch {
    border: 1px solid var(--line);
    border-radius: 50%;
    height: 14px;
    width: 14px;
}

.theme-menu {
    background: var(--panel-strong);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    min-width: 160px;
    overflow: hidden;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 200;
}

.theme-menu.open {
    display: block;
}

.theme-option {
    align-items: center;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    display: flex;
    font-size: 13px;
    gap: 8px;
    padding: 9px 14px;
    transition: background 0.1s;
    width: 100%;
}

.theme-option:hover {
    background: color-mix(in srgb, var(--muted) 12%, transparent);
}

.theme-option.active {
    color: var(--accent);
    font-weight: 600;
}

.theme-swatch {
    border: 1px solid var(--line);
    border-radius: 50%;
    flex-shrink: 0;
    height: 14px;
    width: 14px;
}

@media (max-width: 980px) {
    .header,
    .toolbar {
        flex-direction: column;
    }

    .home-hero {
        flex-direction: column;
    }

    .home-badges {
        justify-content: flex-start;
        max-width: none;
    }

    .tool-card {
        grid-column: span 6;
    }

    .tool-card-feature {
        grid-column: span 12;
    }

    .controls {
        justify-content: flex-start;
    }

    .app-shell:not(.tv-shell) #chart,
    .app-shell:not(.tv-shell) .loading,
    .app-shell:not(.tv-shell) .error {
        min-height: calc(100vh - 280px);
    }
}

@media (max-width: 640px) {
    .header,
    .toolbar,
    .footer-note {
        padding-left: 16px;
        padding-right: 16px;
    }

    .chart-wrap {
        padding-left: 8px;
        padding-right: 8px;
    }

    .header h1 {
        font-size: 20px;
    }

    .subhead {
        font-size: 13px;
    }

    .simple-home-shell {
        padding: 16px;
    }

    .simple-home-card {
        border-radius: 20px;
        padding: 22px 18px;
    }

    .simple-route-list li {
        align-items: flex-start;
        flex-direction: column;
    }

    .ath-main {
        padding: 16px;
    }

    .ath-summary {
        align-items: flex-start;
        text-align: left;
    }

    .ath-filter-header,
    .ath-filter-bottom,
    .ath-hold-header,
    .ath-hold-bottom {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .ath-filter-inputs {
        grid-template-columns: 1fr;
    }

    .ath-chart-header {
        flex-direction: column;
    }

    .ath-chart-legend {
        justify-content: flex-start;
    }

    .ath-cohort-chart {
        height: 360px;
    }

    .home-shell {
        padding: 16px;
    }

    .home-hero {
        border-radius: 22px;
        padding: 22px 18px;
    }

    .home-hero h1 {
        font-size: 28px;
    }

    .tool-card,
    .tool-card-feature {
        grid-column: span 12;
        min-height: 0;
    }

    .tool-card {
        border-radius: 20px;
        padding: 18px;
    }

    .tool-card-top {
        align-items: flex-start;
        flex-direction: column;
    }
}
