:root {
    --bg:         #f0f4f8;
    --surface:    #ffffff;
    --surface-2:  #f8fafc;
    --navy:       #0b1628;
    --navy-2:     #1e293b;
    --border:     #e2e8f0;
    --border-2:   #cbd5e1;
    --text:       #0f172a;
    --text-2:     #334155;
    --muted:      #64748b;
    --faint:      #94a3b8;
    --blue:       #2563eb;
    --blue-2:     #1d4ed8;
    --blue-bg:    #eff6ff;
    --blue-mid:   #bfdbfe;
    --shadow-sm:  0 1px 3px rgba(15,23,42,.07), 0 1px 2px rgba(15,23,42,.04);
    --shadow:     0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.04);
    --shadow-md:  0 8px 24px rgba(15,23,42,.10), 0 2px 6px rgba(15,23,42,.05);
    --shadow-lg:  0 20px 48px rgba(15,23,42,.16), 0 4px 12px rgba(15,23,42,.08);
    --r-sm:       8px;
    --r:          12px;
    --r-lg:       16px;
}

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

body {
    font-family: 'Inter', 'DM Sans', system-ui, sans-serif;
    font-weight: 400;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Nav ─────────────────────────────────── */
.topbar {
    background: var(--navy);
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 4px 16px rgba(0,0,0,.25);
}
.topbar-brand {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.02em;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.topbar-brand span { color: #60a5fa; }
.topbar-meta {
    font-size: 12px;
    color: rgba(255,255,255,.35);
    letter-spacing: .06em;
    text-transform: uppercase;
}
.topbar-link {
    font-size: 13px;
    color: rgba(255,255,255,.65);
    text-decoration: none;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--r-sm);
    border: 1px solid rgba(255,255,255,.12);
    transition: all .15s;
}
.topbar-link:hover { color: #fff; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); }

/* ── Hero ────────────────────────────────── */
.hero {
    background: linear-gradient(150deg, #0b1628 0%, #0f2a50 55%, #0b2a3a 100%);
    padding: 60px 40px 0;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: rgba(255,255,255,.08);
}
.hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}
.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #60a5fa;
    margin-bottom: 16px;
    background: rgba(96,165,250,.1);
    padding: 5px 14px;
    border-radius: 99px;
    border: 1px solid rgba(96,165,250,.2);
}
.hero h1 {
    font-size: clamp(24px, 3.5vw, 44px);
    font-weight: 800;
    color: #fff;
    letter-spacing: -.03em;
    line-height: 1.1;
    margin-bottom: 12px;
}
.hero h1 em {
    font-style: normal;
    color: #60a5fa;
}
.hero-intro {
    font-size: 15px;
    color: rgba(255,255,255,.55);
    line-height: 1.75;
    max-width: 540px;
    margin-bottom: 28px;
    font-weight: 400;
}
.feature-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}
.feature-pill {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,.7);
    border: 1px solid rgba(255,255,255,.12);
    padding: 5px 13px;
    border-radius: 99px;
    background: rgba(255,255,255,.06);
    white-space: nowrap;
}

/* ── Search card (dentro hero) ────────────── */
.search-section {
    background: var(--surface);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 28px 32px 24px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    border-bottom: none;
    position: relative;
    z-index: 2;
}
.search-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 18px;
    display: block;
}
.search-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 12px;
    align-items: end;
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.input {
    height: 48px;
    padding: 0 16px;
    border: 1.5px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    font-weight: 400;
    border-radius: var(--r-sm);
    outline: none;
    width: 100%;
    transition: border-color .15s, box-shadow .15s, background .15s;
    appearance: none;
}
.input:focus {
    border-color: var(--blue);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.input::placeholder { color: var(--faint); }
.search-actions { display: flex; gap: 10px; align-items: flex-end; }
.checks-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    align-items: center;
}
.checks-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    margin-right: 4px;
}
.check-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border: 1.5px solid var(--border-2);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    transition: all .15s;
}
.check-pill input { position: absolute; opacity: 0; pointer-events: none; }
.check-pill-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    flex-shrink: 0;
    transition: background .15s, border-color .15s;
}
.check-pill:has(input:checked) {
    border-color: var(--blue);
    background: var(--blue-bg);
    color: var(--blue);
}
.check-pill:has(input:checked) .check-pill-dot {
    background: var(--blue);
    border-color: var(--blue);
}

/* ── Buttons ──────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 48px;
    padding: 0 24px;
    border: 1.5px solid transparent;
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    letter-spacing: .01em;
}
.btn-primary {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.btn-primary:hover {
    background: var(--blue-2);
    border-color: var(--blue-2);
    box-shadow: 0 4px 16px rgba(37,99,235,.4);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--surface);
    color: var(--text-2);
    border-color: var(--border-2);
}
.btn-secondary:hover {
    border-color: var(--text-2);
    background: var(--surface-2);
}
.btn:disabled {
    opacity: .4;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    transform: none;
}

/* ── Shell ────────────────────────────────── */
.shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 40px 80px;
}

/* ── Status bar ───────────────────────────── */
.statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.statusbar-left { display: flex; align-items: center; gap: 14px; }
.status-text { font-size: 13px; color: var(--muted); }
.loading {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
}
.spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--border-2);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

/* ── Notice ───────────────────────────────── */
.notice {
    display: none;
    padding: 14px 18px;
    border-radius: var(--r-sm);
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 14px;
    margin-bottom: 20px;
    font-weight: 500;
}

/* ── Weather result card ──────────────────── */
.result-card {
    display: none;
    border-radius: var(--r-lg);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}
.result-card-inner {
    display: grid;
    grid-template-columns: 1fr auto;
}
.result-left { padding: 36px 40px; }
.result-icon {
    font-size: 64px;
    line-height: 1;
    display: block;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.12));
}
.result-city {
    font-size: 30px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -.02em;
}
.result-date {
    font-size: 14px;
    color: var(--muted);
    margin-top: 5px;
    font-weight: 500;
    text-transform: capitalize;
}
.result-condition {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 700;
    color: var(--blue);
    background: var(--blue-bg);
    padding: 5px 14px;
    border-radius: 99px;
    border: 1px solid var(--blue-mid);
    letter-spacing: .01em;
}
.result-summary {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,.07);
    font-size: 14px;
    color: var(--muted);
    line-height: 1.75;
    max-width: 480px;
}
.result-right {
    padding: 36px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    min-width: 240px;
    border-left: 1px solid rgba(0,0,0,.06);
}
.result-temp {
    font-size: 68px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.04em;
    color: var(--text);
}
.result-temp-range {
    font-size: 14px;
    color: var(--muted);
    margin-top: 6px;
    font-weight: 500;
}
.result-stats { display: flex; flex-direction: column; gap: 8px; }
.result-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
    padding: 10px 14px;
    background: rgba(0,0,0,.03);
    border-radius: var(--r-sm);
}
.result-stat .sk { color: var(--muted); font-weight: 500; }
.result-stat .sv { font-weight: 700; color: var(--text); }

/* weather themes */
.result-card.theme-sunny   { background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%); }
.result-card.theme-partly  { background: linear-gradient(135deg, #f0f9ff 0%, #fef9c3 100%); }
.result-card.theme-cloudy,
.result-card.theme-fog     { background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%); }
.result-card.theme-rain    { background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%); }
.result-card.theme-snow    { background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); }
.result-card.theme-storm   { background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%); }
.result-card.theme-default { background: var(--surface); }

body.page-theme-sunny   { background: #fef9c3; }
body.page-theme-partly  { background: #eff6ff; }
body.page-theme-cloudy,
body.page-theme-fog     { background: #f1f5f9; }
body.page-theme-rain    { background: #eff6ff; }
body.page-theme-snow    { background: #f0f9ff; }
body.page-theme-storm   { background: #eef2ff; }
body.page-theme-default { background: var(--bg); }

/* ── Info strip ───────────────────────────── */
.info-strip {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.info-cell {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.info-cell .k {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 6px;
}
.info-cell .v {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Stats row ────────────────────────────── */
.stats-row {
    display: none;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.stat-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 20px 18px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--r) var(--r) 0 0;
    background: var(--blue);
}
.stat-box:nth-child(2)::before { background: #ef4444; }
.stat-box:nth-child(3)::before { background: #3b82f6; }
.stat-box:nth-child(4)::before { background: #06b6d4; }
.stat-box:nth-child(5)::before { background: #6366f1; }
.stat-box:nth-child(6)::before { background: #f59e0b; }
.stat-box .lb {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 10px;
}
.stat-box .vl {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    letter-spacing: -.02em;
}

/* ── Content grid ─────────────────────────── */
.content-grid {
    display: grid;
    grid-template-columns: 55% 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}
.panel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.01em;
}
.panel-body { padding: 24px; }
.chart-wrap { height: 320px; position: relative; }

/* ── Segmented control ────────────────────── */
.segmented {
    display: inline-flex;
    border: 1.5px solid var(--border-2);
    border-radius: var(--r-sm);
    overflow: hidden;
    background: var(--surface-2);
}
.segmented button {
    border: none;
    border-right: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    padding: 7px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    transition: all .15s;
}
.segmented button:last-child { border-right: none; }
.segmented button.active { background: var(--blue); color: #fff; }

/* ── Count badge ──────────────────────────── */
.count-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 99px;
}

/* ── Tables ───────────────────────────────── */
.table-wrap { overflow: auto; max-height: 560px; }
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
    font-size: 13px;
}
th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-2);
    color: var(--faint);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
.weather-cell {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 500;
    color: var(--text);
}
.empty-row td {
    text-align: center;
    color: var(--faint);
    padding: 48px;
    font-size: 14px;
}

/* ── Hourly section ───────────────────────── */
.hourly-section { margin-bottom: 20px; }

/* ── SEO blocks ───────────────────────────── */
.seo-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 28px 32px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.seo-block-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    letter-spacing: -.01em;
}
.seo-block p {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.75;
    margin-bottom: 10px;
}
.seo-block p:last-of-type { margin-bottom: 0; }
.seo-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}
.seo-links a {
    text-decoration: none;
    color: var(--blue);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    border: 1.5px solid rgba(37,99,235,.2);
    border-radius: var(--r-sm);
    background: var(--blue-bg);
    transition: all .15s;
}
.seo-links a:hover {
    background: var(--blue-mid);
    border-color: var(--blue);
}

/* ── Animations ───────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.result-card[style*="block"],
.result-card[style*="flex"] { animation: fadeUp .35s ease both; }

.info-strip[style*="grid"] { animation: fadeUp .35s ease .05s both; }

.stats-row[style*="grid"] .stat-box { animation: fadeUp .3s ease both; }
.stats-row[style*="grid"] .stat-box:nth-child(1) { animation-delay: .04s; }
.stats-row[style*="grid"] .stat-box:nth-child(2) { animation-delay: .08s; }
.stats-row[style*="grid"] .stat-box:nth-child(3) { animation-delay: .12s; }
.stats-row[style*="grid"] .stat-box:nth-child(4) { animation-delay: .16s; }
.stats-row[style*="grid"] .stat-box:nth-child(5) { animation-delay: .20s; }
.stats-row[style*="grid"] .stat-box:nth-child(6) { animation-delay: .24s; }

/* ── Footer ───────────────────────────────── */
.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 48px;
    padding: 24px 0;
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* ── Responsive ───────────────────────────── */
@media (max-width: 1100px) {
    .content-grid { grid-template-columns: 1fr; }
    .stats-row { grid-template-columns: repeat(3, 1fr); }
    .info-strip { grid-template-columns: repeat(2, 1fr); }
    .result-card-inner { grid-template-columns: 1fr; }
    .result-right { border-left: none; border-top: 1px solid rgba(0,0,0,.06); }
}

@media (max-width: 768px) {
    .topbar { padding: 0 20px; height: 54px; }
    .hero { padding: 36px 20px 0; }
    .shell { padding: 20px 20px 60px; }
    .search-section { padding: 20px 20px 16px; }
    .search-row { grid-template-columns: 1fr; }
    .search-actions { flex-direction: row; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .info-strip { grid-template-columns: 1fr 1fr; }
    .btn { height: 44px; }
    .input { height: 44px; }
    .topbar-meta { display: none; }
    .result-left, .result-right { padding: 24px 20px; }
    .result-temp { font-size: 52px; }
}

@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    .result-temp { font-size: 44px; }
    .hero h1 { font-size: 22px; }
    .feature-pills { display: none; }
}
