/* 聖誕節應景（2026-12）：背景飄雪與兩個彩蛋。節後移除——index_long.html 的 <link>、.page-snow、christmas.js 的 <script>，連同這個檔、js/christmas.js 與 img/xmas-aris-*.webp */
.page-snow {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

/* 三層雪花：每層是一張重複的點陣，往下移動剛好一格的高度再重來，接縫看不出來 */
.page-snow i {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background-repeat: repeat;
    animation: snow-fall linear infinite;
}

.page-snow i:nth-child(1) {
    --snow-tile: 420px;
    top: -420px;
    opacity: 0.95;
    background-size: 420px 420px;
    background-image:
        radial-gradient(circle at 40px 60px, #fff 0 4px, transparent 5px),
        radial-gradient(circle at 190px 150px, #fff 0 5px, transparent 6px),
        radial-gradient(circle at 330px 40px, #fff 0 3.5px, transparent 4.5px),
        radial-gradient(circle at 110px 300px, #fff 0 4.5px, transparent 5.5px),
        radial-gradient(circle at 290px 350px, #fff 0 4px, transparent 5px);
    animation-duration: 14s;
}

.page-snow i:nth-child(2) {
    --snow-tile: 300px;
    top: -300px;
    opacity: 0.8;
    background-size: 300px 300px;
    background-image:
        radial-gradient(circle at 30px 30px, #fff 0 2.5px, transparent 3.5px),
        radial-gradient(circle at 150px 110px, #fff 0 3px, transparent 4px),
        radial-gradient(circle at 250px 60px, #fff 0 2.5px, transparent 3.5px),
        radial-gradient(circle at 80px 210px, #fff 0 3px, transparent 4px),
        radial-gradient(circle at 220px 250px, #fff 0 2.5px, transparent 3.5px);
    animation-duration: 20s;
}

.page-snow i:nth-child(3) {
    --snow-tile: 220px;
    top: -220px;
    opacity: 0.6;
    background-size: 220px 220px;
    background-image:
        radial-gradient(circle at 20px 90px, #fff 0 1.5px, transparent 2.5px),
        radial-gradient(circle at 100px 30px, #fff 0 2px, transparent 3px),
        radial-gradient(circle at 170px 140px, #fff 0 1.5px, transparent 2.5px),
        radial-gradient(circle at 60px 190px, #fff 0 2px, transparent 3px);
    animation-duration: 28s;
}

@keyframes snow-fall {
    to { transform: translate3d(0, var(--snow-tile), 0); }
}

/* 系統設定「減少動態效果」的人看到的是靜止的雪 */
@media (prefers-reduced-motion: reduce) {
    .page-snow i { animation: none; }
}

/* ── 彩蛋一：雪會積起來 ──
   頁面開著越久，底部草地與兩側的樹、長椅、校門上慢慢積一層雪（四分鐘積滿，重新整理就重來）。 */
.page-snow b {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4.6vw;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0, #fff 0.9vw, #f1f9fd 100%);
    transform-origin: bottom;
    animation: snow-ground 240s ease-out both;
}

/* 景物上的積雪：把同一張圖當遮罩塗成白色、墊在原圖後面再往上推幾 px，露出來的就是每個上緣的一圈雪 */
.page-scene-char::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: #fff;
    -webkit-mask: var(--scene-img) center / 100% 100% no-repeat;
    mask: var(--scene-img) center / 100% 100% no-repeat;
    animation: snow-cap 240s ease-out both;
}

.page-scene-char-left { --scene-img: url("/img/興學伴新介面_左下圖-去背.png?v=20261211"); }
.page-scene-char-right { --scene-img: url("/img/興學伴新介面_右下圖-去背.png?v=20261211"); }

@keyframes snow-ground {
    from { transform: scaleY(0); opacity: 0; }
    to { transform: scaleY(1); opacity: 1; }
}

@keyframes snow-cap {
    from { transform: translateY(0); }
    to { transform: translateY(-0.5vw); }
}

/* ── 彩蛋二：送出「聖誕快樂」時下十秒大雪，鹿角鵝跳出來（christmas.js） ── */
.snow-burst {
    position: fixed;
    inset: 0;
    z-index: 900;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.snow-burst.is-on { opacity: 1; }

.snow-burst i {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background-repeat: repeat;
    animation: snow-fall linear infinite;
}

.snow-burst i:nth-child(1) {
    --snow-tile: 260px;
    top: -260px;
    background-size: 260px 260px;
    background-image:
        radial-gradient(circle at 30px 40px, #fff 0 5px, transparent 6px),
        radial-gradient(circle at 150px 90px, #fff 0 6px, transparent 7px),
        radial-gradient(circle at 220px 200px, #fff 0 4.5px, transparent 5.5px),
        radial-gradient(circle at 80px 190px, #fff 0 5.5px, transparent 6.5px);
    animation-duration: 3.2s;
}

.snow-burst i:nth-child(2) {
    --snow-tile: 180px;
    top: -180px;
    opacity: 0.9;
    background-size: 180px 180px;
    background-image:
        radial-gradient(circle at 20px 120px, #fff 0 3.5px, transparent 4.5px),
        radial-gradient(circle at 100px 30px, #fff 0 4px, transparent 5px),
        radial-gradient(circle at 150px 150px, #fff 0 3px, transparent 4px);
    animation-duration: 4.4s;
}

.snow-burst i:nth-child(3) {
    --snow-tile: 120px;
    top: -120px;
    opacity: 0.75;
    background-size: 120px 120px;
    background-image:
        radial-gradient(circle at 20px 20px, #fff 0 2px, transparent 3px),
        radial-gradient(circle at 80px 70px, #fff 0 2.5px, transparent 3.5px),
        radial-gradient(circle at 50px 105px, #fff 0 2px, transparent 3px);
    animation-duration: 6s;
}

.snow-burst-goose {
    position: fixed;
    --goose-hide: 110%;
    left: 8px;
    bottom: 0;
    z-index: 901;
    width: auto;
    height: min(190px, 26vh);
    pointer-events: none;
    transform: translateY(var(--goose-hide));
    filter: drop-shadow(0 6px 14px rgba(40, 90, 150, 0.3));
}

.snow-burst-goose.is-on { animation: goose-hop 10s ease-in-out both; }

@keyframes goose-hop {
    0% { transform: translateY(var(--goose-hide)); }
    8% { transform: translateY(-8%); }
    12% { transform: translateY(0); }
    22% { transform: translateY(-22%) rotate(-5deg); }
    30% { transform: translateY(0); }
    40% { transform: translateY(-22%) rotate(5deg); }
    48% { transform: translateY(0); }
    60% { transform: translateY(-12%) rotate(-3deg); }
    68%, 90% { transform: translateY(0); }
    100% { transform: translateY(var(--goose-hide)); }
}

/* 手機：鵝站在輸入框上方，不蓋住打字的地方 */
@media (max-width: 768px) {
    .snow-burst-goose {
        --goose-hide: calc(100% + 110px);
        bottom: 96px;
        height: 120px;
    }
}

/* 減少動態效果：積雪直接顯示積滿的樣子；大雪與跳躍不播（christmas.js 也不會觸發） */
@media (prefers-reduced-motion: reduce) {
    .snow-burst, .snow-burst-goose { display: none; }
    .page-snow b { animation: none; }
    .page-scene-char::before { animation: none; transform: translateY(-0.5vw); }
}
