/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0a0a1a;
    --bg-elevated: #0f0f24;
    --bg-card: #151528;
    --bg-card-active: #1e1e3a;
    --bg-card-hover: #1a1a35;
    --text: #e8e8f0;
    --text-dim: #8888aa;
    --text-muted: #5555777;
    --accent: #6c5ce7;
    --accent-glow: rgba(108, 92, 231, 0.3);
    --accent-light: #a29bfe;
    --accent-soft: rgba(108, 92, 231, 0.1);
    --nav-bg: #0d0d20;
    --border: #2a2a4a;
    --border-light: #353560;
    --success: #00b894;
    --danger: #e74c6c;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --glass: rgba(255, 255, 255, 0.03);
}

/* === Light Mode === */
[data-theme="light"] {
    --bg: #f5f5fa;
    --bg-elevated: #ffffff;
    --bg-card: #ffffff;
    --bg-card-active: #ede8ff;
    --bg-card-hover: #f8f6ff;
    --text: #1a1a2e;
    --text-dim: #666680;
    --text-muted: #99999f;
    --accent: #6c5ce7;
    --accent-glow: rgba(108, 92, 231, 0.2);
    --accent-light: #5a4bd1;
    --accent-soft: rgba(108, 92, 231, 0.08);
    --nav-bg: #ffffff;
    --border: #e0e0ee;
    --border-light: #d0d0e0;
    --success: #00b894;
    --danger: #e74c6c;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --glass: rgba(255, 255, 255, 0.6);
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    transition: background var(--transition), color var(--transition);
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 500px;
    margin: 0 auto;
}

/* === Header === */
#header {
    text-align: center;
    padding: 16px 16px 8px;
    flex-shrink: 0;
    position: relative;
}

#header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Theme Toggle */
.theme-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 18px;
    line-height: 1;
    color: var(--text-dim);
}

.theme-toggle:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.theme-toggle:active {
    transform: scale(0.9);
}

/* === Status Bar (Now Playing) === */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 12px;
    color: var(--text-dim);
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.status-bar.visible {
    opacity: 1;
    height: 28px;
}

.status-bar .status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.status-bar .status-text {
    font-weight: 500;
}

/* === Main / Pages === */
#main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 16px 16px;
    -webkit-overflow-scrolling: touch;
}

.page { display: none; }
.page.active { display: block; animation: pageIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

@keyframes pageIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .page.active { animation: none; }
    .sound-card, .play-button, .nav-btn, .preset-card { transition: none !important; }
    .breathe-circle { transition: none !important; }
    @keyframes pulse { 0%, 100% { opacity: 1; } }
    @keyframes statusPulse { 0%, 100% { opacity: 1; } }
}

/* === Sound Grid === */
.sound-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding-top: 8px;
}

.sound-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.sound-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 30%, var(--accent-glow), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.sound-card:hover {
    border-color: var(--border-light);
    background: var(--bg-card-hover);
}

.sound-card.active {
    border-color: var(--accent);
    background: var(--bg-card-active);
    box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}

.sound-card.active::before {
    opacity: 1;
}

.sound-card:active {
    transform: scale(0.96);
}

.sound-icon {
    font-size: 32px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease;
    color: var(--accent-light);
}

.sound-card.active .sound-icon {
    transform: scale(1.1);
    color: var(--text);
}

.sound-name {
    font-size: 13px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.sound-desc {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 3px;
    position: relative;
    z-index: 1;
    line-height: 1.3;
}

/* Active indicator */
.sound-card.active::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
    z-index: 2;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent-glow); }
    50% { opacity: 0.6; box-shadow: 0 0 0 6px transparent; }
}

/* === Master Controls === */
#master-controls {
    flex-shrink: 0;
    padding: 10px 20px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
}

.play-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #5a4bd1);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.1);
    transition: all var(--transition);
}

.play-button:hover {
    box-shadow: 0 6px 28px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
    transform: scale(1.03);
}

.play-button:active {
    transform: scale(0.92);
}

.play-button.playing {
    background: linear-gradient(135deg, var(--danger), #d63384);
    box-shadow: 0 4px 20px rgba(231, 76, 108, 0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}

.volume-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 280px;
    color: var(--text-dim);
}

/* === Volume Slider === */
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    transition: background var(--transition);
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 8px var(--accent-glow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.volume-slider::-webkit-slider-thumb:active {
    transform: scale(1.2);
    box-shadow: 0 3px 12px var(--accent-glow);
}

.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
}

/* Focus styles for accessibility */
.volume-slider:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

/* === Bottom Nav === */
#bottom-nav {
    flex-shrink: 0;
    display: flex;
    background: var(--nav-bg);
    border-top: 1px solid var(--border);
    padding: 4px 0 calc(4px + var(--safe-bottom));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nav-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 6px 0;
    transition: color var(--transition), transform 0.15s ease;
    position: relative;
}

.nav-btn:active {
    transform: scale(0.9);
}

.nav-btn.active {
    color: var(--accent);
}

.nav-btn.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

.nav-icon { font-size: 20px; line-height: 1; }
.nav-icon i { vertical-align: middle; }
.nav-label { font-size: 9px; font-weight: 600; letter-spacing: 0.3px; }

/* === Mix Page === */
.mix-panel {
    padding-top: 8px;
}

.mix-empty {
    text-align: center;
    color: var(--text-dim);
    padding: 40px 20px;
    font-size: 14px;
}

.mix-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.mix-slider-row:hover {
    border-color: var(--border-light);
}

.mix-slider-icon { font-size: 22px; flex-shrink: 0; color: var(--accent-light); }
.mix-slider-info { flex: 1; min-width: 0; }
.mix-slider-name { font-size: 13px; font-weight: 600; margin-bottom: 6px; }

.mix-slider-row .volume-slider {
    height: 4px;
}

.mix-slider-row .volume-slider::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
}

.mix-remove {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.mix-remove:hover { color: var(--danger); background: rgba(231, 76, 108, 0.1); }

#mix-actions {
    margin-top: 16px;
    text-align: center;
}

.save-mix-btn {
    background: var(--bg-card);
    border: 1.5px solid var(--accent);
    color: var(--accent-light);
    border-radius: var(--radius-sm);
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
    box-shadow: var(--shadow-sm);
}

.save-mix-btn:hover { background: var(--accent-soft); }
.save-mix-btn:active { transform: scale(0.97); }

/* === Timer Page === */
.timer-container {
    text-align: center;
    padding-top: 24px;
}

.timer-display {
    font-size: 48px;
    font-weight: 200;
    color: var(--accent-light);
    margin-bottom: 28px;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
}

.timer-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.timer-btn {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    min-width: 90px;
    box-shadow: var(--shadow-sm);
}

.timer-btn:hover { border-color: var(--border-light); }
.timer-btn:active { transform: scale(0.95); }

.timer-btn.active {
    border-color: var(--accent);
    background: var(--bg-card-active);
    color: var(--accent-light);
    box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

.timer-alarm-toggle {
    margin-top: 20px;
}

.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-dim);
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.toggle-text {
    transition: color var(--transition);
}

.toggle-label:has(input:checked) .toggle-text {
    color: var(--accent-light);
}

.timer-cancel {
    margin-top: 24px;
    background: none;
    border: 1.5px solid var(--danger);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 12px 28px;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition);
}

.timer-cancel:hover { background: rgba(231, 76, 108, 0.08); }
.timer-cancel:active { transform: scale(0.95); }

/* === Presets Page === */
.presets-section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    padding-top: 8px;
}

.presets-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preset-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.preset-card:hover { border-color: var(--border-light); }
.preset-card:active { transform: scale(0.98); }

.preset-card.active {
    border-color: var(--accent);
    background: var(--bg-card-active);
    box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}

.preset-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preset-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 3px;
}

.preset-desc {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.4;
}

.preset-sounds {
    margin-top: 8px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.preset-tag {
    font-size: 11px;
    background: var(--accent-soft);
    color: var(--accent-light);
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(108, 92, 231, 0.15);
}

.preset-delete {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 6px 8px;
    color: var(--text-dim);
    opacity: 0.5;
    transition: all var(--transition);
    border-radius: var(--radius-xs);
}

.preset-delete:hover { opacity: 1; color: var(--danger); background: rgba(231, 76, 108, 0.1); }

/* === Visualizer Page === */
.visualizer-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding-top: 8px;
}

#visualizer-canvas {
    flex: 1;
    width: 100%;
    border-radius: var(--radius);
    background: rgba(15, 15, 30, 0.5);
    border: 1px solid var(--border);
}

[data-theme="light"] #visualizer-canvas {
    background: rgba(240, 240, 250, 0.8);
}

.viz-controls {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 12px 0;
}

.viz-mode-btn {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.viz-mode-btn.active {
    border-color: var(--accent);
    color: var(--accent-light);
    background: var(--bg-card-active);
}

.viz-mode-btn:active { transform: scale(0.95); }

/* === Breathing Exercise Page === */
.breathe-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 20px;
}

.breathe-circle {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 100%);
    border: 2px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 20px;
}

.breathe-circle.inhale {
    transform: scale(1.3);
    border-color: var(--accent);
    background: radial-gradient(circle, rgba(108, 92, 231, 0.25) 0%, rgba(108, 92, 231, 0.05) 100%);
    box-shadow: 0 0 40px var(--accent-glow), 0 0 80px rgba(108, 92, 231, 0.1);
}

.breathe-circle.hold {
    transform: scale(1.3);
    border-color: var(--accent-light);
    background: radial-gradient(circle, rgba(162, 155, 254, 0.2) 0%, rgba(162, 155, 254, 0.05) 100%);
    box-shadow: 0 0 30px rgba(162, 155, 254, 0.2);
}

.breathe-circle.exhale {
    transform: scale(1);
    border-color: #5a4bd1;
    background: radial-gradient(circle, rgba(90, 75, 209, 0.1) 0%, transparent 100%);
    transition: all 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.breathe-circle.done {
    border-color: var(--success);
    background: radial-gradient(circle, rgba(0, 184, 148, 0.15) 0%, transparent 100%);
    box-shadow: 0 0 30px rgba(0, 184, 148, 0.2);
}

.breathe-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-light);
}

.breathe-timer {
    font-size: 34px;
    font-weight: 200;
    color: var(--text-dim);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    min-height: 42px;
}

.breathe-desc {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.breathe-subdesc {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

.breathe-controls {
    margin-bottom: 20px;
}

.breathe-start-btn {
    background: linear-gradient(135deg, var(--accent), #5a4bd1);
    border: none;
    color: white;
    border-radius: var(--radius-sm);
    padding: 14px 36px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.breathe-start-btn.active {
    background: linear-gradient(135deg, var(--danger), #d63384);
    box-shadow: 0 4px 16px rgba(231, 76, 108, 0.3);
}

.breathe-start-btn:active { transform: scale(0.95); }

.breathe-cycles {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-dim);
    text-align: center;
}

.breathe-options {
    display: flex;
    align-items: center;
    gap: 12px;
}

.breathe-option-label {
    font-size: 13px;
    color: var(--text-dim);
    font-weight: 500;
}

.breathe-option-btns {
    display: flex;
    gap: 6px;
}

.breathe-opt-btn {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text-dim);
    width: 38px;
    height: 34px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.breathe-opt-btn.active {
    border-color: var(--accent);
    color: var(--accent-light);
    background: var(--bg-card-active);
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
    animation: overlayIn 0.2s ease;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 340px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-input {
    width: 100%;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 15px;
    color: var(--text);
    outline: none;
    margin-bottom: 20px;
    transition: border-color var(--transition);
}

.modal-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.modal-btn.cancel {
    background: var(--bg);
    border: 1.5px solid var(--border);
    color: var(--text-dim);
}

.modal-btn.cancel:hover { border-color: var(--border-light); }

.modal-btn.save {
    background: var(--accent);
    border: 1.5px solid var(--accent);
    color: white;
}

.modal-btn.save:hover { background: #5a4bd1; }
.modal-btn:active { transform: scale(0.97); }

/* === Toast === */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--accent);
    color: white;
    padding: 10px 24px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* === Scrollbar === */
#main::-webkit-scrollbar { width: 3px; }
#main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
#main::-webkit-scrollbar-track { background: transparent; }

/* === Focus visible for keyboard nav === */
button:focus-visible, .sound-card:focus-visible, .preset-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* === Landscape / tablet adjustments === */
@media (min-width: 500px) and (min-height: 600px) {
    .sound-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* === PWA Install Banner === */
.install-banner {
    position: relative;
    background: linear-gradient(135deg, var(--accent), #5a4bd1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    z-index: 300;
    box-shadow: 0 2px 12px rgba(108, 92, 231, 0.4);
    display: none;
}

.install-banner.show {
    display: flex;
}

.install-text {
    font-size: 13px;
    font-weight: 500;
}

.install-btn {
    background: white;
    color: var(--accent);
    border: none;
    border-radius: 20px;
    padding: 6px 18px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s;
}

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

.install-dismiss {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.install-dismiss:hover { color: white; }

/* === Very small screens === */
@media (max-height: 640px) {
    #header { padding: 10px 16px 4px; }
    #header h1 { font-size: 18px; }
    .subtitle { display: none; }
    .sound-card { padding: 14px 12px; }
    .sound-icon { font-size: 26px; margin-bottom: 4px; }
    #master-controls { padding: 6px 20px 4px; gap: 4px; }
    .play-button { width: 52px; height: 52px; }
}
