/* Mitlese-Ansicht — mobil zuerst, WCAG 2.1 AA.
   Bewusst kein user-scalable=no und keine festen px-Schriftgrößen für den Liedtext:
   Browser-Zoom und die System-Schriftgröße müssen greifen. */

* { box-sizing: border-box; }

:root {
    /* Stufe 1..6, per JS gesetzt */
    --lyrics-size: clamp(1.75rem, 8vw, 3.25rem);
    --next-size: clamp(1rem, 4vw, 1.5rem);

    --bg: #0e1116;
    --fg: #ffffff;
    --fg-muted: #b9c1cf;
    --surface: #161b25;
    --border: #2c3445;
    --accent: #6ee7b7;
    --accent-fg: #0e1116;
    --ok: #6ee7b7;
    --warn: #ffb454;
    --err: #ff8080;
}

body[data-theme="light"] {
    --bg: #ffffff;
    --fg: #14181f;
    --fg-muted: #4a5365;
    --surface: #f1f3f7;
    --border: #c7ccd8;
    --accent: #0f6b4a;
    --accent-fg: #ffffff;
    --ok: #0f6b4a;
    --warn: #8a4b00;
    --err: #a81f1f;
}

body[data-theme="contrast"] {
    --bg: #000000;
    --fg: #ffffff;
    --fg-muted: #ffffff;
    --surface: #000000;
    --border: #ffffff;
    --accent: #ffff00;
    --accent-fg: #000000;
    --ok: #ffff00;
    --warn: #ffff00;
    --err: #ffff00;
}

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--fg);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    line-height: 1.4;
    -webkit-text-size-adjust: 100%;
}

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 8px; top: -100px;
    z-index: 10;
    padding: 12px 16px;
    background: var(--accent);
    color: var(--accent-fg);
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus { top: 8px; }

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

/* Bedienelemente dürfen beim Tippen keinen Text markieren — der Liedtext selbst bleibt kopierbar. */
button, label, .live-h1, .next-heading, .live-foot {
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.live {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
    padding: max(12px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
    gap: 12px;
}

/* --- Kopf --- */

.live-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 0 0 auto;
}
.live-head-text { min-width: 0; flex: 1 1 auto; }

.live-h1 {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-muted);
}
.live-song {
    margin: 2px 0 0;
    font-size: 1.125rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.prefs-toggle {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0 14px;
    background: var(--surface);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9375rem;
    font-family: inherit;
    cursor: pointer;
}
.prefs-toggle[aria-expanded="true"] {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
}

/* --- Einstellungen --- */

.prefs {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.prefs[hidden] { display: none; }

.prefs-row { display: flex; flex-direction: column; gap: 8px; }
.prefs-fieldset { margin: 0; padding: 0; border: 0; }
.prefs-label, .prefs legend {
    padding: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--fg-muted);
}
.prefs-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.pbtn {
    min-width: 56px;
    min-height: 44px;
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1.0625rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.pbtn:disabled { opacity: 0.45; cursor: default; }

.prefs-value {
    font-size: 0.875rem;
    color: var(--fg-muted);
    font-variant-numeric: tabular-nums;
}

.pradio, .pcheck {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    font-size: 0.9375rem;
    cursor: pointer;
}
.pradio input, .pcheck input {
    width: 22px; height: 22px;
    accent-color: var(--accent);
    margin: 0;
}
.prefs-checks { gap: 2px; }
.prefs-hint { margin: 0; font-size: 0.8125rem; color: var(--fg-muted); }

/* --- Liedtext --- */

.live-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
    min-height: 0;
    padding: 8px 0;
}

.lyrics {
    text-align: center;
    overflow-wrap: anywhere;
    hyphens: auto;
}
.lyrics .line {
    margin: 0 0 0.25em;
    font-size: var(--lyrics-size);
    font-weight: 600;
    line-height: 1.25;
}
.lyrics .line:last-child { margin-bottom: 0; }

.lyrics .idle,
.lyrics .paused {
    margin: 0;
    font-size: var(--next-size);
    font-weight: 500;
    color: var(--fg-muted);
}

.next {
    flex: 0 0 auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--fg-muted);
}
.next[hidden] { display: none; }
.next-heading {
    margin: 0 0 6px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.next .line {
    margin: 0 0 0.2em;
    font-size: var(--next-size);
    font-weight: 500;
    overflow-wrap: anywhere;
}
.next-empty { margin: 0; font-size: var(--next-size); }

/* --- Fuß --- */

.live-foot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.8125rem;
    color: var(--fg-muted);
}
.live-foot p { margin: 0; }
.progress { font-variant-numeric: tabular-nums; }

.conn { display: inline-flex; align-items: center; gap: 8px; }
.conn-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--warn);
    flex: 0 0 auto;
}
.conn[data-state="online"] .conn-dot { background: var(--ok); }
.conn[data-state="offline"] .conn-dot { background: var(--err); }
body[data-theme="contrast"] .conn-dot { outline: 1px solid var(--fg); }

/* Auf größeren Displays mehr Luft, Text bleibt zentriert */
@media (min-width: 720px) {
    .live { max-width: 900px; margin: 0 auto; padding-inline: 24px; }
}

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