/* ========== 天气卡片主容器 ========== */
.weather-box {
    position: fixed;
    bottom: 70px;
    left: 0;
    width: min(240px, 66vw);
    aspect-ratio: 720 / 400;
    z-index: 999;
    cursor: pointer;
    transform: translate3d(calc(-100% + 38px), 0, 0);
    transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.weather-box.open {
    transform: translate3d(6px, 0, 0);
}
.weather-box.hidden-initial {
    transform: translate3d(-100%, 0, 0);
    transition: none;
}

.glass-card {
    position: absolute;
    inset: 0;
    border-radius: 18px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    z-index: 1;
}

.wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: transparent;
    z-index: 2;
    border-radius: 18px;
}

/* ========== 露出的箭头 ========== */
.handle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.75);
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    z-index: 3000;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.weather-box.open .handle {
    transform: translateY(-50%) rotate(180deg);
}

/* ========== 云层（★ 增加了轻微左右摇晃） ========== */
.cloud-base {
    position: absolute;
    left: 50%;
    top: 28%;
    transform: translate(-50%, -50%);
    width: 40%;
    aspect-ratio: 320 / 100;
    border-radius: 999px;
    /* ★ 新增：轻微左右飘动，6 秒一次来回 */
    animation: cloudDrift 6s ease-in-out infinite alternate;
}

/* ★ 云的飘动动画：以 translate 方式实现，不影响其他定位 */
@keyframes cloudDrift {
    0%   { transform: translate(calc(-50% - 5px), -50%); }
    100% { transform: translate(calc(-50% + 5px), -50%); }
}

.cloud-base::before {
    content: '';
    position: absolute;
    border-radius: 50%;
}
.cloud-base::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 999px;
    z-index: 1000;
}

.cloud-light { background: #e8eef4; }
.cloud-light::before {
    top: -55%; left: 12%; width: 40%; aspect-ratio: 1 / 1;
    background: #e8eef4; box-shadow: 210% -10% 0 12% #e8eef4;
}
.cloud-light::after { background: #e8eef4; }

.cloud-rain-light { background: #88929c; }
.cloud-rain-light::before {
    top: -55%; left: 12%; width: 40%; aspect-ratio: 1 / 1;
    background: #88929c; box-shadow: 210% -10% 0 12% #88929c;
}
.cloud-rain-light::after { background: #88929c; }

.cloud-rain-mid { background: #6e7882; }
.cloud-rain-mid::before {
    top: -55%; left: 12%; width: 40%; aspect-ratio: 1 / 1;
    background: #6e7882; box-shadow: 210% -10% 0 12% #6e7882;
}
.cloud-rain-mid::after { background: #6e7882; }

.cloud-rain-heavy { background: #4f5861; }
.cloud-rain-heavy::before {
    top: -55%; left: 12%; width: 40%; aspect-ratio: 1 / 1;
    background: #4f5861; box-shadow: 210% -10% 0 12% #4f5861;
}
.cloud-rain-heavy::after { background: #4f5861; }

.cloud-storm { background: #383f47; }
.cloud-storm::before {
    top: -55%; left: 12%; width: 40%; aspect-ratio: 1 / 1;
    background: #383f47; box-shadow: 210% -10% 0 12% #383f47;
}
.cloud-storm::after { background: #383f47; }

.cloud-overcast { background: #5f6772; }
.cloud-overcast::before {
    top: -60%; left: 8%; width: 44%; aspect-ratio: 1 / 1;
    background: #5f6772; box-shadow: 240% -14% 0 14% #5f6772;
}
.cloud-overcast::after { background: #5f6772; }

.cloud-snow-heavy { background: #7c8690; }
.cloud-snow-heavy::before {
    top: -55%; left: 12%; width: 40%; aspect-ratio: 1 / 1;
    background: #7c8690; box-shadow: 210% -10% 0 12% #7c8690;
}
.cloud-snow-heavy::after { background: #7c8690; }

.cloud-rain-snow { background: #7a848e; }
.cloud-rain-snow::before {
    top: -55%; left: 12%; width: 40%; aspect-ratio: 1 / 1;
    background: #7a848e; box-shadow: 210% -10% 0 12% #7a848e;
}
.cloud-rain-snow::after { background: #7a848e; }

.cloud-thunder { background: #2c3138; }
.cloud-thunder::before {
    top: -55%; left: 12%; width: 40%; aspect-ratio: 1 / 1;
    background: #2c3138; box-shadow: 210% -10% 0 12% #2c3138;
}
.cloud-thunder::after { background: #2c3138; }

/* ========== 太阳 ========== */
.sun-el {
    position: absolute;
    z-index: 0;
    width: 14%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: #ffdd44;
    box-shadow: 0 0 4vw #ffdd44;
    left: 62%;
    top: 18%;
}
@keyframes sunPulse {
    0 { box-shadow: 0 0 4vw #ffdd44, 0 0 8vw #ffbb22; }
    100% { box-shadow: 0 0 6vw #ffdd44, 0 0 11vw #ffbb22; }
}
.sun-animate {
    animation: sunPulse 3s ease-in-out infinite alternate;
}

/* ========== 月亮 ========== */
.sun-el.moon {
    background: radial-gradient(circle at 35% 32%, #f5f8ff 0%, #d0d8e8 45%, #909db5 100%);
    box-shadow:
        0 0 3vw rgba(200, 220, 255, 0.65),
        0 0 7vw rgba(140, 160, 200, 0.35);
}
@keyframes moonPulse {
    0   { box-shadow: 0 0 3vw rgba(200, 220, 255, 0.65), 0 0 7vw rgba(140, 160, 200, 0.35); }
    100 { box-shadow: 0 0 4vw rgba(220, 235, 255, 0.8),  0 0 9vw rgba(150, 175, 220, 0.5); }
}
.sun-el.moon.sun-animate {
    animation: moonPulse 4s ease-in-out infinite alternate;
}

/* ========== 粒子 ========== */
.particle-zone {
    position: absolute;
    left: 50%;
    top: 42%;
    transform: translateX(-50%);
    width: 42%;
    height: 44%;
    overflow: hidden;
}

.drop {
    position: absolute;
    top: 0;
    background: #05a2eb;
    width: 2px;
    height: 10px;
    animation: rainFall linear infinite;
}
@keyframes rainFall {
    0 { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(180px); opacity: 0; }
}

.snow-flake {
    position: absolute;
    top: 0;
    background: #ffffff;
    border-radius: 50%;
    box-shadow:
        1px 1px 0 rgba(0, 0, 0, 0.45),
        2px 2px 3px rgba(0, 0, 0, 0.35),
        0 0 6px rgba(255, 255, 255, 0.7);
    animation: snowFall linear infinite;
}
@keyframes snowFall {
    0% { transform: translateY(0) translateX(-5px) rotate(0deg); opacity: 1; }
    50% { transform: translateY(90px) translateX(5px) rotate(180deg); opacity: 1; }
    100% { transform: translateY(180px) translateX(-3px) rotate(360deg); opacity: 0; }
}

.hail {
    position: absolute;
    top: 0;
    background: #ffffff;
    border-radius: 2px;
    box-shadow:
        1px 1px 0 rgba(0, 0, 0, 0.5),
        2px 2px 3px rgba(0, 0, 0, 0.4),
        0 0 5px rgba(255, 255, 255, 0.6);
    animation: hailFall linear infinite;
}
@keyframes hailFall {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(180px); opacity: 0; }
}

.dust {
    position: absolute;
    top: 0;
    background: #c2a06e;
    border-radius: 50%;
    animation: dustDrift linear infinite;
}
@keyframes dustDrift {
    0% { transform: translateY(0) translateX(0); opacity: 0.7; }
    100% { transform: translateY(180px) translateX(-40px); opacity: 0; }
}

/* ========== 闪电 ========== */
.lightning {
    position: absolute;
    left: 50%;
    top: 38%;
    width: 0.7%;
    height: 22%;
    background: linear-gradient(#fff8a8, #74c0ff);
    transform: translateX(-50%);
    opacity: 0;
    filter: drop-shadow(0 0 4px #fff7a8);
    z-index: 500;
    transition: opacity 0.12s ease-out, filter 0.18s ease-out;
}
.lightning::before,
.lightning::after {
    content: "";
    position: absolute;
    background: inherit;
}
.lightning::before {
    width: 28px; height: 3px; left: -14px; top: 22px;
    transform: rotate(20deg);
}
.lightning::after {
    width: 22px; height: 3px; right: -10px; top: 52px;
    transform: rotate(-25deg);
}
@keyframes lightningFlash {
    0%, 86%, 100% { opacity: 0; }
    88% { opacity: 0; }
    90% { opacity: 1; }
    91% { opacity: 0.3; }
    93% { opacity: 1; }
    95% { opacity: 0.15; }
    97% { opacity: 0.8; }
    98% { opacity: 0; }
}

/* ========== 闪光覆盖层 ========== */
.flash-overlay {
    position: absolute;
    inset: 0;
    border-radius: 18px;
    background: rgba(255, 248, 168, 0);
    pointer-events: none;
    z-index: 800;
    transition: background 0.2s ease-out;
    opacity: 0;
}
@keyframes flashGlow {
    0%, 86%, 100% { background: rgba(255, 248, 168, 0); }
    88% { background: rgba(255, 248, 168, 0); }
    90% { background: rgba(255, 248, 168, 0.18); }
    92% { background: rgba(255, 248, 168, 0.04); }
    94% { background: rgba(255, 248, 168, 0.14); }
    97% { background: rgba(255, 248, 168, 0); }
}

/* ========== 雾 ========== */
.fog-wrap {
    position: absolute;
    left: 50%;
    top: 28%;
    transform: translate(-50%, -50%);
    width: 40%;
    aspect-ratio: 320 / 200;
    pointer-events: none;
}
.fog-cloud {
    position: absolute;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.32);
    filter: blur(6px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.fog-cloud::before,
.fog-cloud::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.32);
    filter: blur(6px);
}
.fog-1 {
    width: 82%; height: 35%; top: 5%; left: 9%;
    animation: fogDrift 7s ease-in-out infinite alternate;
}
.fog-1::before { width: 32%; height: 130%; top: -55%; left: 11%; }
.fog-1::after  { width: 44%; height: 170%; top: -70%; right: 7%; }
.fog-2 {
    width: 94%; height: 40%; top: 24%; left: 3%;
    background: rgba(255, 255, 255, 0.22);
    animation: fogDrift 9s ease-in-out infinite alternate-reverse;
}
.fog-2::before { width: 31%; height: 125%; top: -52%; left: 12%; }
.fog-2::after  { width: 41%; height: 162%; top: -66%; right: 9%; }
.fog-3 {
    width: 75%; height: 30%; top: 43%; left: 13%;
    background: rgba(255, 255, 255, 0.18);
    animation: fogDrift 8s ease-in-out infinite alternate;
}
.fog-3::before { width: 28%; height: 118%; top: -48%; left: 10%; }
.fog-3::after  { width: 38%; height: 150%; top: -60%; right: 11%; }
@keyframes fogDrift {
    0% { transform: translateX(-10px); }
    100% { transform: translateX(10px); }
}

/* ========== 特效整体随卡片联动（收起时淡出） ========== */
.cloud-base,
.particle-zone,
.sun-el,
.fog-wrap {
    transition: opacity 0.35s ease;
}
.weather-box:not(.open) .cloud-base,
.weather-box:not(.open) .particle-zone,
.weather-box:not(.open) .sun-el,
.weather-box:not(.open) .fog-wrap {
    opacity: 0;
}
.weather-box.open .cloud-base,
.weather-box.open .particle-zone,
.weather-box.open .sun-el,
.weather-box.open .fog-wrap {
    opacity: 1;
    transition: opacity 0.4s ease 0.2s;
}

/* ========== 信息栏（收起时向左滑出 + 淡出） ========== */
.info-area {
    position: absolute;
    left: 50%;
    top: 66%;
    width: 62%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 2000;
    pointer-events: auto;
    transform: translate(-50%, -50%) translateX(-60px);
    opacity: 0;
    transition:
        transform 0.35s cubic-bezier(0.4, 0, 0.6, 1),
        opacity 0.25s ease;
}
.weather-box.open .info-area {
    transform: translate(-50%, -50%) translateX(0);
    opacity: 1;
    transition:
        transform 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.15s,
        opacity 0.4s ease 0.15s;
}

.info-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 14px;
}
.info-row-sub {
    gap: 14px;
}

.info-province,
.info-weather-txt,
.info-temp,
.info-humidity,
.info-wind {
    white-space: nowrap;
    color: #ffffff;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.55),
        1px 1px 2px rgba(0, 0, 0, 0.55),
        2px 2px 4px rgba(0, 0, 0, 0.35);
}

.info-province { font-size: 12px; font-weight: 500; }
.info-weather-txt { font-size: 12px; font-weight: 600; }
.info-temp { font-size: 14px; font-weight: 700; }

.info-humidity,
.info-wind {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.55),
        1px 1px 2px rgba(0, 0, 0, 0.55),
        2px 2px 4px rgba(0, 0, 0, 0.35);
}

.hide { display: none !important; }

/* ========== 手机端 ========== */
@media (max-width: 768px) {
    .weather-box {
        width: min(160px, 45vw);
        bottom: 30px;
        transform: translate3d(calc(-100% + 26px), 0, 0);
        border-radius: 14px;
    }
    .weather-box.open {
        transform: translate3d(4px, 0, 0);
    }
    .glass-card,
    .wrapper,
    .flash-overlay {
        border-radius: 14px;
    }
    .handle {
        right: 8px;
        font-size: 14px;
    }
    .info-area {
        width: 70%;
        gap: 2px;
        transform: translate(-50%, -50%) translateX(-40px);
    }
    .weather-box.open .info-area {
        transform: translate(-50%, -50%) translateX(0);
    }
    .info-row { gap: 8px; }
    .info-row-sub { gap: 10px; }
    .info-province { font-size: 9px; }
    .info-weather-txt { font-size: 9px; }
    .info-temp { font-size: 11px; }
    .info-humidity,
    .info-wind { font-size: 9px; }
    .lightning::before {
        width: 18px; height: 2px; left: -9px; top: 14px;
    }
    .lightning::after {
        width: 14px; height: 2px; right: -7px; top: 34px;
    }
}