:root {
    --tilt-x: 50%;
    --tilt-y: 50%;
}

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

body, html {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
    overscroll-behavior-y: none; /* 防止移动端橡皮筋回弹效果 */
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #ffffff;
    background-color: #1e3c72; /* 兜底背景色，防止加载时露出白边 */
}
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh; /* 支持现代移动端视口高度 */
    padding-bottom: env(safe-area-inset-bottom);
    padding-top: env(safe-area-inset-top);
}

/* 动态背景层 */
.background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: linear-gradient(to bottom, #1e3c72 0%, #2a5298 100%);
    transition: background 2s ease;
}

/* 各种天气的背景主题 */
.bg-clear-day { background: linear-gradient(to bottom, #56CCF2 0%, #2F80ED 100%); }
.bg-clear-night { background: linear-gradient(to bottom, #0F2027 0%, #203A43 50%, #2C5364 100%); }
.bg-cloudy { background: linear-gradient(to bottom, #606c88 0%, #3f4c6b 100%); }
.bg-rain { background: linear-gradient(to bottom, #3a7bd5 0%, #3a6073 100%); }

/* 居中容器 */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 2rem;
    width: 100%;
    z-index: 1; /* 确保在特效之上 */
}

/* 毛玻璃拟态面板 (Liquid Glass) */
.glass {
    background: rgba(255, 255, 255, 0.08); /* 增加透明度 */
    backdrop-filter: blur(35px); /* 加深毛玻璃 */
    -webkit-backdrop-filter: blur(35px);
    border-radius: 32px;
    padding: 4.5rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1), 
        inset 0 0 0 1px rgba(255, 255, 255, 0.15); /* 内部微弱高光 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    transition: transform 0.3s ease;
    position: relative;
}

/* 动态光晕 (Halo Behind) */
.glass::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 36px;
    background: radial-gradient(
        circle at var(--tilt-x) var(--tilt-y),
        rgba(255, 255, 255, 0.6) 0%,
        rgba(255, 255, 255, 0) 50%
    );
    z-index: -1;
    opacity: 0.5;
    filter: blur(20px);
    transition: opacity 0.5s ease;
    pointer-events: none;
}

/* 流光描边 (Liquid Stroke Overlay) */
.glass::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 32px;
    border: 2px solid transparent;
    background: radial-gradient(
        circle at var(--tilt-x) var(--tilt-y),
        rgba(255, 255, 255, 0.8) 0%,
        rgba(255, 255, 255, 0) 40%
    ) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    z-index: 10;
    opacity: 0.7;
    pointer-events: none;
}

.glass:hover {
    transform: translateY(-2px);
}

.top-row {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}


.main-weather {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.temp-box {
    display: flex;
    align-items: flex-start;
}

.temp {
    font-size: 9rem;
    font-weight: 600;
    line-height: 1;
    text-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.unit {
    font-size: 3.5rem;
    font-weight: 300;
    margin-top: 0.5rem;
    margin-left: 0.5rem;
}

.weather-icon i {
    font-size: 8rem;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-12px); }
    100% { transform: translateY(0px); }
}

.condition {
    font-size: 3rem;
    font-weight: 600;
    margin-top: 0.5rem;
    letter-spacing: 2px;
}

.keypoint {
    font-size: 1.5rem;
    font-weight: 300;
    margin-top: 1rem;
    opacity: 0.85;
    line-height: 1.5;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 3.5rem;
    padding-top: 3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 1.2rem 1.5rem;
    border-radius: 16px;
    transition: background 0.3s ease, transform 0.3s ease;
}

.detail-item:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.detail-item i {
    font-size: 2.4rem;
    color: rgba(255, 255, 255, 0.9);
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.detail-label {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.7;
}

.detail-value {
    font-size: 1.6rem;
    font-weight: 600;
}

/* 动画：Fade In */
.fade-in {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* 预警横幅 */
.alert-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1.2rem;
    background: rgba(239, 68, 68, 0.25);
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 12px;
    color: #fecaca;
    font-size: 1.1rem;
    font-weight: 600;
    backdrop-filter: blur(8px);
}
.alert-banner i {
    font-size: 1.6rem;
}

/* 底部天气条 */
.bottom-bar {
    flex-shrink: 0;
    margin: 0 auto 2rem auto;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
    border-radius: 24px;
    padding: 1.5rem 2rem;
    box-shadow: 
        0 4px 20px 0 rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    width: calc(100% - 4rem);
    max-width: 1200px;
    position: relative;
    z-index: 1;
}

/* ==========================================
   天气特效模块 (Effects)
   ========================================== */

/* 天气特效基础容器 */
.weather-effects {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

/* 晴天 (Clear) */
.effect-clear {
    background: radial-gradient(circle at 80% 20%, rgba(255, 255, 200, 0.35) 0%, transparent 40%);
    animation: pulseSun 8s infinite alternate ease-in-out;
}

@keyframes pulseSun {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.4); opacity: 1; }
}

/* 多云 (Cloudy/Haze) */
.effect-cloudy::before, .effect-cloudy::after {
    content: '';
    position: absolute;
    inset: -50%;
    background: 
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.08) 0%, transparent 25%),
        radial-gradient(circle at 70% 60%, rgba(255,255,255,0.05) 0%, transparent 35%);
    background-size: 150% 150%;
    animation: floatClouds 40s linear infinite;
    filter: blur(30px);
}
.effect-cloudy::after {
    background: 
        radial-gradient(circle at 60% 20%, rgba(255,255,255,0.06) 0%, transparent 30%),
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.07) 0%, transparent 25%);
    animation: floatClouds 60s linear infinite reverse;
}

@keyframes floatClouds {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 雨天 (Rain) */
.effect-rain {
    background-image: 
        linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%),
        linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0) 100%);
    background-size: 2px 120px, 1px 90px;
    background-position: 0 0, 50px 50px;
    background-repeat: repeat;
    transform: rotate(15deg) scale(1.5);
    animation: rainDrop 0.8s linear infinite;
}

@keyframes rainDrop {
    0% { background-position: 0 0, 50px 50px; }
    100% { background-position: 0 1000px, 50px 800px; }
}

/* 雪天 (Snow) */
.effect-snow {
    background-image: 
        radial-gradient(circle, rgba(255,255,255,0.7) 10%, transparent 20%),
        radial-gradient(circle, rgba(255,255,255,0.5) 10%, transparent 20%);
    background-size: 25px 25px, 15px 15px;
    background-position: 0 0, 40px 40px;
    background-repeat: repeat;
    animation: snowFall 15s linear infinite;
}

@keyframes snowFall {
    0% { background-position: 0 0, 40px 40px; }
    100% { background-position: 200px 1000px, -100px 800px; }
}

.hourly-forecast-title {
    font-size: 1.1rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hourly-scroll {
    display: grid;
    grid-template-columns: repeat(24, minmax(70px, 1fr));
    gap: 1.5rem 1.2rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
    /* 隐藏原生的滚动条 */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}
.hourly-scroll::-webkit-scrollbar {
    height: 6px;
}
.hourly-scroll::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
}
.hourly-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.4);
    border-radius: 6px;
}

.hourly-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    min-width: 60px;
    padding: 0.5rem;
    border-radius: 12px;
    transition: background 0.3s ease, transform 0.3s ease;
}

.hourly-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
}

.hourly-time {
    font-size: 0.95rem;
    opacity: 0.8;
}

.hourly-item i {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.hourly-temp {
    font-size: 1.2rem;
    font-weight: 600;
}

/* ==========================================
   响应式媒体查询
   ========================================== */

/* 1. 中等屏幕（平板电脑，横屏等） */
@media (max-width: 1024px) {
    .glass {
        padding: 2.5rem 3rem;
        max-width: 650px;
    }
    .temp { font-size: 7rem; }
    .unit { font-size: 2.8rem; }
    .weather-icon i { font-size: 6rem; }
    .condition { font-size: 2.4rem; }
    .details-grid {
        margin-top: 2rem;
        padding-top: 1.8rem;
        gap: 1rem;
    }
    .bottom-bar {
        padding: 1rem 1.5rem;
    }
}

/* 2. 手机端（竖屏） */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    .glass {
        padding: 1.5rem;
        border-radius: 20px;
    }
    .main-weather {
        flex-direction: column;
        gap: 1rem;
    }
    .temp { font-size: 5rem; }
    .unit { font-size: 2rem; }
    .weather-icon i { font-size: 4rem; }
    .condition { font-size: 1.8rem; text-align: center; }
    .keypoint { font-size: 1rem; text-align: center; }
    
    .details-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
    .detail-item {
        padding: 0.8rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    .detail-item i { font-size: 1.5rem; }
    .detail-label { font-size: 0.85rem; }
    .detail-value { font-size: 1.1rem; }
    
    .bottom-bar {
        width: calc(100% - 2rem);
        margin: 0 auto 1rem auto;
        padding: 1rem;
        border-radius: 16px;
    }
    .hourly-scroll {
        gap: 0.8rem;
    }
}

/* 3. 超小屏幕及高度受限优化 */
@media (max-width: 480px), (max-height: 600px) {
    .temp { font-size: 4rem; }
    .unit { font-size: 1.8rem; }
    .weather-icon i { font-size: 3rem; }
    .glass { padding: 1rem; }
    .details-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .detail-item { padding: 0.6rem; }
    .bottom-bar {
        padding: 0.8rem;
    }
}


