:root {
    --bg: #faf7f2;
    --card: #ffffff;
    --border: #e8e0d0;
    --header-bg: #2c1f14;
    --header-fg: #f5ede0;
    --accent: #8b5e3c;
    --s-color: #5b3fa0;
    --a-color: #b07d2e;
    --t-color: #c0522a;
    --b-color: #2a5e8c;
    --text: #2c1f14;
    --muted: #7a6a58;
    --muted-light: #9a8a78;
    --hover-bg: #fdf5ec;
    --lyrics-bg: #fdf9f4;
    --lyrics-border: #c9a96e;
    --lyrics-text: #4a3828;
}

* { box-sizing: border-box; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only-focusable:focus-visible {
    position: static;
    width: auto;
    height: auto;
    padding: 8px 16px;
    margin: 0 auto 8px;
    overflow: visible;
    clip: auto;
    white-space: normal;
    display: block;
    max-width: 860px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 24px 16px 48px;
    background: var(--bg);
    color: var(--text);
}

.tip-text {
    max-width: 860px;
    margin: 0 auto 16px;
    font-size: 0.9rem;
    color: var(--muted);
}

header {
    max-width: 860px;
    margin: 0 auto 28px;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 16px;
}

h1 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.5rem;
    font-weight: normal;
    margin: 0 0 4px;
    letter-spacing: 0.02em;
}

header p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

footer {
    max-width: 860px;
    margin: 40px auto 0;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.7;
}

footer p { margin: 0 0 0.5em; }
footer p:last-child { margin-bottom: 0; }

main {
    max-width: 860px;
    margin: 0 auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgb(44 31 20 / 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
}

thead tr {
    background: var(--header-bg);
    color: var(--header-fg);
}

th {
    padding: 12px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
}

th:nth-child(2) { color: #c4b0e8; }
th:nth-child(3) { color: #f0d090; }
th:nth-child(4) { color: #f0a880; }
th:nth-child(5) { color: #90c0e8; }

td {
    border-bottom: 1px solid var(--border);
    padding: 10px 8px;
    text-align: center;
    vertical-align: middle;
}

td:first-child {
    font-family: Georgia, serif;
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: bold;
    width: 48px;
}

td:first-child a {
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

td:first-child a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

@media (hover: hover) and (pointer: fine) {
    td:first-child a:hover {
        opacity: 0.7;
    }

    tbody tr[data-nr]:hover td {
        background: var(--hover-bg);
    }
}

audio {
    width: 100%;
    height: 32px;
}

/* Liedtext */
.lyrics-row { display: none; }
.lyrics-row.active { display: table-row; }
.lyrics-row td {
    text-align: left;
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--lyrics-text);
    line-height: 1.9;
    background: var(--lyrics-bg);
    border-left: 3px solid var(--lyrics-border);
    border-bottom: 2px solid var(--border);
    padding: 16px 20px;
}

/* Stimmenwahl */
.voice-pref {
    max-width: 860px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--muted);
    flex-wrap: wrap;
    border: none;
    min-inline-size: 0;
    padding: 0;
}

.voice-pref legend {
    float: left;
    margin: 0;
    padding: 0;
}

.voice-btn {
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 4px 14px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--card);
    letter-spacing: 0.05em;
    line-height: 1.6;
    transition: background 0.15s, color 0.15s;
}

.voice-btn[data-voice="S"] { color: var(--s-color); border-color: var(--s-color); }
.voice-btn[data-voice="A"] { color: var(--a-color); border-color: var(--a-color); }
.voice-btn[data-voice="T"] { color: var(--t-color); border-color: var(--t-color); }
.voice-btn[data-voice="B"] { color: var(--b-color); border-color: var(--b-color); }

.voice-btn[data-voice="S"].active { background: var(--s-color); color: #fff; }
.voice-btn[data-voice="A"].active { background: var(--a-color); color: #fff; }
.voice-btn[data-voice="T"].active { background: var(--t-color); color: #fff; }
.voice-btn[data-voice="B"].active { background: var(--b-color); color: #fff; }

.voice-btn:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px;
}

.voice-autoplay-label:focus-within {
    outline: 2px solid var(--text);
    outline-offset: 2px;
    border-radius: 3px;
}

.voice-autoplay-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    color: var(--muted);
    cursor: pointer;
    margin-left: 4px;
}

.voice-pref-hint {
    font-size: 0.8rem;
    color: var(--muted-light);
    font-style: italic;
}

/* Fokus-Link-Bar */
.focus-link-bar {
    max-width: 860px;
    margin: -16px auto 10px;
    font-size: 0.85rem;
    text-align: right;
    color: var(--muted);
}

/* Fokus-Modus: alle 4 Audio-Spalten verstecken */
table[data-voice] :is(td, th):nth-child(n+2) { display: none; }

/* Nur die gewählte Spalte einblenden */
table[data-voice="S"] :is(td, th):nth-child(2) { display: table-cell; }
table[data-voice="A"] :is(td, th):nth-child(3) { display: table-cell; }
table[data-voice="T"] :is(td, th):nth-child(4) { display: table-cell; }
table[data-voice="B"] :is(td, th):nth-child(5) { display: table-cell; }

/* Mobile Optimierung */
@media (max-width: 768px) {
    table, thead, tbody, th, td, tr {
        display: block;
    }

    /* Fokus-Modus: sichtbare Spalte wieder als flex darstellen */
    table[data-voice="S"] td:nth-child(2),
    table[data-voice="A"] td:nth-child(3),
    table[data-voice="T"] td:nth-child(4),
    table[data-voice="B"] td:nth-child(5) { display: flex; }

    /* Fokus-Modus: Stimmen-Label ausblenden (nur eine Stimme sichtbar) */
    table[data-voice] td:not(:first-child)::before { content: none; }

    thead { display: none; }

    tbody tr[data-nr] {
        margin-bottom: 12px;
        border-radius: 6px;
        overflow: hidden;
        box-shadow: 0 1px 6px rgb(44 31 20 / 0.08);
        border: 1px solid var(--border);
    }

    td {
        border: none;
        border-bottom: 1px solid var(--border);
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 12px;
    }

    td:first-child {
        background: var(--header-bg);
        color: var(--header-fg);
        font-size: 0.85rem;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        justify-content: flex-start;
        gap: 8px;
        width: auto;
    }

    td:first-child::before { content: "Nr."; opacity: 0.6; font-family: system-ui; font-size: 0.75rem; }
    td:nth-child(2)::before { content: "S"; font-weight: bold; color: var(--s-color); }
    td:nth-child(3)::before { content: "A"; font-weight: bold; color: var(--a-color); }
    td:nth-child(4)::before { content: "T"; font-weight: bold; color: var(--t-color); }
    td:nth-child(5)::before { content: "B"; font-weight: bold; color: var(--b-color); }

    .lyrics-row.active {
        display: block;
        margin-bottom: 12px;
    }

    tr.lyrics-row > td {
        display: block;
        width: auto;
        border-left: 3px solid var(--lyrics-border);
        background: var(--lyrics-bg);
        color: var(--lyrics-text);
        text-transform: none;
        font-family: Georgia, "Times New Roman", serif;
        font-style: italic;
        font-size: 0.95rem;
        font-weight: normal;
        letter-spacing: normal;
        line-height: 1.9;
        padding: 16px 20px;
    }

    tr.lyrics-row > td::before {
        content: none !important;
    }

    audio {
        width: 100%;
        height: 36px;
    }
}
