:root {
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #020617;
    --card-bg: rgba(15, 23, 42, 0.96);
    --accent: #38bdf8;
    --accent-soft: rgba(56, 189, 248, 0.2);
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --radius-lg: 20px;
    --shadow-soft: 0 24px 60px rgba(15, 23, 42, 0.55);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 16px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at top, #1e293b 0, #020617 45%, #000 100%);
    min-height: 100vh;
}

/* Floating snowy background */
.snow-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 0 0, rgba(255, 255, 255, 0.14) 0, transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(255, 255, 255, 0.1) 0, transparent 55%);
    opacity: 0.4;
    animation: snowDrift 20s linear infinite alternate;
    z-index: 0;
}

@keyframes snowDrift {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(0, 20px, 0);
    }
}

.page-shell {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
}

/* Card / layout */

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px 20px 18px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.28);
    margin-top: 24px;
}

@media (min-width: 640px) {
    .card {
        padding: 32px 32px 22px;
        margin-top: 40px;
    }
}

/* Entry animation */

.card--float-up {
    animation: floatUp 0.7s ease-out both;
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translate3d(0, 18px, 0) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

/* Typography */

h1,
h2,
h3 {
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.03em;
}

.hero-header h1 {
    font-size: clamp(1.9rem, 3vw, 2.3rem);
}

.hero-tagline {
    margin-top: 8px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.hero-subtext {
    margin: 18px 0 24px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* Buttons */

.btn {
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.75rem 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease,
        color 0.18s ease,
        opacity 0.18s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    color: #0f172a;
    box-shadow: 0 16px 40px rgba(56, 189, 248, 0.45);
}

.btn-primary:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 18px 45px rgba(56, 189, 248, 0.6);
}

.btn-primary:active {
    transform: translateY(1px) scale(0.99);
    box-shadow: 0 10px 24px rgba(56, 189, 248, 0.35);
}

.btn-large {
    padding: 0.9rem 1.9rem;
    font-size: 1rem;
}

.btn-secondary {
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-main);
    border: 1px solid rgba(148, 163, 184, 0.6);
}

.btn-secondary:hover {
    background: rgba(30, 64, 175, 0.9);
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.6);
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-main);
}

a.btn {
    text-decoration: none;
}

/* Alerts */

.alert {
    margin-top: 18px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.09);
    border: 1px solid rgba(248, 113, 113, 0.65);
    font-size: 0.85rem;
    color: #fecaca;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.alert-icon {
    flex-shrink: 0;
}

/* Footer */

.page-footer {
    margin-top: 22px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* Index (hero) */

.hero-form {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Results header / tooltip */

.results-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.results-title-group h1 {
    font-size: clamp(1.6rem, 2.5vw, 1.9rem);
}

.results-location {
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Info pill tooltip */

.info-pill {
    position: relative;
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-muted);
    border: 1px solid rgba(148, 163, 184, 0.65);
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
}

.info-pill-icon {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.info-pill-tooltip {
    position: absolute;
    right: 0;
    top: 140%;
    max-width: 260px;
    padding: 0.6rem 0.8rem;
    background: #020617;
    border-radius: 12px;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text-main);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.75);
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition:
        opacity 0.18s ease,
        transform 0.18s ease;
}

.info-pill:hover .info-pill-tooltip {
    opacity: 1;
    transform: translateY(0);
}

/* Summary cards */

.summary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 640px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.summary-card {
    background: radial-gradient(
        circle at top,
        rgba(56, 189, 248, 0.18) 0,
        transparent 55%
    );
    border-radius: 16px;
    padding: 14px 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.4);
}

.summary-card h2 {
    font-size: 1rem;
    margin-bottom: 8px;
}

/* Bars */

.bar-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 3fr) minmax(0, 0.9fr);
    gap: 10px;
    align-items: center;
}

@media (max-width: 480px) {
    .bar-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .bar-value {
        text-align: left;
        margin-top: 4px;
    }
}

.bar-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.summary-date {
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.bar-track {
    position: relative;
    height: 0.6rem;
    border-radius: 999px;
    overflow: hidden;

    background: rgba(148, 163, 184, 0.35);

    box-shadow:
        inset 0 0 0 1px rgba(15, 23, 42, 0.7),
        0 0 0 1px rgba(15, 23, 42, 0.5);
}

.bar-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    background: linear-gradient(90deg, #38bdf8, #0ea5e9);
    background-size: 180% 100%;
    border-radius: inherit;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.5);
    transition:
        width 1.2s cubic-bezier(0.22, 0.61, 0.36, 1),
        background-position 1.6s ease-out;
}

.bar-fill--active {
    background-position: 100% 0;
}

.bar-value {
    text-align: right;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

/* Details / 15-day table */

.details-section {
    margin-top: 10px;
}

#moreDataSection {
    margin-top: 16px;
}

.details-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition:
        max-height 0.5s ease,
        opacity 0.3s ease,
        transform 0.3s ease;
}

.details-panel--open {
    max-height: 520px; /* Enough for the table; adjust if needed */
    opacity: 1;
    transform: translateY(0);
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    margin-top: 8px;
    padding-bottom: 4px;
}

.pred-table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.pred-table th,
.pred-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.pred-table th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.pred-table tbody tr:hover {
    background: rgba(15, 23, 42, 0.9);
}

/* Bottom actions */

.results-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-start;
}

/* Reduced motion accessibility */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
