:root {
    color-scheme: light;
    --ink: #142033;
    --muted: #1e2b3d;
    --page: #f5f7fb;
    --panel: #ffffff;
    --line: #d8e0ea;
    --brand: #071b33;
    --accent: #f2b705;
    --good: #064734;
    --warn: #4c2a00;
    --bad: #65100b;
    --shadow: 0 14px 34px rgba(20, 32, 51, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--page);
    color: var(--ink);
    line-height: 1.5;
}

body {
    margin: 0;
    min-width: 320px;
}

img,
canvas,
svg {
    max-width: 100%;
}

button {
    min-height: 44px;
    max-width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 0 16px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

button:hover {
    filter: brightness(1.08);
}

button:disabled {
    background: #4b596c;
    color: #fff;
    cursor: not-allowed;
    filter: none;
    opacity: 1;
}

button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

button.secondary,
.tab {
    background: #eef3f8;
    color: var(--ink);
}

.tab.is-active {
    background: var(--brand);
    color: #fff;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: 12px;
    transform: translateY(-140%);
    background: var(--brand);
    color: #fff;
    padding: 10px 12px;
    border-radius: 6px;
    z-index: 10;
}

.skip-link:focus {
    transform: translateY(0);
}

.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;
}

.site-header,
.layout {
    width: min(1120px, calc(100% - 24px));
    margin: 0 auto;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 0 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand img {
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(7, 27, 51, 0.16);
}

.brand h1,
.panel h2,
.eyebrow,
.price,
p {
    margin: 0;
}

.brand h1 {
    font-size: clamp(1.7rem, 6vw, 2.8rem);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.eyebrow {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
}

.updated {
    display: none;
    text-align: right;
    color: var(--muted);
    font-size: 0.85rem;
}

.updated strong {
    display: block;
    color: var(--ink);
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

.install-button[hidden] {
    display: none;
}

.install-button {
    white-space: nowrap;
}

.layout {
    display: grid;
    gap: 14px;
    padding-bottom: 34px;
}

.panel {
    min-width: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 14px;
}

.hero {
    display: grid;
    gap: 16px;
    background: linear-gradient(135deg, #071b33 0%, #123a5d 60%, #0b6b61 100%);
    color: #fff;
}

.hero .eyebrow,
.hero .muted {
    color: #fff;
}

.price {
    margin-top: 10px;
    font-size: clamp(2.7rem, 13vw, 6.2rem);
    line-height: 1.5;
    font-weight: 850;
    overflow-wrap: anywhere;
}

.recommendation {
    align-self: end;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 1.08rem;
    font-weight: 800;
}

.price-summary {
    display: grid;
    gap: 12px;
}

.summary-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 14px;
}

.summary-card-good {
    border-left: 5px solid var(--good);
}

.summary-card-high {
    border-left: 5px solid var(--bad);
}

.summary-value {
    margin-top: 4px;
    color: var(--ink);
    font-size: clamp(1.45rem, 7vw, 2rem);
    line-height: 1.5;
    font-weight: 850;
    overflow-wrap: anywhere;
}

.summary-card .muted {
    margin-top: 8px;
    font-size: 0.94rem;
}

.section-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.section-head > * {
    min-width: 0;
}

.section-head h2 {
    margin-top: 2px;
    font-size: 1.24rem;
    overflow-wrap: anywhere;
}

.muted {
    color: var(--muted);
    line-height: 1.5;
}

.cheap-grid {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.cheap-hour {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

.cheap-hour > div {
    min-width: 0;
}

.cheap-hour strong {
    font-size: 1.1rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 3px 10px;
    background: #e7f7ef;
    color: var(--good);
    font-weight: 800;
    white-space: nowrap;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chart-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfe;
}

canvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: manipulation;
}

canvas:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: -4px;
}

.chart-tooltip {
    position: absolute;
    left: 12px;
    top: 12px;
    max-width: min(260px, calc(100% - 24px));
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    box-shadow: 0 8px 24px rgba(20, 32, 51, 0.12);
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
}

.chart-tooltip.is-visible {
    opacity: 1;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    margin-top: 14px;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    padding: 10px 6px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    overflow-wrap: anywhere;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.78rem;
}

td:last-child,
th:last-child {
    text-align: right;
}

td:first-child,
th:first-child {
    width: 36%;
}

.state-good {
    color: var(--good);
    font-weight: 800;
}

.state-warn {
    color: var(--warn);
    font-weight: 800;
}

.state-bad {
    color: var(--bad);
    font-weight: 800;
}

@media (min-width: 680px) {
    .updated {
        display: block;
    }

    .layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero,
    .price-summary,
    .chart-panel {
        grid-column: 1 / -1;
    }

    .price-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero {
        grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.75fr);
        align-items: end;
        padding: 28px;
    }

    .cheap-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 420px) {
    .site-header {
        align-items: flex-start;
        padding-top: 16px;
    }

    .brand {
        gap: 10px;
    }

    .brand img {
        width: 42px;
        height: 42px;
        border-radius: 10px;
    }

    .section-head {
        align-items: stretch;
    }

    .section-head button {
        padding-inline: 14px;
    }

    .chart-panel .section-head {
        display: grid;
        grid-template-columns: 1fr;
    }

    .chart-panel .tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-panel .tab {
        width: 100%;
    }

    .table-wrap {
        font-size: 0.86rem;
    }

    th,
    td {
        padding-inline: 4px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}
