/* CSS Reset & Basics */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Lora', serif;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: #FDFBF7; 
    color: #333;
}

/* Layering */
#atmosphere {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 1;
    transition: background-color 2s ease;
}
#watercolor-canvas {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 10;
    pointer-events: auto; /* Allow drawing */
}
#ui-layer {
    position: absolute; top: 0; left: 0; width: 100%; min-height: 100vh;
    z-index: 20;
    pointer-events: none;
    display: flex; justify-content: center; align-items: center; text-align: center;
}

/* Screen Management */
.screen {
    position: absolute; top:0; left: 0; width: 100%; min-height: 100vh;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: opacity 2s ease, visibility 2s;
    pointer-events: auto;
    padding: 20px;
}
.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

/* Theme Toggle & Audio */
.theme-toggle-btn, .audio-toggle-btn {
    pointer-events: auto; opacity: 0.5; margin-top: 0 !important;
}

/* Themes */
.day-mode { background: linear-gradient(to bottom, #CADDF0 0%, #FDFBF7 100%); }
.night-mode { background-color: #0F172A; color: #E2E8F0; }

/* Glowing Breathing Circle */
#breathing-circle {
    width: 120px; height: 120px; border-radius: 50%;
    background: radial-gradient(circle, rgba(153, 204, 255, 0.4) 0%, rgba(153, 204, 255, 0) 80%);
    box-shadow: 0 0 40px 20px rgba(153, 204, 255, 0.2);
    margin-bottom: 40px; transform: scale(1);
}
.night-mode #breathing-circle {
    box-shadow: 0 0 60px 30px rgba(153, 204, 255, 0.4);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 80%);
}

#breathing-text {
    font-size: 20px; font-style: italic; opacity: 0.7; transition: opacity 1s;
}

/* Atmosphere Elements */
#sky-elements { width: 100%; height: 100%; position: relative; }

.drifting-cloud {
    position: absolute;
    animation-name: drift;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes drift {
    0% { transform: translateX(-50vw); opacity: 0; }
    10% { opacity: 0.8; }
    90% { opacity: 0.8; }
    100% { transform: translateX(120vw); opacity: 0; }
}

.star {
    position: absolute; background: white; border-radius: 50%;
    animation: twinkle 5s infinite alternate;
}
@keyframes twinkle { 0% { opacity: 0.1; } 50% { opacity: 0.8; } 100% { opacity: 0.2; } }
.constellation-star { opacity: 0.5; }

.shooting-star {
    position: absolute;
    height: 1px;
    background: linear-gradient(to left, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%);
    transform: rotate(135deg);
    animation: shoot 1.5s ease-in forwards;
}
.shooting-star::after {
    content: ''; position: absolute;
    right: 0; top: -2px;
    width: 5px; height: 5px; background: white;
    border-radius: 50%; box-shadow: 0 0 12px 4px rgba(255, 255, 255, 0.9);
}
@keyframes shoot {
    0% { transform: rotate(135deg) translateX(0); opacity: 0; width: 0px; }
    10% { opacity: 1; width: 150px; }
    100% { transform: rotate(135deg) translateX(800px); opacity: 0; width: 150px; }
}
.faint-heart { width: 24px; height: 24px; color: rgba(0,0,0,0.05); }

/* Typography & Animations */
h1 { font-size: clamp(20px, 4vw, 28px); font-weight: 400; letter-spacing: 0.05em; margin-bottom: 30px; }
.fade-in-slow { animation: fadeIn 3s ease forwards; }
.fade-in-delayed { opacity: 0; animation: fadeIn 3s ease 3s forwards; }
@keyframes fadeIn { to { opacity: 1; } }

/* Buttons */
button {
    background: transparent; border: 1px solid rgba(0,0,0,0.1);
    padding: 12px 30px; border-radius: 30px; font-family: 'Lora', serif;
    font-size: 16px; color: inherit; cursor: pointer; transition: all 0.3s ease;
}
button:hover { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.3); }
.night-mode button { border-color: rgba(255,255,255,0.2); }
.night-mode button:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.4); }
.subtle-btn { border: none; opacity: 0.4; font-size: 14px; text-decoration: underline; margin-top: 40px; }
.subtle-btn:hover { background: transparent; opacity: 0.8; }

/* Responsive Sanctuary Layout */
.sanctuary-layout {
    display: flex; flex-direction: column-reverse; 
    align-items: center; justify-content: center;
    width: 100%; max-width: 1200px; gap: 40px; padding: 40px 20px;
    min-height: 100vh;
}

@media (min-width: 900px) {
    .sanctuary-layout {
        flex-direction: row; justify-content: space-between;
        padding: 60px;
    }
}

.text-pane {
    flex: 1; display: flex; flex-direction: column; justify-content: center;
    max-width: 600px; text-align: left; z-index: 21;
}

.quote-container { margin: 40px 0; }
blockquote {
    font-size: clamp(24px, 4vw, 42px); line-height: 1.6;
    font-family: 'Playfair Display', 'Lora', serif;
    white-space: pre-wrap; margin-bottom: 20px;
}
#daily-author {
    font-size: clamp(20px, 3vw, 28px); font-family: 'Caveat', cursive; opacity: 0.8;
}

.art-pane {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    max-width: 500px; z-index: 21;
}
#daily-art-img {
    width: 100%; max-height: 60vh; object-fit: contain;
    border-radius: 8px; box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}
.night-mode #daily-art-img { box-shadow: 0 20px 40px rgba(0,0,0,0.4); }

.art-credit {
    margin-top: 15px; font-size: 12px; font-style: italic; opacity: 0.5;
}

/* Magical Cursive Playback */
#cursive-playback-container { 
    position: fixed; 
    z-index: 9999;
    pointer-events: none;
    max-width: 90vw;
    padding: 60px; /* Space for the fog */
    background: radial-gradient(ellipse at center, rgba(253, 251, 247, 0.95) 0%, rgba(253, 251, 247, 0.7) 40%, rgba(253, 251, 247, 0) 70%);
}
.night-mode #cursive-playback-container {
    background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.7) 40%, rgba(15, 23, 42, 0) 70%);
}
#cursive-text {
    font-family: 'Caveat', cursive; font-size: clamp(24px, 4vw, 36px); line-height: 1.4;
    color: rgba(0,0,0,0.7);
    text-shadow: 0 0 10px #FDFBF7, 0 0 20px #FDFBF7, 0 0 30px #FDFBF7;
}
.night-mode #cursive-text { 
    color: rgba(255,255,255,0.7); 
    text-shadow: 0 0 10px #0F172A, 0 0 20px #0F172A, 0 0 30px #0F172A;
}

/* Journal Input */
#journal-container { display: flex; flex-direction: column; width: 100%; gap: 15px; margin-top: 40px; }
#journal-container label { font-style: italic; font-size: 16px; opacity: 0.7; }
#journal-input {
    width: 100%; padding: 15px 0; border: none; border-bottom: 1px solid rgba(0,0,0,0.2);
    background: transparent; font-family: 'Lora', serif; font-size: 18px;
    resize: none; outline: none; color: inherit; line-height: 1.5;
}
.night-mode #journal-input { border-bottom-color: rgba(255,255,255,0.3); }
#journal-input:focus { border-bottom-color: rgba(0,0,0,0.6); }
.night-mode #journal-input:focus { border-bottom-color: rgba(255,255,255,0.7); }


/* Top Right Controls */
.top-controls { position: fixed; top: 20px; right: 20px; z-index: 1000; display: flex; gap: 20px; }
.top-controls .subtle-btn { margin-top: 0 !important; pointer-events: auto; opacity: 0.6; }
