/* --- 1. Global Variables & Reset --- */
:root {
    --primary-color: #ba4949; 
    --text-color: #4a4a4a;
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Fredoka', sans-serif; 
}

/* --- 2. Animated Backgrounds & Themes --- */
body {
    height: 100vh;
    height: var(--app-height, 100vh);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
    /* SMOOTH THEME TRANSITION */
    transition: background 3s ease-in-out;
    overflow: hidden; 
    position: relative; 
    
    background: linear-gradient(45deg, #ba4949, #e66465, #ff9a9e);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;

    cursor: default; 
}

/* --- EXISTING THEMES --- */
body.theme-pink { --primary-color: #ff9a9e; background: linear-gradient(45deg, #ff9a9e, #fecfef, #feada6); }
body.theme-purple { --primary-color: #6c5ce7; background: linear-gradient(45deg, #6c5ce7, #a29bfe, #74b9ff); }
body.theme-green { --primary-color: #00b894; background: linear-gradient(45deg, #00b894, #55efc4, #81ecec); }
body.theme-orange { --primary-color: #fdcb6e; background: linear-gradient(45deg, #fdcb6e, #ffeaa7, #fab1a0); }

/* --- NEW 6 GRADIENT THEMES --- */
body.theme-teal { --primary-color: #20c997; background: linear-gradient(45deg, #20c997, #96f2d7, #38d9a9); }
body.theme-blue { --primary-color: #4dabf7; background: linear-gradient(45deg, #4dabf7, #a5d8ff, #74c0fc); }
body.theme-indigo { --primary-color: #5c7cfa; background: linear-gradient(45deg, #5c7cfa, #bac8ff, #91a7ff); }
body.theme-yellow { --primary-color: #fcc419; background: linear-gradient(45deg, #fcc419, #ffec99, #ffe066); }
body.theme-cyan { --primary-color: #22b8cf; background: linear-gradient(45deg, #22b8cf, #99e9f2, #66d9e8); }
body.theme-slate { --primary-color: #868e96; background: linear-gradient(45deg, #495057, #868e96, #adb5bd); }

/* --- 7 ADDITIONAL THEMES --- */
body.theme-lime    { --primary-color: #82c91e; background: linear-gradient(45deg, #82c91e, #d8f5a2, #a9e34b); }
body.theme-magenta { --primary-color: #e64980; background: linear-gradient(45deg, #e64980, #ffdeeb, #fcc2d7); }
body.theme-gold    { --primary-color: #fab005; background: linear-gradient(45deg, #fab005, #fff9db, #ffe066); }
body.theme-brick   { --primary-color: #e8590c; background: linear-gradient(45deg, #e8590c, #ffe8cc, #ffc078); }
body.theme-navy    { --primary-color: #1864ab; background: linear-gradient(45deg, #1864ab, #d0ebff, #74c0fc); }
body.theme-berry   { --primary-color: #c026d3; background: linear-gradient(45deg, #c026d3, #f5d0fe, #e879f9); }
body.theme-coffee  { --primary-color: #5c4033; background: linear-gradient(45deg, #5c4033, #d7ccc8, #a1887f); }

/* Break Modes */
body.short-break { --primary-color: #38858a; background: linear-gradient(45deg, #38858a, #4e9f9f, #88d8b0) !important; }
body.long-break { --primary-color: #397097; background: linear-gradient(45deg, #397097, #4f8a8b, #7dace4) !important; }

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- 3. Logo Styling --- */
.logo-container {
    position: absolute;
    top: 30px;
    left: 30px;
    z-index: 100;
    transition: opacity 0.5s;
}

.app-logo {
    width: 100px; 
    height: auto;
    opacity: 1; 
    transition: transform 0.3s ease;
    animation: floatLogo 6s ease-in-out infinite;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.app-logo:hover {
    transform: scale(1.1) rotate(5deg);
}

@keyframes floatLogo {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* --- 4. HAMBURGER MENU --- */
.menu-container {
    position: absolute;
    top: 30px;
    right: 30px;
    z-index: 200;
    transition: opacity 0.5s;
    
    /* ADDED FOR FULLSCREEN BTN LAYOUT */
    display: flex;
    gap: 15px;
    align-items: center;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.icon-btn:hover { background: #fff; color: var(--primary-color); transform: translateY(-2px); }

.dropdown {
    position: absolute;
    top: 60px; /* Slight adjust for alignment */
    right: 0;
    width: 220px; 
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    padding: 1.2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border: 1px solid rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transform-origin: top right;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dropdown.hidden { opacity: 0; transform: scale(0.8) translateY(-10px); pointer-events: none; }

.menu-label { font-size: 0.85rem; font-weight: 600; color: #888; margin-bottom: 8px; display: block; }

.divider { height: 1px; background: rgba(0,0,0,0.08); margin: 5px 0; }

.menu-link {
    text-decoration: none; color: var(--text-color); font-weight: 500;
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 8px 10px; border-radius: 10px;
    transition: background 0.2s; cursor: pointer;
}
.menu-link:hover { background: rgba(0,0,0,0.05); color: var(--primary-color); }

/* Menu Music Indicator */
.music-indicator { display: flex; align-items: flex-end; gap: 2px; height: 15px; }
.music-indicator.hidden { display: none; }
.bar { width: 3px; background-color: var(--primary-color); animation: musicBounce 1s infinite; }
.bar:nth-child(1) { height: 60%; animation-delay: 0s; }
.bar:nth-child(2) { height: 100%; animation-delay: 0.2s; }
.bar:nth-child(3) { height: 80%; animation-delay: 0.4s; }

@keyframes musicBounce { 0%, 100% { height: 30%; } 50% { height: 100%; } }

/* --- 5. CUSTOM MINI PLAYER --- */
.mini-player-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    width: 280px;
    transition: opacity 0.5s;
}

.player-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}
.player-card.hidden { display: none; }

/* Top Section: Art + Controls */
.player-top { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }

.album-art-wrapper {
    position: relative;
    width: 60px; height: 60px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0,0,0,0.05);
    flex-shrink: 0;
}
#player-thumb { width: 100%; height: 100%; object-fit: cover; }

/* Jelly Visualizer (Overlay on Art) */
.jelly-visualizer {
    position: absolute; bottom: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.3);
    display: flex; justify-content: center; align-items: flex-end; gap: 3px; padding-bottom: 10px;
}
.jelly-visualizer.hidden { display: none; }
.j-bar {
    width: 5px; background: #fff; border-radius: 2px;
    animation: jellyBounce 0.8s infinite ease-in-out alternate;
}
.j-bar:nth-child(1) { height: 15px; animation-delay: 0s; }
.j-bar:nth-child(2) { height: 25px; animation-delay: 0.2s; }
.j-bar:nth-child(3) { height: 18px; animation-delay: 0.4s; }

@keyframes jellyBounce { from { transform: scaleY(0.5); } to { transform: scaleY(1.2); } }

.track-info { flex: 1; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }

/* Marquee Title */
.marquee-container {
    white-space: nowrap; overflow: hidden; box-sizing: border-box;
    margin-bottom: 5px; width: 100%;
}
.marquee-content {
    display: inline-block; padding-left: 100%;
    animation: marquee 10s linear infinite;
    font-size: 0.9rem; font-weight: 600; color: var(--text-color);
}
@keyframes marquee { 0% { transform: translate(0, 0); } 100% { transform: translate(-100%, 0); } }

.player-controls-row { display: flex; gap: 8px; justify-content: center; }
.p-btn {
    background: transparent; border: none; font-size: 1.2rem;
    color: var(--text-color); cursor: pointer; transition: color 0.2s;
}
.p-btn:hover { color: var(--primary-color); }
.play-btn { font-size: 1.5rem; }

/* Bottom Section: Scrubber & Volume */
.player-bottom { display: flex; flex-direction: column; gap: 8px; }

.scrubber-container {
    width: 100%; height: 4px; background: rgba(0,0,0,0.1);
    border-radius: 2px; cursor: pointer; position: relative; overflow: hidden;
}
.scrubber-bar {
    height: 100%; width: 0%; background: var(--primary-color);
    border-radius: 2px; transition: width 0.2s linear;
}

.bottom-tools { display: flex; justify-content: space-between; align-items: center; }
.volume-wrapper { display: flex; align-items: center; gap: 5px; color: #888; font-size: 0.9rem; }
#volume-slider { width: 70px; cursor: pointer; accent-color: var(--primary-color); }

.p-icon-btn {
    background: transparent; border: none; color: #888;
    cursor: pointer; transition: 0.2s;
}
.p-icon-btn:hover { color: var(--primary-color); transform: scale(1.1); }

/* Input View */
.input-label { font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; text-align: center; }
#yt-url-input {
    width: 100%; padding: 8px; border-radius: 10px; border: 1px solid rgba(0,0,0,0.1);
    margin-bottom: 10px; background: rgba(255,255,255,0.6);
}
.input-actions { display: flex; gap: 10px; }
.input-btn {
    flex: 1; padding: 8px; border: none; border-radius: 8px; cursor: pointer; font-weight: 500;
}
.input-btn.cancel { background: rgba(0,0,0,0.1); color: #666; }
.input-btn.load { background: var(--primary-color); color: #fff; }

/* --- 6. Falling Melons Animation --- */
#melon-rain-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 0; overflow: hidden; transition: opacity 0.5s;
}
.falling-melon {
    position: absolute; top: -50px; width: 40px; opacity: 0.6;
    animation: fall linear forwards; transition: transform 0.1s;
}
@keyframes fall {
    0% { transform: translateY(0) rotate(0deg); opacity: 0; }
    10% { opacity: 0.8; }
    100% { transform: translateY(110vh) rotate(360deg); opacity: 0; }
}
.pop-effect { transform: scale(1.5) !important; opacity: 0 !important; transition: all 0.2s ease-out; }

/* --- 7. Confetti Animation --- */
#confetti-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 2000; overflow: hidden; transition: opacity 0.5s;
}
.confetti-piece {
    position: absolute; width: 100px; height: 100px;
    background-image: url('assets/confetti.png'); background-size: contain;
    background-repeat: no-repeat; background-position: center; opacity: 0;
}
@keyframes confetti-explode {
    0% { transform: translate(0, 0) scale(0.5) rotate(0deg); opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translate(var(--tx), var(--ty)) scale(1) rotate(720deg); opacity: 0; }
}

/* --- 8. LOGO CURSOR TRAIL --- */
.sparkle {
    position: absolute; width: 25px; height: 25px; pointer-events: none;
    background-image: url('assets/logo.png'); background-size: contain;
    background-repeat: no-repeat; z-index: 9999; animation: fadeSparkle 0.8s linear forwards;
}
@keyframes fadeSparkle {
    0% { transform: scale(1) rotate(0deg); opacity: 0.8; }
    100% { transform: scale(0) rotate(180deg); opacity: 0; }
}

/* --- 9. Peeking Corner Mascot --- */
.peeking-container {
    position: fixed; bottom: -10px; right: 20px; z-index: 5;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); cursor: pointer;
}
.peeking-melon { width: 300px; transform: rotate(-10deg); }
.peeking-container:hover { transform: translateY(-20px) rotate(0deg); }
.mascot-dancing {
    animation: peekingDance 1s infinite ease-in-out alternate !important; transform-origin: bottom right; 
}
@keyframes peekingDance { 0% { transform: rotate(-10deg); } 100% { transform: rotate(5deg) scale(1.05); } }

/* --- 10. Glass Card --- */
.timer-card {
    background: var(--glass-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border); border-radius: 40px; padding: 2rem;
    width: 90%; max-width: 450px; text-align: center; box-shadow: var(--shadow);
    transition: transform 0.3s ease; z-index: 10; position: relative; margin-top: 40px; 
}
.timer-card:hover { transform: translateY(-5px); }

/* --- 11. Mode Switchers --- */
.modes {
    display: inline-flex; justify-content: center; gap: 10px; margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.3); padding: 5px; border-radius: 50px;
    margin-top: 10px; transition: opacity 0.5s;
}
.mode-btn {
    background: transparent; border: none; padding: 8px 16px; border-radius: 20px;
    cursor: pointer; font-weight: 500; letter-spacing: 0.5px; color: #fff;
    opacity: 0.8; transition: all 0.3s ease;
}
.mode-btn.active { background: #fff; color: var(--primary-color); opacity: 1; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }

/* --- 12. Task Input --- */
.task-container {
    height: 40px; display: flex; justify-content: center; align-items: center;
    margin-bottom: 0.5rem; width: 100%; z-index: 10; position: relative; transition: opacity 0.5s;
}
#task-input {
    background: rgba(255, 255, 255, 0.2); border: none; border-bottom: 2px solid rgba(255, 255, 255, 0.5);
    padding: 10px; color: #fff; font-size: 1.1rem; width: 80%; text-align: center;
    outline: none; border-radius: 10px; transition: all 0.3s ease; cursor: text;
}
#task-input:focus { background: rgba(255, 255, 255, 0.3); width: 90%; }
#task-input::placeholder { color: rgba(255, 255, 255, 0.7); font-style: italic; }
#task-display { color: #fff; font-size: 1.3rem; font-weight: 500; animation: fadeIn 0.5s ease; }
#task-name { font-weight: 600; text-transform: capitalize; border-bottom: 2px dashed rgba(255,255,255,0.5); }
.hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- 13. The Circular Timer --- */
.circle-container {
    position: relative; width: 280px; height: 280px; margin: 0 auto 1rem auto;
    display: flex; justify-content: center; align-items: center;
}
.progress-ring {
    position: absolute; top: 0; left: 0; transform: rotate(-90deg);
    shape-rendering: geometricPrecision; overflow: visible;
}
.progress-ring__circle {
    transition: stroke-dashoffset 1s linear; transform-origin: 50% 50%;
    stroke: #fff; opacity: 0.9; stroke-linecap: round; will-change: stroke-dashoffset;
}
.timer-display {
    font-size: 5rem; font-weight: 600; color: #fff;
    text-shadow: 0 4px 10px rgba(0,0,0,0.1); font-feature-settings: "tnum";
    z-index: 2; letter-spacing: -2px;
}
#status-text {
    margin-bottom: 2rem; font-size: 1.2rem; letter-spacing: 0.5px;
    color: #fff; opacity: 0.95; min-height: 25px;
}

/* --- 14. Controls --- */
.controls {
    display: flex; justify-content: center; align-items: center; gap: 15px; transition: opacity 0.5s;
}
.btn-primary {
    background: #fff; color: var(--primary-color); border: none; padding: 15px 40px;
    font-size: 1.2rem; font-weight: 600; border-radius: 50px; cursor: pointer;
    display: flex; align-items: center; gap: 8px; transition: all 0.2s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.btn-primary:active { transform: scale(0.95); }
.jelly-active { animation: jelly 0.5s; }
@keyframes jelly {
    0%, 100% { transform: scale(1, 1); }
    25% { transform: scale(0.9, 1.1); }
    50% { transform: scale(1.1, 0.9); }
    75% { transform: scale(0.95, 1.05); }
}
.btn-icon {
    background: transparent; border: 2px solid rgba(255, 255, 255, 0.5);
    color: #fff; width: 50px; height: 50px; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; transition: all 0.2s ease;
}
.btn-icon:hover { background: rgba(255, 255, 255, 0.2); transform: rotate(-180deg); }

/* --- 15. Custom Input Styling --- */
.custom-timer-input {
    margin-top: 2rem; display: flex; justify-content: center; align-items: center;
    gap: 10px; opacity: 0.8; transition: opacity 0.3s;
}
.custom-timer-input:hover { opacity: 1; }
#custom-minutes, #set-custom-btn {
    height: 45px; box-sizing: border-box; font-size: 1rem; border-radius: 15px; 
    border: 1px solid rgba(255, 255, 255, 0.4);
}
#custom-minutes {
    background: rgba(255, 255, 255, 0.2); padding: 0 10px; color: #fff;
    width: 100px; text-align: center; outline: none; cursor: text;
}
#custom-minutes::placeholder { color: rgba(255, 255, 255, 0.6); }
#set-custom-btn {
    background: rgba(255, 255, 255, 0.8); padding: 0 20px; color: var(--primary-color);
    font-weight: 600; cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: all 0.2s;
}
#set-custom-btn:hover { background: #fff; transform: translateY(-2px); }
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* --- 16. ABOUT PAGE STYLES --- */
.about-card {
    max-width: 550px !important; 
    width: 90%;
    padding: 2.5rem;
    margin-top: 80px; 
    margin-bottom: 40px;
    
    /* GLASSMORPHISM */
    background: rgba(255, 255, 255, 0.25); 
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

.avatar-wrapper {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: #fff;
    padding: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    animation: floatLogo 4s ease-in-out infinite;
}

.profile-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.about-content p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 500;
}

/* Tech Stack Section */
.tech-stack {
    margin: 20px 0;
    text-align: center;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 15px;
    border-radius: 12px;
}

.tech-label {
    display: block;
    font-size: 0.85rem;
    color: #fff;
    margin-bottom: 8px;
    font-weight: 600;
}

.tech-icons {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 2rem;
    color: #fff;
}

.tech-icons i {
    transition: transform 0.2s, color 0.2s;
    cursor: default;
    margin: 0 8px;
}

.tech-icons i:hover {
    transform: translateY(-3px);
}

/* NEW: About Links Container Box (The Fix) */
.about-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 1.5rem 0;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 20px;
    border-radius: 15px;
}

.social-btn {
    background: rgba(255, 255, 255, 0.6); 
    padding: 10px 20px; 
    border-radius: 15px;
    text-decoration: none; 
    color: var(--primary-color); /* Colored text looks better on white bg */
    font-weight: 600; 
    display: flex; 
    align-items: center;
    gap: 8px; 
    transition: all 0.2s ease; 
    border: 1px solid rgba(255, 255, 255, 0.8); 
    cursor: pointer;
}

.social-btn:hover { 
    background: #fff; 
    transform: translateY(-3px); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Back Button Tweak */
.back-btn {
    width: 100%;
    justify-content: center;
    margin-top: 10px;
    text-decoration: none;
}

/* Simple Footer */
.simple-footer {
    position: fixed;
    bottom: 10px;
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    z-index: 1;
}

/* About Page Menu Tweaks */
#about-page-body .icon-btn {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
#about-page-body .icon-btn:hover {
    background: #fff;
    color: var(--primary-color);
}
#about-page-body .dropdown {
    z-index: 1000; 
}

/* --- 17. ZEN MODE STYLES --- */
body.zen-mode .logo-container,
body.zen-mode .menu-container,
body.zen-mode .peeking-container,
body.zen-mode .modes,
body.zen-mode .task-container,
body.zen-mode .controls,
body.zen-mode .custom-timer-input,
body.zen-mode #status-text,
body.zen-mode #melon-rain-container,
body.zen-mode #confetti-container { opacity: 0; pointer-events: none; }
body.zen-mode .timer-card { background: transparent; border-color: transparent; box-shadow: none; backdrop-filter: none; }
body.zen-mode .circle-container { transform: scale(1.5); margin: 0; }
#exit-zen-btn {
    position: fixed; bottom: 30px; right: 30px; width: 50px; height: 50px;
    background: rgba(255, 255, 255, 0.2); border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%; color: #fff; font-size: 1.5rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; z-index: 9999;
    transition: all 0.3s ease;
}
#exit-zen-btn:hover { background: rgba(255,255,255,0.4); transform: scale(1.1); }
#exit-zen-btn.hidden { display: none; }

/* --- 18. MODALS (Shortcuts & Settings) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(5px);
    display: flex; justify-content: center; align-items: center; z-index: 3000;
    opacity: 1; transition: opacity 0.3s;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }
.modal-content {
    background: #fff; padding: 2rem; border-radius: 20px; width: 90%; max-width: 350px;
    text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.2); color: #444;
    position: relative;
}
/* Settings Modal specific tweaks */
.settings-content { max-width: 450px; text-align: left; padding: 25px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid rgba(0,0,0,0.05); padding-bottom: 10px; }
.modal-header h3 { margin: 0; font-size: 1.5rem; color: var(--primary-color); }
.close-icon-btn {
    background: transparent; border: none; font-size: 1.5rem; color: #888;
    cursor: pointer; width: 35px; height: 35px; display: flex; align-items: center;
    justify-content: center; border-radius: 50%; transition: all 0.2s ease;
}
.close-icon-btn:hover { background: rgba(0,0,0,0.05); color: var(--primary-color); transform: rotate(90deg); }

.settings-section { margin-bottom: 25px; }
.settings-label { display: block; font-weight: 600; font-size: 1rem; color: #555; margin-bottom: 12px; }

.settings-row { display: flex; gap: 15px; justify-content: space-between; }
.setting-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.setting-item label { font-size: 0.75rem; color: #666; font-weight: 500; }
.setting-item input {
    width: 100%; text-align: center; border: 2px solid rgba(0,0,0,0.1); border-radius: 12px;
    padding: 10px; font-size: 1.1rem; color: var(--text-color); background: rgba(255,255,255,0.5);
    font-family: 'Fredoka', sans-serif; transition: all 0.2s;
}
.setting-item input:focus { border-color: var(--primary-color); background: #fff; outline: none; }

.settings-section .theme-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(30px, 1fr));
    gap: 12px; justify-items: center;
}
.settings-section .theme-dot {
    width: 32px; height: 32px; border: 3px solid transparent; border-radius: 50%; cursor: pointer; transition: transform 0.2s;
}
.settings-section .theme-dot:hover { transform: scale(1.1); border-color: rgba(0,0,0,0.1); }

.save-settings-btn {
    margin-top: 10px; width: 100%; background: var(--primary-color); color: #fff;
    border: none; padding: 14px; border-radius: 15px; font-size: 1.1rem;
    font-weight: 600; cursor: pointer; font-family: 'Fredoka', sans-serif;
    transition: transform 0.2s, box-shadow 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.save-settings-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0,0,0,0.15); opacity: 1; }
.save-settings-btn:active { transform: scale(0.98); }

.shortcut-row {
    display: flex; justify-content: space-between; align-items: center;
    margin: 10px 0; padding: 5px 0; border-bottom: 1px solid #eee;
}
kbd {
    background: #eee; padding: 2px 8px; border-radius: 5px; font-family: monospace;
    font-size: 0.9rem; border: 1px solid #ccc; box-shadow: 0 2px 0 #ccc;
}
.modal-close-btn {
    margin-top: 1.5rem; background: var(--primary-color); color: #fff; border: none;
    padding: 10px 25px; border-radius: 50px; cursor: pointer; font-weight: 600;
}

/* --- 19. MOBILE OPTIMIZATION (ENHANCED) --- */
@media screen and (max-width: 600px) {
    /* Adjust Layout */
    .logo-container { top: 15px; left: 15px; }
    .app-logo { width: 50px; } /* Smaller logo */
    
    .menu-container { top: 15px; right: 15px; }
    .icon-btn { width: 38px; height: 38px; font-size: 1.1rem; }

    /* Main Card */
    .timer-card {
        width: 90%;
        padding: 1.5rem;
        margin-top: 60px; /* Space for header */
        margin-bottom: 120px; /* Space for player */
    }

    /* Timer Size */
    .circle-container {
        width: 240px; 
        height: 240px;
        margin: 0.5rem auto;
    }
    .progress-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
    .timer-display { font-size: 3.5rem; }

    /* Controls */
    .controls { gap: 20px; }
    .btn-primary { padding: 12px 35px; font-size: 1.1rem; }
    .btn-icon { width: 45px; height: 45px; }
    .modes { gap: 5px; width: 100%; display: flex; justify-content: space-between; }
    .mode-btn { padding: 8px 10px; font-size: 0.85rem; flex: 1; }

    /* Prevent iOS Zoom (Force 16px) */
    #task-input, #custom-minutes, #yt-url-input, .setting-item input {
        font-size: 16px !important; 
    }

    /* Hide Mascot (Too cluttered on mobile) */
    .peeking-container { display: none; }

    /* Mini Player: Bottom Sheet Style */
    .mini-player-container {
        width: 94%;
        left: 3%;
        bottom: 15px;
        /* Handle iPhone Notch/Home Bar area */
        bottom: calc(15px + env(safe-area-inset-bottom));
    }
    
    /* Settings Modal: Full width, centered */
    .modal-content {
        width: 92%;
        padding: 1.5rem;
        max-height: 80vh; /* Scrollable if too tall */
        overflow-y: auto;
    }
    
    /* Larger targets for touch */
    .settings-section .theme-grid { gap: 15px; }
    .settings-section .theme-dot { width: 45px; height: 45px; }
    
    /* About Page Mobile Tweaks */
    .about-card {
        padding: 1.5rem;
        margin-top: 60px;
        width: 92%;
    }
    .avatar-wrapper {
        width: 90px;
        height: 90px;
    }
    .simple-footer {
        display: none; /* Hide footer on mobile to save space */
    }
    
    body.zen-mode .circle-container { transform: scale(1.2); }
}

/* --- FIXED: HIDDEN PLAYER (Ensures playback works) --- */
.hidden-player {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 1px;
    height: 1px;
    opacity: 0.001;
    pointer-events: none;
    z-index: -1;
}

/* --- 404 PAGE STYLES (FIXED) --- */

.page-404 {
    overflow: hidden; 
}

.error-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100%;
    z-index: 10;
    padding: 20px;
}

.error-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem !important;
    max-width: 450px !important;
    width: 100%;
    
    /* VISIBILITY FIX: Strong white background */
    background: rgba(255, 255, 255, 0.9) !important; 
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 1) !important;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15) !important;
    
    /* CRITICAL FIXES FOR LAYOUT */
    overflow: hidden; 
    box-sizing: border-box;
    position: relative;
    /* Force column layout */
    justify-content: center;
}

/* Styling for your custom 404 image */
.error-image-wrapper {
    width: 100%;
    margin-bottom: 20px;
    border-radius: 20px;
    /* Force containment */
    display: flex;
    justify-content: center;
    overflow: hidden; 
}

.custom-404-img {
    /* FORCE IMAGE TO STAY INSIDE */
    width: 100% !important;
    max-width: 100% !important; 
    height: auto;
    max-height: 300px; /* Prevent it from getting too tall */
    display: block;
    object-fit: contain; /* Ensures the mascot stays INSIDE the box */
    margin: 0 auto;
}

.error-msg {
    color: #4a4a4a; /* Dark text for readability */
    font-size: 1.1rem;
    margin-bottom: 2rem;
    font-weight: 500;
    line-height: 1.6;
}

.home-btn {
    text-decoration: none;
    padding: 15px 30px;
    display: inline-flex;
    justify-content: center;
    width: 100%; 
    transition: transform 0.2s, box-shadow 0.2s;
    background: var(--primary-color);
    color: #fff;
    border-radius: 15px;
    font-weight: 600;
}

.home-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    opacity: 0.95;
}

/* Mobile Adjustments */
@media screen and (max-width: 600px) {
    .error-card {
        padding: 1.5rem !important;
    }
    .error-msg {
        font-size: 1rem;
    }
}

/* --- REVIEW MODAL STYLES (UPDATED) --- */
.review-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    text-align: center;
}

.star-rating {
    display: flex;
    gap: 8px;
    font-size: 2rem;
    cursor: pointer;
    margin-bottom: 5px;
}

/* NEW MELON ICON STYLES */
.melon-icon {
    font-size: 2.2rem;
    filter: grayscale(100%);
    opacity: 0.4;
    transition: all 0.2s ease;
}

.melon-icon.active,
.melon-icon:hover {
    filter: none;
    opacity: 1;
    transform: scale(1.15) rotate(5deg);
}

#rating-text {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

#review-text {
    width: 100%;
    height: 100px;
    padding: 12px;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    background: rgba(255,255,255,0.8);
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    color: var(--text-color);
    resize: none;
    transition: border-color 0.2s;
}

#review-text:focus {
    outline: none;
    border-color: var(--primary-color);
}