/* ===== LANTERN THEME — Taiwan Sky Lantern Festival ===== */

:root {
    --lantern-sky-top: #020713;
    --lantern-sky-mid: #0b1732;
    --lantern-sky-bot: #172b42;
    --lantern-ground: #0b150d;
    --lantern-glow: rgba(255, 160, 50, 0.6);
    --lantern-mountain1: #0a1a12;
    --lantern-mountain2: #0f2218;
    --lantern-mountain3: #142a1f;
}

/* ===== MAIN SCENE ===== */
.lantern-scene {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 72%, rgba(255, 132, 48, 0.18) 0%, rgba(255, 132, 48, 0.07) 20%, rgba(255, 132, 48, 0) 46%),
        radial-gradient(ellipse at 82% 12%, rgba(255, 219, 128, 0.12) 0%, rgba(255, 219, 128, 0) 32%),
        linear-gradient(180deg,
            var(--lantern-sky-top) 0%,
            var(--lantern-sky-mid) 30%,
            var(--lantern-sky-bot) 60%,
            #183123 80%,
            var(--lantern-ground) 100%
        );
}
.lantern-scene::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 38%;
    background: linear-gradient(180deg, rgba(255, 140, 58, 0) 0%, rgba(255, 122, 38, 0.08) 48%, rgba(20, 8, 5, 0.46) 100%);
    pointer-events: none;
    z-index: 5;
}
.lantern-scene::after {
    content: '';
    position: absolute;
    inset: auto 0 0 0;
    height: 21%;
    background:
        linear-gradient(90deg, rgba(255, 126, 44, 0.13), rgba(255, 126, 44, 0.03) 24%, rgba(255, 126, 44, 0.04) 76%, rgba(255, 126, 44, 0.13)),
        linear-gradient(180deg, rgba(255, 195, 94, 0.04), rgba(6, 8, 5, 0.62));
    pointer-events: none;
    z-index: 7;
}

/* ===== WATERMARK ===== */
.lantern-watermark {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    max-width: 800px;
    height: auto;
    pointer-events: none;
    z-index: 2;
}
.lantern-watermark text {
    fill: rgba(255, 200, 120, 0.10);
    font-size: 44px;
    font-weight: 300;
    font-family: 'Georgia', 'Times New Roman', serif;
    letter-spacing: 10px;
    text-transform: uppercase;
}

/* ===== MOON ===== */
.lantern-moon {
    position: absolute;
    top: 6%;
    right: 12%;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff8e1, #ffe082 40%, #ffb300 100%);
    box-shadow: 0 0 30px rgba(255, 224, 130, 0.42), 0 0 90px rgba(255, 183, 77, 0.22);
    z-index: 2;
}

/* ===== STARS ===== */
.lantern-stars {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}
.lantern-stars .star {
    position: absolute;
    border-radius: 50%;
    background: #fff;
    animation: lantern-twinkle 3s ease-in-out infinite alternate;
}
.lantern-stars .star.s-sm { width: 1px; height: 1px; opacity: 0.4; }
.lantern-stars .star.s-md { width: 2px; height: 2px; opacity: 0.6; }
.lantern-stars .star.s-lg { width: 3px; height: 3px; opacity: 0.8; }
@keyframes lantern-twinkle {
    0% { opacity: 0.2; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.2); }
}

/* ===== CLOUDS ===== */
.lantern-clouds {
    position: absolute;
    top: 10%;
    left: 0;
    width: 100%;
    height: 20%;
    z-index: 3;
    pointer-events: none;
}
.lantern-cloud {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 220, 176, 0.055);
    filter: blur(20px);
    animation: lantern-cloud-drift linear infinite;
}
.lantern-cloud.lc1 { width: 200px; height: 40px; top: 20%; left: -10%; animation-duration: 90s; }
.lantern-cloud.lc2 { width: 150px; height: 30px; top: 50%; left: 30%; animation-duration: 110s; animation-delay: -40s; }
.lantern-cloud.lc3 { width: 180px; height: 35px; top: 70%; left: 60%; animation-duration: 80s; animation-delay: -60s; }
@keyframes lantern-cloud-drift {
    from { transform: translateX(0); }
    to { transform: translateX(calc(100vw + 200px)); }
}

/* ===== MOUNTAINS ===== */
.lantern-mountains {
    position: absolute;
    bottom: 18%;
    left: 0;
    width: 100%;
    height: 45%;
    z-index: 4;
    pointer-events: none;
    filter: drop-shadow(0 -18px 28px rgba(255, 116, 36, 0.035));
}
.lantern-mountain {
    position: absolute;
    bottom: 0;
    width: 100%;
}
.lantern-mountain.lm1 {
    height: 100%;
    background: var(--lantern-mountain1);
    clip-path: polygon(0% 100%, 0% 65%, 8% 50%, 18% 58%, 30% 35%, 42% 45%, 55% 25%, 68% 40%, 78% 30%, 88% 42%, 95% 35%, 100% 50%, 100% 100%);
}
.lantern-mountain.lm2 {
    height: 85%;
    background: var(--lantern-mountain2);
    clip-path: polygon(0% 100%, 0% 70%, 12% 55%, 25% 65%, 38% 40%, 50% 55%, 62% 35%, 75% 50%, 85% 40%, 100% 55%, 100% 100%);
}
.lantern-mountain.lm3 {
    height: 65%;
    background: var(--lantern-mountain3);
    clip-path: polygon(0% 100%, 0% 60%, 15% 45%, 30% 55%, 45% 38%, 60% 50%, 75% 35%, 90% 48%, 100% 42%, 100% 100%);
}

/* ===== AMBIENT LANTERNS (CSS background lanterns) ===== */
.lantern-ambient {
    position: absolute;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}
.ambient-lantern {
    position: absolute;
    width: 8px;
    height: 12px;
    border-radius: 12% 12% 20% 20% / 22% 22% 12% 12%;
    background: linear-gradient(90deg, rgba(176, 36, 22, 0.6), rgba(255, 180, 60, 0.9) 48%, rgba(164, 30, 20, 0.6));
    box-shadow: 0 0 6px rgba(255, 160, 50, 0.5), 0 0 12px rgba(255, 120, 30, 0.2);
    animation: ambient-float linear infinite;
    opacity: 0.6;
}
@keyframes ambient-float {
    0% { transform: translateY(0) translateX(0); opacity: 0.6; }
    20% { opacity: 0.8; }
    80% { opacity: 0.7; }
    100% { transform: translateY(calc(-100vh - 50px)) translateX(var(--drift, 20px)); opacity: 0; }
}

/* ===== OLD STREET (Shifen Old Street SVG) ===== */
.lantern-oldstreet {
    position: absolute;
    bottom: 6.6%;
    left: 0;
    width: 100%;
    height: 40%;
    z-index: 6;
    pointer-events: none;
    filter: drop-shadow(0 -12px 26px rgba(255, 104, 35, 0.12));
}
.lantern-oldstreet::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2%;
    height: 31%;
    background: radial-gradient(ellipse at 50% 100%, rgba(255, 158, 68, 0.2), rgba(255, 98, 30, 0.04) 50%, transparent 72%);
    pointer-events: none;
    z-index: 2;
}
.oldstreet-svg {
    width: 100%;
    height: 100%;
    opacity: 1;
    filter: saturate(1.06) contrast(1.08);
}

/* ===== RED LANTERN STRING — now drawn on canvas, hide CSS version ===== */
.lantern-string {
    display: none;
}

/* ===== RAILROAD TRACKS ===== */
.lantern-tracks {
    position: absolute;
    bottom: 7.2%;
    left: 0;
    width: 100%;
    height: 18px;
    z-index: 8;
    pointer-events: none;
}
.lantern-tracks::before,
.lantern-tracks::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, rgba(92, 76, 58, 0.24), rgba(179, 142, 92, 0.58), rgba(92, 76, 58, 0.24));
    box-shadow: 0 0 8px rgba(255, 156, 72, 0.12);
}
.lantern-tracks::before { top: 4px; }
.lantern-tracks::after { top: 13px; }
.track-tie {
    position: absolute;
    top: 2px;
    width: 5px;
    height: 17px;
    background: rgba(68, 44, 27, 0.58);
    transform: skewX(-18deg);
}

/* ===== STREET LAMPS ===== */
.lantern-lamp {
    position: absolute;
    bottom: 10.4%;
    width: 4px;
    z-index: 9;
    pointer-events: none;
}
.lantern-lamp::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 4px;
    height: 56px;
    background: rgba(48, 38, 29, 0.76);
    border-radius: 2px 2px 0 0;
}
.lantern-lamp::after {
    content: '';
    position: absolute;
    bottom: 56px;
    left: -4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 220, 130, 0.8), rgba(255, 180, 80, 0.3) 60%, transparent 100%);
    box-shadow: 0 0 14px rgba(255, 200, 100, 0.52), 0 0 34px rgba(255, 126, 38, 0.18);
}
.lantern-lamp.ll1 { left: 8%; }
.lantern-lamp.ll2 { left: 32%; }
.lantern-lamp.ll3 { left: 58%; }
.lantern-lamp.ll4 { left: 84%; }

/* ===== CATS ===== */
.lantern-cat {
    position: absolute;
    bottom: 12%;
    z-index: 9;
    pointer-events: none;
}
.lantern-cat svg {
    width: 20px;
    height: 16px;
    fill: #1a1a1a;
}
.lantern-cat.cat1 { left: 18%; }
.lantern-cat.cat2 { right: 15%; }

/* ===== TRAIN ===== */
.lantern-train {
    position: absolute;
    bottom: 7.5%;
    z-index: 10;
    pointer-events: none;
    opacity: 0.9;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4));
}
.lantern-train-body {
    display: flex;
    gap: 2px;
}
.train-car-l {
    width: 42px;
    height: 20px;
    background: linear-gradient(180deg, rgba(55, 84, 122, 0.92), rgba(31, 45, 70, 0.92));
    border-radius: 4px 4px 2px 2px;
    position: relative;
    border: 1px solid rgba(167, 130, 72, 0.36);
}
.train-car-l::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 5px;
    right: 5px;
    height: 7px;
    background: rgba(255, 214, 96, 0.42);
    border-radius: 1px;
}
.train-car-l::before {
    content: '';
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 2px;
    height: 2px;
    background: rgba(214, 91, 42, 0.7);
}
.lantern-train.train-a {
    animation: train-pass-lr 34s linear infinite;
}
.lantern-train.train-b {
    bottom: 8.8%;
    transform: scale(0.78);
    opacity: 0.76;
    animation: train-pass-rl 42s linear infinite;
    animation-delay: -14s;
}
.lantern-train.train-c {
    bottom: 6.5%;
    transform: scale(0.92);
    animation: train-pass-lr 52s linear infinite;
    animation-delay: -26s;
}
@keyframes train-pass {
    0% { left: -120px; }
    100% { left: calc(100% + 120px); }
}
@keyframes train-pass-lr {
    0% { left: -260px; }
    100% { left: calc(100% + 260px); }
}
@keyframes train-pass-rl {
    0% { right: -220px; }
    100% { right: calc(100% + 220px); }
}

/* ===== MAIN CANVAS ===== */
.lantern-tree-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 12;
    pointer-events: none;
}

/* ===== FX CANVAS ===== */
.lantern-fx-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 14;
    pointer-events: none;
}

/* ===== TICKER ===== */
.lantern-ticker {
    background: rgba(5, 10, 20, 0.75);
    border-top: 1px solid rgba(255, 160, 50, 0.2);
    color: rgba(255, 200, 120, 0.9);
}

/* ===== TOOLTIP ===== */
.lantern-tooltip {
    position: absolute;
    z-index: 50;
    padding: 10px 14px;
    background: rgba(10, 15, 25, 0.92);
    border: 1px solid rgba(255, 160, 50, 0.4);
    border-radius: 8px;
    color: #ffe0a0;
    font-size: 0.82rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    max-width: 220px;
    line-height: 1.5;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.lantern-tooltip.visible {
    opacity: 1;
}

/* ===== SHOOTING STAR ===== */
.lantern-shooting-star {
    position: absolute;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0.9), transparent);
    border-radius: 1px;
    z-index: 3;
    opacity: 0;
    pointer-events: none;
    transform: rotate(-25deg);
}
.lantern-shooting-star.active {
    animation: lantern-shoot 1.2s ease-out forwards;
}
@keyframes lantern-shoot {
    0% { opacity: 1; transform: rotate(-25deg) translateX(0); }
    100% { opacity: 0; transform: rotate(-25deg) translateX(-180px); }
}
