:root, [data-theme="light"] {
    --bg: #ffffff;
    --card: #ffffff;
    --card-border: #eaeaea;
    --card-hover: #f5f5f5;
    --input-bg: #f5f5f5;
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --text-inactive: #b0b0b0;
    --accent: #2563eb;
    --toggle-on: #7c3aed;
    --danger: #dc2626;
    --safe-top: env(safe-area-inset-top, 0);
    --safe-bottom: env(safe-area-inset-bottom, 0);
    --touch: 48px;
}

[data-theme="dark"] {
    --bg: #0d1117;
    --card: #161b22;
    --card-border: #30363d;
    --card-hover: #21262d;
    --input-bg: #0d1117;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --text-inactive: #6e7681;
    --accent: #58a6ff;
    --toggle-on: #7c3aed;
    --danger: #f85149;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Ladebildschirm */
#loadingScreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
#loadingScreen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
#loadingScreen .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--card-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: loadingSpin 0.9s linear infinite;
}
#loadingScreen .text {
    margin-top: 16px;
    font-size: 1rem;
    color: var(--text-muted);
}
@keyframes loadingSpin {
    to { transform: rotate(360deg); }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: calc(56px + var(--safe-bottom));
    scrollbar-width: thin;
    scrollbar-color: var(--card-border) transparent;
}

/* Scrollbar-Design (Webkit: Chrome, Safari, Edge) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
::-webkit-scrollbar-corner { background: transparent; }

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: var(--card-border) transparent; }

/* Header – „Alarm in X Minuten" + Datum */
header {
    padding: 20px 16px;
    padding-top: max(20px, var(--safe-top));
    background: var(--bg);
    border-bottom: 1px solid var(--card-border);
    position: relative;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-title {
    font-size: clamp(1.5rem, 6vw, 1.75rem);
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 8px;
}
.live-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent, #2563eb);
    opacity: 0.85;
    animation: live-pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes live-pulse {
    0%, 100% { opacity: 0.85; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.7); }
}

.header-subtitle {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin: 4px 0 0 0;
}
.header-subtitle-empty { opacity: 0; pointer-events: none; }

.header-actions {
    display: flex;
    gap: 4px;
}

.header-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}
.header-btn:hover { color: var(--text); background: var(--card-hover); }
.header-btn:active { transform: scale(0.96); }
.header-btn.danger { color: var(--danger); }
.header-btn .theme-icon { width: 22px; height: 22px; display: block; }
[data-theme="dark"] .header-btn .theme-icon { filter: invert(1); }
.header-btn img.theme-icon { vertical-align: middle; }

/* Alarm-Liste */
.main {
    padding: 12px 16px;
    max-width: 600px;
    margin: 0 auto;
}

.wecker {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--card-border);
    cursor: pointer;
    transition: background 0.15s;
    min-height: 72px;
}
.wecker:hover { background: var(--card-hover); }
.wecker:last-child { border-bottom: none; }

.wecker-left { flex: 1; min-width: 0; }
.wecker-label {
    font-size: 0.875rem;
    color: var(--text);
    margin: 0 0 2px 0;
    display: block;
}
.wecker.inaktiv .wecker-label { color: var(--text-inactive); }
.weckzeit {
    font-size: 1.75rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    color: var(--text);
}
.wecker.inaktiv .weckzeit { color: var(--text-inactive); }

.wecker-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.wecker.inaktiv .wecker-meta { color: var(--text-inactive); }

.toggle {
    flex-shrink: 0;
}
.toggle input { display: none; }
.toggle span {
    display: block;
    width: 51px;
    height: 31px;
    background: #d1d5db;
    border-radius: 31px;
    position: relative;
    transition: background 0.2s;
}
.toggle span::after {
    content: '';
    position: absolute;
    width: 27px;
    height: 27px;
    background: #fff;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(20px); }

/* Panels */
.panel { display: none; padding-bottom: calc(56px + var(--safe-bottom)); }
.panel.active { display: block; }
.panel .panel-inner { padding: 12px 16px; max-width: 600px; margin: 0 auto; }
.panel .panel-header { padding: 20px 16px; padding-top: max(20px, var(--safe-top)); background: var(--bg); border-bottom: 1px solid var(--card-border); }
.panel h2.panel-heading { font-size: 1.1rem; margin: 0 0 12px 0; color: var(--text-muted); }

.timer-inner { text-align: center; padding-top: 24px; }
.timer-set { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 16px; }
.timer-set input { width: 64px; padding: 10px; text-align: center; font-size: 1.25rem; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 8px; color: var(--text); }
.timer-presets { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 20px; }
.timer-preset-btn { min-width: 64px; padding: 10px 14px; background: var(--card-hover); border: 1px solid var(--card-border); border-radius: 10px; color: var(--text); font-size: 0.95rem; cursor: pointer; transition: background 0.2s; }
.timer-preset-btn:hover { background: var(--card); }
.timer-preset-btn:active { transform: scale(0.98); }
.timer-anzeige { font-size: 2.5rem; font-weight: 700; letter-spacing: 0.05em; color: var(--text); margin-bottom: 16px; font-variant-numeric: tabular-nums; }
.timer-buttons { display: flex; gap: 10px; justify-content: center; }
#timerPresetEditOverlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 100; display: none; align-items: center; justify-content: center; }
#timerPresetEditOverlay.show { display: flex; }
#timerPresetEditBox { background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 20px; min-width: 260px; }
#timerPresetEditBox h3 { margin: 0 0 12px 0; font-size: 1rem; color: var(--accent); }
.timer-preset-edit-actions { display: flex; gap: 10px; margin-top: 14px; justify-content: flex-end; }
.timer-preset-edit-actions .header-btn { min-height: 40px; padding: 8px 16px; }
.timer-preset-edit-input { width: 100%; padding: 10px 12px; font-size: 1rem; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 8px; color: var(--text); box-sizing: border-box; }
.timer-preset-edit-input:focus { outline: none; border-color: var(--accent); }
.timer-preset-edit-label { display: block; margin-bottom: 6px; font-size: 0.9rem; color: var(--text-muted); }

.musik-inner { padding: 16px; }
.musik-upload { margin-bottom: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.musik-upload-label { font-size: 0.9rem; color: var(--text-muted); display: block; width: 100%; margin-bottom: 4px; }
.musik-upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; }
.musik-album-label { font-size: 0.85rem; color: var(--text-muted); }
.musik-album-input { flex: 1; min-width: 120px; padding: 8px 10px; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 8px; color: var(--text); font-size: 0.9rem; }
.musik-album-select { min-width: 140px; padding: 8px 10px; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 8px; color: var(--text); font-size: 0.9rem; }
.musik-alben-section { margin-bottom: 20px; }
.musik-alben-create { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.musik-alben-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.musik-alben-liste li { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 8px; }
.musik-alben-liste li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.musik-alben-liste li button { flex-shrink: 0; padding: 4px 10px; font-size: 0.85rem; }
.musik-alben-liste li .album-cover-wrap { width: 40px; height: 40px; border-radius: 8px; overflow: hidden; background: var(--card-hover); flex-shrink: 0; }
.musik-alben-liste li .album-cover-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-edit-icon-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.album-edit-cover { width: 48px; height: 48px; flex-shrink: 0; }
.album-edit-icon-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.musik-upload-status { font-size: 0.85rem; color: var(--text-muted); }
.musik-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.musik-info .musik-titel { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.musik-info .musik-album { font-size: 0.8rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.musik-playlist-checkboxes, .musik-edit-playlists { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 8px; }
.musik-playlist-checkboxes label, .musik-edit-playlists label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--text); cursor: pointer; }
.musik-playlist-checkboxes input, .musik-edit-playlists input { flex-shrink: 0; }
.musik-list-wrap { margin-top: 16px; }
.musik-list-title { font-size: 0.95rem; color: var(--accent); margin: 0 0 10px 0; }
.musik-liste { list-style: none; margin: 0; padding: 0; }
.musik-liste li {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 14px; margin-bottom: 8px; background: var(--input-bg); border: 1px solid var(--card-border);
    border-radius: 10px; font-size: 0.9rem; color: var(--text);
}
.musik-liste li .musik-cover-wrap { flex-shrink: 0; width: 48px; height: 48px; border-radius: 8px; overflow: hidden; background: var(--card-hover); }
.musik-liste li .musik-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.musik-liste li .musik-size { font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; }
.musik-liste li button { flex-shrink: 0; padding: 6px 12px; font-size: 0.85rem; }
.musik-edit-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; }
.musik-edit-overlay[aria-hidden="false"] { display: flex; }
.musik-edit-box { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 12px; padding: 20px; max-width: 360px; width: 100%; }
.musik-edit-title { margin: 0 0 14px 0; font-size: 1rem; color: var(--text); }
.musik-edit-label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 4px; }
.musik-edit-input { width: 100%; padding: 8px 10px; margin-bottom: 12px; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 8px; color: var(--text); box-sizing: border-box; }
.musik-edit-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.wetter-suche { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.wetter-suche input { flex: 1; min-width: 100px; padding: 10px 12px; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 8px; color: var(--text); }
.wetter-ort-anzeige { font-size: 0.95rem; color: var(--text-muted); flex: 1; min-width: 0; }
.wetter-ergebnis { font-size: 0.95rem; color: var(--text); }
.wetter-ergebnis .wetter-aktuell { font-size: 1.25rem; margin-bottom: 12px; }
.wetter-ergebnis .wetter-vorhersage { margin-top: 12px; }
.wetter-ergebnis .tag { padding: 8px 0; border-bottom: 1px solid var(--card-border); }

/* Bottom Navigation */
.header-update-bar {
    display: none;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.header-update-bar.visible { display: flex; }
.header-update-btn {
    min-height: 36px;
    padding: 0 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    touch-action: manipulation;
}
.header-update-btn:hover { opacity: 0.88; }
.header-update-btn:active { transform: scale(0.96); }
.header-update-close {
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    background: var(--card-hover);
    border: none;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}
.header-update-close:hover { background: var(--card-border); color: var(--text); }

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg);
    border-top: 1px solid var(--card-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 20;
}

.bottom-nav a, .bottom-nav span, .bottom-nav button {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 6px;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-family: inherit;
}
.bottom-nav a:hover, .bottom-nav button:hover { color: var(--text); }
.bottom-nav a.active, .bottom-nav span.active, .bottom-nav button.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 500;
}

/* Bildschirmtastatur (Touch) – über Overlays (Einstellungen, Bearbeiten) */
.touch-keyboard {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    padding: 8px 6px calc(12px + var(--safe-bottom));
    background: var(--card);
    border-top: 1px solid var(--card-border);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    gap: 6px;
    max-height: 42vh;
}
.touch-keyboard.visible { display: flex; }
.touch-keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    flex-wrap: nowrap;
}
.touch-keyboard-key {
    min-width: 28px;
    min-height: 44px;
    padding: 0 6px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    flex: 0 0 auto;
}
.touch-keyboard-key:active { background: var(--card-hover); }
.touch-keyboard-key--wide { flex: 1; max-width: 120px; }
.touch-keyboard-key--space { flex: 2; min-width: 80px; max-width: 200px; }
.touch-keyboard-key--action { background: var(--card-hover); font-size: 0.85rem; }
.touch-keyboard-key--shift.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* Overlays */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: var(--safe-top) 0 var(--safe-bottom);
    overflow-y: auto;
}

.overlay-box {
    background: var(--bg);
    border: 1px solid var(--card-border);
    padding: 20px;
    border-radius: 16px;
    width: 94%;
    max-width: 440px;
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    margin: auto;
    box-shadow: 0 4px 24px rgba(0,0,0,0.12);
}
@media (min-width: 600px) {
    .overlay-box {
        max-width: 680px;
        max-height: 92dvh;
        padding: 24px 28px;
    }
    #settingsOverlay .overlay-box {
        min-height: 72dvh;
    }
    #settingsOverlay .settings-tab-panels {
        min-height: 52dvh;
    }
}
@media (min-width: 960px) {
    .overlay-box { max-width: 820px; }
}

.overlay-box h2 { margin-top: 0; margin-bottom: 18px; font-size: 1.25rem; color: var(--text); }

.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 0.875rem; }
.form-row input[type="time"],
.form-row input[type="date"],
.form-row input[type="text"],
.form-row input[type="password"],
.form-row input[type="number"],
.form-row select,
.form-row textarea {
    width: 100%;
    min-height: var(--touch);
    padding: 12px 14px;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text);
    font-size: 1rem;
}
.form-row input[type="number"] { max-width: 10rem; }
.form-row textarea { min-height: 88px; resize: vertical; }
.platzhalter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.platzhalter-chip {
    padding: 6px 10px;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: monospace;
    color: var(--accent);
    cursor: grab;
    user-select: none;
}
.platzhalter-chip:active { cursor: grabbing; }
.platzhalter-chip:hover { background: var(--card-hover); }
.editSprachtext-drop { outline: 2px dashed var(--accent); outline-offset: 2px; }

.sprachtext-toggle-row { display: flex; gap: 8px; margin-bottom: 8px; }
.sprachtext-toggle-btn {
    padding: 8px 14px;
    font-size: 0.875rem;
    border: 1px solid var(--card-border);
    background: var(--input-bg);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sprachtext-toggle-btn:hover { background: var(--card-hover); color: var(--text); }
.sprachtext-toggle-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.sprachtext-preview-wrap {
    min-height: 88px;
    padding: 12px 14px;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text);
    font-size: 1rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.wochentage-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.wochentage-row input[type="checkbox"] { display: none; }
.wochentage-row label {
    display: flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px;
    padding: 6px 10px;
    margin: 0;
    cursor: pointer;
    border-radius: 10px;
    border: 2px solid var(--card-border);
    background: var(--input-bg);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    user-select: none;
    touch-action: manipulation;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.wochentage-row input[type="checkbox"]:checked + span {
    /* über JS gesteuert */
}
.wochentage-row label.tag-aktiv {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
[data-theme="dark"] .wochentage-row label.tag-aktiv { color: #fff; }

.form-actions { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-actions .header-btn { min-height: var(--touch); padding: 0 18px; background: var(--card-hover); border: 1px solid var(--card-border); color: var(--text); border-radius: 10px; font-size: 1rem; }
.form-actions .header-btn:hover { opacity: 0.9; }
.form-actions .header-btn.danger { background: rgba(220,38,38,0.15); color: var(--danger); border-color: transparent; }
[data-theme="dark"] .form-actions .header-btn.danger { background: rgba(248,81,73,0.2); }
.settings-overlay-footer .btn-primary {
    min-height: var(--touch); padding: 0 20px;
    background: var(--accent); color: #fff;
    border: none; border-radius: 10px;
    font-size: 0.95rem; font-family: inherit;
    cursor: pointer; font-weight: 600;
    transition: opacity 0.15s;
}
.settings-overlay-footer .btn-primary:hover { opacity: 0.88; }
.settings-overlay-footer .btn-secondary {
    min-height: var(--touch); padding: 0 16px;
    background: var(--card-hover); color: var(--text);
    border: 1px solid var(--card-border); border-radius: 10px;
    font-size: 0.95rem; font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}
.settings-overlay-footer .btn-secondary:hover { background: var(--card-border); }
.settings-msg { font-size: 0.88rem; flex: 1; color: var(--text-muted); min-width: 0; }
.settings-msg.error { color: var(--danger); }

.platzhalter-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; line-height: 1.4; }

.audio-section .audio-groups { margin-top: 10px; }
.audio-group { margin-bottom: 14px; }
.audio-group-title { font-size: 0.875rem; font-weight: 600; color: var(--text); display: block; margin-bottom: 6px; }
.audio-list { list-style: none; margin: 0 0 8px 0; padding: 0; }
.audio-list li { display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; background: var(--input-bg); border-radius: 8px; margin-bottom: 4px; font-size: 0.875rem; }
.audio-list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.audio-list li button { flex-shrink: 0; margin-left: 8px; padding: 2px 8px; font-size: 0.8rem; background: var(--card-hover); border: 1px solid var(--card-border); border-radius: 6px; color: var(--text); cursor: pointer; }
.audio-search-wrap { position: relative; }
.audio-search-input { width: 100%; padding: 8px 10px; font-size: 0.875rem; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 8px; box-sizing: border-box; }
.audio-search-results { position: absolute; left: 0; right: 0; top: 100%; margin: 2px 0 0 0; padding: 4px 0; list-style: none; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 8px; max-height: 200px; overflow-y: auto; z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.audio-search-results[aria-hidden="true"] { display: none; }
.audio-search-results li { padding: 8px 12px; cursor: pointer; font-size: 0.875rem; display: flex; align-items: center; gap: 8px; }
.audio-search-results li:hover { background: var(--card-hover); }
.audio-search-results li .audio-search-type { font-size: 0.75rem; color: var(--text-muted); }

#settingsOverlay .overlay-box {
    min-height: 480px;
    min-height: 52dvh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}
#settingsOverlay #settingsBoxContent {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.settings-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 0;
    flex-shrink: 0;
}
@media (min-width: 600px) {
    .settings-overlay-header { padding: 20px 24px 0; }
}
.settings-overlay-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}
.settings-overlay-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--card-hover);
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.settings-overlay-close:hover { background: var(--card-border); color: var(--text); }
#settingsOverlay .settings-tabs-wrapper {
    flex-shrink: 0;
    padding: 10px 20px 0;
}
@media (min-width: 600px) {
    .settings-overlay-header + .settings-tabs-wrapper-outer { padding: 12px 24px 0; }
    #settingsOverlay .settings-tabs-wrapper { padding: 12px 24px 0; }
}
#settingsOverlay .settings-tab-panels {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 20px;
}
@media (min-width: 600px) {
    #settingsOverlay .settings-tab-panels { padding: 14px 24px; }
}
.settings-overlay-footer {
    flex-shrink: 0;
    padding: 10px 20px 16px;
    border-top: 1px solid var(--card-border);
    background: var(--bg);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
@media (min-width: 600px) {
    .settings-overlay-footer { padding: 12px 24px 18px; }
}
#editBox {
    display: flex;
    flex-direction: column;
}
#editBoxContent {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
@media (min-width: 600px) {
    #editBox { max-height: 92dvh; }
}
.settings-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
}
.settings-tabs::-webkit-scrollbar { display: none; }
.settings-tabs button {
    padding: 7px 13px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 7px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.settings-tabs button:hover { color: var(--text); background: var(--card-hover); }
.settings-tabs button.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}
.settings-tab-panel { display: none; }
.settings-tab-panel.active { display: block; }
.settings-section {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
}
.settings-section:last-child { margin-bottom: 0; }
.settings-section h3 {
    margin: 0 0 12px 0;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.settings-section .form-row:last-child { margin-bottom: 0; }
.settings-section.sleep-mode-section { }
.settings-section.sleep-mode-section .form-row { margin-bottom: 0; }
.settings-section.sleep-mode-section .platzhalter-hint { margin-top: 10px; padding: 10px 12px; background: var(--input-bg); border-radius: 8px; border-left: 3px solid var(--accent); }
.info-value { margin: 0; font-family: ui-monospace, monospace; font-size: 1rem; color: var(--text); }
.info-cron-status { margin: 6px 0 0 0; padding: 8px 12px; border-radius: 8px; font-size: 0.9rem; font-weight: 500; }
.info-cron-status.status-ok   { background: rgba(34, 197, 94, 0.2);  color: #16a34a; }
.info-cron-status.status-warn { background: rgba(234, 179, 8, 0.2);   color: #ca8a04; }
.info-cron-status.status-error { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
[data-theme="dark"] .info-cron-status.status-ok   { background: rgba(34, 197, 94, 0.25);  color: #4ade80; }
[data-theme="dark"] .info-cron-status.status-warn { background: rgba(234, 179, 8, 0.25);   color: #facc15; }
[data-theme="dark"] .info-cron-status.status-error { background: rgba(239, 68, 68, 0.2);   color: #f87171; }
.cron-job-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.cron-job-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    background: var(--input-bg); border: 1px solid var(--card-border);
}
.cron-job-info { flex: 1; min-width: 0; }
.cron-job-label { font-weight: 500; font-size: 0.95rem; color: var(--text); }
.cron-job-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; font-family: ui-monospace, monospace; }
.cron-job-run-btn {
    flex-shrink: 0;
    min-height: 36px; padding: 0 14px;
    background: var(--accent); color: #fff;
    border: none; border-radius: 8px;
    font-size: 0.88rem; font-weight: 600; cursor: pointer;
    touch-action: manipulation; white-space: nowrap;
}
.cron-job-run-btn:hover { opacity: 0.88; }
.cron-job-run-btn:active { transform: scale(0.96); }
.cron-job-run-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cleanup-list { display: flex; flex-direction: column; margin-top: 10px; border: 1px solid var(--card-border); border-radius: 10px; overflow: hidden; }
.cleanup-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--card-border); background: var(--input-bg); }
.cleanup-item:last-child { border-bottom: none; }
.cleanup-item-info { flex: 1; min-width: 0; }
.cleanup-item-label { font-weight: 500; font-size: 0.92rem; color: var(--text); }
.cleanup-item-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.cleanup-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cleanup-btn { flex-shrink: 0; min-height: 32px; padding: 0 12px; background: var(--accent); color: #fff; border: none; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; touch-action: manipulation; white-space: nowrap; }
.cleanup-btn:hover { opacity: 0.88; }
.cleanup-btn:active { transform: scale(0.96); }
.cleanup-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cleanup-btn.danger { background: var(--danger, #e74c3c); }
.cleanup-log { margin-top: 10px; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 8px; padding: 10px 12px; font-size: 0.82rem; font-family: ui-monospace, monospace; color: var(--text-muted); white-space: pre-wrap; }
.tts-custom-list { margin: 10px 0; }
.tts-custom-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--input-bg);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--card-border);
    gap: 10px;
}
.tts-custom-item span { font-size: 0.9rem; flex: 1; min-width: 0; color: var(--text); }
.tts-custom-item code { color: var(--accent); }
.tts-custom-item .btn-small { min-height: 40px; padding: 0 14px; font-size: 0.875rem; background: var(--card-hover); border: 1px solid var(--card-border); color: var(--text); border-radius: 8px; }
.settings-msg { margin-top: 12px; font-size: 0.9rem; color: var(--accent); }
.settings-msg.error { color: var(--danger); }
.accent-color-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.accent-color-row input[type="color"] { width: 44px; height: 44px; padding: 2px; border: 1px solid var(--card-border); border-radius: 8px; cursor: pointer; background: var(--input-bg); }
.accent-hex-input { width: 90px; padding: 8px 10px; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 8px; color: var(--text); font-family: monospace; font-size: 0.9rem; }
.icons-upload-list { display: flex; flex-direction: column; gap: 14px; }
.icons-upload-row { display: flex; align-items: center; gap: 14px; padding: 12px; background: var(--input-bg); border: 1px solid var(--card-border); border-radius: 10px; }
.icons-upload-preview { width: 48px; height: 48px; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: var(--card-hover); }
.icons-upload-preview img { width: 100%; height: 100%; object-fit: contain; }
.icons-upload-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.icons-upload-label { font-weight: 500; color: var(--text); }
.icons-upload-badge { font-size: 0.8rem; color: var(--text-muted); }
.icons-upload-badge:not(.default) { color: var(--accent); }
.icons-upload-actions { display: flex; gap: 8px; flex-shrink: 0; }

.update-version-display { font-weight: 600; font-size: 1rem; margin: 4px 0; color: var(--text); }
.update-log-wrap { margin-top: 16px; }
.update-log-wrap label { display: block; margin-bottom: 6px; color: var(--text-muted); font-size: 0.875rem; }
.update-log { max-height: 180px; overflow: auto; background: var(--input-bg); padding: 12px; border-radius: 8px; font-size: 12px; font-family: monospace; white-space: pre-wrap; margin: 0; border: 1px solid var(--card-border); }

.zeitzone-dropdown-wrap { position: relative; }
.zeitzone-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 2px 0 0 0;
    padding: 0;
    list-style: none;
    max-height: 220px;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 50;
    display: none;
}
.zeitzone-list[aria-hidden="false"] { display: block; }
.zeitzone-list li {
    padding: 10px 12px;
    font-size: 0.9rem;
    color: var(--text);
    cursor: pointer;
    border-bottom: 1px solid var(--card-border);
}
.zeitzone-list li:last-child { border-bottom: none; }
.zeitzone-list li:hover { background: var(--card-hover); }
.zeitzone-list li.zeitzone-hidden { display: none; }

/* In-Overlay-Ladeanzeige */
.overlay-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
}
.overlay-loading .spinner-small {
    width: 32px;
    height: 32px;
    border: 3px solid var(--card-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: loadingSpin 0.9s linear infinite;
}
.overlay-loading .text { margin-top: 10px; font-size: 0.9rem; }

/* Sleep-Mode Vollbild – 3 Spalten wie Screen-Saver (Aktuell | 8-Tage | Details) */
#sleepModeOverlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg);
    display: none;
    flex-direction: column;
    padding: max(var(--safe-top), 16px) 16px max(16px, var(--safe-bottom));
    box-sizing: border-box;
}
#sleepModeOverlay.visible { display: flex; }
#sleepModeOverlay .sleep-mode-time {
    flex-shrink: 0;
    text-align: center;
    padding: 12px 0 16px;
    color: var(--text);
}
#sleepModeOverlay .sleep-mode-time-clock {
    display: block;
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: var(--text);
}
#sleepModeOverlay .sleep-mode-time-date {
    display: block;
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 4px;
}
#sleepModeOverlay .sleep-panels {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 12px;
}
#sleepModeOverlay .sleep-left,
#sleepModeOverlay .sleep-center,
#sleepModeOverlay .sleep-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 16px;
    overflow: hidden;
}
#sleepModeOverlay .sleep-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
/* Linke Spalte: Aktuelles Wetter */
#sleepModeOverlay .sleep-now-icon-wrap {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}
#sleepModeOverlay .sleep-now-icon {
    width: 80px;
    height: 80px;
    object-fit: contain;
}
/* Wetter-Icons sind weiße SVGs – im Light-Mode invertieren damit sie sichtbar sind */
.sleep-now-icon, .sleep-forecast-icon { filter: invert(1) opacity(0.8); }
[data-theme="dark"] .sleep-now-icon, [data-theme="dark"] .sleep-forecast-icon { filter: none; }
#sleepModeOverlay .sleep-now-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 8px;
}
#sleepModeOverlay .sleep-now-temp {
    font-size: 2.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    text-align: center;
    line-height: 1.1;
}
#sleepModeOverlay .sleep-highlow {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 12px 0;
    flex-wrap: wrap;
}
#sleepModeOverlay .sleep-highlow span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.95rem;
    color: var(--text-muted);
}
#sleepModeOverlay .sleep-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
    font-size: 0.85rem;
    color: var(--text-muted);
}
#sleepModeOverlay .sleep-strip span { display: inline-flex; align-items: center; gap: 4px; }
/* Mittlere Spalte: 8-Tage-Vorschau */
#sleepModeOverlay .sleep-forecast-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}
#sleepModeOverlay .sleep-forecast-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.9rem;
    color: var(--text);
}
#sleepModeOverlay .sleep-forecast-row:last-child { border-bottom: none; }
#sleepModeOverlay .sleep-forecast-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}
#sleepModeOverlay .sleep-forecast-date { min-width: 36px; color: var(--text); }
#sleepModeOverlay .sleep-forecast-temp { font-weight: 600; font-variant-numeric: tabular-nums; }
#sleepModeOverlay .sleep-sun {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
    font-size: 0.9rem;
    color: var(--text-muted);
}
#sleepModeOverlay .sleep-sun span { display: inline-flex; align-items: center; gap: 6px; }
/* Rechte Spalte: Details */
#sleepModeOverlay .sleep-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
#sleepModeOverlay .sleep-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text);
}
#sleepModeOverlay .sleep-detail-row .label { color: var(--text-muted); }
#sleepModeOverlay .sleep-detail-row .value { font-variant-numeric: tabular-nums; }
#sleepModeOverlay .sleep-pm {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--card-border);
    font-size: 0.8rem;
    color: var(--text-muted);
}
/* Wecker-Leiste unten */
#sleepModeOverlay .sleep-wecker-bar {
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    flex-shrink: 0;
}
#sleepModeOverlay .sleep-wecker-bar .sleep-title { margin-bottom: 6px; }
#sleepModeOverlay .sleep-wecker-item {
    font-size: 0.95rem;
    padding: 4px 0;
    color: var(--text);
}
#sleepModeOverlay .sleep-wecker-zeit { font-weight: 600; font-variant-numeric: tabular-nums; }
#sleepModeOverlay .sleep-wecker-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
#sleepModeOverlay .sleep-wetter-tag { font-size: 0.9rem; padding: 6px 0; color: var(--text-muted); }

/* Wetter-Tab: gleiches 3-Spalten-Design wie Sleep-Mode */
#panelWetter.panel.active {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 56px - var(--safe-bottom));
    overflow: hidden;
    padding-bottom: 0;
}
#panelWetter .panel-header { flex-shrink: 0; }
#panelWetter .panel-inner.wetter-dashboard {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 12px 14px;
    max-width: none;
    overflow: hidden;
}
#panelWetter .panel-inner .sleep-panels {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 12px;
}
#panelWetter .panel-inner .sleep-left,
#panelWetter .panel-inner .sleep-center,
#panelWetter .panel-inner .sleep-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 12px;
    overflow: hidden;
}
#panelWetter .panel-inner .sleep-title { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
#panelWetter .panel-inner .sleep-now-icon-wrap { display: flex; justify-content: center; margin: 6px 0; }
#panelWetter .panel-inner .sleep-now-icon { width: 64px; height: 64px; object-fit: contain; }
#panelWetter .panel-inner .sleep-now-desc { font-size: 0.85rem; color: var(--text-muted); text-align: center; margin-bottom: 4px; }
#panelWetter .panel-inner .sleep-now-temp { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); text-align: center; line-height: 1.1; }
#panelWetter .panel-inner .sleep-highlow { display: flex; gap: 10px; justify-content: center; margin: 6px 0; flex-wrap: wrap; }
#panelWetter .panel-inner .sleep-highlow span { display: inline-flex; align-items: center; gap: 4px; font-size: 0.88rem; color: var(--text-muted); }
#panelWetter .panel-inner .sleep-strip { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--card-border); font-size: 0.8rem; color: var(--text-muted); }
#panelWetter .panel-inner .sleep-strip span { display: inline-flex; align-items: center; gap: 4px; }
#panelWetter .panel-inner .sleep-forecast-list { flex: 1; overflow-y: auto; min-height: 0; }
#panelWetter .panel-inner .sleep-forecast-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--card-border); font-size: 0.85rem; color: var(--text); }
#panelWetter .panel-inner .sleep-forecast-row:last-child { border-bottom: none; }
#panelWetter .panel-inner .sleep-forecast-icon { width: 24px; height: 24px; object-fit: contain; flex-shrink: 0; }
#panelWetter .panel-inner .sleep-forecast-date { min-width: 32px; color: var(--text); }
#panelWetter .panel-inner .sleep-forecast-temp { font-weight: 600; font-variant-numeric: tabular-nums; }
#panelWetter .panel-inner .sleep-sun { display: flex; gap: 12px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--card-border); font-size: 0.85rem; color: var(--text-muted); }
#panelWetter .panel-inner .sleep-sun span { display: inline-flex; align-items: center; gap: 4px; }
#panelWetter .panel-inner .sleep-details { display: flex; flex-direction: column; gap: 5px; flex: 1; min-height: 0; overflow-y: auto; }
#panelWetter .panel-inner .sleep-detail-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.85rem; color: var(--text); }
#panelWetter .panel-inner .sleep-detail-row .label { color: var(--text-muted); }
#panelWetter .panel-inner .sleep-detail-row .value { font-variant-numeric: tabular-nums; }
#panelWetter .panel-inner .sleep-pm { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--card-border); font-size: 0.78rem; color: var(--text-muted); }
#panelWetter .panel-inner .sleep-wetter-tag { font-size: 0.85rem; padding: 4px 0; color: var(--text-muted); }

/* WLAN-Tab */
.wlan-status-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--text);
}
.wlan-status-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
}
.wlan-status-dot.connected { background: #22c55e; }
.wlan-status-dot.disconnected { background: #ef4444; }
.wlan-status-info { display: flex; flex-direction: column; gap: 2px; }
.wlan-status-ssid { font-weight: 600; color: var(--text); }
.wlan-status-ip { font-size: 0.8rem; color: var(--text-muted); }
.wlan-network-list { display: flex; flex-direction: column; gap: 6px; }
.wlan-network-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}
.wlan-network-item:hover { background: var(--card-hover); }
.wlan-network-item.in-use { border-color: var(--accent); }
.wlan-network-ssid { flex: 1; font-size: 0.9rem; color: var(--text); font-weight: 500; }
.wlan-network-signal { font-size: 0.75rem; color: var(--text-muted); font-family: monospace; }
.wlan-network-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--card-hover);
    color: var(--text-muted);
}
.wlan-network-badge.open { background: #22c55e22; color: #22c55e; }
.wlan-network-badge.active { background: var(--accent); color: #fff; }
.wlan-msg {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-top: 6px;
}
.wlan-msg.ok { background: #22c55e22; color: #22c55e; }
.wlan-msg.error { background: #ef444422; color: #ef4444; }

/* ── Statistiken Panel ── */
.stats-range-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.stats-range-btn {
    padding: 6px 16px; border: 1px solid var(--card-border); border-radius: 20px;
    background: var(--card-hover); color: var(--text-muted);
    font-size: 0.85rem; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.stats-range-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.stats-range-btn:hover:not(.active) { background: var(--card); color: var(--text); }
.stats-chart-card {
    background: var(--card); border: 1px solid var(--card-border); border-radius: 12px;
    padding: 14px 16px; margin-bottom: 14px;
}
.stats-chart-title {
    font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px;
}
.stats-chart-wrap { min-height: 100px; }
.stats-chart-wrap svg { display: block; color: var(--text); }
.stats-loading, .stats-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100px; color: var(--text-muted); font-size: 0.9rem;
}
.stats-summary-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.stats-kpi {
    background: var(--card); border: 1px solid var(--card-border); border-radius: 10px;
    padding: 10px 6px; text-align: center;
}
.stats-kpi .kpi-label {
    display: block; font-size: 0.68rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px;
}
.stats-kpi .kpi-value { display: block; font-size: 0.88rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.stats-hint { font-size: 0.78rem; color: var(--text-muted); text-align: center; margin-top: 4px; padding-bottom: 4px; }

/* ── Alarm-Klingel-Overlay ── */
.alarm-ringing-overlay {
    position: fixed;
    inset: 0;
    z-index: 10500;
    display: none;
    flex-direction: row;
    background: #0a0d12;
}
.alarm-ringing-overlay.active { display: flex; }

.alarm-ringing-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: #0d1117;
    border-right: 1px solid #21262d;
    position: relative;
}
.alarm-ringing-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(88,166,255,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.alarm-cover-wrap {
    width: min(280px, 60vw);
    height: min(280px, 60vw);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05);
}
.alarm-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.alarm-cover-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #161b22;
    border-radius: 20px;
}
.alarm-cover-fallback svg { opacity: 0.5; }

.alarm-ringing-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 40px 32px;
}
.alarm-ringing-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #58a6ff;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    animation: alarm-pulse-label 1.4s ease-in-out infinite;
}
@keyframes alarm-pulse-label {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.alarm-time-display {
    font-size: clamp(3rem, 10vw, 5.5rem);
    font-weight: 700;
    color: #e6edf3;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    line-height: 1;
    animation: alarm-pulse-time 1.4s ease-in-out infinite;
}
@keyframes alarm-pulse-time {
    0%, 100% { text-shadow: 0 0 30px rgba(88,166,255,0.3); }
    50% { text-shadow: 0 0 60px rgba(88,166,255,0.7); }
}
.alarm-ringing-title {
    font-size: 0.95rem;
    color: #8b949e;
    text-align: center;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.alarm-ringing-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 280px;
    margin-top: 8px;
}
.alarm-snooze-btn {
    padding: 18px 24px;
    background: #21262d;
    border: 1px solid #30363d;
    border-radius: 14px;
    color: #e6edf3;
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.alarm-snooze-btn:hover { background: #30363d; }
.alarm-snooze-btn:active { transform: scale(0.97); }
.alarm-stop-btn {
    padding: 18px 24px;
    background: #ef4444;
    border: none;
    border-radius: 14px;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.alarm-stop-btn:hover { background: #dc2626; }
.alarm-stop-btn:active { transform: scale(0.97); }

/* "Ton starten"-Button bei Firefox-Autoplay-Block */
.alarm-play-audio-btn {
    padding: 14px 24px;
    background: var(--accent, #2563eb);
    border: none;
    border-radius: 14px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 280px;
    margin-bottom: 12px;
    animation: alarm-pulse 1s ease-in-out infinite;
}
.alarm-play-audio-btn:hover { opacity: 0.88; }
.alarm-play-audio-btn:active { transform: scale(0.97); }
@keyframes alarm-pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent, #2563eb) 50%, transparent); }
    50%       { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent, #2563eb) 0%, transparent); }
}

@media (max-width: 540px) {
    .alarm-ringing-overlay { flex-direction: column; }
    .alarm-ringing-left { border-right: none; border-bottom: 1px solid #21262d; flex: 0 0 auto; padding: 24px; }
    .alarm-cover-wrap { width: min(180px, 50vw); height: min(180px, 50vw); }
    .alarm-ringing-right { padding: 24px 20px; gap: 16px; }
}

/* ── header-btn-primary ── */
.header-btn.header-btn-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    font-weight: 600;
}
.header-btn.header-btn-primary:hover { opacity: 0.88; color: #fff; background: var(--accent); }

/* ══════════════════════════════════════════════════════════════
   Musik-Tab – Split-Layout: Player links | Bibliothek rechts
   ══════════════════════════════════════════════════════════════ */

#panelMusik.panel.active {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 56px - var(--safe-bottom));
    overflow: hidden;
    padding-bottom: 0;
}
#panelMusik .panel-header { flex-shrink: 0; }

.musik-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Player (linke Spalte) ── */
.musik-player {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px 16px;
    gap: 14px;
    border-right: 1px solid var(--card-border);
    background: var(--card);
    overflow-y: auto;
}

.player-cover {
    width: 100%;
    max-width: 200px;
    aspect-ratio: 1;
    border-radius: 14px;
    overflow: hidden;
    background: var(--input-bg);
    flex-shrink: 0;
    position: relative;
    box-shadow: 0 6px 28px rgba(0,0,0,0.18);
}
.player-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.player-cover-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inactive);
}

.player-info {
    text-align: center;
    width: 100%;
    min-width: 0;
}
.player-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}
.player-playlist-name {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-progress {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
}
.player-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    min-width: 28px;
}
.player-time-end { text-align: right; }
.player-seekbar {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--card-border);
    cursor: pointer;
    accent-color: var(--accent);
    outline: none;
}
.player-seekbar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
}
.player-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.player-btn:hover { color: var(--text); background: var(--card-hover); }
.player-btn:active { transform: scale(0.92); }
.player-btn-play {
    width: 50px;
    height: 50px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s, transform 0.1s;
    box-shadow: 0 3px 12px color-mix(in srgb, var(--accent) 40%, transparent);
}
.player-btn-play:hover { opacity: 0.88; }
.player-btn-play:active { transform: scale(0.93); }

.player-volume {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.player-volume-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: color 0.15s;
}
.player-volume-btn:hover { color: var(--text); }
.player-volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--card-border);
    cursor: pointer;
    accent-color: var(--accent);
    outline: none;
}
.player-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

/* ── Bibliothek (rechte Spalte) ── */
.musik-library {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.musik-filter-bar {
    display: flex;
    gap: 6px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--card-border);
    overflow-x: auto;
    scrollbar-width: none;
    flex-shrink: 0;
    align-items: center;
}
.musik-filter-bar::-webkit-scrollbar { display: none; }
.musik-filter-btn {
    padding: 5px 13px;
    border-radius: 20px;
    border: 1px solid var(--card-border);
    background: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.musik-filter-btn:hover { background: var(--card-hover); color: var(--text); }
.musik-filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 500;
}

.musik-tracklist {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 4px 0;
}
.musik-track-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 12px;
    cursor: pointer;
    transition: background 0.1s;
    user-select: none;
}
.musik-track-item:hover { background: var(--card-hover); }
.musik-track-item.playing {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.musik-track-item.playing .track-title { color: var(--accent); font-weight: 600; }

.track-cover {
    width: 42px;
    height: 42px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--input-bg);
    position: relative;
}
.track-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.track-cover-playing {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.42);
    border-radius: 6px;
    color: #fff;
}
.musik-track-item.playing .track-cover-playing { display: flex; }

.track-info { flex: 1; min-width: 0; }
.track-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.track-meta {
    font-size: 0.73rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.track-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}
.musik-track-item:hover .track-actions,
.musik-track-item:focus-within .track-actions { opacity: 1; }
.track-actions .player-btn { padding: 6px; border-radius: 6px; }

.musik-library-footer {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--card-border);
    background: var(--bg);
}
.musik-footer-btn {
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.82rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.musik-footer-btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: transparent;
    font-weight: 600;
}
.musik-footer-btn-primary:hover { opacity: 0.88; color: #fff; background: var(--accent); }
.musik-upload-status-bar {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Verwaltungs-Overlay ── */
.musik-manage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.musik-manage-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

/* ── Equalizer ── */
.player-eq-wrap {
    width: 100%;
    border-top: 1px solid var(--card-border);
    padding-top: 10px;
}

.player-eq-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.player-eq-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-family: inherit;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
    flex: 1;
    text-align: left;
}
.player-eq-toggle:hover { color: var(--text); background: var(--card-hover); }
.player-eq-toggle[aria-expanded="true"] { color: var(--accent); }
.player-eq-toggle[aria-expanded="true"] .eq-chevron { transform: rotate(180deg); }
.eq-chevron { transition: transform 0.2s; flex-shrink: 0; }

.player-eq-reset {
    color: var(--text-muted);
    background: var(--card-hover);
    border: 1px solid var(--card-border);
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    padding: 3px 9px;
    min-height: 26px;
    transition: color 0.15s, background 0.15s;
}
.player-eq-reset:hover { color: var(--accent); border-color: var(--accent); }

.player-eq {
    display: none;
    padding: 10px 0 4px;
}
.player-eq.open { display: block; }

.eq-bands {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 4px;
}

.eq-band {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.eq-db {
    font-size: 0.68rem;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    min-width: 22px;
    text-align: center;
    font-weight: 600;
    letter-spacing: -0.02em;
}
.eq-db.zero { color: var(--text-muted); font-weight: 400; }

/* Vertikale Range-Slider — Firefox + Webkit */
.eq-slider {
    /* Firefox: orient="vertical" Attribut im HTML + diese Property */
    -moz-orient: vertical;
    /* Webkit/Blink (Chrome, Edge, Safari) */
    writing-mode: vertical-lr;
    direction: rtl;
    width: 20px;
    height: 80px;
    accent-color: var(--accent);
    cursor: pointer;
    outline: none;
    background: transparent;
    padding: 0;
    margin: 0;
}

/* Webkit-Track */
.eq-slider::-webkit-slider-container { height: 80px; }
.eq-slider::-webkit-slider-runnable-track {
    width: 4px;
    background: var(--card-border);
    border-radius: 2px;
}
.eq-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    transition: transform 0.1s;
    margin-left: -6px;
}
.eq-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }

/* Firefox-Track und Thumb */
.eq-slider::-moz-range-track {
    width: 4px;
    background: var(--card-border);
    border-radius: 2px;
}
.eq-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.eq-slider::-moz-range-thumb:hover { transform: scale(1.15); }
.eq-slider::-moz-range-progress {
    background: color-mix(in srgb, var(--accent) 40%, transparent);
    border-radius: 2px;
}

.eq-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: center;
}

/* ── Responsive: Mobile – Player wird zur Kompakt-Leiste oben ── */
@media (max-width: 620px) {
    .musik-layout { flex-direction: column; }

    .musik-player {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 10px 12px;
        gap: 10px;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
        overflow-y: visible;
        flex-shrink: 0;
    }
    .player-cover {
        width: 52px;
        max-width: 52px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        flex-shrink: 0;
    }
    .player-info { text-align: left; flex: 1; min-width: 0; }
    .player-progress { display: none; }
    .player-volume { display: none; }
    .player-controls { gap: 2px; flex-shrink: 0; }
    .player-btn-play { width: 40px; height: 40px; }
    .player-btn { padding: 6px; }
}
