/* --- DYNAMIC CSS SKY BACKGROUND & FONTS --- */
body { 
    background: linear-gradient(to bottom, #87CEEB 0%, #F0F8FF 100%);
    font-family: 'Quicksand', 'Varela Round', 'Verdana', 'Geneva', system-ui, -apple-system, sans-serif; 
    color: #0A1931; 
    display: flex; flex-direction: column; align-items: center; justify-content: space-between; 
    height: 100dvh; 
    margin: 0; padding: 30px 0 0 0; box-sizing: border-box; position: relative; overflow: hidden; 
}

/* --- ARTIFICIAL CSS CLOUDS --- */
#sky-background { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden; }
.cloud { position: absolute; background: rgba(255, 255, 255, 0.6); border-radius: 100px; filter: blur(15px); animation: drift 60s ease-in-out infinite alternate; }
.cloud::after, .cloud::before { content: ''; position: absolute; background: inherit; border-radius: 50%; }

.cloud-1 { width: 300px; height: 100px; top: 10%; left: 10%; }
.cloud-1::after { width: 150px; height: 150px; top: -70px; left: 30px; }
.cloud-1::before { width: 120px; height: 120px; top: -40px; left: 140px; }

.cloud-2 { width: 200px; height: 70px; top: 30%; right: 10%; transform: scale(0.7); opacity: 0.5;}
.cloud-2::after { width: 90px; height: 90px; top: -45px; left: 20px; }
.cloud-2::before { width: 70px; height: 70px; top: -20px; left: 90px; }

.cloud-3 { width: 400px; height: 120px; bottom: 15%; left: 5%; transform: scale(1.1); opacity: 0.7;}
.cloud-3::after { width: 180px; height: 180px; top: -80px; left: 40px; }
.cloud-3::before { width: 150px; height: 150px; top: -50px; left: 190px; }

@keyframes drift { from { transform: translateX(0); } to { transform: translateX(40px); } }
.cloud-2 { animation-duration: 90s; animation-delay: -30s; }
.cloud-3 { animation-duration: 120s; animation-delay: -10s; }

/* --- DISPLAY AREA --- */
#display-area { text-align: center; flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 10; width: 100%; padding-bottom: 20px;}
#status { font-size: 2.8rem; font-weight: bold; color: #0A1931; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 2px; min-height: 3.5rem; transition: font-size 0.3s ease;}
.status-small { font-size: 1.8rem !important; margin-top: 10px; }

#app-desc { font-size: 1.1rem; font-weight: 500; opacity: 0.8; max-width: 500px; margin: 0 auto 20px auto; line-height: 1.4; color: #0A1931; padding: 0 20px;}
#counter { font-size: 1.3rem; margin-bottom: 20px; min-height: 2.5em; color: #0A1931; font-weight: 800; line-height: 1.5; width: 90%; max-width: 600px; transition: opacity 0.2s;}

/* --- PACER & TIMER --- */
#pacer-container { height: min(350px, 35vh); width: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; position: relative;}

#circle { 
    width: 150px; height: 150px; background: rgba(255, 255, 255, 0.15); border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); 
    border: 3px solid rgba(255, 255, 255, 0.5); 
    font-family: 'Quicksand', sans-serif; font-size: 4.5rem; font-weight: 400; color: #ffffff; 
    text-shadow: 0 0 20px rgba(255,255,255,0.8); opacity: 0; z-index: 5;
}

.inhale { transform: scale(2.2); background-color: rgba(0, 191, 255, 0.3); box-shadow: 0 0 80px rgba(0, 191, 255, 0.8); opacity: 1 !important; }
.exhale { transform: scale(0.5); background-color: rgba(255, 182, 193, 0.3) !important; box-shadow: 0 0 25px rgba(255, 182, 193, 0.5) !important; opacity: 1 !important; }

/* OUTRO ANIMATION */
@keyframes outroPulse {
    0% { transform: scale(0.7); box-shadow: 0 0 20px rgba(255, 255, 255, 0.3); opacity: 0.8; background-color: rgba(255, 255, 255, 0.1); }
    50% { transform: scale(1.1); box-shadow: 0 0 50px rgba(255, 255, 255, 0.9); opacity: 1; background-color: rgba(255, 255, 255, 0.3); }
    100% { transform: scale(0.7); box-shadow: 0 0 20px rgba(255, 255, 255, 0.3); opacity: 0.8; background-color: rgba(255, 255, 255, 0.1); }
}
.outro-mode { animation: outroPulse 6s ease-in-out infinite !important; opacity: 1 !important; }

/* Premium Digital Widget */
#timer { 
    position: absolute; display: none; z-index: 15;
    font-family: 'Quicksand', sans-serif; font-variant-numeric: tabular-nums; 
    font-weight: 700; letter-spacing: 2px; color: #0A1931; 
    font-size: min(5rem, 16vw); 
    background: rgba(255, 255, 255, 0.25);
    padding: 15px 40px; border-radius: 25px;
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 0 40px rgba(255, 255, 255, 0.4);
}

/* --- TAP ZONE --- */
#tap-zone { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 20; cursor: pointer; }

/* --- CONTROLS --- */
#controls { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; z-index: 30; padding-bottom: max(30px, env(safe-area-inset-bottom)); gap: 15px;}
.btn-row { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; }
button { padding: 18px 35px; font-size: 1.1rem; cursor: pointer; background: #0A1931; color: #E0F7FA; border: none; border-radius: 50px; font-weight: bold; transition: 0.3s; text-transform: uppercase; letter-spacing: 1px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
button:hover { background: #1a365d; transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
.btn-secondary { background: rgba(255,255,255,0.6); color: #0A1931; border: 2px solid #0A1931; backdrop-filter: blur(5px); }
.btn-preview { padding: 8px 12px; font-size: 1rem; border-radius: 12px; margin-left: 10px; box-shadow: none;}
#mainBtn.btn-start { font-size: 1.4rem; padding: 22px 60px; background: #00BFFF; color: #0A1931; }

.hidden { display: none !important; opacity: 0; }
.btn-stop { position: fixed; top: 20px; right: 20px; background: white; color: #ff4757; border: 2px solid #ff4757; padding: 10px 20px; font-size: 0.9rem; border-radius: 50px; z-index: 50; box-shadow: none; opacity: 0.7;}
.btn-stop:hover { opacity: 1; }

.stats-container { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; width: 100%; align-items: center; }
.stat-pill { background: rgba(255, 255, 255, 0.7); border-radius: 50px; padding: 15px 25px; display: flex; justify-content: space-between; align-items: center; width: 100%; max-width: 350px; border: 1px solid rgba(255,255,255,0.9); font-size: 1.2rem; font-weight: 700; color:#0A1931; }

/* --- MODALS & SETTINGS UI --- */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(224, 247, 250, 0.96); backdrop-filter: blur(12px); z-index: 100; display: flex; flex-direction: column; align-items: center; padding: 40px 20px; box-sizing: border-box; overflow-y: auto; color: #0A1931;}
.settings-card { background: white; border-radius: 20px; padding: 25px; width: 100%; max-width: 500px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); margin-bottom: 20px; text-align: left; }
.settings-card h3 { margin-top: 0; color: #00BFFF; text-transform: uppercase; letter-spacing: 1px; border-bottom: 2px solid #E0F7FA; padding-bottom: 10px; font-size: 1rem;}
.setting-row { display: flex; flex-direction: column; align-items: stretch; margin-bottom: 15px; font-weight: bold; font-size: 1.1rem; color: #0A1931;}
.setting-header { display: flex; justify-content: space-between; align-items: center; width: 100%; }

.setting-divider { border: 0; height: 2px; background: linear-gradient(to right, transparent, rgba(0, 191, 255, 0.4), transparent); margin: 25px 0; }
.sub-setting-card { background: rgba(224, 247, 250, 0.3); border-left: 4px solid #00BFFF; padding: 15px; border-radius: 0 10px 10px 0; margin-top: 15px; }

.sub-header { display: flex; justify-content: flex-start; align-items: center; gap: 12px; font-size: 0.95rem; font-weight: bold; color: #0A1931; }
.custom-checkbox { width: 22px; height: 22px; cursor: pointer; accent-color: #00BFFF; margin: 0; }

input[type="range"] { -webkit-appearance: none; width: 100%; height: 8px; border-radius: 5px; background: #E0F7FA; outline: none; margin-top: 10px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #00BFFF; cursor: pointer; transition: 0.2s; }
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

.switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #00BFFF; }
input:checked + .slider:before { transform: translateX(22px); }

.radio-group { display: flex; justify-content: space-between; background: #f0f8ff; border-radius: 50px; padding: 5px; margin-top: 10px; }
.radio-group label { flex: 1; text-align: center; cursor: pointer; position: relative; }
.radio-group input { display: none; }
.radio-group span { display: block; padding: 10px; border-radius: 50px; font-size: 0.95rem; transition: 0.3s; color: #0A1931; }
.radio-group input:checked + span { background: #0A1931; color: white; }

select { flex-grow: 1; padding: 10px; border-radius: 10px; border: 2px solid #E0F7FA; font-family: 'Quicksand'; font-weight: bold; font-size: 1rem; color: #0A1931; outline: none; background: white; margin: 0;}

.login-input { width: 100%; padding: 15px; border-radius: 10px; border: 2px solid #E0F7FA; margin-bottom: 15px; font-size: 1.1rem; box-sizing: border-box; color: #0A1931;}
.settings-btn-group { display: flex; gap: 10px; width: 100%; max-width: 500px; margin-bottom: 40px; }

.tabs { display: flex; background: rgba(10, 25, 49, 0.1); border-radius: 50px; padding: 5px; margin-bottom: 25px; }
.tab-btn { padding: 10px 30px; border-radius: 50px; font-size: 1rem; font-weight: bold; cursor: pointer; border: none; background: transparent; color: #0A1931; transition: 0.3s;}
.tab-btn.active { background: #0A1931; color: white; }

/* CALENDAR STACKED BAR CHART */
#chart-container { display: flex; gap: 20px; overflow-x: auto; width: 95%; max-width: 1000px; padding: 30px 20px; border-radius: 20px; background: rgba(255, 255, 255, 0.6); align-items: flex-end; height: 280px; flex-direction: row-reverse; }
.chart-session { display: flex; flex-direction: column; align-items: center; min-width: 80px; height: 100%; justify-content: flex-end; }
.bars-wrapper { display: flex; align-items: flex-end; justify-content: center; gap: 5px; height: 180px; width: 100%; border-bottom: 2px solid rgba(10, 25, 49, 0.2); padding-bottom: 10px; }
.bar { width: 25px; background: linear-gradient(to top, #00BFFF, rgba(0,191,255,0.4)); border-radius: 5px 5px 0 0; transition: height 0.5s ease; position: relative; display: flex; justify-content: center; cursor: pointer; }
.bar-label { position: absolute; top: -22px; font-size: 0.75rem; font-weight: bold; color: #0A1931; }
.session-date { font-size: 0.85rem; color: #0A1931; text-align: center; margin-top: 15px; font-weight: 700; opacity: 0.9;}

#calendar-view { width: 100%; max-width: 450px; display: flex; flex-direction: column; align-items: center; }
.cal-header { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 15px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; width: 100%; text-align: center; background: rgba(255, 255, 255, 0.7); padding: 20px; border-radius: 20px; }
.cal-day-name { font-weight: bold; opacity: 0.8; font-size: 0.9rem; color:#0A1931;}
.cal-day { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; margin: auto; border-radius: 50%; font-weight: 700; cursor: pointer; transition: 0.2s; color:#0A1931; }
.cal-day:hover:not(.empty) { background: rgba(255,255,255,0.9); transform: scale(1.1); }
.empty { opacity: 0; pointer-events: none; }
.has-session { background: rgba(0, 191, 255, 0.3); border: 2px solid #00BFFF; }
.has-session.selected { background: #00BFFF; color: white; }
#day-details { margin-top: 20px; width: 100%; background: white; border-radius: 20px; padding: 25px; box-sizing: border-box; text-align: left; }
.details-header { border-bottom: 2px solid #E0F7FA; padding-bottom: 10px; margin-top: 0;}
.session-block { margin-bottom: 15px; padding: 15px; background: #f8f9fa; border-radius: 12px; }
.round-detail { display: flex; justify-content: space-between; border-bottom: 1px solid #eee; padding: 4px 0;}