html {
    min-height: 100%;
    background: #0d1726;
    overscroll-behavior: none;
}

* {
    box-sizing: border-box;
}

body {
    position: relative;
    margin: 0;
    min-height: 100vh;
    padding: 48px 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-attachment: fixed;
    background-size: cover;
    transition: background 0.6s ease, color 0.2s ease;
    overflow-x: hidden;
    overscroll-behavior: none;
    color: #fff;
}

.weather-scene {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    width: 36rem;
    height: 36rem;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.7;
    pointer-events: none;
    animation: drift 18s ease-in-out infinite alternate;
    z-index: 0;
}

body::before {
    top: -10rem;
    right: -8rem;
}

body::after {
    bottom: -14rem;
    left: -8rem;
    animation-delay: 1.4s;
}

body .card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(120deg, rgba(255,255,255,0.18), transparent 30%, transparent 70%, rgba(255,255,255,0.1));
    pointer-events: none;
    opacity: 0.9;
}

.card,
.block,
.day-card,
.stat-pill,
.unit-toggle,
button,
.search-form input {
    will-change: transform, box-shadow;
}

body .block:hover,
body .day-card:hover,
body .stat-pill:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

body .block,
body .day-card,
body .stat-pill {
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

@keyframes floatIn {
    0% { opacity: 0; transform: translateY(12px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.block-current,
.block-hourly,
.block-daily {
    animation: floatIn 0.55s ease both;
}

.block-hourly { animation-delay: 0.08s; }
.block-daily { animation-delay: 0.12s; }

html.sunny, body.sunny { background: linear-gradient(135deg, #4facfe, #00f2fe); }
html.rainy, body.rainy { background: linear-gradient(135deg, #0f2027, #203a43 35%, #2c5364); }
html.cloudy, body.cloudy { background: linear-gradient(135deg, #4b5d7d, #b5c7db 52%, #edf2ff); }
html.thunder, body.thunder { background: linear-gradient(135deg, #0a1220, #1e2a39 32%, #2c3e50); }

html[data-condition*="clear"], html[data-condition*="sunny"],
body[data-condition*="clear"], body[data-condition*="sunny"] {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

html[data-condition*="rain"], html[data-condition*="drizzle"], html[data-condition*="shower"],
body[data-condition*="rain"], body[data-condition*="drizzle"], body[data-condition*="shower"] {
    background: linear-gradient(135deg, #0f2027, #203a43 35%, #2c5364);
}

html[data-condition*="cloud"], html[data-condition*="overcast"], html[data-condition*="fog"],
html[data-condition*="mist"], html[data-condition*="haze"], html[data-condition*="snow"],
body[data-condition*="cloud"], body[data-condition*="overcast"], body[data-condition*="fog"],
body[data-condition*="mist"], body[data-condition*="haze"], body[data-condition*="snow"] {
    background: linear-gradient(135deg, #4b5d7d, #b5c7db 52%, #edf2ff);
}

html[data-condition*="storm"], html[data-condition*="thunder"], html[data-condition*="lightning"],
body[data-condition*="storm"], body[data-condition*="thunder"], body[data-condition*="lightning"] {
    background: linear-gradient(135deg, #0a1220, #1e2a39 32%, #2c3e50);
}

body.sunny::before { background: rgba(255, 212, 87, 0.38); }
body.sunny::after { background: rgba(142, 224, 255, 0.44); }
body.rainy::before { background: rgba(95, 176, 255, 0.35); }
body.rainy::after { background: rgba(169, 223, 255, 0.3); }
body.cloudy::before { background: rgba(255, 255, 255, 0.45); }
body.cloudy::after { background: rgba(164, 181, 217, 0.38); }
body.thunder::before { background: rgba(117, 130, 255, 0.28); }
body.thunder::after { background: rgba(140, 168, 255, 0.2); }

body[data-condition*="clear"]::before,
body[data-condition*="sunny"]::before { background: rgba(255, 212, 87, 0.38); }
body[data-condition*="clear"]::after,
body[data-condition*="sunny"]::after { background: rgba(142, 224, 255, 0.44); }

body[data-condition*="rain"]::before,
body[data-condition*="drizzle"]::before,
body[data-condition*="shower"]::before { background: rgba(95, 176, 255, 0.35); }
body[data-condition*="rain"]::after,
body[data-condition*="drizzle"]::after,
body[data-condition*="shower"]::after { background: rgba(169, 223, 255, 0.3); }

body[data-condition*="cloud"]::before,
body[data-condition*="overcast"]::before,
body[data-condition*="fog"]::before,
body[data-condition*="mist"]::before,
body[data-condition*="haze"]::before,
body[data-condition*="snow"]::before { background: rgba(255, 255, 255, 0.45); }
body[data-condition*="cloud"]::after,
body[data-condition*="overcast"]::after,
body[data-condition*="fog"]::after,
body[data-condition*="mist"]::after,
body[data-condition*="haze"]::after,
body[data-condition*="snow"]::after { background: rgba(164, 181, 217, 0.38); }

body[data-condition*="storm"]::before,
body[data-condition*="thunder"]::before,
body[data-condition*="lightning"]::before { background: rgba(117, 130, 255, 0.28); }
body[data-condition*="storm"]::after,
body[data-condition*="thunder"]::after,
body[data-condition*="lightning"]::after { background: rgba(140, 168, 255, 0.2); }

@keyframes drift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(26px, 30px, 0) scale(1.12); }
}

@keyframes floatCloud {
    0% { transform: translateX(-30px) translateY(0); opacity: 0.55; }
    50% { transform: translateX(20px) translateY(-8px); opacity: 0.9; }
    100% { transform: translateX(50px) translateY(6px); opacity: 0.6; }
}

@keyframes rainFall {
    0% { transform: translateY(-20px); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translateY(120vh); opacity: 0; }
}

@keyframes lightningFlash {
    0%, 20%, 24%, 100% { opacity: 0; }
    21% { opacity: 1; }
    22% { opacity: 0.2; }
    23% { opacity: 1; }
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

@keyframes particleDrift {
    0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0; }
    20% { opacity: 0.8; }
    100% { transform: translate3d(30px, -80px, 0) scale(1.4); opacity: 0; }
}

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

.card {
    position: relative;
    z-index: 1;
    width: min(100%, 900px);
    background: rgba(18, 27, 38, 0.34);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 30px;
    box-shadow: 0 26px 80px rgba(6, 16, 28, 0.28), inset 0 1px 0 rgba(255,255,255,0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    padding: 26px 26px 10px;
    animation: fadeUp 0.6s ease-out;
}

.block {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 18px 34px rgba(7, 18, 28, 0.12);
    padding: 22px 20px;
}

.block:last-child {
    margin-bottom: 0;
}

h1 {
    margin: 0;
    color: #f2f8ff;
    font-size: clamp(26px, 3vw, 38px);
    letter-spacing: -0.04em;
}

h2 {
    margin: 0 0 14px;
    color: #fff;
    font-size: 1.5rem;
}

h3 {
    color: #f5fbff;
    margin: 0 0 18px;
    border-left: 4px solid rgba(128, 210, 255, 0.9);
    padding-left: 12px;
    font-size: 1.2rem;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 11px;
    color: rgba(230, 243, 255, 0.8);
}

.time {
    color: rgba(232, 242, 255, 0.82);
    font-size: 14px;
    margin-bottom: 20px;
}

.title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.unit-toggle {
    padding: 12px 18px;
    font-size: 14px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.12);
    color: #edf8ff;
    box-shadow: 0 10px 30px rgba(17, 35, 58, 0.18);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.unit-toggle:hover {
    transform: translateY(-1px) scale(1.02);
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.32);
    box-shadow: 0 16px 30px rgba(17, 35, 58, 0.2);
}

.search-form {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-form input,
.search-form button,
.unit-toggle {
    will-change: transform;
}

input[type="text"] {
    flex: 1;
    padding: 15px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(15, 33, 51, 0.22);
    color: #f2fbff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input[type="text"]::placeholder {
    color: rgba(218, 236, 255, 0.7);
}

input[type="text"]:focus {
    border-color: rgba(150, 216, 255, 0.8);
    box-shadow: 0 0 0 4px rgba(129, 201, 255, 0.18);
    transform: translateY(-1px);
}

button {
    padding: 14px 22px;
    background: linear-gradient(135deg, #60b7ff, #3984ff);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow: 0 16px 28px rgba(42, 97, 196, 0.28);
}

button:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
}

button:active {
    transform: scale(0.98);
}

.error {
    color: #fff5f6;
    background: rgba(255, 72, 72, 0.18);
    border: 1px solid rgba(255, 114, 114, 0.35);
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 600;
    margin: 0 0 18px;
}

.weather-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 22px;
    padding: 18px 18px 14px;
    margin: 0 0 22px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 18px 24px rgba(10, 18, 32, 0.12);
}

.sun-glow {
    position: absolute;
    top: 6%;
    right: 12%;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 214, 92, 0.75), rgba(255, 214, 92, 0.18) 35%, transparent 70%);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.4s ease;
}

.cloud {
    position: absolute;
    width: 180px;
    height: 52px;
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    filter: blur(0.5px);
    opacity: 0;
    animation: floatCloud 18s ease-in-out infinite alternate;
}

.cloud::before,
.cloud::after {
    content: "";
    position: absolute;
    background: rgba(255,255,255,0.18);
    border-radius: 50%;
}

.cloud::before {
    width: 58px;
    height: 58px;
    left: 20px;
    top: -25px;
}

.cloud::after {
    width: 72px;
    height: 72px;
    right: 22px;
    top: -30px;
}

.cloud-one { top: 16%; left: 10%; }
.cloud-two { top: 24%; right: 14%; animation-delay: 2s; }

.rain {
    position: absolute;
    top: -12%;
    width: 2px;
    height: 110px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(176, 223, 255, 0.95));
    opacity: 0;
    animation: rainFall 1.2s linear infinite;
}

.rain-one { left: 22%; animation-delay: 0s; }
.rain-two { left: 48%; animation-delay: 0.2s; }
.rain-three { left: 72%; animation-delay: 0.4s; }

.lightning {
    position: absolute;
    top: 8%;
    right: 22%;
    width: 0;
    height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-top: 52px solid rgba(255, 255, 255, 0.82);
    transform: rotate(12deg);
    opacity: 0;
    animation: lightningFlash 6s ease-in-out infinite;
}

.stars {
    position: absolute;
    inset: 0;
    opacity: 0;
    background-image:
        radial-gradient(circle, rgba(255,255,255,0.9) 1px, transparent 1.5px),
        radial-gradient(circle, rgba(255,255,255,0.7) 1px, transparent 1.4px),
        radial-gradient(circle, rgba(255,255,255,0.8) 1px, transparent 1.6px);
    background-size: 180px 180px;
    background-position: 0 0, 80px 60px, 150px 30px;
    animation: twinkle 4s ease-in-out infinite alternate;
}

.particles {
    position: absolute;
    inset: 0;
    opacity: 0;
}

.particles::before,
.particles::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle, rgba(255,255,255,0.9) 0 1.2px, transparent 1.3px),
        radial-gradient(circle, rgba(255,255,255,0.75) 0 1px, transparent 1.3px),
        radial-gradient(circle, rgba(255,255,255,0.6) 0 1.4px, transparent 1.5px);
    background-size: 120px 120px;
    background-position: 0 0, 50px 60px, 100px 30px;
    animation: particleDrift 12s linear infinite;
}

.particles::after {
    animation-delay: 4s;
}

body.sunny .sun-glow,
body.sunny .particles {
    opacity: 1;
}

body.rainy .cloud,
body.rainy .rain {
    opacity: 1;
}

body.cloudy .cloud {
    opacity: 0.9;
}

body.thunder .cloud,
body.thunder .lightning {
    opacity: 1;
}

body.thunder .stars {
    opacity: 0.7;
}

body.sunny .weather-hero {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 20px 30px rgba(79, 172, 254, 0.12);
}

body.rainy .weather-hero {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 20px 30px rgba(45, 96, 140, 0.16);
}

body.cloudy .weather-hero {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 20px 30px rgba(119, 135, 160, 0.18);
}

body.thunder .weather-hero {
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 20px 30px rgba(57, 79, 136, 0.2);
}

html.sunny body .sun-glow,
html.rainy body .rain,
html.cloudy body .cloud,
html.thunder body .cloud,
html.thunder body .lightning,
html.thunder body .stars {
    display: block;
}

.weather-hero::before {
    content: "";
    position: absolute;
    inset: -10% auto auto -20%;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.38), transparent 70%);
    animation: orbFloat 9s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes orbFloat {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(45px, 20px, 0) scale(1.1); }
}

.weather-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    padding: 6px 12px;
    margin-bottom: 16px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(239, 247, 255, 0.9);
}

.hero-main {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: end;
    margin-bottom: 18px;
}

.city-meta {
    font-size: 1.15rem;
    font-weight: 700;
    color: rgba(255,255,255,0.9);
    margin-bottom: 10px;
}

.condition-pill {
    display: inline-block;
    background: rgba(80, 176, 255, 0.16);
    border: 1px solid rgba(160, 225, 255, 0.35);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: #ebf8ff;
}

.hero-temp {
    font-size: clamp(2.2rem, 5vw, 4rem);
    font-weight: 800;
    color: #f5fbff;
    line-height: 1;
    letter-spacing: -0.06em;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.stat-pill {
    background: rgba(7, 17, 28, 0.15);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-pill .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(216, 233, 255, 0.72);
}

.stat-pill strong {
    font-size: 1.1rem;
    color: #fff;
}

.weather-info {
    padding: 0;
}

.info-heading {
    margin: 0 0 12px;
    color: rgba(240, 247, 255, 0.92);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.weather-info p {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    font-size: 15px;
    margin: 0 0 10px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: rgba(232, 242, 255, 0.92);
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
}

.weather-info p strong {
    color: rgba(245, 250, 255, 0.92);
}

.weather-info p:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
}

.hourly-container {
    max-height: 430px;
    overflow-y: auto;
}

.hourly-container th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(228, 240, 255, 0.1);
    color: #eaf6ff;
    box-shadow: 0 1px 0 rgba(255,255,255,0.08);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    white-space: nowrap;
}

th, td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: rgba(237, 245, 255, 0.92);
}

th {
    background: rgba(255,255,255,0.04);
    color: rgba(224, 240, 255, 0.9);
    font-weight: 600;
}

tbody tr:nth-child(odd) { background: rgba(255,255,255,0.02); }
tbody tr:nth-child(even) { background: rgba(255,255,255,0.04); }
tbody tr:hover { background: rgba(145, 199, 255, 0.08); }

td:nth-child(1), th:nth-child(1) { text-align: left; }
td:nth-child(n+2), th:nth-child(n+2) { text-align: center; }

.daily-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.day-card {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.day-card:hover {
    transform: translateY(-5px) scale(1.01);
    border-color: rgba(151, 219, 255, 0.38);
    box-shadow: 0 18px 30px rgba(16, 31, 51, 0.18);
}

.day-date {
    font-weight: 700;
    font-size: 16px;
    color: #dfeeff;
    margin-bottom: 8px;
}

.day-temp {
    font-size: 22px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 12px;
}

.day-details {
    width: 100%;
    text-align: left;
    font-size: 13px;
    color: rgba(232, 242, 255, 0.9);
}

.day-details p {
    margin: 6px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.12);
    padding-bottom: 5px;
}

.day-details p:last-child {
    border-bottom: none;
}

@media (max-width: 700px) {
    body {
        padding: 18px 12px;
    }

    .card {
        padding: 18px 14px;
        border-radius: 24px;
    }

    .weather-hero {
        border-radius: 18px;
    }

    .hero-main {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .daily-cards {
        grid-template-columns: 1fr;
    }
}

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

@media (max-width: 560px) {
    .title-row {
        flex-direction: column;
        align-items: stretch;
    }

    .unit-toggle,
    button {
        width: 100%;
    }

    .search-form {
        flex-direction: column;
        gap: 10px;
    }

    .weather-info p {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    th, td {
        padding: 9px 10px;
        font-size: 13px;
    }
}
