:root {
    color-scheme: light;
    --bg: #eef4f2;
    --panel: #ffffff;
    --panel-soft: #f8fbfa;
    --ink: #17211d;
    --muted: #607069;
    --line: #d6e1dd;
    --accent: #0f766e;
    --accent-2: #b45309;
    --soblahov-red: #b91c1c;
    --soblahov-yellow: #f2c94c;
    --danger: #b91c1c;
    --shadow: 0 18px 45px rgba(23, 33, 29, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(135deg, rgba(185, 28, 28, 0.06), transparent 34%),
        linear-gradient(315deg, rgba(15, 118, 110, 0.08), transparent 30%),
        var(--bg);
    color: var(--ink);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px clamp(18px, 4vw, 52px);
    border-bottom: 1px solid rgba(214, 225, 221, 0.9);
    background: rgba(255, 255, 255, 0.9);
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 24px rgba(23, 33, 29, 0.05);
}

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

.station-mark {
    width: 46px;
    height: 34px;
    display: grid;
    grid-template-rows: 2fr 1fr 2fr 1fr 2fr 1fr 2fr;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(23, 33, 29, 0.14), 0 10px 24px rgba(185, 28, 28, 0.18);
    flex: 0 0 auto;
}

.station-mark span:nth-child(odd) {
    background: var(--soblahov-red);
}

.station-mark span:nth-child(2),
.station-mark span:nth-child(6) {
    background: #ffffff;
}

.station-mark span:nth-child(4) {
    background: var(--soblahov-yellow);
}

h1 {
    margin: 0;
    font-size: 25px;
    font-weight: 780;
    letter-spacing: 0;
}

p {
    margin: 3px 0 0;
    color: var(--muted);
}

nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

select,
input,
button,
.button {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    padding: 8px 11px;
    font: inherit;
    box-shadow: 0 1px 0 rgba(23, 33, 29, 0.03);
}

button,
.button {
    cursor: pointer;
    text-decoration: none;
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

main {
    width: min(1420px, 100%);
    margin: 0 auto;
    padding: 24px clamp(14px, 3vw, 40px) 48px;
}

.conditions {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(214, 225, 221, 0.95);
    border-radius: 8px;
    padding: 16px;
    min-height: 132px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.metric::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), rgba(15, 118, 110, 0.18));
}

.metric.primary::before {
    background: linear-gradient(90deg, var(--soblahov-red), var(--soblahov-yellow), var(--accent));
}

.metric span,
.metric small {
    color: var(--muted);
    font-size: 14px;
}

.metric strong {
    font-size: 30px;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.metric.forecast {
    grid-column: span 2;
    background:
        linear-gradient(120deg, rgba(185, 28, 28, 0.08), rgba(242, 201, 76, 0.08)),
        rgba(255, 255, 255, 0.96);
}

.forecast-body {
    display: grid;
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
}

.metric.forecast strong {
    display: block;
    font-size: 24px;
    line-height: 1.16;
    margin-bottom: 8px;
}

.metric.forecast small {
    display: block;
    line-height: 1.35;
}

.weather-glyph {
    width: 64px;
    height: 64px;
    position: relative;
    border-radius: 50%;
    background: #f2c94c;
    box-shadow: inset 0 -8px 0 rgba(180, 83, 9, 0.12), 0 12px 24px rgba(185, 28, 28, 0.12);
}

.weather-glyph::before,
.weather-glyph::after {
    content: "";
    position: absolute;
}

.weather-glyph-cloud,
.weather-glyph-rain,
.weather-glyph-thunder,
.weather-glyph-snow,
.weather-glyph-fog {
    background: #e7eef2;
}

.weather-glyph-cloud::before,
.weather-glyph-rain::before,
.weather-glyph-thunder::before,
.weather-glyph-snow::before,
.weather-glyph-fog::before {
    width: 44px;
    height: 24px;
    left: 10px;
    top: 25px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 10px -12px 0 2px #ffffff, 24px -4px 0 1px #ffffff;
}

.weather-glyph-rain::after {
    width: 4px;
    height: 18px;
    left: 24px;
    top: 47px;
    border-radius: 4px;
    background: #0891b2;
    box-shadow: 12px -2px 0 #0891b2, 24px -1px 0 #0891b2;
}

.weather-glyph-thunder::after {
    left: 28px;
    top: 45px;
    width: 15px;
    height: 22px;
    background: var(--soblahov-yellow);
    clip-path: polygon(35% 0, 100% 0, 60% 40%, 100% 40%, 20% 100%, 45% 52%, 0 52%);
}

.weather-glyph-snow::after {
    width: 6px;
    height: 6px;
    left: 20px;
    top: 49px;
    border-radius: 50%;
    background: #7cafd0;
    box-shadow: 13px 6px 0 #7cafd0, 27px 1px 0 #7cafd0;
}

.weather-glyph-fog::after {
    width: 42px;
    height: 3px;
    left: 12px;
    top: 49px;
    border-radius: 99px;
    background: #9aa8a4;
    box-shadow: 0 8px 0 #9aa8a4;
}

.weather-glyph-wind {
    background: #e7f3f1;
}

.weather-glyph-wind::before {
    width: 42px;
    height: 4px;
    left: 12px;
    top: 24px;
    border-radius: 99px;
    background: var(--accent);
    box-shadow: 8px 13px 0 var(--accent), -4px 26px 0 rgba(15, 118, 110, 0.65);
}

.weather-glyph-unknown {
    background: #eef2f0;
}

.weather-glyph-unknown::before {
    content: "?";
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 26px;
    font-weight: 760;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    position: relative;
}

.chart-grid.is-loading .chart-panel {
    opacity: 0.58;
}

.chart-panel {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(214, 225, 221, 0.95);
    border-radius: 8px;
    padding: 14px;
    height: 330px;
    box-shadow: var(--shadow);
    transition: opacity 0.18s ease;
}

.chart-panel.wide {
    grid-column: 1 / -1;
}

.loading-overlay {
    position: absolute;
    inset: 12px;
    z-index: 4;
    display: grid;
    place-items: center;
    gap: 10px;
    align-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.64);
    color: var(--ink);
    font-weight: 700;
    backdrop-filter: blur(3px);
}

.loading-overlay[hidden] {
    display: none;
}

.loading-overlay span {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid rgba(15, 118, 110, 0.18);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}

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

canvas {
    width: 100% !important;
    height: 100% !important;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-box {
    width: min(420px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.login-box form {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}

.login-box label {
    display: grid;
    gap: 6px;
    color: var(--muted);
}

.login-box input,
.login-box button {
    width: 100%;
}

.error {
    color: var(--danger);
}

@media (max-width: 1120px) {
    .conditions {
        grid-template-columns: repeat(3, minmax(150px, 1fr));
    }
}

@media (max-width: 980px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .conditions,
    .chart-grid {
        grid-template-columns: 1fr;
    }

    .metric.forecast {
        grid-column: span 1;
    }

    .chart-panel {
        height: 300px;
    }
}

@media (max-width: 560px) {
    .brand {
        min-width: 0;
    }

    nav,
    nav select,
    nav input {
        width: 100%;
    }

    .forecast-body {
        grid-template-columns: 58px minmax(0, 1fr);
        gap: 12px;
    }

    .weather-glyph {
        width: 54px;
        height: 54px;
    }
}
