:root {
    color-scheme: light dark;

    --line: #1c6cf1;
    --line-soft: rgba(28, 108, 241, 0.16);
    --point: #1c6cf1;
    --point-active: #0f4db2;
    --transition-band: rgba(242, 154, 74, 0.14);
    --fixed-band: rgba(28, 108, 241, 0.08);
    --boundary: rgba(127, 93, 244, 0.72);
    --grid: rgba(32, 45, 64, 0.12);
    --axis: rgba(32, 45, 64, 0.24);
    --tooltip: rgba(255, 255, 255, 0.97);
    --tooltip-border: rgba(32, 45, 64, 0.12);
    --tooltip-shadow: 0 12px 28px rgba(26, 33, 49, 0.16);
    --text-main: #1e2430;
    --text-muted: #5d6878;
}

@media (prefers-color-scheme: dark) {
    :root {
        --line: #6aa6ff;
        --line-soft: rgba(106, 166, 255, 0.2);
        --point: #6aa6ff;
        --point-active: #c7ddff;
        --transition-band: rgba(255, 176, 91, 0.16);
        --fixed-band: rgba(106, 166, 255, 0.1);
        --boundary: rgba(171, 147, 255, 0.74);
        --grid: rgba(230, 238, 250, 0.12);
        --axis: rgba(230, 238, 250, 0.24);
        --tooltip: rgba(18, 22, 30, 0.97);
        --tooltip-border: rgba(230, 238, 250, 0.08);
        --tooltip-shadow: 0 14px 30px rgba(0, 0, 0, 0.36);
        --text-main: #eef3fb;
        --text-muted: #a7b3c4;
    }
}

* {
    box-sizing: border-box;
}

button,
input,
select {
    font: inherit;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

#lang-zh,
#lang-en {
    background: transparent;
    border-color: transparent;
    color: rgb(100 116 139);
}

html[lang="zh-HK"] #lang-zh,
html[lang="en"] #lang-en {
    background: rgb(37 99 235) !important;
    border-color: rgb(37 99 235) !important;
    color: #ffffff !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.lang-button:hover {
    background: rgb(241 245 249) !important;
}

.lang-button[aria-pressed="true"]:hover {
    background: rgb(37 99 235) !important;
}

.range-button {
    background: transparent;
    border-color: transparent;
    color: rgb(100 116 139);
}

.range-button[aria-pressed="true"] {
    background: rgb(37 99 235) !important;
    border-color: rgb(37 99 235) !important;
    color: #ffffff !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.range-button:hover {
    background: rgb(241 245 249) !important;
}

.range-button[aria-pressed="true"]:hover {
    background: rgb(37 99 235) !important;
}

.ghost-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.ghost-button:disabled:hover {
    background: inherit !important;
}

@media (prefers-color-scheme: dark) {
    #lang-zh,
    #lang-en {
        color: rgb(203 213 225);
    }

    html[lang="zh-HK"] #lang-zh,
    html[lang="en"] #lang-en {
        background: rgb(96 165 250) !important;
        border-color: rgb(96 165 250) !important;
        color: rgb(15 23 42) !important;
    }

    .lang-button:hover {
        background: rgb(30 41 59) !important;
    }

    .lang-button[aria-pressed="true"]:hover {
        background: rgb(96 165 250) !important;
    }

    .range-button {
        color: rgb(203 213 225);
    }

    .range-button[aria-pressed="true"] {
        background: rgb(96 165 250) !important;
        border-color: rgb(96 165 250) !important;
        color: rgb(15 23 42) !important;
    }

    .range-button:hover {
        background: rgb(30 41 59) !important;
    }

    .range-button[aria-pressed="true"]:hover {
        background: rgb(96 165 250) !important;
    }
}

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

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.legend-swatch {
    display: inline-block;
    border-radius: 999px;
}

.legend-swatch.band {
    width: 18px;
    height: 12px;
    border: 1px solid var(--axis);
}

.legend-swatch.transition {
    background: var(--transition-band);
}

.legend-swatch.fixed {
    background: var(--fixed-band);
}

.legend-swatch.line {
    width: 24px;
    height: 0;
    border-top: 3px solid var(--line);
}

.legend-swatch.boundary {
    width: 18px;
    height: 0;
    border-top: 2px dashed var(--boundary);
}

.chart-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--axis) transparent;
}

.chart-inner {
    min-width: 100%;
}

.tooltip {
    position: absolute;
    min-width: 220px;
    max-width: 280px;
    pointer-events: none;
    background: var(--tooltip);
    border: 1px solid var(--tooltip-border);
    box-shadow: var(--tooltip-shadow);
    border-radius: 14px;
    padding: 12px 14px;
    color: var(--text-main);
    z-index: 2;
}

.tooltip-price {
    font-weight: 700;
    margin-bottom: 6px;
}

.tooltip-duty,
.tooltip-tier,
.tooltip-rate {
    font-size: 0.94rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.axis-label,
.tick-label,
.boundary-label,
.zone-label,
.annotation-label {
    font-family: inherit;
    fill: var(--text-muted);
}

.axis-line,
.grid-line {
    stroke: var(--axis);
}

.grid-line {
    stroke: var(--grid);
}

.chart-line {
    fill: none;
    stroke: var(--line);
    stroke-width: 4;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.chart-area {
    fill: var(--line-soft);
}

.chart-point {
    fill: var(--point);
    stroke: rgba(255, 255, 255, 0.9);
    stroke-width: 2.5;
    transition:
        r 120ms ease,
        fill 120ms ease;
}

@media (prefers-color-scheme: dark) {
    .chart-point {
        stroke: rgba(15, 23, 42, 0.9);
    }
}

.chart-point.is-active {
    fill: var(--point-active);
}

.boundary-line {
    stroke: var(--boundary);
    stroke-width: 2;
    stroke-dasharray: 7 7;
}

.band-fixed {
    fill: var(--fixed-band);
}

.band-transition {
    fill: var(--transition-band);
}

.selection-line {
    stroke: var(--point-active);
    stroke-width: 1.5;
    stroke-dasharray: 5 7;
}

.plot-hover-area {
    fill: transparent;
    cursor: crosshair;
}

body.is-mobile .chart-inner {
    min-width: 1280px;
}

body.is-mobile .plot-hover-area,
body.is-mobile .chart-point {
    pointer-events: none;
}

@media (max-width: 720px) {
    .tooltip {
        min-width: 190px;
        max-width: calc(100vw - 40px);
        padding: 10px 12px;
    }
}
