.icon { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; display: inline-block; }
.icon-solid { fill: currentColor; stroke: none; }
.icon-sm { width: 20px; height: 20px; }

#splash-screen { 
    position: fixed; 
    top: 0; left: 0; width: 100vw; height: 100vh; 
    background-color: #293132; z-index: 9999; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    flex-direction: column; /* Stacks the line and text vertically */
    gap: 15px; /* Adds breathing room between the wave and the logo */
    animation: fadeSplash 0.8s ease 1.2s forwards;
    pointer-events: none; 
}

@keyframes fadeSplash {
    to { opacity: 0; visibility: hidden; }
}

/* ==========================================
   SPLASH SCREEN SVG ANIMATION
   ========================================== */
.splash-svg {
    width: 90vw; /* Keeps it wide but leaves breathing room on the edges */
   max-width: 1000px;
    max-height: 40vh; /* Prevents vertical cut-off on ultra-wide screens */
    overflow: visible; /* Allows the neon shadow to bleed out perfectly */
}

.splash-path {
    fill: none !important; /* Changed from transparent to none */
    stroke: #00e5ff !important; /* Hardcoded cyan instead of the missing variable */
    stroke-width: 2 !important;
    stroke-linecap: round;
    filter: drop-shadow(0 0 10px rgba(0, 229, 255, 0.8));
    
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: drawSplashLine 0.9s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes drawSplashLine {
    to {
        stroke-dashoffset: 0; /* Completes the line */
    }
}
/* ==========================================
   SPLASH SCREEN LOGO TYPOGRAPHY
   ========================================== */
.splash-logo {
    font-size: 1.8rem;
    letter-spacing: 2px;
    opacity: 0; /* Starts hidden */
    /* Fades in smoothly half a second after the wave starts drawing */
    animation: fadeInSplashLogo 0.5s ease 0.4s forwards; 
}

.splash-logo .logo-on {
    color: #00e5ff;
    font-weight: 700;
}

.splash-logo .logo-lock {
    color: #e0e0e0;
    font-weight: 400;
}

@keyframes fadeInSplashLogo {
    to { opacity: 1; }
}
html, body { width: 100%; height: 100%; margin: 0; padding: 0; transition: background-color 0.8s ease; position: fixed; overflow: hidden; touch-action: none; }
body { color: #e0e0e0; font-family: 'Cabin', sans-serif; display: flex; justify-content: center; align-items: center; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }

.app-container { width: 100%; max-width: 380px; height: auto; max-height: 100dvh; padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 20px) 20px; box-sizing: border-box; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; scrollbar-width: none; position: relative; z-index: 10; overscroll-behavior-y: contain; padding-bottom: calc(env(safe-area-inset-bottom) + 60px);}
.app-container::-webkit-scrollbar { display: none; }

.card { background: rgba(20, 20, 20, 0.65); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 20px; border-radius: 16px; position: relative; box-shadow: 0 8px 32px rgba(0,0,0,0.15); transition: background 0.5s ease, color 0.5s ease; }
.station-card { padding-top: 20px; padding-bottom: 24px; }
.ambient-card { margin-top: 0; padding-top: 28px; text-align: center; }
.mini-card { padding: 12px 20px; }

.main-play-btn { position: absolute; top: -41px; left: 50%; transform: translateX(-50%); width: 108px; height: 50px; border-radius: 12px; background: rgba(0, 229, 255, 0.9); color: #121212; border: 6px solid rgba(20, 20, 20, 0.65); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); z-index: 20; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s ease; }
.main-play-btn:hover { background: rgba(0, 229, 255, 1); transform: translateX(-50%) scale(1.05); }
.main-play-btn svg { width: 24px; height: 24px; }

.header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; gap: 8px; }
select, .search-input { width: 100%; padding: 10px; margin: 0; background: rgba(0,0,0,0.5); color: #fff; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px; font-family: inherit; font-size: 16px; outline: none; }
select { cursor: pointer; }
select option { background: #1e1e1e; color: #fff; }
optgroup { background: #121212; color: #00e5ff; font-style: normal; font-weight: 600; }

.mini-btn { background: rgba(0, 229, 255, 0.6); border: none; border-radius: 8px; color: white; padding: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.mini-btn:hover { background: rgba(0, 229, 255, 1); }
.mini-btn.close-btn { background: rgba(255, 82, 82, 0.4); }
.mini-btn.close-btn:hover { background: rgba(255, 82, 82, 0.8); }

.search-result-item { display: flex; justify-content: space-between; align-items: center; padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 0.8em; }
.search-result-item span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 65%; text-align: left; }
.action-btns { display: flex; gap: 5px; }
.action-btns .mini-btn { padding: 8px; }
.manager-heading { color: #84ffff; font-size: 0.8em; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.1); text-align: left; margin: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; gap: 6px; }

.ambient-controls { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 20px; }
.ambient-btn, .ambient-btn.active { flex: 1; height: 44px; max-width: 50px; background: rgba(40, 40, 40, 0.8) !important; color: white !important; position: relative; overflow: hidden; touch-action: none; border: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.ambient-btn::before { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: var(--vol, 50%); background: rgba(0, 229, 255, 0.3) !important; z-index: 1; transition: background 0.3s ease; }
.ambient-btn.active::before { background: rgba(0, 229, 255, 0.9) !important; }
.ambient-btn svg { position: relative; z-index: 2; pointer-events: none; filter: drop-shadow(0px 1px 3px rgba(0,0,0,0.8)); }

#binauralDrawer { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; display: flex; flex-direction: column; gap: 10px; }
#binauralDrawer.open { max-height: 180px; margin-top: 5px; margin-bottom: 20px; }
.binaural-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.wave-btn { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: #888; padding: 10px 2px; border-radius: 6px; font-size: 0.55em; font-weight: 700; text-transform: uppercase; cursor: pointer; transition: 0.2s; text-align: center; }
.wave-btn.active { background: rgba(0, 229, 255, 0.2); border-color: #00e5ff; color: #fff; }

.volume-container { display: flex; align-items: center; gap: 8px; color: #bbb; justify-content: center; }
input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; touch-action: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 14px; width: 14px; border-radius: 50%; background: #00e5ff; cursor: pointer; margin-top: -5px; box-shadow: 0 2px 5px rgba(0,0,0,0.3); }
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; cursor: pointer; background: rgba(255, 255, 255, 0.2); border-radius: 4px; }

.timer-container { position: relative; width: 100%; margin: 0 auto 20px auto; display: flex; justify-content: center; align-items: center; }
.timer-svg { width: 100%; height: auto; overflow: visible; display: block; }
.timer-track { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 4; stroke-linecap: round; }
.timer-progress { fill: none; stroke: #00e5ff; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.timer-display { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100%; text-align: center; font-size: 2.8em; font-weight: 700; color: #fff; font-family: ui-rounded, system-ui, sans-serif; font-variant-numeric: tabular-nums; line-height: 1; z-index: 2; }
.timer-display.active-border { -webkit-text-stroke: 0px #000; text-shadow: 0px 2px 4px rgba(0,0,0,0.5); }

body.light-theme .timer-display.active-border { -webkit-text-stroke: 0px #fff; }
.timer-btn-group { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.timer-btn { background: rgba(60, 60, 60, 0.6); border: 1px solid transparent; color: #fff; padding: 8px; width: 44px; height: 44px; border-radius: 8px; cursor: pointer; transition: 0.2s; font-family: inherit; font-weight: 600; font-size: 0.9em; display: flex; align-items: center; justify-content: center; }
.timer-btn:hover { background: rgba(0, 229, 255, 0.8); color: #121212; transform: translateY(-2px); }
.timer-btn.active-timer { background: rgba(0, 229, 255, 1); color: #121212; }
.timer-btn.stop-btn { background: rgba(255, 82, 82, 0.3); color: #ff8a8a; }
.timer-btn.stop-btn:hover { background: rgba(255, 82, 82, 0.8); color: #fff; }
.timer-btn.sleep-btn { position: absolute; top: 8px; left: 8px; width: 28px; height: 28px; padding: 4px; color: #555; opacity: 0.5; z-index: 3; }
.timer-btn.sleep-btn:hover { background: rgba(90, 70, 160, 0.6); color: #c0b0ff; opacity: 1; transform: none; }
.timer-btn.sleep-btn.active { background: rgba(90, 70, 160, 0.4); color: #b8a0ff; border-color: rgba(140, 110, 255, 0.4); opacity: 1; }

.appearance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.appearance-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: transparent; border: 1px solid rgba(255,255,255,0.1); color: #bbb; padding: 12px 5px; border-radius: 8px; cursor: pointer; transition: 0.3s; font-family: inherit; font-weight: 600; }
.appearance-btn:hover, .appearance-btn.active { background: rgba(255,255,255,0.1); color: #fff; }
.utility-btn { flex-direction: row; padding: 10px 5px; gap: 8px; font-size: 0.8em; }

#customTimeModal, #statsModal, #aboutModal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.7); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); z-index: 10000; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s; padding: 20px; box-sizing: border-box; }
#customTimeModal.active, #statsModal.active, #aboutModal.active { opacity: 1; visibility: visible; }
.modal-card { width: 100%; max-width: 300px; text-align: center; padding: 25px 20px; display: flex; flex-direction: column; max-height: 80vh; }
.modal-title { margin-bottom: 20px; font-weight: 600; font-size: 1.1em; color: #fff; text-transform: uppercase; letter-spacing: 1px; flex-shrink: 0; }
.about-content { overflow-y: auto; text-align: left; color: #ccc; font-size: 0.9em; line-height: 1.5; margin-bottom: 20px; overscroll-behavior: contain; }
.about-content::-webkit-scrollbar { display: none; }
.modal-input { width: 100%; padding: 15px; margin-bottom: 20px; box-sizing: border-box; background: rgba(0,0,0,0.5); color: #fff; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 8px; font-family: inherit; font-size: 1.4em; text-align: center; outline: none; transition: 0.2s; }
.modal-input:focus { border-color: #00e5ff; box-shadow: 0 0 10px rgba(0,229,255,0.2); }
.modal-actions { display: flex; gap: 10px; flex-shrink: 0; }
.modal-actions .mini-btn { flex: 1; padding: 12px; font-weight: 600; font-size: 1em; }
.stat-row { display: flex; justify-content: space-between; align-items: center; font-size: 1.2em; color: #fff; margin-bottom: 12px; padding: 12px 15px; background: rgba(0,0,0,0.3); border-radius: 8px; }
.stat-row strong { color: #00e5ff; font-weight: 700; font-size: 1.1em; }

body.light-theme .card { background: rgba(255, 255, 255, 0.7); color: #121212; }
body.light-theme .main-play-btn { border-color: rgba(255, 255, 255, 0.7); }
body.light-theme .timer-display { color: #121212; }
body.light-theme select, body.light-theme .search-input, body.light-theme .modal-input { background: rgba(255,255,255,0.5); color: #121212; border-color: rgba(0,0,0,0.1); }
body.light-theme .modal-title { color: #333; }
body.light-theme .about-content { color: #555; }
body.light-theme .appearance-btn { color: #444; border-color: rgba(0,0,0,0.1); }
body.light-theme .appearance-btn:hover { background: rgba(0,0,0,0.05); color: #121212; }
body.light-theme .timer-btn { background: rgba(0,0,0,0.1); color: #333; }
body.light-theme .timer-btn:hover { background: rgba(0, 229, 255, 0.8); }
body.light-theme .timer-btn.active-timer { background: rgba(0, 229, 255, 1); color: #ffffff; }
body.light-theme .timer-track { stroke: rgba(0,0,0,0.1); }
body.light-theme .stat-row { color: #121212; background: rgba(255,255,255,0.5); }
body.light-theme .stat-row strong { color: #008b99; }
body.light-theme .wave-btn { border-color: rgba(0,0,0,0.1); color: #666; }

body.night-mode { background-color: #000 !important; }
body.night-mode .app-container, body.night-mode #zenDisplay { filter: grayscale(100%) brightness(0.35); }
body.night-mode #zenDisplay { background: rgba(0,0,0,0.95); }

#zenDisplay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh; display: flex; flex-direction: column; justify-content: center; align-items: center; opacity: 0; pointer-events: none; z-index: 999; transition: opacity 0.8s ease, filter 0.8s ease; background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); cursor: pointer; }
#zenTime { 
    font-size: 14vmin; /* Significantly reduced size */
    font-weight: 300;  /* Changed from bold (700) to light (300) */
    color: #fff; 
    font-family: ui-rounded, system-ui, sans-serif; 
    font-variant-numeric: tabular-nums; 
    line-height: 1; 
    text-shadow: 0 2px 10px rgba(0,0,0,0.5); 
}
#zenStatus { 
    font-size: 3.5vmin; /* Slightly smaller text */
    font-weight: 400;   /* Lighter weight */
    color: #00e5ff; 
    margin-top: 10px; 
    letter-spacing: 4px; 
    text-transform: uppercase; 
    text-shadow: 0 2px 5px rgba(0,0,0,0.5); 
}
body.zen-active .app-container { opacity: 0; pointer-events: none; transform: scale(0.95); transition: 0.5s ease; }
body.zen-active #zenDisplay { opacity: 1; pointer-events: auto; }
/* ==========================================
   ZEN MODE LAYOUT
   ========================================== */
.zen-timer-wrapper {
    position: relative;
    width: 96vw; 
    display: flex;
    flex-direction: column; /* Stacks the wave and the text vertically */
    justify-content: center;
    align-items: center;
    gap: 30px; /* Perfect breathing room between the wave and the text */
}
.zen-timer-svg {
    width: 100%;
    max-width: 140vh; /* Limits the wave width so it never overflows the screen height! */
    height: auto;
    opacity: 0.8; 
    overflow: visible;
}
.zen-text-content {
    position: relative; /* Removes the problematic fixed bottom anchor */
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    pointer-events: none; 
}

/* ==========================================
   MOBILE (PORTRAIT) ORDERING
   ========================================== */
.layout-col { display: contents; } /* Makes wrappers invisible to flexbox on mobile */

#card-station   { order: 1; }
#card-ambient   { order: 2; }
#card-timer     { order: 3; }
#card-settings  { order: 4; }

/* ==========================================
   LANDSCAPE & TABLET LAYOUT
   ========================================== */
@media (orientation: landscape) and (min-width: 600px), (min-width: 768px) {
    .app-container {
        max-width: 850px; 
        display: grid;
        grid-template-columns: 1fr 1fr; 
        gap: 20px;
        align-items: start; 
    }
    
    .layout-col {
        display: flex; /* Activates the column wrappers */
        flex-direction: column;
        gap: 20px;
    }

    .card {
        margin-bottom: 0; /* Let the flex gap handle spacing */
    }

    /* Reset the mobile order so they stay inside their specific columns */
    #card-station, #card-ambient, #card-timer, #card-settings {
        order: 0; 
    }
}
/* ==========================================
   GAMIFICATION & STATS CHART
   ========================================== */
.streak-banner {
    background: rgba(255, 255, 255, 0.05);
    color: #888;
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s ease;
}

/* Lights up orange when a streak is active! */
.streak-banner.active {
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
    border-color: rgba(255, 152, 0, 0.3);
    text-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}

.chart-container {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.chart-title {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 15px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.bar-chart {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 100px; /* Chart height */
    gap: 8px;
}

.bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    gap: 8px;
}

.bar {
    width: 100%;
    background: rgba(0, 229, 255, 0.15);
    border-radius: 4px;
    min-height: 4px;
    transition: height 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

/* Makes today's bar pop out in bright cyan */
.bar.today {
    background: #00e5ff;
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.bar-label {
    font-size: 0.75rem;
    color: #888;
    font-weight: 600;
}
/* Add this to your style.css */
button, .btn-primary, .card {
    touch-action: manipulation;
}

/* ==========================================
   APP DASHBOARD LOGO & SPACING
   ========================================== */
.app-brand-title {
    font-size: 1.2rem; /* Much smaller, subtler size */
    letter-spacing: 1.5px;
    margin-bottom: 20px; /* Space between the logo and the Radio text bar */
    display: flex;
    justify-content: flex-start; /* Pushes the logo to the left */
    align-items: center;
    width: 100%;
}

.app-brand-title .logo-on {
    color: #00e5ff;
    font-weight: 700;
}

.app-brand-title .logo-lock {
    color: #e0e0e0;
    font-weight: 400;
}
/* ==========================================
   MINIMALIST TOP-RIGHT TIMER (UPDATED)
   ========================================== */
#timerDisplay {
    position: absolute !important;
    top: 15px !important;
    right: 20px !important;
    
    /* Kills all old centering rules & borders */
    left: auto !important; 
    transform: none !important; 
    width: auto !important; 
    border: none !important; 
    background: transparent !important; 
    
    /* New, slightly larger typography */
    font-size: 1.2rem !important; /* Bumped up from 0.9rem */
    font-weight: 300 !important;  
    color: #a0a0a0 !important;    /* Slightly lighter grey for contrast */
    letter-spacing: 2px !important;
    
    /* Starts hidden */
    opacity: 0; 
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    z-index: 10;
}

/* Added !important to guarantee it shows up when active */
#timerDisplay.timer-active {
    opacity: 1 !important;
    visibility: visible !important;
}
/* ==========================================
   SEARCH RESULTS (SCROLL & WIDTH FIX)
   ========================================== */
.results-container {
    max-height: 280px !important; /* Strictly limits the vertical height */
    overflow-y: auto !important;  /* Forces the scrollbar to appear */
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100%;
    margin-top: 15px;
    padding-right: 5px; 
    box-sizing: border-box;
    display: block !important;    /* Prevents flex-stretching bugs */
}

/* Custom Scrollbar for a sleek, premium look */
.results-container::-webkit-scrollbar {
    width: 6px;
}
.results-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}
.results-container::-webkit-scrollbar-thumb {
    background: rgba(0, 229, 255, 0.3); /* Brand cyan, slightly transparent */
    border-radius: 10px;
}
.results-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 229, 255, 0.6);
}

/* ------------------------------------------
   WIDTH & TRUNCATION PROTECTION 
   ------------------------------------------ */
.results-container > div,
.results-container > button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden; 
    margin-bottom: 8px; /* Restores spacing between rows */
    background: rgba(255, 255, 255, 0.05); /* Subtle row background */
    padding: 8px 10px;
    border-radius: 8px;
}

/* Target the FIRST child of the row (which holds the text) */
.results-container > div > div:first-child,
.results-container > button > div:first-child {
    flex: 1 1 auto;
    min-width: 0; /* Forces desktop browsers to respect width boundaries */
    margin-right: 10px;
}

/* Force the actual text inside to chop off with an ellipsis */
.results-container > div > div:first-child *,
.results-container > button > div:first-child * {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block; 
    max-width: 100%;
}

/* Protect the action buttons on the right */
.results-container > div > div:last-child,
.results-container > button > div:last-child {
    flex-shrink: 0; /* Prevents buttons from being squished */
    display: flex;
    gap: 8px;
}
/* ==========================================
   DESKTOP COLUMN STRICT BOUNDARIES
   ========================================== */
/* 1. Force the main layout columns to respect screen widths */
.layout-col {
    min-width: 0 !important; /* The magic rule that allows truncation */
    max-width: 100% !important;
    box-sizing: border-box !important;
    height: auto !important;
}

/* 2. Strictly lock the Radio Card and Search Mode */
#card-station, 
#searchMode {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* 3. Trap any invisible horizontal bleed */
#card-station {
    height: auto !important;
    min-height: min-content;
    flex: 0 0 auto !important; /* Prevents flexbox from squishing the card to a fixed ratio */
    overflow: visible !important; /* Allows the card to stretch without hiding content */
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* 4. Ensure the search input bar itself isn't causing the stretch */
.search-input {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* ==========================================
   STATION CARD MODE TRANSITION (player ↔ search)
   ========================================== */
#playerMode {
    max-height: 120px;
    opacity: 1;
    visibility: visible;
    overflow: hidden;
    /* search→player: delay entrance until searchMode has collapsed (~0.2s) */
    transition: opacity 0.3s ease 0.2s, max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1) 0.15s, visibility 0s linear 0s;
}

#searchMode {
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    overflow: hidden;
    /* search→player: collapse quickly so playerMode can follow */
    transition: opacity 0.2s ease, max-height 0.3s cubic-bezier(0.25, 1, 0.5, 1), visibility 0s linear 0.2s;
}

#card-station.search-active #playerMode {
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    /* player→search: fade out the dropdown first */
    transition: opacity 0.25s ease, max-height 0.35s cubic-bezier(0.25, 1, 0.5, 1), visibility 0s linear 0.25s;
}

#card-station.search-active #searchMode {
    max-height: 70dvh;
    opacity: 1;
    visibility: visible;
    /* player→search: delayed entrance — waits for dropdown to fade out */
    transition: opacity 0.35s ease 0.28s, max-height 0.5s cubic-bezier(0.25, 1, 0.5, 1) 0.25s, visibility 0s linear 0s;
}

/* 2. Animate the search results container */
#searchResults {
    /* Collapsed state */
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding-bottom: 0;
    overflow-y: hidden; /* Hide scrollbar while collapsed */
    
    /* The magic that makes it smooth */
    transition: max-height 0.4s cubic-bezier(0.25, 1, 0.5, 1), 
                opacity 0.3s ease-in, 
                margin-top 0.4s ease, 
                padding-bottom 0.4s ease;
}

/* 3. The Expanded State */
#searchResults.expanded {
    max-height: 55dvh; /* Or whatever height you prefer */
    opacity: 1;
    margin-top: 15px;
    padding-bottom: 10px;
    overflow-y: auto; /* Allow scrolling once fully open */
}