:root {
    --brand: #9300D3;
    --brand-dark: #650092;
    --brand-light: #d99af3;
    --ink: #261b2b;
    --muted: #6f6474;
    --surface: #fff;
    --surface-soft: #fbf7fd;
    --line: #e6dbea;
    --cheap: #1b7f46;
    --cheap-soft: #dff5e7;
    --mid: #b47a00;
    --mid-soft: #fff4c7;
    --expensive: #d83245;
    --expensive-soft: #ffe0e4;
    --daily-gradient: linear-gradient(110deg, #c92f5d, #a93cac, #9300d3, #516bc4);
    --cheap-gradient: linear-gradient(110deg, #147a3d, #0f6b38, #187a45);
    --expensive-gradient: linear-gradient(110deg, #b83b30, #c22050, #a81035);
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 8px;
    background: linear-gradient(180deg, #fff 0, var(--surface-soft) 100%);
    color: var(--ink);
    font-family: Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
}

button,
input,
select {
    font: inherit;
}

:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px var(--brand-dark);
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 2000;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--brand-dark);
    color: #fff;
    font-weight: 700;
    transform: translateY(-150%);
    transition: transform .15s ease;
}

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

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

.dialog-open {
    overflow: hidden;
}

.page-shell main:focus {
    outline: none;
    box-shadow: none;
}

.page-shell {
    width: min(100%, 1480px);
    margin: 0 auto;
}

main {
    min-width: 0;
}

.site-header {
    padding: 18px 8px 12px;
    text-align: center;
}

h1 {
    margin: 0;
    font-size: clamp(1.8rem, 7vw, 2.7rem);
    line-height: 1.1;
}

.subtitle {
    margin: 8px 0 0;
    color: var(--brand-dark);
    font-size: clamp(1rem, 4vw, 1.3rem);
    font-weight: 700;
}

.scope-note {
    max-width: 760px;
    margin: 8px auto 0;
    color: var(--muted);
    font-size: .92rem;
}

.status {
    margin: 12px 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    text-align: center;
}

.status[hidden] {
    display: none;
}

#loading-status {
    display: grid;
    min-height: max(420px, calc(100svh - 160px));
    place-content: center;
}

.loader {
    width: 34px;
    height: 34px;
    margin: 0 auto 10px;
    border: 4px solid var(--brand-light);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

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

.retry-button,
.action-button {
    min-height: 44px;
    padding: 10px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.day-section {
    margin: 14px 0 24px;
}

.day-overview {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 18px 12px;
    border-radius: 14px;
    background: var(--daily-gradient);
    background-size: 300% 300%;
    color: #fff;
    text-align: center;
    animation: gradient-shift 9s ease alternate infinite;
    box-shadow: 0 12px 30px rgb(101 0 146 / 16%);
}

@keyframes gradient-shift {
    0% { background-position: 0 50%; }
    100% { background-position: 100% 50%; }
}

.day-overview h2 {
    margin: 0 0 14px;
    font-size: clamp(1.35rem, 5vw, 2rem);
}

.summary-grid {
    display: grid;
    gap: 10px;
}

.current-overview {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px 18px;
    margin-bottom: 12px;
    padding: 12px 16px;
    border: 2px solid rgb(255 255 255 / 70%);
    border-radius: 12px;
    background: rgb(64 0 92 / 30%);
    box-shadow: inset 0 0 28px rgb(255 255 255 / 10%);
}

.current-overview span,
.current-overview strong {
    display: block;
}

.current-overview-label {
    width: 100%;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.current-overview .clock {
    font-size: clamp(1.2rem, 5vw, 1.65rem);
}

.current-overview strong {
    font-size: clamp(1.35rem, 5vw, 1.8rem);
}

.summary-card {
    padding: 12px;
    border: 1px solid rgb(255 255 255 / 45%);
    border-radius: 11px;
    background: rgb(255 255 255 / 15%);
    backdrop-filter: blur(3px);
}

.summary-card strong,
.summary-card span {
    display: block;
}

.summary-card strong {
    margin-top: 3px;
    font-size: 1.28rem;
}

.summary-card--cheap {
    background: var(--cheap-gradient);
}

.summary-card--expensive {
    background: var(--expensive-gradient);
}

.updated-at {
    margin: 12px 0 0;
    font-size: .78rem;
}

.chart-card,
.tool-card,
.past-control {
    margin: 12px 0 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 8px 22px rgb(101 0 146 / 7%);
}

.chart-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 14px;
    margin-bottom: 8px;
}

.chart-header h3,
.tool-card h3 {
    margin: 0;
    font-size: 1.08rem;
}

.chart-header span {
    color: var(--muted);
    font-size: .78rem;
}

.comparison-caption {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px 16px;
    margin: 0 0 6px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
}

.comparison-caption i {
    display: inline-block;
    width: 18px;
    height: 8px;
    margin-right: 5px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--cheap), var(--mid), var(--expensive));
}

.comparison-caption .previous-series {
    background: repeating-linear-gradient(
        135deg,
        var(--brand) 0 4px,
        var(--brand-dark) 4px 8px
    );
}

.comparison-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 8px;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 700;
}

.comparison-control select {
    min-width: 150px;
    padding: 7px 28px 7px 9px;
    border: 1px solid #7d6d84;
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

.chart {
    display: flex;
    align-items: stretch;
    gap: 3px;
    height: 200px;
    padding-top: 20px;
    border-bottom: 1px solid var(--line);
}

.chart-column {
    position: relative;
    display: flex;
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1px;
    width: 100%;
    height: calc(100% - 22px);
}

.chart-bar {
    width: min(44%, 14px);
    min-height: 10px;
    border-radius: 5px 5px 0 0;
    background: var(--mid);
    transition: filter .2s, transform .2s;
}

.chart-bars--single .chart-bar {
    width: min(100%, 28px);
}

.chart-bar--comparison {
    border: 1px solid var(--brand-dark);
    background: repeating-linear-gradient(
        135deg,
        var(--brand) 0 4px,
        var(--brand-dark) 4px 8px
    ) !important;
}

.chart-bar:hover {
    filter: brightness(.9);
    transform: scaleX(1.12);
}

.chart-column.cheap .chart-bar { background: var(--cheap); }
.chart-column.expensive .chart-bar { background: var(--expensive); }
.chart-column.current .chart-bar:not(.chart-bar--comparison) { box-shadow: 0 0 0 3px var(--brand-light); }

.chart-label {
    height: 18px;
    margin-top: 4px;
    color: var(--muted);
    font-size: clamp(.55rem, 2vw, .7rem);
    white-space: nowrap;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 14px;
    margin: 11px 0 0;
    padding: 0;
    color: var(--muted);
    font-size: .8rem;
    list-style: none;
}

.legend i {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 4px;
    border-radius: 50%;
}

.legend .cheap { background: var(--cheap); }
.legend .mid { background: var(--mid); }
.legend .expensive { background: var(--expensive); }
.legend .comparison {
    background: repeating-linear-gradient(
        135deg,
        var(--brand) 0 3px,
        var(--brand-dark) 3px 6px
    );
}

.price-list {
    display: block;
    margin-top: 12px;
}

.price-card {
    position: relative;
    width: 100%;
    margin: 8px 0;
    padding: 10px;
    border: 1px solid var(--mid);
    border-radius: 8px;
    background: var(--mid-soft);
    text-align: center;
}

.price-card.cheap {
    border-color: var(--cheap);
    background: var(--cheap-soft);
}

.price-card.expensive {
    border-color: var(--expensive);
    background: var(--expensive-soft);
}

.price-card.minimum {
    border-width: 3px;
    background: var(--cheap);
    color: #fff;
}

.price-card.maximum {
    border-width: 3px;
    background: var(--expensive);
    color: #fff;
}

.price-card.current {
    border: 4px solid var(--brand);
    background: var(--daily-gradient);
    background-size: 250% 250%;
    color: #fff;
    animation: gradient-shift 4s ease alternate infinite;
}

.price-time,
.price-value {
    display: block;
}

.price-time {
    font-weight: 700;
}

.price-value {
    font-size: 1.15rem;
}

.price-badge {
    display: inline-block;
    margin-top: 3px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgb(255 255 255 / 72%);
    color: var(--ink);
    font-size: .7rem;
    font-weight: 700;
}

.clock {
    font-family: Orbitron, Roboto, sans-serif;
    text-shadow: 1px 1px 2px var(--brand-dark);
}

.price-card.past {
    border-color: #aaa;
    background: #e3e3e5;
    color: #555;
    font-size: .9rem;
}

.past-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: left;
}

.past-control input {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--brand);
}

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

.insights,
.explanation {
    margin: 24px 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 8px 22px rgb(101 0 146 / 7%);
}

.insights > h2,
.explanation > h2 {
    margin: 0 0 4px;
    color: var(--brand-dark);
    font-size: clamp(1.35rem, 5vw, 1.8rem);
}

.section-intro {
    margin: 0 0 14px;
    color: var(--muted);
}

.insight-grid {
    display: grid;
    gap: 12px;
}

.insight-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.insight-card h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.insight-value {
    display: block;
    margin: 4px 0;
    color: var(--brand-dark);
    font-size: 1.35rem;
    font-weight: 700;
}

.extreme-pair {
    display: grid;
    gap: 8px;
}

.extreme {
    padding: 9px;
    border-left: 4px solid var(--cheap);
    border-radius: 6px;
    background: #fff;
}

.extreme--maximum {
    border-left-color: var(--expensive);
}

.extreme strong,
.extreme span {
    display: block;
}

.insight-note,
.data-status {
    color: var(--muted);
    font-size: .82rem;
}

.explanation-grid {
    display: grid;
    gap: 18px;
}

.explanation h3 {
    margin: 0 0 6px;
    color: var(--brand-dark);
}

.explanation p {
    margin: 6px 0;
}

.faq {
    margin-top: 18px;
}

.faq details {
    padding: 11px 0;
    border-top: 1px solid var(--line);
}

.faq summary {
    cursor: pointer;
    color: var(--brand-dark);
    font-weight: 700;
}

.tool-card p {
    margin: 8px 0;
}

.result {
    min-height: 48px;
    padding: 10px;
    border-left: 4px solid var(--brand);
    border-radius: 6px;
    background: var(--surface-soft);
}

.fields {
    display: grid;
    gap: 10px;
    margin: 12px 0;
}

.field label {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: .84rem;
    font-weight: 700;
}

.field input,
.field select {
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid #7d6d84;
    border-radius: 8px;
    background: #fff;
}

.tomorrow-pending {
    padding: 24px 16px;
    border: 1px dashed var(--brand-light);
    border-radius: 14px;
    background: var(--surface);
    text-align: center;
}

.tomorrow-pending h2 {
    margin-top: 0;
}

.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid #999;
    background: #f6f6f6;
    color: #666;
    font-size: .78rem;
    text-align: center;
}

.ad-slot ins {
    width: 100%;
}

.ad-inline {
    width: 100%;
    min-height: 100px;
    margin: 18px 0;
}

.ad-rail {
    display: none;
}

.footer {
    padding: 10px 0 24px;
    text-align: center;
}

.footer a {
    color: var(--brand);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px 12px;
    margin-top: 8px;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand);
    cursor: pointer;
    text-decoration: underline;
}

.consent-banner {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 1000;
    max-width: 680px;
    margin: auto;
    padding: 16px;
    border: 1px solid var(--brand-light);
    border-radius: 14px;
    background: #fff;
    box-shadow:
        0 0 0 100vmax rgb(38 27 43 / 32%),
        0 16px 45px rgb(38 27 43 / 28%);
}

.consent-banner h2 {
    margin: 0 0 6px;
    font-size: 1.15rem;
}

.consent-banner p {
    margin: 6px 0 12px;
    color: var(--muted);
    font-size: .9rem;
}

.consent-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.consent-button {
    min-height: 42px;
    padding: 8px 14px;
    border: 1px solid var(--brand);
    border-radius: 9px;
    background: #fff;
    color: var(--brand-dark);
    cursor: pointer;
    font-weight: 700;
}

.consent-button--accept {
    background: var(--brand);
    color: #fff;
}

[hidden] {
    display: none !important;
}

@media (min-width: 600px) {
    body {
        padding: 14px;
    }

    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .fields {
        grid-template-columns: repeat(3, 1fr);
    }

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

@media (min-width: 900px) {
    .price-list {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
    }

    .price-card {
        margin: 0;
        min-height: 96px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .tools-grid {
        grid-template-columns: 1fr 1fr;
    }

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

@media (min-width: 1180px) {
    .top-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 300px;
        gap: 22px;
        align-items: start;
    }

    .today-hero {
        min-width: 0;
    }

    .ad-rail {
        display: block;
        padding-top: 0;
    }

    .ad-vertical {
        width: 300px;
        min-height: 600px;
    }

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

@media (prefers-contrast: more) {
    .chart-card,
    .tool-card,
    .past-control,
    .price-card,
    .insight-card,
    .explanation {
        border-width: 2px;
    }
}

@media (forced-colors: active) {
    .chart-bar,
    .legend i,
    .comparison-caption i {
        border: 1px solid CanvasText;
        background: Highlight !important;
        opacity: 1;
    }

    .price-card,
    .summary-card,
    .current-overview {
        border: 2px solid CanvasText;
    }
}
