/* ===== Custom Properties ===== */
:root {
    --sky-top: #05080f;
    --sky-mid: #081510;
    --bg-deep: #040a06;
    --text-main: #d0f0dc;
    --text-dim: #6a9e7a;
    --accent-gold: #e8be5a;
    --ring-color: rgba(130, 215, 165, 0.28);
    --ring-active: rgba(130, 215, 165, 0.6);
    --ripple-color: rgba(130, 215, 165, 0.15);
    --moon-color: #eae6d6;
    --mush-cyan: #40e8c0;
    --mush-gold: #e8c848;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: linear-gradient(
        175deg,
        var(--sky-top) 0%,
        #0a1018 15%,
        #091812 35%,
        var(--sky-mid) 55%,
        var(--bg-deep) 100%
    );
    color: var(--text-main);
    font-family: 'Playfair Display', serif;
    overflow: hidden;
    cursor: default;
    position: relative;
}

/* ===== Sky & Stars ===== */
.sky {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Three star layers with offset twinkle timing */
.stars-1::before, .stars-1::after,
.stars-2::before, .stars-2::after,
.stars-3::before, .stars-3::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.stars-1::before {
    width: 2px; height: 2px;
    top: 3%; left: 5%;
    background: #fff;
    box-shadow:
        0 0 4px 1px rgba(180,200,255,0.3),
        90px 15px 0 0 rgba(255,255,255,0.7),
        220px 40px 0 0 rgba(200,220,255,0.5),
        370px 8px 0 0.5px rgba(255,255,240,0.6),
        510px 55px 0 0 rgba(180,200,255,0.4),
        680px 20px 0 0 rgba(255,255,255,0.6),
        800px 48px 0 0.5px rgba(200,230,255,0.5),
        960px 12px 0 0 rgba(255,255,240,0.7),
        1100px 38px 0 0 rgba(180,200,255,0.4),
        1250px 60px 0 0 rgba(255,255,255,0.5),
        45px 95px 0 0 rgba(255,255,240,0.5),
        175px 120px 0 0.5px rgba(200,220,255,0.4),
        340px 85px 0 0 rgba(255,255,255,0.6),
        490px 110px 0 0 rgba(180,200,255,0.5),
        650px 75px 0 0.5px rgba(255,255,240,0.4),
        790px 130px 0 0 rgba(200,230,255,0.6),
        930px 95px 0 0 rgba(255,255,255,0.4),
        1070px 115px 0 0.5px rgba(255,255,240,0.5),
        1200px 80px 0 0 rgba(200,220,255,0.6);
    animation: twinkle-1 5s ease-in-out infinite alternate;
}

.stars-1::after {
    width: 1.5px; height: 1.5px;
    top: 8%; left: 12%;
    background: #fff;
    box-shadow:
        60px 25px 0 0 rgba(255,255,255,0.45),
        200px 55px 0 0 rgba(200,220,255,0.55),
        350px 15px 0 0 rgba(255,255,240,0.4),
        500px 45px 0 0 rgba(180,200,255,0.5),
        640px 70px 0 0 rgba(255,255,255,0.4),
        780px 30px 0 0 rgba(200,230,255,0.55),
        920px 58px 0 0 rgba(255,255,240,0.45),
        1060px 18px 0 0 rgba(255,255,255,0.5),
        130px 100px 0 0 rgba(200,220,255,0.4),
        280px 130px 0 0 rgba(255,255,240,0.5),
        420px 95px 0 0 rgba(180,200,255,0.45),
        570px 125px 0 0 rgba(255,255,255,0.55),
        710px 105px 0 0 rgba(200,230,255,0.4),
        860px 135px 0 0 rgba(255,255,240,0.5),
        1000px 110px 0 0 rgba(255,255,255,0.45);
    animation: twinkle-2 6s ease-in-out infinite alternate;
}

.stars-2::before {
    width: 2.5px; height: 2.5px;
    top: 2%; left: 30%;
    background: rgba(200,220,255,0.8);
    box-shadow:
        0 0 6px 2px rgba(150,180,255,0.2),
        150px 35px 0 0 rgba(255,255,230,0.7),
        350px 65px 0 0.5px rgba(200,220,255,0.6),
        580px 20px 0 0 rgba(255,255,240,0.5),
        780px 50px 0 0.5px rgba(180,200,255,0.7);
    animation: twinkle-3 7s ease-in-out infinite alternate;
}

.stars-2::after {
    width: 1px; height: 1px;
    top: 6%; left: 18%;
    background: rgba(255,255,255,0.5);
    box-shadow:
        40px 30px 0 0 rgba(255,255,255,0.3),
        110px 65px 0 0 rgba(255,255,255,0.25),
        200px 20px 0 0 rgba(255,255,255,0.35),
        290px 50px 0 0 rgba(255,255,255,0.2),
        380px 75px 0 0 rgba(255,255,255,0.3),
        470px 35px 0 0 rgba(255,255,255,0.25),
        560px 60px 0 0 rgba(255,255,255,0.3),
        650px 25px 0 0 rgba(255,255,255,0.2),
        740px 55px 0 0 rgba(255,255,255,0.35),
        830px 40px 0 0 rgba(255,255,255,0.25),
        920px 70px 0 0 rgba(255,255,255,0.3),
        1010px 30px 0 0 rgba(255,255,255,0.2),
        1100px 62px 0 0 rgba(255,255,255,0.3);
    animation: twinkle-1 4s ease-in-out infinite alternate-reverse;
}

.stars-3::before {
    width: 3px; height: 3px;
    top: 5%; left: 72%;
    background: rgba(255,248,220,0.9);
    border-radius: 50%;
    box-shadow:
        0 0 8px 2px rgba(255,220,150,0.15),
        -300px 40px 0 -0.5px rgba(200,220,255,0.7),
        -600px 15px 0 0 rgba(255,248,220,0.6);
    animation: twinkle-2 8s ease-in-out infinite alternate;
}

@keyframes twinkle-1 { 0% { opacity: 0.5; } 100% { opacity: 1; } }
@keyframes twinkle-2 { 0% { opacity: 0.6; } 100% { opacity: 0.9; } }
@keyframes twinkle-3 { 0% { opacity: 0.4; } 100% { opacity: 1; } }

/* Nebula patches */
.nebula {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(60px);
}

.nebula-1 {
    top: 2%;
    left: 10%;
    width: 40vw;
    height: 25vh;
    background: radial-gradient(ellipse, rgba(60,25,100,0.08) 0%, transparent 70%);
    animation: nebula-pulse 25s ease-in-out infinite alternate;
}

.nebula-2 {
    top: 8%;
    right: 5%;
    width: 35vw;
    height: 20vh;
    background: radial-gradient(ellipse, rgba(20,70,80,0.07) 0%, transparent 70%);
    animation: nebula-pulse 35s ease-in-out infinite alternate-reverse;
}

@keyframes nebula-pulse {
    0%   { opacity: 0.6; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.15); }
}

/* Shooting star */
.shooting-star {
    position: absolute;
    top: 8%;
    left: 20%;
    width: 80px;
    height: 1.5px;
    background: linear-gradient(90deg, rgba(255,255,255,0.8) 0%, transparent 100%);
    border-radius: 1px;
    opacity: 0;
    transform: rotate(-25deg);
    animation: shoot 12s ease-in infinite;
    animation-delay: 8s;
}

@keyframes shoot {
    0%   { opacity: 0; transform: rotate(-25deg) translateX(0); }
    1%   { opacity: 1; }
    4%   { opacity: 0; transform: rotate(-25deg) translateX(300px); }
    100% { opacity: 0; transform: rotate(-25deg) translateX(300px); }
}

/* ===== Moon & God Rays ===== */
.moon-group {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    z-index: 0;
    pointer-events: none;
}

.moon {
    position: absolute;
    top: 45px;
    right: 80px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: radial-gradient(circle at 38% 35%,
        #f5f0e0 0%, #e8e2cc 40%, #d8d0b4 80%, #c8bfa0 100%);
    box-shadow:
        0 0 15px 4px rgba(245,240,225,0.2),
        0 0 40px 8px rgba(245,240,225,0.1);
    overflow: hidden;
}

.moon-glow {
    position: absolute;
    top: 10px;
    right: 48px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(245,240,225,0.06) 0%,
        rgba(245,240,225,0.03) 40%,
        transparent 70%);
}

.moon-crater {
    position: absolute;
    border-radius: 50%;
    background: rgba(0,0,0,0.06);
}

.crater-1 { width: 12px; height: 12px; top: 18px; left: 15px; }
.crater-2 { width: 8px; height: 8px; top: 35px; left: 38px; }
.crater-3 { width: 6px; height: 6px; top: 14px; left: 40px; opacity: 0.5; }

.god-ray {
    position: absolute;
    background: linear-gradient(180deg,
        rgba(245,240,225,0.03) 0%, transparent 100%);
    transform-origin: top center;
    pointer-events: none;
}

.ray-1 {
    top: 85px;
    right: 95px;
    width: 40px;
    height: 45vh;
    transform: rotate(-8deg);
    opacity: 0.7;
    animation: ray-flicker 8s ease-in-out infinite alternate;
}

.ray-2 {
    top: 90px;
    right: 118px;
    width: 25px;
    height: 38vh;
    transform: rotate(-18deg);
    opacity: 0.5;
    animation: ray-flicker 10s ease-in-out infinite alternate-reverse;
}

.ray-3 {
    top: 88px;
    right: 68px;
    width: 30px;
    height: 42vh;
    transform: rotate(5deg);
    opacity: 0.4;
    animation: ray-flicker 12s ease-in-out infinite alternate;
}

@keyframes ray-flicker {
    0%   { opacity: 0.2; }
    50%  { opacity: 0.6; }
    100% { opacity: 0.3; }
}

/* ===== Forest ===== */
.forest-layer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
    pointer-events: none;
}

.trees {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: block;
}

.trees-far {
    height: 50vh;
    opacity: 0.45;
}

.trees-mid {
    height: 42vh;
    opacity: 0.7;
}

.trees-front {
    height: 34vh;
}

/* ===== Ground & Vegetation ===== */
.ground-layer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    pointer-events: none;
    height: 8vh;
}

.ground {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(to bottom, transparent 0%, var(--bg-deep) 30%, #030804 100%);
}

/* Glowing mushrooms */
.mushroom {
    position: absolute;
    bottom: 2vh;
    z-index: 3;
}

.mush-cap {
    width: 10px;
    height: 7px;
    border-radius: 50% 50% 20% 20%;
    position: relative;
}

.mush-stem {
    width: 3px;
    height: 6px;
    margin: 0 auto;
    border-radius: 0 0 2px 2px;
    opacity: 0.5;
}

.mush-glow {
    position: absolute;
    top: -8px;
    left: -10px;
    width: 30px;
    height: 25px;
    border-radius: 50%;
    pointer-events: none;
}

.mush-1 { left: 8%; }
.mush-1 .mush-cap { background: var(--mush-cyan); }
.mush-1 .mush-stem { background: rgba(64,232,192,0.3); }
.mush-1 .mush-glow { background: radial-gradient(circle, rgba(64,232,192,0.15) 0%, transparent 70%); animation: mush-pulse 4s ease-in-out infinite; }

.mush-2 { left: 22%; bottom: 1.5vh; }
.mush-2 .mush-cap { background: var(--mush-gold); width: 8px; height: 5px; }
.mush-2 .mush-stem { background: rgba(232,200,72,0.3); height: 4px; }
.mush-2 .mush-glow { background: radial-gradient(circle, rgba(232,200,72,0.12) 0%, transparent 70%); animation: mush-pulse 5s ease-in-out infinite; animation-delay: -1.5s; width: 24px; height: 20px; }

.mush-3 { right: 15%; }
.mush-3 .mush-cap { background: var(--mush-cyan); width: 12px; height: 8px; }
.mush-3 .mush-stem { background: rgba(64,232,192,0.3); height: 7px; width: 4px; }
.mush-3 .mush-glow { background: radial-gradient(circle, rgba(64,232,192,0.18) 0%, transparent 70%); animation: mush-pulse 4.5s ease-in-out infinite; animation-delay: -3s; width: 35px; height: 30px; left: -12px; top: -10px; }

.mush-4 { right: 30%; bottom: 2.5vh; }
.mush-4 .mush-cap { background: var(--mush-gold); width: 7px; height: 5px; }
.mush-4 .mush-stem { background: rgba(232,200,72,0.3); height: 5px; width: 2px; }
.mush-4 .mush-glow { background: radial-gradient(circle, rgba(232,200,72,0.1) 0%, transparent 70%); animation: mush-pulse 6s ease-in-out infinite; animation-delay: -2s; width: 22px; height: 18px; }

@keyframes mush-pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.2); }
}

/* Ground flowers */
.ground-flower {
    position: absolute;
    bottom: 3vh;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    z-index: 3;
}

.flower-1 { left: 35%; background: rgba(180,140,255,0.5); box-shadow: 0 0 6px 2px rgba(180,140,255,0.15); animation: flower-glow 6s ease-in-out infinite; }
.flower-2 { left: 55%; background: rgba(100,200,255,0.4); box-shadow: 0 0 5px 2px rgba(100,200,255,0.1); animation: flower-glow 7s ease-in-out infinite; animation-delay: -2s; bottom: 2.5vh; }
.flower-3 { left: 75%; background: rgba(180,140,255,0.45); box-shadow: 0 0 6px 2px rgba(180,140,255,0.12); animation: flower-glow 5s ease-in-out infinite; animation-delay: -4s; }
.flower-4 { left: 42%; background: rgba(255,200,150,0.4); box-shadow: 0 0 5px 2px rgba(255,200,150,0.1); animation: flower-glow 8s ease-in-out infinite; animation-delay: -1s; width: 3px; height: 3px; bottom: 3.5vh; }
.flower-5 { left: 88%; background: rgba(100,200,255,0.35); box-shadow: 0 0 4px 2px rgba(100,200,255,0.08); animation: flower-glow 6s ease-in-out infinite; animation-delay: -3s; width: 3px; height: 3px; }

@keyframes flower-glow {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}

/* ===== Mist ===== */
.mist {
    position: fixed;
    left: -25%;
    right: -25%;
    z-index: 3;
    pointer-events: none;
}

.mist-1 {
    bottom: 12%;
    height: 22%;
    background: radial-gradient(ellipse at 25% 50%, rgba(120,170,145,0.12) 0%, transparent 55%),
                radial-gradient(ellipse at 75% 40%, rgba(140,180,155,0.08) 0%, transparent 50%);
    animation: mist-drift 45s ease-in-out infinite alternate;
    opacity: 0.6;
}

.mist-2 {
    bottom: 18%;
    height: 18%;
    background: radial-gradient(ellipse at 60% 50%, rgba(100,150,140,0.1) 0%, transparent 50%),
                radial-gradient(ellipse at 20% 60%, rgba(150,180,170,0.06) 0%, transparent 45%);
    animation: mist-drift 60s ease-in-out infinite alternate-reverse;
    opacity: 0.5;
}

.mist-3 {
    bottom: 8%;
    height: 15%;
    background: radial-gradient(ellipse at 45% 50%, rgba(160,190,170,0.08) 0%, transparent 50%);
    animation: mist-drift 50s ease-in-out infinite alternate;
    animation-delay: -15s;
    opacity: 0.4;
}

@keyframes mist-drift {
    0%   { transform: translateX(0); }
    100% { transform: translateX(6%); }
}

/* ===== Particle Canvas ===== */
#particle-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
}

/* ===== Ripple Layer ===== */
#ripple-layer {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--ripple-color);
    transform: scale(0);
    animation: ripple-expand 2.2s ease-out forwards;
    pointer-events: none;
}

.ripple::after {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 1px solid rgba(130,215,165,0.08);
}

@keyframes ripple-expand {
    0%   { transform: scale(0); opacity: 0.45; }
    100% { transform: scale(1); opacity: 0; }
}

/* ===== Main Layout ===== */
.clearing-container {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 500px;
    width: 100%;
}

/* ===== Back Link ===== */
.back-link {
    position: fixed;
    top: 2rem;
    left: 2rem;
    color: var(--text-dim);
    text-decoration: none;
    font-family: 'Lora', serif;
    font-size: 0.9rem;
    font-style: italic;
    transition: color 0.4s ease;
    z-index: 20;
}

.back-link:hover { color: var(--text-main); }

/* ===== Title ===== */
.clearing-title {
    font-size: clamp(1.2rem, 3.5vw, 1.8rem);
    font-weight: 400;
    margin: 0 0 1rem;
    text-shadow:
        0 0 30px rgba(130,215,165,0.12),
        0 0 60px rgba(130,215,165,0.05);
    letter-spacing: 3px;
    opacity: 0;
    animation: title-in 2.5s ease 0.5s forwards;
}

@keyframes title-in {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ===== Breathing Ring ===== */
.breathing-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.breathing-ring {
    position: relative;
    width: clamp(120px, 22vw, 165px);
    height: clamp(120px, 22vw, 165px);
    border-radius: 50%;
    border: 1.5px solid var(--ring-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    font: inherit;
    color: inherit;
    transition: transform 0.3s ease-out, border-color 0.8s ease, box-shadow 0.8s ease;
    box-shadow:
        0 0 25px rgba(130,215,165,0.05),
        inset 0 0 25px rgba(130,215,165,0.02);
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.breathing-ring:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 8px;
}

.ring-orbit {
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    border: 1px solid rgba(130,215,165,0.06);
    pointer-events: none;
    animation: orbit-spin 30s linear infinite;
}

.ring-orbit::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 50%;
    width: 4px;
    height: 4px;
    margin-left: -2px;
    border-radius: 50%;
    background: rgba(130,215,165,0.4);
    box-shadow: 0 0 8px 2px rgba(130,215,165,0.2);
}

@keyframes orbit-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ring-glow {
    position: absolute;
    inset: -18px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(130,215,165,0.03) 0%, transparent 70%);
    pointer-events: none;
    transition: opacity 1s ease;
}

.ring-inner {
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(130,215,165,0.03) 0%, transparent 65%);
    pointer-events: none;
}

/* Breathing phases */
.breathing-ring.phase-inhale {
    transform: scale(1.18);
    border-color: var(--ring-active);
    box-shadow:
        0 0 50px rgba(130,215,165,0.14),
        0 0 100px rgba(130,215,165,0.05),
        inset 0 0 40px rgba(130,215,165,0.06);
}
.breathing-ring.phase-inhale .ring-glow { opacity: 1; }
.breathing-ring.phase-inhale .ring-orbit { border-color: rgba(130,215,165,0.12); }

.breathing-ring.phase-hold {
    transform: scale(1.18);
    border-color: var(--ring-active);
    box-shadow:
        0 0 50px rgba(130,215,165,0.14),
        0 0 100px rgba(130,215,165,0.05),
        inset 0 0 40px rgba(130,215,165,0.06);
}

.breathing-ring.phase-exhale {
    transform: scale(1);
    border-color: var(--ring-color);
    box-shadow:
        0 0 25px rgba(130,215,165,0.05),
        inset 0 0 25px rgba(130,215,165,0.02);
}
.breathing-ring.phase-exhale .ring-glow { opacity: 0.3; }

.breathing-ring.phase-rest {
    transform: scale(1);
    border-color: var(--ring-color);
}
.breathing-ring.phase-rest .ring-glow { opacity: 0.2; }

.breathing-label {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: clamp(0.85rem, 2.2vw, 1.1rem);
    color: var(--text-main);
    text-align: center;
    pointer-events: none;
    padding: 0 0.6rem;
    line-height: 1.4;
}

.breathing-timer {
    font-family: 'Lora', serif;
    font-size: 0.75rem;
    color: var(--text-dim);
    min-height: 1.2em;
    margin: 0;
    opacity: 0.6;
}

.breathing-mode {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0.2rem 0.6rem;
    opacity: 0.5;
    transition: opacity 0.3s, color 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.breathing-mode:hover {
    opacity: 1;
    color: var(--text-main);
}

/* ===== Affirmation ===== */
.affirmation {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: clamp(0.8rem, 2vw, 1rem);
    color: var(--text-dim);
    text-align: center;
    min-height: 1.5em;
    transition: opacity 1s ease;
    margin: 0.8rem 0 0;
}

.affirmation.fading { opacity: 0; }

/* ===== Sound Toggle ===== */
.sound-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 20;
    background: transparent;
    border: 1px solid rgba(106,158,122,0.3);
    color: var(--text-dim);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s, border-color 0.3s;
    font-size: 1rem;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.sound-toggle:hover {
    color: var(--text-main);
    border-color: rgba(106,158,122,0.6);
}

.sound-toggle:focus-visible {
    color: var(--text-main);
    outline: 2px solid var(--text-main);
    outline-offset: 3px;
}

.sound-toggle[aria-pressed='true'] {
    color: var(--accent-gold);
    border-color: rgba(232,190,90,0.4);
}

/* ===== Bird ===== */
.magic-bird {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 15;
    filter: drop-shadow(0 0 10px rgba(113,227,161,0.35));
    transform-origin: center;
    will-change: transform;
}

.bird-tail {
    transform-origin: 10px 50px;
    animation: tailWag 3s ease-in-out infinite;
}

@keyframes tailWag {
    0%, 100% { transform: rotate(0deg); }
    50%      { transform: rotate(-5deg); }
}

.is-flying .bird-wing-back {
    transform-origin: 30px 40px;
    animation: wingFlapBack 0.15s infinite alternate linear;
}

.is-flying .bird-wing-front {
    transform-origin: 20px 40px;
    animation: wingFlapFront 0.15s infinite alternate linear;
}

@keyframes wingFlapBack {
    0%   { transform: rotate(-5deg) scaleY(1); }
    100% { transform: rotate(-45deg) scaleY(-1); }
}

@keyframes wingFlapFront {
    0%   { transform: rotate(5deg) scaleY(1); }
    100% { transform: rotate(45deg) scaleY(-1); }
}

.sparkle {
    opacity: 0;
    transform-origin: center;
}

.is-perched .sparkle {
    animation: twinkle-sparkle 2s ease-in-out infinite;
}

.is-perched .s2 { animation-delay: 0.5s; }
.is-perched .s3 { animation-delay: 1s; }

@keyframes twinkle-sparkle {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50%      { opacity: 1; transform: scale(1.2); }
}

.is-flying .bird-tail {
    animation: tailFlap 0.2s infinite alternate linear;
}

@keyframes tailFlap {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(10deg); }
}

/* ===== Clouds ===== */
.cloud {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(200,210,200,0.04) 0%, transparent 70%);
    pointer-events: none;
    filter: blur(8px);
}

.cloud-1 {
    top: 25px;
    right: -120px;
    width: 160px;
    height: 50px;
    animation: cloud-drift 80s linear infinite;
}

.cloud-2 {
    top: 70px;
    right: -180px;
    width: 200px;
    height: 40px;
    opacity: 0.6;
    animation: cloud-drift 110s linear infinite;
    animation-delay: -40s;
}

@keyframes cloud-drift {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-500px); }
}

/* ===== Spawned Flowers ===== */
.flower-bed {
    position: fixed;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    overflow: hidden;
}

.spawned-flower {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    transform: scale(0);
    animation: flower-bloom 8s ease forwards;
}

.spawned-flower::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 1px;
    height: 12px;
    background: rgba(80,160,100,0.4);
    transform: translateX(-50%);
    transform-origin: bottom center;
}

.spawned-flower::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    pointer-events: none;
}

.spawned-flower.color-violet {
    background: rgba(180,140,255,0.7);
    box-shadow: 0 0 8px 3px rgba(180,140,255,0.2);
}
.spawned-flower.color-violet::after {
    background: radial-gradient(circle, rgba(180,140,255,0.1) 0%, transparent 70%);
}

.spawned-flower.color-blue {
    background: rgba(100,200,255,0.7);
    box-shadow: 0 0 8px 3px rgba(100,200,255,0.2);
}
.spawned-flower.color-blue::after {
    background: radial-gradient(circle, rgba(100,200,255,0.1) 0%, transparent 70%);
}

.spawned-flower.color-gold {
    background: rgba(255,210,100,0.7);
    box-shadow: 0 0 8px 3px rgba(255,210,100,0.2);
}
.spawned-flower.color-gold::after {
    background: radial-gradient(circle, rgba(255,210,100,0.1) 0%, transparent 70%);
}

.spawned-flower.color-pink {
    background: rgba(255,160,180,0.7);
    box-shadow: 0 0 8px 3px rgba(255,160,180,0.2);
}
.spawned-flower.color-pink::after {
    background: radial-gradient(circle, rgba(255,160,180,0.1) 0%, transparent 70%);
}

@keyframes flower-bloom {
    0%   { transform: scale(0); opacity: 0; }
    15%  { transform: scale(1.2); opacity: 1; }
    20%  { transform: scale(1); }
    80%  { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(0.5); opacity: 0; }
}

/* ===== Interactive Mushrooms ===== */
.mushroom { cursor: pointer; pointer-events: auto; transition: filter 0.3s; }
.mushroom:hover .mush-glow { opacity: 1 !important; transform: scale(1.5); }
.mushroom:hover .mush-cap { filter: brightness(1.4); }

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }

    .mist, .nebula, .shooting-star,
    .god-ray, .ring-orbit, .cloud { display: none; }
    #particle-canvas { display: none; }
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .back-link { top: 1rem; left: 1rem; font-size: 0.8rem; }
    .sound-toggle { top: 1rem; right: 1rem; }
    .moon { width: 45px; height: 45px; }
    .trees-far  { height: 40vh; }
    .trees-mid  { height: 34vh; }
    .trees-front { height: 26vh; }
    .god-ray { display: none; }
}

@media (max-height: 550px) {
    .clearing-title { font-size: 1.1rem; margin-bottom: 0.5rem; }
    .breathing-ring { width: 100px; height: 100px; }
    .affirmation { margin-top: 0.4rem; }
    .trees-far  { height: 35vh; }
    .trees-mid  { height: 28vh; }
    .trees-front { height: 22vh; }
    .thought-jar { margin-top: 0.3rem; }
    .mood-question { font-size: 1rem; }
    .mood-btn { padding: 0.4rem 0.6rem; }
}

/* ===== Seasonal Custom Properties ===== */
body.season-spring {
    --sky-top: #0a0812;
    --sky-mid: #12180e;
    --bg-deep: #080a04;
    --ring-color: rgba(200, 180, 215, 0.28);
    --ring-active: rgba(200, 180, 215, 0.6);
    --ripple-color: rgba(220, 180, 200, 0.15);
}

body.season-summer {
    --sky-top: #080c05;
    --sky-mid: #0c1a0a;
    --bg-deep: #060a04;
    --ring-color: rgba(180, 215, 130, 0.28);
    --ring-active: rgba(180, 215, 130, 0.6);
    --ripple-color: rgba(180, 220, 130, 0.15);
    --mush-cyan: #50f0d0;
    --mush-gold: #f0d050;
}

body.season-autumn {
    --sky-top: #0c0806;
    --sky-mid: #14100a;
    --bg-deep: #080604;
    --ring-color: rgba(215, 165, 100, 0.28);
    --ring-active: rgba(215, 165, 100, 0.6);
    --ripple-color: rgba(215, 165, 100, 0.15);
    --accent-gold: #d4944a;
    --mush-cyan: #c8a050;
    --mush-gold: #d08830;
    --text-dim: #9e8a6a;
}

body.season-winter {
    --sky-top: #060a12;
    --sky-mid: #081018;
    --bg-deep: #040610;
    --ring-color: rgba(160, 190, 220, 0.28);
    --ring-active: rgba(160, 190, 220, 0.6);
    --ripple-color: rgba(160, 190, 220, 0.15);
    --text-main: #d0e0f0;
    --text-dim: #6a8a9e;
    --accent-gold: #8ab4d8;
    --mush-cyan: #60a8d0;
    --mush-gold: #a0c0e0;
}

body.season-winter .ground {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--bg-deep) 30%,
        #0a0e18 100%
    );
}

body.season-winter .mushroom .mush-cap {
    box-shadow: 0 -1px 0 1px rgba(200, 220, 240, 0.3);
}

body.season-autumn .ground {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--bg-deep) 30%,
        #0a0804 100%
    );
}

body.season-spring .nebula-1 {
    background: radial-gradient(
        ellipse,
        rgba(120, 50, 80, 0.08) 0%,
        transparent 70%
    );
}

/* ===== Mood Check-in ===== */
.mood-checkin {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 10, 6, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 1;
    transition: opacity 1.2s ease;
    padding: 1rem;
}

.mood-checkin.fade-out {
    opacity: 0;
    pointer-events: none;
}

.mood-checkin.hidden { display: none; }

.mood-inner {
    text-align: center;
    max-width: 380px;
    width: 100%;
    animation: title-in 1.5s ease forwards;
}

.mood-question {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.2rem, 3.5vw, 1.6rem);
    font-weight: 400;
    color: var(--text-main);
    margin: 0 0 1.6rem;
    letter-spacing: 1px;
    text-shadow: 0 0 30px rgba(130, 215, 165, 0.12);
}

.mood-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
}

.mood-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(130, 215, 165, 0.15);
    background: rgba(130, 215, 165, 0.04);
    color: var(--text-main);
    font-family: 'Lora', serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition:
        border-color 0.4s ease,
        background 0.4s ease,
        transform 0.2s ease,
        box-shadow 0.4s ease;
    -webkit-tap-highlight-color: transparent;
}

.mood-btn:hover, .mood-btn:focus-visible {
    border-color: rgba(130, 215, 165, 0.5);
    background: rgba(130, 215, 165, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(130, 215, 165, 0.1);
}

.mood-btn:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 3px;
}

.mood-emoji {
    font-size: 1.6rem;
    line-height: 1;
}

.mood-label {
    font-style: italic;
    opacity: 0.8;
}

.mood-skip {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.4rem 0.8rem;
    opacity: 0.5;
    transition: opacity 0.3s, color 0.3s;
    -webkit-tap-highlight-color: transparent;
}

.mood-skip:hover { opacity: 1; color: var(--text-main); }

/* ===== Thought Jar ===== */
.thought-jar {
    margin-top: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    animation: title-in 2s ease 1.5s forwards;
}

.thought-label {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: clamp(0.7rem, 1.8vw, 0.85rem);
    color: var(--text-dim);
    opacity: 0.6;
}

.thought-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 320px;
}

.thought-input {
    flex: 1;
    background: rgba(130, 215, 165, 0.04);
    border: 1px solid rgba(130, 215, 165, 0.12);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    color: var(--text-main);
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.4s, box-shadow 0.4s;
    -webkit-tap-highlight-color: transparent;
}

.thought-input::placeholder {
    color: var(--text-dim);
    opacity: 0.4;
}

.thought-input:focus {
    border-color: rgba(130, 215, 165, 0.35);
    box-shadow: 0 0 20px rgba(130, 215, 165, 0.06);
}

.thought-release {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(130, 215, 165, 0.15);
    background: rgba(130, 215, 165, 0.04);
    color: var(--text-main);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        border-color 0.3s,
        background 0.3s,
        transform 0.2s;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.thought-release:hover {
    border-color: rgba(130, 215, 165, 0.5);
    background: rgba(130, 215, 165, 0.1);
    transform: scale(1.1);
}

.thought-release:focus-visible {
    outline: 2px solid var(--text-main);
    outline-offset: 3px;
}

/* Released thought firefly */
.thought-firefly {
    position: fixed;
    z-index: 50;
    pointer-events: none;
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 0.8rem;
    color: var(--accent-gold);
    text-shadow: 0 0 12px rgba(232, 190, 90, 0.5);
    white-space: nowrap;
    animation: thought-rise 6s ease-out forwards;
}

.thought-firefly::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(245, 215, 90, 0.25) 0%,
        rgba(245, 215, 90, 0.08) 40%,
        transparent 70%
    );
    transform: translate(-50%, -50%);
    pointer-events: none;
}

@keyframes thought-rise {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
    30% {
        opacity: 0.9;
        transform: translateY(-60px) scale(0.9);
    }
    60% {
        opacity: 0.5;
        transform: translateY(-150px) scale(0.6);
        filter: blur(0.5px);
    }
    100% {
        opacity: 0;
        transform: translateY(-280px) scale(0.2);
        filter: blur(2px);
    }
}

/* ===== Constellation Canvas ===== */
#constellation-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* ===== Visit Counter ===== */
.visit-counter {
    position: fixed;
    bottom: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 0.7rem;
    color: var(--text-dim);
    opacity: 0;
    margin: 0;
    z-index: 20;
    pointer-events: none;
    animation: title-in 3s ease 3s forwards;
    white-space: nowrap;
}

/* ===== Mood-driven scene adjustments ===== */
body.mood-anxious {
    --ring-color: rgba(130, 175, 215, 0.28);
    --ring-active: rgba(130, 175, 215, 0.6);
}

body.mood-tired .clearing-container {
    filter: brightness(0.9);
}

body.mood-restless .breathing-ring {
    animation: gentle-pulse 4s ease-in-out infinite;
}

@keyframes gentle-pulse {
    0%, 100% { box-shadow: 0 0 25px rgba(130, 215, 165, 0.05); }
    50% { box-shadow: 0 0 40px rgba(130, 215, 165, 0.12); }
}

body.mood-sad {
    --ring-color: rgba(160, 140, 200, 0.28);
    --ring-active: rgba(160, 140, 200, 0.6);
    --ripple-color: rgba(160, 140, 200, 0.15);
}

/* ===== Bird enrichment states ===== */
.is-perched .bird-head {
    animation: bird-head-tilt 5s ease-in-out infinite;
}

@keyframes bird-head-tilt {
    0%, 40%, 100% { transform: rotate(0deg); }
    45% { transform: rotate(-8deg) translateY(-1px); }
    55% { transform: rotate(-8deg) translateY(-1px); }
    60% { transform: rotate(0deg); }
}

.is-perched .bird-body {
    animation: bird-breathe 3s ease-in-out infinite;
}

@keyframes bird-breathe {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.03); }
}

/* Bird leaf */
.bird-leaf {
    opacity: 0;
    transition: opacity 0.6s ease;
    transform-origin: 85px 38px;
}

.is-perched .bird-leaf {
    opacity: 1;
    animation: leaf-dangle 4s ease-in-out infinite;
}

@keyframes leaf-dangle {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(5deg); }
}

@media (max-width: 480px) {
    .mood-options { gap: 0.4rem; }
    .mood-btn { padding: 0.5rem 0.7rem; }
    .mood-emoji { font-size: 1.3rem; }
    .thought-input-row { max-width: 280px; }
    .visit-counter { font-size: 0.65rem; bottom: 0.8rem; }
}
