/* Farbton (--h) und Sättigung (--s) setzt script.js passend zum Hintergrundbild.
   Registriert, damit der Farbwechsel weich animiert wird. */
@property --h {
    syntax: '<number>';
    inherits: true;
    initial-value: 271;
}

@property --s {
    syntax: '<percentage>';
    inherits: true;
    initial-value: 100%;
}

:root {
    --sidebar-width: 400px;
    --h: 271;
    --s: 100%;
    --on-accent: #fff;
    --accent: hsl(var(--h) var(--s) 70%);
    --accent-strong: hsl(var(--h) var(--s) 48%);
    --accent-hover: hsl(var(--h) var(--s) 55%);
    --accent-border: hsl(var(--h) var(--s) 65% / 0.5);
    --accent-soft: hsl(var(--h) var(--s) 60% / 0.22);
    --success: #1f9d55;
    --danger: #ff6b6b;
    --text: hsl(var(--h) 60% 96%);
    --muted: hsl(var(--h) 25% 90% / 0.68);
    --sidebar-bg: hsl(var(--h) 35% 7% / 0.62);
    --surface: rgba(255, 255, 255, 0.05);
    --surface-hover: var(--accent-soft);
    --border: rgba(255, 255, 255, 0.12);
    --radius: 12px;
    color-scheme: dark;
    transition: --h 0.6s ease, --s 0.6s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
}

body {
    min-height: 100vh;
    font-family: 'Roboto', system-ui, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: #0d0716;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Hintergrund ---------- */

/* #bg folgt leicht der Maus (Tiefeneffekt) und ist dafür etwas größer als das Fenster.
   Darin liegen zwei Ebenen, die sich beim Bildwechsel überblenden. */
#bg {
    position: fixed;
    inset: -24px;
    z-index: -1;
    overflow: hidden;
    transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
    will-change: transform;
}

.bg-layer {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.2s ease;
    /* Langsamer Zoom + Schwenk; Richtung (--kx/--ky) setzt script.js pro Bild */
    animation: ken-burns 40s ease-in-out infinite alternate;
    will-change: transform, opacity;
}

.bg-layer.is-visible {
    opacity: 1;
}

.bg-layer:not(.is-visible) {
    animation-play-state: paused;
}

@keyframes ken-burns {
    from {
        transform: scale(1.02);
    }

    to {
        transform: scale(1.12) translate(var(--kx, 0%), var(--ky, 0%));
    }
}

/* ---------- Seitenleiste ---------- */

.page {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    max-width: 100%;
    overflow-y: auto;
    padding: 28px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    backdrop-filter: blur(18px) saturate(1.2);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.45s, width 0.3s ease;
}

/* Kino-Modus (Taste H): Leiste fährt nach links raus, das ganze Bild ist frei */
body.is-cinema .page {
    transform: translateX(calc(-100% - 24px));
    box-shadow: none;
}

/* Griff zum Breiterziehen am rechten Rand der Leiste (script.js) */
.sidebar-resizer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: calc(min(var(--sidebar-width), 100vw) - 4px);
    z-index: 4;
    width: 8px;
    cursor: col-resize;
    touch-action: none;
    transition: left 0.3s ease;
}

.sidebar-resizer::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 3px;
    width: 2px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.15s;
}

.sidebar-resizer:hover::after,
.sidebar-resizer:focus-visible::after,
body.is-resizing .sidebar-resizer::after {
    opacity: 0.8;
}

.sidebar-resizer:focus-visible {
    outline: none;
}

/* Während des Ziehens folgt die Leiste direkt der Maus, ohne Animation und ohne Text zu markieren */
body.is-resizing {
    cursor: col-resize;
    user-select: none;
}

body.is-resizing .page,
body.is-resizing .sidebar-resizer {
    transition: none;
}

body.is-cinema .sidebar-resizer {
    display: none;
}

.cinema-restore {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

body.is-cinema .cinema-restore {
    opacity: 0.55;
    pointer-events: auto;
    transition-delay: 0.3s;
}

body.is-cinema .cinema-restore:hover,
body.is-cinema .cinema-restore:focus-visible {
    opacity: 1;
}

.btn-icon {
    min-width: 32px;
    padding-left: 8px;
    padding-right: 8px;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 4px;
}

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

.notice {
    margin: 0;
    padding: 10px 12px;
    font-size: 0.82rem;
    color: var(--text);
    background: hsl(40 90% 50% / 0.15);
    border: 1px solid hsl(40 90% 60% / 0.4);
    border-radius: 10px;
}

h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.panel {
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.section-title {
    margin: 0 0 12px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ---------- Kacheln ---------- */

.tiles {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

/* --mx/--my (Mausposition) und --rx/--ry (Neigung) setzt script.js */
.tile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    overflow: hidden;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid transparent;
    color: inherit;
    text-decoration: none;
    transform: perspective(600px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
    transition: background 0.15s, border-color 0.15s, transform 0.2s ease-out;
}

.tile:hover {
    background: var(--surface-hover);
    border-color: var(--accent-border);
}

/* Lichtschein, der der Maus folgt */
.tile::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(140px circle at var(--mx, 50%) var(--my, 50%), hsl(var(--h) var(--s) 70% / 0.3), transparent 70%);
    opacity: 0;
    transition: opacity 0.2s;
}

.tile:hover::before {
    opacity: 1;
}

.tile-icon,
.tile-text {
    position: relative;
}

.tile-icon {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--on-accent);
    background: linear-gradient(135deg, var(--accent-strong), hsl(calc(var(--h) + 25) var(--s) 66%));
}

/* Tastenkürzel-Nummer (1–9), von script.js gesetzt */
.tile[data-key]::after {
    content: attr(data-key);
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--muted);
    opacity: 0.6;
}

.tile-local .tile-icon {
    background: linear-gradient(135deg, hsl(var(--h) 40% 22%), hsl(var(--h) 40% 38%));
    color: #fff;
}

.tile-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tile-name {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tile-url {
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Buttons & Felder ---------- */

.btn {
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--on-accent);
    background: var(--accent-strong);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 7px 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.btn:hover {
    background: var(--accent-hover);
}

.btn.is-done {
    color: #fff;
    background: var(--success);
}

.btn-ghost {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.16);
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.78rem;
}

.field {
    width: 100%;
    min-width: 0;
    font: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 10px;
}

.field::placeholder {
    color: var(--muted);
}

.tile:focus-visible,
.video:focus-visible,
.btn:focus-visible,
.field:focus-visible,
.back-link:focus-visible,
.collapsible summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- Zugangsdaten (einklappbar) ---------- */

.collapsible summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    cursor: pointer;
    border-radius: 6px;
}

.collapsible summary::-webkit-details-marker {
    display: none;
}

.collapsible summary .section-title {
    margin: 0;
}

.chevron {
    color: var(--muted);
    transition: transform 0.2s;
}

.collapsible[open] .chevron {
    transform: rotate(180deg);
}

.collapsible-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.inline-copy {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-copy .field {
    flex: 1;
}

.field-secret {
    font-family: ui-monospace, Consolas, monospace;
}

.secret-toggle {
    align-self: flex-start;
}

.creds {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cred {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.cred-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.pill {
    display: inline-block;
    padding: 1px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
}

/* ---------- Videos ---------- */

.back-link {
    display: inline-block;
    margin-bottom: 2px;
    font-size: 0.85rem;
    color: var(--muted);
    text-decoration: none;
}

.back-link:hover {
    color: var(--text);
}

.result-count {
    font-size: 0.8rem;
    color: var(--muted);
    white-space: nowrap;
}

.empty {
    margin: 0;
    padding: 20px 0;
    text-align: center;
    color: var(--muted);
}

/* Videoseite: Hintergrundbild wie auf website.html, Inhalt mittig über die ganze Breite */
body.videos-page {
    --content-width: 1440px;
}

/* Abschnitt unter den Kacheln: dunkler, damit er auf hellen Bildern lesbar bleibt */
.videos-main .panel {
    background: hsl(var(--h) 30% 8% / 0.8);
}

/* Kopfzeile: bleibt beim Scrollen oben */
.topbar {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 12px 24px;
    background: hsl(var(--h) 35% 7% / 0.82);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    backdrop-filter: blur(16px) saturate(1.2);
}

/* Gleiche Breite wie das Kachelraster darunter (dort 24px Innenabstand je Seite) */
.topbar > * {
    max-width: calc(var(--content-width) - 48px);
    margin-left: auto;
    margin-right: auto;
}

.topbar-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
}

.topbar-title {
    display: flex;
    align-items: baseline;
    gap: 14px;
}

.topbar-title .back-link {
    margin: 0;
}

.topbar h1 {
    font-size: 1.5rem;
}

.topbar-search {
    flex: 1 1 260px;
    max-width: 560px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.topbar-actions .btn[aria-expanded="true"] {
    color: var(--on-accent);
    background: var(--accent-strong);
    border-color: transparent;
}

.topbar-actions .tag-count:empty {
    display: none;
}

/* Aufklappbereiche "Filter" und "+ Add video" */
.topbar-panel {
    max-height: min(62vh, 560px);
    overflow-y: auto;
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.topbar .active-filters {
    margin-top: 10px;
    margin-bottom: 0;
}

/* Hinzufügen: links Einfügefeld, rechts die Felder */
.add-form {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: 12px;
    align-items: stretch;
}

.add-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-content: start;
}

.add-fields .tag-picker,
.add-actions {
    grid-column: 1 / -1;
}

.add-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Feld zum Einfügen von Text von der Videoseite */
.paste-field {
    resize: vertical;
    min-height: 3.2em;
    font-size: 0.82rem;
    line-height: 1.4;
}

.add-form .paste-field {
    height: 100%;
    min-height: 150px;
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.add-form .form-row,
.edit-form .form-row {
    display: grid;
    grid-template-columns: 1fr 110px;
    gap: 8px;
}

.edit-form .add-status:empty {
    display: none;
}

.edit-actions {
    display: flex;
    gap: 8px;
}

.add-status {
    margin: 0;
    min-height: 1.2em;
    font-size: 0.8rem;
    color: var(--muted);
}

.add-status[data-state="ok"] {
    color: #6ee7a0;
}

.add-status[data-state="error"] {
    color: var(--danger);
}

.btn[aria-pressed="true"] {
    color: var(--on-accent);
    background: var(--accent-strong);
    border-color: transparent;
}

.btn:disabled {
    opacity: 0.55;
    cursor: default;
}

/* ---------- Session (website.html): offene Tabs merken / wieder öffnen ---------- */

.session-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.session-info {
    margin: 10px 0 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.session-tabs {
    margin-top: 6px;
    font-size: 0.8rem;
}

.session-tabs summary {
    cursor: pointer;
    color: var(--muted);
}

.session-tabs summary:hover {
    color: var(--text);
}

.session-list {
    max-height: 220px;
    overflow-y: auto;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.session-list a {
    display: block;
    overflow: hidden;
    padding: 3px 6px;
    border-radius: 5px;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--text);
    text-decoration: none;
}

.session-list a:hover {
    background: var(--surface-hover);
}

.session-panel .add-status {
    margin-top: 6px;
}

.session-panel .add-status:empty {
    display: none;
}

/* ---------- Video-Kacheln ---------- */

/* Unten eine volle Bildschirmhöhe Platz: ganz nach unten scrollen = nur noch das Hintergrundbild */
.videos-main {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 28px 24px 100vh;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.video-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

/* Infokarte in der Akzentfarbe (folgt dem Hintergrundbild), dunkel genug für weiße Schrift.
   Kein Unschärfe-Effekt: ruckelt sonst, während das Bild im Hintergrund zoomt */
.video-item {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    background: linear-gradient(160deg, hsl(var(--h) var(--s) 24% / 0.88), hsl(var(--h) var(--s) 13% / 0.9));
    border: 1px solid var(--accent-border);
    transition: transform 0.2s ease-out, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.video-item:hover {
    transform: translateY(-3px);
    background: linear-gradient(160deg, hsl(var(--h) var(--s) 30% / 0.92), hsl(var(--h) var(--s) 17% / 0.92));
    border-color: var(--accent-border);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}

.video {
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.video:focus-visible {
    outline-offset: -2px;
    border-radius: 14px;
}

/* Vorschaubild; beim Drüberfahren wechselt script.js die Standbilder je nach Mausposition */
.video-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, hsl(var(--h) 40% 14%), hsl(var(--h) 40% 26%));
}

.video-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Kein Bild (anderer Anbieter, noch nicht geholt oder Datei fehlt) → Plattformname bzw. Hinweis */
.video-thumb-empty,
.video-thumb:has(img[hidden])::before {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.video-thumb:has(img[hidden])::before {
    content: "No image";
}

/* Fortschrittsbalken: welches der 10 Standbilder gerade gezeigt wird */
.video-thumb[data-frames]::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: calc(var(--progress, 0) * 100%);
    background: var(--accent);
}

.video-duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: #fff;
    background: rgba(0, 0, 0, 0.72);
}

.video-duration:empty {
    display: none;
}

.video-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 12px 14px 14px;
}

.video-title {
    display: -webkit-box;
    overflow: hidden;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.video-cast {
    font-size: 0.82rem;
    color: var(--muted);
}

/* Plattform · Upload-Datum */
.video-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--muted);
    opacity: 0.85;
}

.video-meta > * + *::before {
    content: "·";
    margin-right: 6px;
}

/* Bearbeiten / Entfernen: in der Infokarte unten rechts, auf Höhe der Tags-Zeile, beim Drüberfahren.
   (Liegen im <li> neben dem Link; bottom so gewählt, dass die Mitte zur Tag-Zeile passt) */
.video-edit,
.video-remove {
    position: absolute;
    bottom: 11px;
    right: 12px;
    z-index: 1;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    padding: 0;
    font: inherit;
    font-size: 1.05rem;
    line-height: 1;
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 7px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}

.video-edit {
    right: 44px;
    font-size: 0.85rem;
}

/* Platz rechts in der letzten Zeile (meist Tags), damit nichts unter die Buttons rutscht */
.video-info > :last-child {
    padding-right: 66px;
}

.video-item:hover .video-edit,
.video-item:hover .video-remove,
.video-item:focus-within .video-edit,
.video-item:focus-within .video-remove {
    opacity: 1;
}

.video-edit:hover {
    color: var(--on-accent);
    background: var(--accent-strong);
    border-color: transparent;
}

.video-remove:hover {
    color: #fff;
    background: rgba(220, 60, 60, 0.85);
    border-color: transparent;
}

.video-edit:focus-visible,
.video-remove:focus-visible {
    outline: 2px solid var(--accent);
}

.video-item.is-dragging {
    opacity: 0.35;
}

/* Kachel im Bearbeiten-Modus */
.video-item.is-editing {
    padding: 14px;
    background: var(--accent-soft);
    border-color: var(--accent-border);
    transform: none;
}

@media (max-width: 1100px) {
    .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    .add-form,
    .add-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .topbar-actions {
        margin-left: 0;
    }
}

@media (max-width: 640px) {
    .topbar {
        padding: 10px 16px;
    }

    .videos-main {
        padding: 20px 16px 100vh;
    }

    .video-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------- Tags ---------- */

.video-tags {
    grid-column: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 3px;
}

/* Tag und Studio am Video – Klick filtert danach statt das Video zu öffnen */
.tag,
.video-studio {
    padding: 0 7px;
    border-radius: 999px;
    font-size: 0.7rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

/* Studio steht vorn und hebt sich von den Tags ab */
.video-studio {
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.24);
}

.tag:hover,
.video-studio:hover {
    color: var(--on-accent);
    background: var(--accent-strong);
}

/* Einzelne Darstellerin anklicken = danach filtern */
.video-cast .name {
    cursor: pointer;
    border-radius: 3px;
    transition: color 0.15s;
}

.video-cast .name:hover {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 2px;
}


/* Gewählte Filter über der Liste und Vorschläge unter dem Tags-Feld */
.active-filters,
.tag-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.active-filters {
    margin-bottom: 10px;
}

/* Darstellerinnen als Links zu HQPorner */
.actress-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.actress-link {
    text-decoration: none;
}

.actress-link:hover {
    color: var(--on-accent);
    background: var(--accent-strong);
    border-color: transparent;
}

.actress-links .empty {
    width: 100%;
    padding: 6px 0;
}

.chip-kind {
    margin-right: 5px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.75;
}

/* ---------- Filter-Panel links (Videoseite) ---------- */

body.videos-page {
    --filter-width: 360px;
}

/* Fährt von links rein; zu ist es unsichtbar und nicht per Tab erreichbar (inert, script.js) */
.filter-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 4;
    width: var(--filter-width);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px 16px 32px;
    overflow-y: auto;
    background: hsl(var(--h) 35% 7% / 0.88);
    border-right: 1px solid var(--border);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    backdrop-filter: blur(18px) saturate(1.2);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s linear 0.35s;
}

body.filters-open .filter-sidebar {
    transform: none;
    visibility: visible;
    transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s;
}

/* Breite Fenster: Kopfzeile und Kacheln rücken nach rechts, statt verdeckt zu werden */
@media (min-width: 1100px) {
    body.videos-page {
        transition: padding-left 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
    }

    body.videos-page.filters-open {
        padding-left: var(--filter-width);
    }
}

/* Mit offenem Panel ist bis ca. 1400px zu wenig Platz für 3 Kacheln nebeneinander */
@media (min-width: 1100px) and (max-width: 1400px) {
    body.filters-open .video-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.filter-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.filter-sidebar-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.sort-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sort-box .section-title {
    margin: 0;
}

/* ---------- Klappliste (script.js: enhanceSelect) ---------- */

.select {
    position: relative;
}

.select-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    font: inherit;
    font-size: 0.9rem;
    text-align: left;
    color: var(--text);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.select-button:hover {
    background: var(--accent-soft);
    border-color: var(--accent-border);
}

/* Aufgeklappt: dezent wie eine gewählte Zeile in den Filterlisten */
.select-button[aria-expanded="true"] {
    background: var(--accent-soft);
    border-color: var(--accent-border);
}

.select-button .chevron {
    color: inherit;
    opacity: 0.8;
}

.select-button[aria-expanded="true"] .chevron {
    transform: rotate(180deg);
}

.select-button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.select-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 5;
    margin: 0;
    padding: 5px;
    list-style: none;
    background: hsl(var(--h) 35% 9% / 0.97);
    border: 1px solid var(--accent-border);
    border-radius: 10px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
    animation: select-open 0.14s ease-out;
}

@keyframes select-open {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

.select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}

/* Häkchen-Platz für alle Optionen, damit der Text bündig bleibt */
.select-option::before {
    content: "✓";
    width: 1em;
    color: var(--accent);
    visibility: hidden;
}

.select-option[aria-selected="true"] {
    font-weight: 600;
}

.select-option[aria-selected="true"]::before {
    visibility: visible;
}

/* Maus drüber (setzt den Fokus, script.js) oder Pfeiltasten: dezente Akzentfarbe wie in den Filterlisten */
.select-option:focus {
    outline: none;
    background: var(--surface-hover);
}

.select-option[aria-selected="true"] {
    background: var(--accent-soft);
}

.facet-sections {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Je eine Liste für Darstellerinnen, Studios und Tags – einzeln auf-/zuklappbar */
.facet-section {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.18);
}

.facet-section.has-active {
    border-color: var(--accent-border);
}

.facet-section summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    list-style: none;
    cursor: pointer;
}

.facet-section summary::-webkit-details-marker {
    display: none;
}

.facet-section summary .section-title {
    margin: 0;
}

.facet-section summary .tag-count {
    margin-left: 0;
}

.facet-section summary .chevron {
    margin-left: auto;
}

.facet-section[open] .chevron {
    transform: rotate(180deg);
}

.facet-section summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}

.facet-section .facet-table {
    margin-top: 6px;
}

/* Schmale Leiste: Namen bekommen den meisten Platz */
.facet-section .facet-table .num {
    width: 66px;
}

.facet-section .facet-table th.facet-related,
.facet-section .facet-table td.facet-related {
    width: 32%;
}

/* ---------- Filtertabellen ---------- */

.facet-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.82rem;
}

.facet-table th {
    padding: 0;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: left;
    color: var(--muted);
}

.facet-table th button {
    width: 100%;
    padding: 6px 8px;
    font: inherit;
    text-align: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

.facet-table th button:hover {
    color: var(--text);
}

.facet-table th.facet-related {
    padding: 6px 8px;
}

.facet-table .num {
    width: 84px;
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.facet-table th.facet-related,
.facet-table td.facet-related {
    width: 42%;
}

.facet-table td {
    padding: 5px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.facet-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.facet-table tbody tr:hover {
    background: var(--surface-hover);
}

.facet-table tr.is-active {
    background: var(--accent-soft);
}

.facet-name {
    max-width: 100%;
    padding: 0;
    overflow: hidden;
    font: inherit;
    text-align: left;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
}

.facet-name[aria-pressed="true"] {
    font-weight: 600;
}

.facet-name[aria-pressed="true"]::before {
    content: "✓ ";
    color: var(--accent);
}

.facet-table td.facet-related {
    font-size: 0.75rem;
    color: var(--muted);
}

.facet-table td.facet-empty {
    padding: 14px 8px;
    text-align: center;
    white-space: normal;
    color: var(--muted);
    cursor: default;
}

.facet-name:focus-visible,
.facet-table th button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-radius: 4px;
}

.tag-picker:empty {
    display: none;
}

.tag-chip,
.tag-clear {
    font: inherit;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.tag-chip:hover,
.tag-clear:hover {
    background: rgba(255, 255, 255, 0.16);
}

.tag-chip[aria-pressed="true"] {
    color: var(--on-accent);
    background: var(--accent-strong);
    border-color: transparent;
}

.tag-chip:focus-visible,
.tag-clear:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.tag-count {
    margin-left: 6px;
    opacity: 0.65;
    font-variant-numeric: tabular-nums;
}

.tag-clear {
    color: var(--muted);
    background: transparent;
}

/* ---------- Tastenkürzel (website.html) ---------- */

.shortcuts {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 8px 14px;
    margin: 0;
    font-size: 0.85rem;
}

.shortcuts dt {
    white-space: nowrap;
    color: var(--muted);
}

.shortcuts dd {
    margin: 0;
}

kbd {
    display: inline-block;
    min-width: 1.7em;
    padding: 1px 6px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 6px;
}

/* ---------- Einblenden beim Laden (Verzögerung über --i aus script.js) ---------- */

.reveal {
    animation: reveal 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
    animation-delay: calc(var(--i, 0) * 35ms);
}

@keyframes reveal {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- Einblendung (Tastenkürzel) ---------- */

.toast {
    position: fixed;
    bottom: 24px;
    left: 20px;
    z-index: 10;
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    background: hsl(var(--h) 35% 10% / 0.92);
    border: 1px solid var(--accent-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}

.toast.is-visible {
    opacity: 1;
    transform: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .page {
        width: 100%;
        border-right: none;
    }

    .sidebar-resizer {
        display: none;
    }
}

/* Windows-Einstellung "Animationen anzeigen" aus: keine Bewegungseffekte */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }

    .tile {
        transform: none;
    }

    #bg {
        transform: none !important;
    }
}
