/*
 * ============================================
 * FOCUS MODE - STYLESHEET
 * ============================================
 * New sidebar layout matching Frame.png design
 */

/* ========== FONT IMPORTS ========== */
@import url('https://fonts.cdnfonts.com/css/budmo');
@import url('https://fonts.cdnfonts.com/css/norse');
@import url('https://fonts.cdnfonts.com/css/bradley-gratis');
@import url('https://fonts.cdnfonts.com/css/goodfish');
@import url('https://fonts.cdnfonts.com/css/good-timing');
@import url('https://fonts.cdnfonts.com/css/neuland');
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap');

/* ========== CSS VARIABLES ========== */
:root {
    /* Primary Colors */
    --color-purple: #9B7ED9;
    --color-purple-light: #E8D5FF;
    --color-purple-dark: #7B5FC4;
    --color-magenta: #C53FC4;
    --color-orange: #F5A55A;

    /* Light Mode (default for sidebar cards) */
    --card-bg: #ffffff;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --text-primary: #2d2d2d;
    --text-secondary: #666666;
    --text-muted: #999999;

    /* Sidebar - width calculated so 2 square cards fit vertically */
    /* 100vh - theme(45px) - musicPlayer(70px) - 3gaps(30px) - 2padding(32px) - marginBottom(10px) = available for 2 cards */
    --sidebar-width: calc(((100vh - 187px) / 2 + 32px) * 1.43);
    --sidebar-padding: 12px;
    --card-radius: 26px;
    --card-gap: 13px;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}


/* ========== THEMED BACKGROUNDS ========== */
body[data-theme="space"] {
    --bg-image: url('/slides/noise_meter/assets/backgrounds/space.png');
}

body[data-theme="dinosaur"] {
    --bg-image: url('/slides/noise_meter/assets/backgrounds/dinosaur.png');
}

body[data-theme="dance"] {
    --bg-image: url('/slides/noise_meter/assets/backgrounds/dance.png');
}

body[data-theme="egypt"] {
    --bg-image: url('/slides/noise_meter/assets/backgrounds/egypt.png');
}

body[data-theme="wizard"] {
    --bg-image: url('/slides/noise_meter/assets/backgrounds/wizard.png');
}

body[data-theme="zombies"] {
    --bg-image: url('/slides/noise_meter/assets/backgrounds/zombie.png');
}

body[data-theme="library"] {
    --bg-image: url('/slides/noise_meter/assets/backgrounds/library.png');
}

body[data-theme="balls"] {
    --bg-image: linear-gradient(135deg, #1a1a3e 0%, #2d1b4e 100%);
}

body[data-theme="simple"] {
    --bg-image: linear-gradient(135deg, #f5f5f0 0%, #e8e8e0 100%);
}

/* ========== THEME-SPECIFIC OVERRIDES ========== */
body[data-theme="space"] .timer-display {
    font-size: clamp(28px, 3.5vw, 52px);
}

body[data-theme="wizard"] .timer-display {
    font-size: clamp(36px, 4.5vw, 72px);
}


/* ========== THEME FONTS ========== */
/* Theme fonts apply to UI elements except theme selector */
body[data-theme="space"] .card,
body[data-theme="space"] .music-player,
body[data-theme="space"] .speech-bubble {
    font-family: 'Good Timing', sans-serif;
}

body[data-theme="dinosaur"] .card,
body[data-theme="dinosaur"] .music-player,
body[data-theme="dinosaur"] .speech-bubble {
    font-family: 'Neuland', sans-serif;
}

body[data-theme="dance"] .card,
body[data-theme="dance"] .music-player,
body[data-theme="dance"] .speech-bubble {
    font-family: 'Fredoka', sans-serif;
}

body[data-theme="egypt"] .card,
body[data-theme="egypt"] .music-player,
body[data-theme="egypt"] .speech-bubble {
    font-family: 'Norse', sans-serif;
}

body[data-theme="wizard"] .card,
body[data-theme="wizard"] .music-player,
body[data-theme="wizard"] .speech-bubble {
    font-family: 'Bradley Gratis', cursive;
}

body[data-theme="zombies"] .card,
body[data-theme="zombies"] .music-player,
body[data-theme="zombies"] .speech-bubble {
    font-family: 'Creepster', cursive;
}

body[data-theme="library"] .card,
body[data-theme="library"] .music-player,
body[data-theme="library"] .speech-bubble {
    font-family: 'Goodfish', serif;
}


/* ========== RESET & BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

html {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    display: flex;
    background: #f5f5f0;
}


/* ========== SIDEBAR ========== */
.sidebar {
    width: var(--sidebar-width);
    max-width: 40vw;
    height: 100vh;
    max-height: 100vh;
    padding: var(--sidebar-padding);
    display: flex;
    flex-direction: column;
    gap: var(--card-gap);
    background: transparent;
    z-index: 100;
    flex-shrink: 0;
    overflow: visible;
    box-sizing: border-box;
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(0);
    transition: transform var(--transition-normal);
    will-change: transform;
}

body.sidebar-collapsed .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

body.sidebar-collapsed .main-content {
    margin-left: 0;
}

/* ========== SIDEBAR TOGGLE BUTTON ========== */
.sidebar-toggle-btn {
    position: absolute;
    top: 16px;
    right: -20px;
    width: 20px;
    height: 56px;
    border-radius: 0 10px 10px 0;
    border: none;
    background: linear-gradient(135deg, #832EC5 0%, #a855f7 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 8px rgba(131, 46, 197, 0.25);
    transition: all 0.25s ease;
    z-index: 101;
    opacity: 0.7;
}

.sidebar-toggle-btn:hover {
    opacity: 1;
    width: 24px;
    right: -24px;
    box-shadow: 3px 3px 12px rgba(131, 46, 197, 0.35);
}

.sidebar-toggle-btn .toggle-icon {
    transition: transform 0.3s ease;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.sidebar-toggle-btn.collapsed .toggle-icon {
    transform: rotate(180deg);
}


/* ========== THEME SELECTOR ========== */
.theme-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.timer-toggle-btn {
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.timer-toggle-btn:hover {
    background: #f0f0f0;
    border-color: var(--color-purple);
}

.timer-toggle-btn.inactive {
    opacity: 0.6;
    background: #f0f0f0;
}

.timer-toggle-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.theme-selector-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-label {
    font-size: clamp(14px, 1.5vw, 23px);
    font-weight: 600;
    color: var(--text-primary);
}

.theme-selector .custom-dropdown {
    width: 175px;
}

/* Custom Dropdowns */
.custom-dropdown {
    position: relative;
    display: inline-block;
}



.dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    font-size: 16px;
    font-weight: 500;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.dropdown-trigger:hover {
    border-color: var(--color-purple);
    background: #f8f8f8;
}

.dropdown-trigger.open {
    border-color: var(--color-purple);
    border-bottom: 1px solid transparent;
    border-radius: 8px 8px 0 0;
}

.dropdown-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.dropdown-trigger.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-value {
    flex: 1;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: none;
    border-radius: 0 0 8px 8px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    z-index: 1000;
    box-shadow: none;
}

.dropdown-menu.open {
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-top: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dropdown-option {
    padding: 12px 14px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 15px;
    transition: background var(--transition-fast);
    user-select: none;
}

.dropdown-option:hover {
    background: #f0f0f0;
}

.dropdown-option.selected {
    background: var(--color-purple-light);
    color: var(--color-purple-dark);
    font-weight: 600;
}

/* Music dropdown expands upward */
.music-dropdown {
    flex: 1;
    z-index: 1001;
}

.music-dropdown .dropdown-menu {
    top: auto;
    bottom: 100%;
    border-radius: 8px 8px 0 0;
    z-index: 1001;
    width: 100%;
}

.music-dropdown .dropdown-menu.open {
    border-top: 1px solid #e0e0e0;
    border-bottom: none;
}

.music-dropdown .dropdown-trigger.open {
    border-radius: 0 0 8px 8px;
    border-top: 1px solid transparent;
    border-bottom: 1px solid var(--color-purple);
}

.theme-select {
    display: none;
}

.music-select {
    display: none;
}


/* ========== CARDS ========== */
.card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 20px;
    border: none;
    width: 100%;
}


/* ========== TIMER CARD ========== */
.timer-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 0.9;
    min-height: 0;
    padding: 32px;
    overflow: hidden;
}

.card-title {
    font-size: clamp(18px, 1.8vw, 28px);
    font-weight: 600;
    color: #000000;
    margin-bottom: 2px;
    text-align: center;
}

.timer-arc-container {
    position: relative;
    width: 85%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
}

.timer-arc {
    width: 100%;
    height: auto;
}

.timer-arc-bg {
    fill: none;
    stroke: rgba(156, 252, 236, 0.25);
    stroke-width: 14;
    stroke-linecap: round;
    transition: stroke 0.3s ease, opacity 0.3s ease;
}

.timer-arc-progress {
    fill: none;
    stroke: url(#arcGradient);
    stroke-width: 14;
    stroke-linecap: round;
    stroke-dasharray: 251;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.8s ease-out;
}

.timer-display-wrapper {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.timer-display {
    font-size: clamp(32px, 4vw, 64px);
    font-weight: 700;
    color: #7B5FC4;
    letter-spacing: 1px;
    cursor: pointer;
    transition: color var(--transition-fast);
    display: block;
}

.timer-edit-input {
    display: none;
    font-size: clamp(32px, 4vw, 64px); /* Match timer-display size */
    font-weight: 700;
    color: var(--color-purple-dark);
    text-align: center;
    border: none;
    background: transparent;
    font-family: inherit;
    letter-spacing: 1px; /* Match timer-display letter-spacing */
    padding: 0;
    margin: 0;
    width: auto;
    min-width: 180px;
}

.timer-edit-input.editing {
    display: block;
}

.timer-edit-input:focus {
    outline: none;
}

/* Timer theme indicator - positioned along the arc */
.timer-theme-indicator {
    position: absolute;
    font-size: clamp(14px, 1.8vw, 24px);
    z-index: 10;
    transition: left 0.8s ease-out, top 0.8s ease-out;
    transform: translate(-50%, -50%);
    /* White circle with shadow */
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(24px, 2.5vw, 38px);
    height: clamp(24px, 2.5vw, 38px);
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timer-theme-indicator .indicator-image {
    width: 70%;
    height: 70%;
    object-fit: contain;
}

.timer-controls {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.timer-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: #f5f5f5;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.timer-btn:hover {
    background: var(--color-purple-light);
    color: var(--color-purple-dark);
}

.timer-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.timer-btn svg {
    width: 22px;
    height: 22px;
}


/* ========== NOISE METER CARD ========== */
.noise-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1.1;
    min-height: 0;
    padding: 24px 32px 36px 32px;
    overflow: hidden;
}

.noise-card.hidden {
    display: none;
}

/* Timer card visibility animations (not in simple mode) */
.timer-card {
    transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease;
}

.timer-card.timer-hidden {
    opacity: 0;
    transform: translateY(-20px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    margin-bottom: calc(-1 * var(--card-gap));
    overflow: hidden;
    pointer-events: none;
    flex: 0;
}

/* Noise card expansion when timer is hidden (not in simple mode) */
.noise-card {
    transition: flex 0.3s ease, transform 0.3s ease, padding 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, border-radius 0.3s ease;
}

.noise-card.expanded {
    flex: 2;
    padding: 12px 12px 16px 12px;
    justify-content: center;
}

.noise-card.expanded .gauge-container {
    flex: none;
    justify-content: center;
}

.noise-card.expanded .gauge-label {
    margin-bottom: 2px;
}

/* When timer is hidden, make sidebar white and remove noise card container styling (not in simple mode) */
body:not([data-theme="simple"]) .sidebar:has(.timer-card.timer-hidden) {
    background: var(--card-bg);
    border-radius: 0;
}

body:not([data-theme="simple"]) .sidebar:has(.timer-card.timer-hidden) .noise-card {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

/* Ensure simple mode doesn't get these animations */
body[data-theme="simple"] .timer-card.timer-hidden {
    opacity: 1;
    transform: none;
    max-height: none;
    padding: 70px 50px;
    pointer-events: auto;
}

body[data-theme="simple"] .noise-card.expanded {
    flex: unset;
    transform: none;
}

.gauge-container {
    position: relative;
    width: 85%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
}

.gauge {
    width: 100%;
    height: auto;
}

.gauge-bg {
    fill: none;
    stroke: #f0f0f0;
    stroke-width: 13;
    stroke-linecap: round;
}

.gauge-fill {
    fill: none;
    stroke: url(#gaugeGradient);
    stroke-width: 13;
    stroke-linecap: round;
    stroke-dasharray: 251.33;
    stroke-dashoffset: 251.33;
    transition: stroke-dashoffset 0.3s ease-out;
}

.gauge-threshold {
    stroke: #F44336;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 4, 3;
    opacity: 0.8;
}

.gauge-needle {
    stroke: #7B5FC4 !important;
    stroke-width: 2.5 !important;
    stroke-linecap: round;
    transform-origin: 100px 100px;
    transition: transform 0.3s ease-out;
}

.gauge-center {
    fill: #7B5FC4 !important;
}

.gauge-label {
    font-size: clamp(18px, 1.8vw, 28px);
    font-weight: 600;
    color: #000000;
    text-align: center;
    margin-bottom: 2px;
}

.sensitivity-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80%;
    max-width: 280px;
    gap: 12px;
}

.sensitivity-slider {
    width: 100%;
    height: clamp(6px, 0.8vw, 10px);
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #4CAF50, #FFC107, #F44336);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

.sensitivity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: white;
    border: 2px solid #666;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sensitivity-slider::-moz-range-thumb {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: white;
    border: 2px solid #666;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sensitivity-label {
    font-size: clamp(12px, 1.1vw, 17px);
    color: var(--text-muted);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin-top: 4px;
    margin-bottom: 8px;
    white-space: nowrap;
}

.sensitivity-value {
    color: var(--text-muted);
    font-weight: 600;
}

.sensitivity-labels-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 4px;
    margin-bottom: 8px;
    white-space: nowrap;
}

.sensitivity-labels-row .sensitivity-label {
    margin-top: 0;
    margin-bottom: 0;
}

.alert-counter-label {
    font-size: clamp(12px, 1.1vw, 17px);
    color: var(--text-muted);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    white-space: nowrap;
}

.alert-counter-value {
    font-weight: 700;
}

.mic-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(4px, 0.6vw, 10px);
    margin-top: 16px;
    margin-bottom: 4px;
    width: 100%;
}

.component-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    border: none;
    border-radius: 50%;
    background: #f5f5f5;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.component-btn:hover {
    background: var(--color-purple-light);
    color: var(--color-purple-dark);
}

.component-btn.active {
    background: var(--color-purple);
    color: white;
}

.component-btn.muted {
    background: #f5f5f5;
    color: #e74c3c;
}

.component-btn.muted:hover {
    background: #ffebee;
    color: #c0392b;
}

.component-btn svg {
    width: 22px;
    height: 22px;
}

.alert-sound-dropdown {
    width: clamp(90px, 10vw, 200px);
    flex-shrink: 1;
    position: relative;
    z-index: 1001;
}

.alert-sound-dropdown .dropdown-trigger {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    height: 38px;
    box-sizing: border-box;
}

.alert-sound-dropdown .dropdown-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.alert-sound-dropdown .dropdown-menu {
    min-width: 120px;
    top: auto;
    bottom: 100%;
    border-radius: 8px 8px 0 0;
}

.alert-sound-dropdown .dropdown-menu.open {
    border-bottom: none;
    border-top: 1px solid #e0e0e0;
}

.alert-sound-dropdown .dropdown-trigger.open {
    border-radius: 0 0 8px 8px;
    border-bottom: 1px solid #e0e0e0;
    border-top: 1px solid transparent;
}

.mic-selector-dropdown {
    width: clamp(80px, 9vw, 180px);
    flex-shrink: 1;
    position: relative;
    z-index: 1001;
}

.mic-selector-dropdown .dropdown-trigger {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    height: 38px;
    box-sizing: border-box;
}

.mic-selector-dropdown .dropdown-value {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.mic-selector-dropdown .dropdown-menu {
    min-width: 180px;
    top: auto;
    bottom: 100%;
    border-radius: 8px 8px 0 0;
}

.mic-selector-dropdown .dropdown-menu.open {
    border-bottom: none;
    border-top: 1px solid #e0e0e0;
}

.mic-selector-dropdown .dropdown-trigger.open {
    border-radius: 0 0 8px 8px;
    border-bottom: 1px solid #e0e0e0;
    border-top: 1px solid transparent;
}


/* ========== MUSIC PLAYER ========== */
.music-player {
    display: flex;
    align-items: center;
    gap: 13px;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 13px 16px;
    margin-top: auto;
    margin-bottom: 4px;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
    position: relative;
}

.play-btn {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: var(--text-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.play-btn:hover {
    background: var(--color-purple);
    transform: scale(1.05);
}

.play-btn.active {
    background: var(--color-purple);
}

.play-btn svg {
    width: 24px;
    height: 24px;
}




/* ========== MAIN CONTENT ========== */
.main-content {
    flex: 1;
    height: 100vh;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    transition: background-image 0.5s ease, margin-left var(--transition-normal);
    margin-left: var(--sidebar-width);
}

.main-content::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
    box-shadow:
        0 0 0 0 rgba(0, 0, 0, 0),
        inset 0 0 0 0 rgba(0, 0, 0, 0),
        inset 0 0 0 0 rgba(0, 0, 0, 0);
    z-index: 40;
}

.main-content.timer-complete::before {
    opacity: 1;
    animation: timerBorderGlow 2.4s ease-out;
}

@keyframes timerBorderGlow {
    0% {
        box-shadow:
            0 0 18px 6px rgba(255, 215, 107, 0.55),
            inset 0 0 28px 10px rgba(255, 140, 102, 0.35),
            inset 0 0 60px 20px rgba(131, 46, 197, 0.2);
    }
    40% {
        box-shadow:
            0 0 36px 14px rgba(255, 215, 107, 0.85),
            inset 0 0 40px 16px rgba(255, 140, 102, 0.6),
            inset 0 0 90px 30px rgba(131, 46, 197, 0.4);
    }
    100% {
        box-shadow:
            0 0 6px 2px rgba(255, 215, 107, 0),
            inset 0 0 10px 4px rgba(255, 140, 102, 0),
            inset 0 0 30px 10px rgba(131, 46, 197, 0);
    }
}


/* ========== ROBOT ========== */
.robot-container {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
}

.robot-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.robot-image {
    width: clamp(180px, 25vw, 280px);
    height: auto;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

.robot-video {
    width: clamp(800px, 90vw, 1400px);
    height: auto;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

body.robot-hidden .robot-container {
    display: none;
}

.robot-wrapper.studying .robot-image {
    animation: gentle-bounce 3s ease-in-out infinite;
}

.robot-wrapper.alert .robot-image {
    animation: shake 0.5s ease-in-out;
}

@keyframes gentle-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0) rotate(0);
    }

    25% {
        transform: translateX(-8px) rotate(-3deg);
    }

    75% {
        transform: translateX(8px) rotate(3deg);
    }
}

@keyframes celebrate {

    0%,
    100% {
        transform: scale(1) rotate(0);
    }

    25% {
        transform: scale(1.1) rotate(-5deg);
    }

    50% {
        transform: scale(1.15) rotate(0);
    }

    75% {
        transform: scale(1.1) rotate(5deg);
    }
}

.robot-wrapper.celebrate .robot-image {
    animation: celebrate 0.8s ease-in-out;
}


/* ========== NOISE VISUAL EFFECT ========== */
.noise-effect-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 40;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: hidden;
    --intensity-color: rgba(255, 100, 100, 0.15);
}

.noise-effect-layer.active {
    opacity: 1;
}

/* Screen flash effect for high intensity */
.screen-flash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--intensity-color);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease;
}

.noise-effect-layer.active .screen-flash {
    animation: screen-pulse var(--flash-duration, 0.8s) ease-in-out infinite;
}

@keyframes screen-pulse {

    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: var(--flash-opacity, 0.3);
    }
}

/* Ripple circles emanating from center */
.ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    margin-left: -100px;
    margin-top: -100px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    opacity: 0;
    --ripple-scale: 1;
    --ripple-opacity: 0.6;
    --ripple-speed: 2.5s;
    will-change: transform, opacity;
}

.noise-effect-layer.active .ripple {
    animation: ripple-expand var(--ripple-speed) ease-out infinite;
}

.ripple-1 {
    animation-delay: 0s;
}

.ripple-2 {
    animation-delay: 0.5s;
}

.ripple-3 {
    animation-delay: 1s;
}

.ripple-4 {
    animation-delay: 1.5s;
}

.ripple-5 {
    animation-delay: 2s;
}

.ripple-6 {
    animation-delay: 2.5s;
}

@keyframes ripple-expand {
    0% {
        transform: scale(0.1);
        opacity: var(--ripple-opacity);
    }

    100% {
        transform: scale(calc(12 * var(--ripple-scale)));
        opacity: 0;
    }
}

/* Individual sound wave bars - natural spread */
.sound-wave {
    position: absolute;
    bottom: 0;
    width: 8px;
    height: 80px;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.9));
    border-radius: 4px;
    opacity: 0;
    --wave-scale: 1;
    --wave-delay: 0s;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
    transform-origin: bottom center;
    will-change: transform, opacity;
}

.noise-effect-layer.active .sound-wave {
    animation: wave-pulse 0.8s ease-in-out infinite;
    animation-delay: var(--wave-delay);
}

@keyframes wave-pulse {

    0%,
    100% {
        transform: scaleY(0.2);
        opacity: 0.3;
    }

    50% {
        transform: scaleY(var(--wave-scale));
        opacity: 0.9;
    }
}

/* Theme-specific effect colors - whiter tints */
body[data-theme="space"] .noise-effect-layer {
    --intensity-color: rgba(255, 255, 255, 0.15);
}

body[data-theme="space"] .ripple {
    border-color: rgba(220, 255, 250, 0.9);
}

body[data-theme="space"] .sound-wave {
    background: linear-gradient(to top, rgba(200, 255, 245, 0.2), rgba(220, 255, 250, 0.95));
}

body[data-theme="dinosaur"] .noise-effect-layer {
    --intensity-color: rgba(255, 255, 255, 0.15);
}

body[data-theme="dinosaur"] .ripple {
    border-color: rgba(230, 255, 220, 0.9);
}

body[data-theme="dinosaur"] .sound-wave {
    background: linear-gradient(to top, rgba(220, 255, 210, 0.2), rgba(230, 255, 220, 0.95));
}

body[data-theme="dance"] .noise-effect-layer {
    --intensity-color: rgba(255, 255, 255, 0.15);
}

body[data-theme="dance"] .ripple {
    border-color: rgba(255, 230, 255, 0.9);
}

body[data-theme="dance"] .sound-wave {
    background: linear-gradient(to top, rgba(255, 220, 255, 0.2), rgba(255, 230, 255, 0.95));
}

body[data-theme="egypt"] .noise-effect-layer {
    --intensity-color: rgba(255, 255, 255, 0.15);
}

body[data-theme="egypt"] .ripple {
    border-color: rgba(255, 245, 220, 0.9);
}

body[data-theme="egypt"] .sound-wave {
    background: linear-gradient(to top, rgba(255, 240, 210, 0.2), rgba(255, 245, 220, 0.95));
}

body[data-theme="wizard"] .noise-effect-layer {
    --intensity-color: rgba(255, 255, 255, 0.15);
}

body[data-theme="wizard"] .ripple {
    border-color: rgba(240, 230, 255, 0.9);
}

body[data-theme="wizard"] .sound-wave {
    background: linear-gradient(to top, rgba(235, 225, 255, 0.2), rgba(240, 230, 255, 0.95));
}

body[data-theme="zombies"] .noise-effect-layer {
    --intensity-color: rgba(255, 255, 255, 0.18);
}

body[data-theme="zombies"] .ripple {
    border-color: rgba(255, 235, 235, 0.9);
}

body[data-theme="zombies"] .sound-wave {
    background: linear-gradient(to top, rgba(255, 230, 230, 0.2), rgba(255, 235, 235, 0.95));
}

body[data-theme="library"] .noise-effect-layer {
    --intensity-color: rgba(255, 255, 255, 0.15);
}

body[data-theme="library"] .ripple {
    border-color: rgba(255, 240, 235, 0.9);
}

body[data-theme="library"] .sound-wave {
    background: linear-gradient(to top, rgba(255, 235, 230, 0.2), rgba(255, 240, 235, 0.95));
}

body[data-theme="balls"] .noise-effect-layer {
    --intensity-color: rgba(255, 255, 255, 0.15);
}

body[data-theme="balls"] .ripple {
    border-color: rgba(255, 240, 245, 0.9);
}

body[data-theme="balls"] .sound-wave {
    background: linear-gradient(to top, rgba(255, 235, 240, 0.2), rgba(255, 240, 245, 0.95));
}


/* ========== NOISE ALERT TEXT ========== */
.noise-alert-text {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    font-size: 100px;
    font-weight: 100;
    color: rgba(255, 255, 255, 0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 60;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    font-family: 'Fredoka One', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.noise-alert-text.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

body[data-theme="balls"] .noise-alert-text {
    display: block;
}

body:not([data-theme="balls"]) .noise-alert-text {
    display: none;
}


/* ========== SPEECH BUBBLE ========== */
.speech-bubble {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: white;
    padding: 8px 16px;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-bottom: 16px;
    white-space: nowrap;
    text-align: center;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 22px;
    z-index: 100;
}

.speech-bubble.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) scale(1);
}

.speech-bubble-tail {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid white;
}

/* Dinosaur theme speech bubble - positioned to the right with left-pointing tail */
body[data-theme="dinosaur"] .speech-bubble {
    bottom: 60%;
    left: 60%;
    right: auto;
    transform: scale(0.8);
    transform-origin: left center;
    margin-bottom: 0;
}

body[data-theme="dinosaur"] .speech-bubble.show {
    transform: scale(1);
}

body[data-theme="dinosaur"] .speech-bubble-tail {
    bottom: 50%;
    left: -10px;
    right: auto;
    transform: translateY(50%);
    border-left: none;
    border-right: 12px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
}

/* Space theme - larger robot and speech bubble positioned to the right */
body[data-theme="space"] .robot-image {
    width: clamp(360px, 50vw, 560px);
}

body[data-theme="space"] .robot-container {
    bottom: 0;
}

/* Wizard and Zombies videos - larger */
body[data-theme="wizard"] .robot-video,
body[data-theme="zombies"] .robot-video {
    width: auto;
    height: 100vh;
    max-width: 100vw;
    object-fit: contain;
    object-position: bottom center;
}

body[data-theme="wizard"] .robot-container,
body[data-theme="zombies"] .robot-container {
    bottom: 0;
}

body[data-theme="space"] .robot-video {
    width: auto;
    height: 100vh;
    max-width: 100vw;
    object-fit: contain;
    object-position: bottom center;
}

body[data-theme="space"] .speech-bubble {
    bottom: 60%;
    left: 60%;
    right: auto;
    transform: scale(0.8);
    transform-origin: left center;
    margin-bottom: 0;
}

/* Dance theme - robot video */
body[data-theme="dance"] .robot-video {
    width: auto;
    height: 100vh;
    max-width: 100vw;
    object-fit: contain;
    object-position: bottom center;
}

/* Wizard theme - robot video */
body[data-theme="wizard"] .robot-video {
    width: auto;
    height: 100vh;
    max-width: 100vw;
    object-fit: contain;
    object-position: bottom center;
}

/* Library theme - robot video */
body[data-theme="library"] .robot-video {
    width: auto;
    height: 100vh;
    max-width: 100vw;
    object-fit: contain;
    object-position: bottom center;
}

/* Robot container positioning for video themes */
body[data-theme="dance"] .robot-container,
body[data-theme="wizard"] .robot-container,
body[data-theme="library"] .robot-container {
    bottom: 0;
}

body[data-theme="space"] .speech-bubble.show {
    transform: scale(1);
}

body[data-theme="space"] .speech-bubble-tail {
    bottom: 50%;
    left: -10px;
    right: auto;
    transform: translateY(50%);
    border-left: none;
    border-right: 12px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
}

/* Dance theme - speech bubble positioned to the right with left-pointing tail */
body[data-theme="dance"] .speech-bubble {
    bottom: 60%;
    left: 60%;
    right: auto;
    transform: scale(0.8);
    transform-origin: left center;
    margin-bottom: 0;
}

body[data-theme="dance"] .speech-bubble.show {
    transform: scale(1);
}

body[data-theme="dance"] .speech-bubble-tail {
    bottom: 50%;
    left: -10px;
    right: auto;
    transform: translateY(50%);
    border-left: none;
    border-right: 12px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
}

/* Egypt theme - speech bubble positioned to the right with left-pointing tail */
body[data-theme="egypt"] .speech-bubble {
    bottom: 60%;
    left: 60%;
    right: auto;
    transform: scale(0.8);
    transform-origin: left center;
    margin-bottom: 0;
}

body[data-theme="egypt"] .speech-bubble.show {
    transform: scale(1);
}

body[data-theme="egypt"] .speech-bubble-tail {
    bottom: 50%;
    left: -10px;
    right: auto;
    transform: translateY(50%);
    border-left: none;
    border-right: 12px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
}

/* Wizard theme - speech bubble positioned to the right with left-pointing tail */
body[data-theme="wizard"] .speech-bubble {
    bottom: 60%;
    left: 60%;
    right: auto;
    transform: scale(0.8);
    transform-origin: left center;
    margin-bottom: 0;
}

body[data-theme="wizard"] .speech-bubble.show {
    transform: scale(1);
}

body[data-theme="wizard"] .speech-bubble-tail {
    bottom: 50%;
    left: -10px;
    right: auto;
    transform: translateY(50%);
    border-left: none;
    border-right: 12px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
}

/* Zombies theme - speech bubble positioned to the right with left-pointing tail */
body[data-theme="zombies"] .speech-bubble {
    bottom: 60%;
    left: 60%;
    right: auto;
    transform: scale(0.8);
    transform-origin: left center;
    margin-bottom: 0;
}

body[data-theme="zombies"] .speech-bubble.show {
    transform: scale(1);
}

body[data-theme="zombies"] .speech-bubble-tail {
    bottom: 50%;
    left: -10px;
    right: auto;
    transform: translateY(50%);
    border-left: none;
    border-right: 12px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
}

/* Library theme - speech bubble positioned to the right with left-pointing tail */
body[data-theme="library"] .speech-bubble {
    bottom: 60%;
    left: 60%;
    right: auto;
    transform: scale(0.8);
    transform-origin: left center;
    margin-bottom: 0;
}

body[data-theme="library"] .speech-bubble.show {
    transform: scale(1);
}

body[data-theme="library"] .speech-bubble-tail {
    bottom: 50%;
    left: -10px;
    right: auto;
    transform: translateY(50%);
    border-left: none;
    border-right: 12px solid white;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
}

/* Balls Theme */
body[data-theme="balls"] .robot-container {
    display: none;
}

body[data-theme="balls"] .noise-effect-layer {
    display: none;
}

.balls-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.balls-canvas:active {
    cursor: grabbing;
}

/* ========== SIMPLE MODE ========== */
body[data-theme="simple"] {
    flex-direction: column;
    overflow-y: auto !important; /* Allow scrolling if content is too tall */
}

body[data-theme="simple"] .sidebar {
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    padding: 0;
    background: transparent;
    position: sticky; /* Better than fixed for scrolling */
    top: 0;
    left: 0;
    display: flex;
    flex-direction: row; /* Align items in a row */
    justify-content: flex-start; /* Align contents to the left */
    align-items: center;
    padding: 16px 24px;
    z-index: 10000; /* Ensure header stays above content */
    border-bottom: 1px solid rgba(0,0,0,0.05);
    background-color: #d1c4e9; /* Match simple background */
    overflow: visible; /* Allow dropdowns to overflow */
    gap: 16px;
    transform: none; /* Override collapse transform */
}

body[data-theme="simple"] .sidebar-toggle-btn {
    display: none; /* Hide toggle button in simple mode */
}

body[data-theme="simple"] .theme-selector {
    position: static; /* Let it flow in the new sidebar header */
    width: auto;
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 10001; /* Ensure selector is above other header items */
}

/* Ensure dropdowns are visible */
body[data-theme="simple"] .custom-dropdown {
    z-index: 10002;
}
body[data-theme="simple"] .dropdown-menu {
    z-index: 10003;
}

body[data-theme="simple"] .theme-selector-right {
    gap: 15px;
}

/* Cards hidden in sidebar for simple mode - shown via .simple-card-group */

body[data-theme="simple"] .music-player {
    display: none;
}

body[data-theme="simple"] .robot-container {
    display: none;
}

body[data-theme="simple"] .noise-effect-layer {
    display: none;
}

#simpleModeControls {
    display: none !important;
    gap: 15px;
}

body[data-theme="simple"] #simpleModeControls {
    display: flex !important;
    margin-left: auto; /* Push controls to the right */
}

.simple-toggle-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--color-purple);
    border-radius: 20px;
    color: var(--color-purple);
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.simple-toggle-btn:hover {
    background: var(--color-purple-light);
    box-shadow: 0 6px 16px rgba(155, 126, 217, 0.3);
}

.simple-toggle-btn:active {
    transform: scale(0.95);
}

.simple-toggle-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.simple-toggle-btn.disabled:hover {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body[data-theme="simple"] .main-content {
    width: 100%;
    min-height: calc(100vh - 80px); /* Subtract header height */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    background-image: none !important;
    background-color: #d1c4e9;
    overflow: visible; /* Let body handle scroll */
    margin-left: 0; /* Override sidebar margin in simple mode */
}

.simple-card-group {
    display: flex;
    gap: clamp(20px, 4vw, 60px); /* Responsive gap */
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    max-width: 1400px;
    transition: gap 0.4s ease;
}

.simple-card-group:has(.timer-card.hidden) {
    gap: 0;
}

/* Base card style for simple mode - responsive */
body[data-theme="simple"] .card {
    display: flex !important;
    /* Use clamp for responsive sizing: min 300px, preferred 45vw, max 600px */
    width: clamp(300px, 45vw, 600px);
    /* Make height auto but try to match width (aspect-ratio optional but good for squareness) */
    height: auto;
    min-height: clamp(300px, 45vw, 600px); 
    aspect-ratio: 1 / 1;
    padding: clamp(20px, 3vw, 50px);
    overflow: hidden !important; /* Prevent content spill */
    flex: 0 1 auto; /* Allow shrinking */
    background: white;
    border-radius: 26px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
}

body[data-theme="simple"] .timer-card {
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
}

body[data-theme="simple"] .card-title {
    font-size: clamp(20px, 2.5vw, 28px);
    margin-bottom: 0;
    flex-shrink: 0;
}

body[data-theme="simple"] .timer-arc-container {
    width: 100%;
    max-width: 400px;
    position: relative;
    flex-shrink: 1; /* Allow shrinking */
    display: flex;
    justify-content: center;
    align-items: center;
}

body[data-theme="simple"] .timer-arc {
    width: 100%;
    height: auto;
    max-height: 100%;
}

body[data-theme="simple"] .timer-display-wrapper {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

body[data-theme="simple"] .timer-display {
    font-size: clamp(32px, 5vw, 64px) !important;
    font-weight: 700;
    line-height: 1;
}

body[data-theme="simple"] .timer-controls {
    margin-top: 20px;
    gap: 20px;
    flex-shrink: 0;
}

body[data-theme="simple"] .timer-btn {
    width: clamp(40px, 5vw, 56px);
    height: clamp(40px, 5vw, 56px);
}

body[data-theme="simple"] #noiseMeterContainer {
    width: clamp(300px, 45vw, 600px) !important;
    min-width: 300px; /* Allow shrinking down to 300 */
    height: auto;
    min-height: clamp(300px, 45vw, 600px);
    padding: clamp(30px, 4vw, 70px) clamp(20px, 3vw, 50px);
    flex-shrink: 0;
}

body[data-theme="simple"] .gauge-container {
    width: 100%;
    height: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2vw, 36px);
}

body[data-theme="simple"] .gauge {
    width: 100%;
    max-width: 460px;
    height: auto;
    max-height: 300px;
    margin-top: clamp(10px, 3vw, 40px);
}

body[data-theme="simple"] .gauge-label {
    font-size: clamp(20px, 2.5vw, 30px);
    font-weight: 600;
    margin-bottom: clamp(10px, 2vw, 20px);
    margin-top: clamp(15px, 2.5vw, 40px); /* Add top margin to lower the title */
}

body[data-theme="simple"] .sensitivity-control {
    width: 100%;
    max-width: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(10px, 2vw, 24px);
    margin-top: auto;
}

body[data-theme="simple"] .sensitivity-slider {
    width: 80%;
    height: 10px;
}

body[data-theme="simple"] .sensitivity-label {
    font-size: clamp(16px, 1.8vw, 22px);
    font-weight: 600;
    text-align: center;
}

body[data-theme="simple"] .alert-counter-label {
    font-size: clamp(16px, 1.8vw, 22px);
    text-align: center;
}

body[data-theme="simple"] .alert-counter-value {
    font-weight: 700;
}

body[data-theme="simple"] .mic-controls {
    width: 100%;
    display: flex;
    gap: clamp(10px, 2vw, 24px);
    justify-content: center;
    margin-top: clamp(10px, 2vw, 20px);
    margin-bottom: clamp(20px, 4vw, 60px);
    flex-wrap: wrap; /* Wrap controls on small screens */
}

body[data-theme="simple"] .component-btn {
    width: clamp(44px, 5vw, 60px);
    height: clamp(44px, 5vw, 60px);
    padding: 12px;
}

body[data-theme="simple"] .alert-sound-dropdown {
    flex: 1 1 auto;
    width: auto;
    min-width: 120px;
    max-width: 160px;
}

body[data-theme="simple"] .mic-selector-dropdown {
    flex: 1 1 auto;
    width: auto;
    min-width: 150px;
    max-width: 200px;
}

body[data-theme="simple"] .timer-card.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    width: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
    transition: opacity 0.4s ease, transform 0.4s ease, width 0.4s ease, margin 0.4s ease;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
    :root {
        --sidebar-width: 240px;
    }

    .timer-display {
        font-size: 32px;
    }

    .robot-image {
        width: clamp(140px, 20vw, 200px);
    }
}

@media (max-width: 700px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 50vh;
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
        padding: 12px;
        gap: 8px;
    }

    .theme-selector {
        width: 100%;
    }

    .card {
        min-width: 200px;
        flex: 1;
    }

    .music-player {
        width: 100%;
        margin-top: 0;
    }

    .main-content {
        height: 50vh;
    }

    .robot-container {
        bottom: 5%;
    }
}

@media (max-width: 480px) {
    .sidebar {
        flex-direction: column;
        max-height: 60vh;
        overflow-y: auto;
    }

    .card {
        min-width: 100%;
    }

    .timer-display {
        font-size: 32px;
    }

    .main-content {
        height: 40vh;
    }
}


/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid var(--color-purple);
    outline-offset: 2px;
}
