/* Seeteifin Seekirchen · Video-Plattform */

:root {
    --bg: #f6f3ef;
    --surface: #ffffff;
    --surface-2: #f1ece6;
    --surface-3: #e8e1d9;
    --text: #1d1a18;
    --text-2: #4a423d;
    --muted: #7a706a;
    --border: #e4ddd5;
    --border-strong: #d3c9bf;
    --accent: #a35a26;
    --accent-hover: #8a4a1d;
    --accent-soft: #f6e6d8;
    --accent-text: #8e4c1e;
    --on-accent: #ffffff;
    --ok: #2e7d4f;
    --ok-soft: #e1f1e7;
    --warn: #9a6200;
    --warn-soft: #fbefd6;
    --fail: #b3261e;
    --fail-soft: #f9e1de;
    --gold: #a77a1b;
    --shadow: 0 1px 2px rgba(29, 20, 15, .06), 0 4px 16px rgba(29, 20, 15, .06);
    --shadow-lg: 0 20px 60px rgba(29, 20, 15, .25);
    --radius: 12px;
    --radius-lg: 16px;
    --topbar: 64px;
    --tabbar: 0px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f0d0c;
        --surface: #191614;
        --surface-2: #221e1b;
        --surface-3: #2d2724;
        --text: #f3ede7;
        --text-2: #d2c8c0;
        --muted: #a0958d;
        --border: #2f2925;
        --border-strong: #433a35;
        --accent: #d19060;
        --accent-hover: #e0a578;
        --accent-soft: #33241a;
        --accent-text: #e6a877;
        --on-accent: #1a120c;
        --ok: #5cc28a;
        --ok-soft: #173225;
        --warn: #f0b44c;
        --warn-soft: #382a12;
        --fail: #ff7a7f;
        --fail-soft: #3a1919;
        --gold: #e0b558;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .25);
        --shadow-lg: 0 24px 70px rgba(0, 0, 0, .6);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0f0d0c;
    --surface: #191614;
    --surface-2: #221e1b;
    --surface-3: #2d2724;
    --text: #f3ede7;
    --text-2: #d2c8c0;
    --muted: #a0958d;
    --border: #2f2925;
    --border-strong: #433a35;
    --accent: #d19060;
    --accent-hover: #e0a578;
    --accent-soft: #33241a;
    --accent-text: #e6a877;
        --on-accent: #1a120c;
    --ok: #5cc28a;
    --ok-soft: #173225;
    --warn: #f0b44c;
    --warn-soft: #382a12;
    --fail: #ff7a7f;
    --fail-soft: #3a1919;
    --gold: #e0b558;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .25);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, .6);
    color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 24px; letter-spacing: -.01em; }
h2 { font-size: 17px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.error-text { color: var(--fail); font-size: 13px; }

/* --- Topbar ---------------------------------------------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 18px;
    height: var(--topbar);
    padding: 0 24px;
    padding-top: env(safe-area-inset-top);
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex: none;
}

.brand img { border-radius: 9px; display: block; }
.brand-text { display: grid; line-height: 1.05; }
.brand-text strong { font-size: 17px; letter-spacing: .02em; }
.brand-text small { color: var(--accent-text); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

.topbar-search {
    position: relative;
    flex: 1;
    max-width: 460px;
    margin-left: 12px;
}

.topbar-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    fill: none;
    stroke: var(--muted);
    stroke-width: 2;
    stroke-linecap: round;
}

.topbar-search input {
    width: 100%;
    height: 40px;
    padding: 0 14px 0 38px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    outline: none;
}

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

.topbar-nav { display: flex; gap: 4px; margin-left: auto; }

.topbar-nav a {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text-2);
    font-weight: 600;
    text-decoration: none;
}

.topbar-nav a:hover { background: var(--surface-2); color: var(--text); }
.topbar-nav a.active { background: var(--accent-soft); color: var(--accent-text); }

.topbar-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
}

.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .i-sun { display: none; }
    :root:not([data-theme="light"]) .i-moon { display: block; }
}

.menu { position: relative; }
.menu-trigger { list-style: none; cursor: pointer; border-radius: 999px; }
.menu-trigger::-webkit-details-marker { display: none; }

.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 230px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.menu-head { display: grid; padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-head span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }

.menu-panel a, .menu-panel button {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: none;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); }

/* --- Tabbar (Handy) -------------------------------------------------------- */

.tabbar { display: none; }

/* --- Layout ---------------------------------------------------------------- */

.page {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 24px 60px;
}

.page-wide { max-width: 1600px; }

.section { margin-bottom: 32px; }
.section-title { margin-bottom: 14px; font-size: 18px; }

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.count {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 14px;
    vertical-align: middle;
}

.card {
    margin-bottom: 18px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card > h2 { margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); }
.card-warn .hint { margin: -6px 0 10px; }
.cards-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.cards-2 .card { margin-bottom: 0; }
.cards-2 + .card { margin-top: 18px; }

.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; align-content: start; }

/* --- Buttons --------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--surface-2);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}

.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border-color: var(--border-strong); background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--fail); color: #fff; }
.btn-danger-ghost { border-color: color-mix(in srgb, var(--fail) 45%, transparent); background: transparent; color: var(--fail); }
.btn-danger-ghost:hover { background: var(--fail-soft); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-pill { border-radius: 999px; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.btn.is-on { background: var(--accent-soft); color: var(--accent-text); }
.btn.is-on svg { fill: currentColor; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.link-btn:hover { color: var(--text); }
.link-danger:hover { color: var(--fail); }

.seg {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: var(--surface-2);
}

.seg button {
    min-height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg-wide { display: flex; margin-bottom: 12px; }
.seg-wide button { flex: 1; }

/* --- Formulare ------------------------------------------------------------- */

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field small { color: var(--muted); font-size: 12px; }

.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .field textarea, .field select, .filters select, .role-form input:not([type="color"]), .copy input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    outline: none;
}

.field textarea { resize: vertical; min-height: 90px; }
.field input:not([type="checkbox"]):focus, .field textarea:focus, .field select:focus, .role-form input:focus, .copy input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
fieldset:disabled { opacity: .7; }

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.switch input { appearance: none; position: relative; width: 42px; height: 24px; margin: 0; border-radius: 999px; background: var(--surface-3); cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }

.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.filters select { width: auto; min-height: 38px; padding: 6px 10px; }

.filter {
    padding: 6px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.filter.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

/* --- Flash, Chips, Avatar -------------------------------------------------- */

.flashes { display: grid; gap: 8px; margin-bottom: 18px; }

.flash {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    font-size: 14px;
}

.flash-ok { border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: var(--ok-soft); }
.flash-warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); }
.flash-error { border-color: color-mix(in srgb, var(--fail) 35%, transparent); background: var(--fail-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }

.chip {
    --chip: var(--muted);
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--chip) 16%, transparent);
    color: color-mix(in srgb, var(--chip) 75%, var(--text));
    font-size: 12px;
    font-weight: 600;
    line-height: 20px;
    white-space: nowrap;
}

.chip-admin { --chip: var(--gold); }
.chip-ok { --chip: var(--ok); }
.chip-warn { --chip: var(--warn); }
.chip-fail { --chip: var(--fail); }

.avatar {
    flex: none;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-3);
    object-fit: cover;
}

.avatar-initials {
    background: linear-gradient(135deg, #a8693c, #3b2416);
    color: #fff;
    font-weight: 700;
    letter-spacing: .02em;
}

.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg { width: 84px; height: 84px; font-size: 26px; }
.avatar-xl { width: 104px; height: 104px; font-size: 32px; }

/* --- Video-Karten ---------------------------------------------------------- */

.vgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 26px 18px;
}

.vcard { display: grid; gap: 10px; text-decoration: none; }

.vcard-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--surface-3);
}

.vcard-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.vcard:hover .vcard-thumb img { transform: scale(1.04); }

.vcard-duration, .vcard-new {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(0, 0, 0, .78);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.vcard-new { left: 8px; right: auto; top: 8px; bottom: auto; background: var(--accent); color: var(--on-accent); text-transform: uppercase; letter-spacing: .05em; }

.vcard-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, .35); }
.vcard-progress::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p); background: var(--accent); }

.vcard-body h3 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 15px;
}

.vcard-body p { margin-top: 3px; color: var(--muted); font-size: 13px; }

.empty { display: grid; justify-items: center; gap: 14px; padding: 60px 20px; color: var(--muted); text-align: center; }
.empty img { border-radius: 16px; }

/* --- Video ansehen --------------------------------------------------------- */

.watch {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 28px;
    align-items: start;
}

.player {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    background: #000;
    isolation: isolate;
}

.player::before {
    content: "";
    position: absolute;
    inset: -40px;
    z-index: -1;
    background: var(--poster, none) center / cover no-repeat;
    filter: blur(40px) brightness(.45) saturate(1.2);
}

.player video { display: block; width: 100%; height: 100%; object-fit: contain; background: transparent; }

.player.is-portrait {
    aspect-ratio: auto;
    height: min(80vh, 900px);
    height: min(80svh, 900px);
}

.player-placeholder { display: grid; place-items: center; height: 100%; color: #ddd; }

.player-toast {
    position: absolute;
    left: 50%;
    top: 16px;
    transform: translateX(-50%);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .75);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    pointer-events: none;
}

.watch-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.watch-head h1 { font-size: 21px; }

.watch-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}

.watch-meta { color: var(--muted); font-size: 14px; }
.watch-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.watch-desc {
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface-2);
    white-space: pre-line;
    font-size: 14px;
}

.watch-side .vlist { display: grid; gap: 14px; }
.watch-side .vcard { grid-template-columns: 168px minmax(0, 1fr); gap: 10px; align-items: start; }
.watch-side .vcard-body h3 { font-size: 14px; }

/* --- Kommentare ------------------------------------------------------------ */

.comments { margin-top: 28px; }
.comments > h2 { margin-bottom: 16px; }

.comment-form, .comment { display: flex; gap: 12px; }
.comment-form { margin-bottom: 26px; }
.comment-input, .comment-main { flex: 1; min-width: 0; }

.comment-input textarea, .comment-edit textarea {
    width: 100%;
    min-height: 40px;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid var(--border-strong);
    background: transparent;
    resize: none;
    outline: none;
    overflow: hidden;
}

.comment-input textarea:focus, .comment-edit textarea:focus { border-bottom: 2px solid var(--accent); }
.comment-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.comment { margin-bottom: 20px; }
.comment header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.comment header time { color: var(--muted); }
.comment-body { margin-top: 3px; white-space: pre-line; overflow-wrap: anywhere; }
.comment-tools { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.comment-tools form { display: contents; }
.comment-edit { margin-top: 8px; }
.replies { margin-top: 14px; }
.comment-reply { margin-bottom: 14px; }
.comment:target > .comment-main { animation: flash-target 2s ease; border-radius: 8px; }

@keyframes flash-target {
    from { background: var(--accent-soft); }
    to { background: transparent; }
}

/* --- Mitglieder & Profil --------------------------------------------------- */

.members {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 14px;
}

.member {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 22px 12px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    text-align: center;
}

.member .chips { justify-content: center; }

.profile-head { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.profile-head .chips { margin-top: 8px; }

/* --- Listen & Tabellen ----------------------------------------------------- */

.rows { margin: 0; padding: 0; list-style: none; }
ul.card.rows { padding: 4px 0; }

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.row:first-child { border-top: 0; }
ul.card.rows .row { padding: 12px 18px; }
.row-main { display: grid; gap: 2px; flex: 1; min-width: 0; text-decoration: none; }
.row-main > span { overflow-wrap: anywhere; }
.row-main .muted { font-size: 13px; }
.row-side { display: grid; justify-items: end; gap: 4px; font-size: 12px; text-align: right; }
.row-side.btn-row { display: flex; justify-content: flex-end; }
.row-link:hover { background: var(--surface-2); }
.row.is-muted { opacity: .6; }

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 8px 10px; border-bottom: 1px solid var(--border-strong); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; text-transform: uppercase; letter-spacing: .04em; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-fail td { background: color-mix(in srgb, var(--fail-soft) 50%, transparent); }
.table td .chip { margin: 0 2px 2px 0; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 14px; }

/* --- Verwaltung ------------------------------------------------------------ */

.subnav {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    padding-bottom: 2px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}

.subnav a {
    flex: none;
    padding: 10px 14px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-weight: 600;
    text-decoration: none;
    margin-bottom: -3px;
}

.subnav a:hover { color: var(--text); }
.subnav a.active { border-color: var(--accent); color: var(--text); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }

.stat {
    display: grid;
    gap: 2px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.stat span { color: var(--muted); font-size: 13px; }
.stat strong { font-size: 26px; letter-spacing: -.02em; }
.stat small { color: var(--muted); font-size: 12px; }

.dot-live {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--accent);
    vertical-align: 2px;
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    70% { box-shadow: 0 0 0 8px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.live { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.live-item { display: flex; gap: 14px; align-items: center; }
.live-thumb { position: relative; flex: none; width: 128px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px; background: var(--surface-3); }
.live-thumb img { width: 100%; height: 100%; object-fit: cover; }
.live-state { position: absolute; left: 6px; bottom: 6px; padding: 0 6px; border-radius: 5px; color: #fff; font-size: 11px; font-weight: 700; }
.live-state.is-playing { background: var(--accent); color: var(--on-accent); }
.live-state.is-paused { background: rgba(0, 0, 0, .7); }
.live-main { display: grid; gap: 4px; flex: 1; min-width: 0; }
.live-main > a { font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-main > .muted { font-size: 12px; }
.live-user { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.live-empty { padding: 6px 0; }

.bar { height: 5px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.bar-lg { height: 10px; }

.user-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.user-layout > .card, .user-layout aside .card { margin-bottom: 0; }
.user-layout + .card { margin-top: 18px; }
.user-layout aside { gap: 18px; }
.user-layout aside h2 { display: flex; align-items: center; gap: 8px; }

.avatar-edit, .thumb-edit { display: flex; align-items: center; gap: 18px; }

.role-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.role-option { --chip: var(--muted); position: relative; cursor: pointer; }
.role-option input { position: absolute; opacity: 0; pointer-events: none; }

.role-option span {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    transition: all .12s;
}

.role-option input:checked + span {
    border-color: var(--chip);
    background: color-mix(in srgb, var(--chip) 18%, transparent);
    color: color-mix(in srgb, var(--chip) 75%, var(--text));
}

.role-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.admin-box { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.perm-list { display: grid; gap: 8px; margin-top: 12px; }

.mini-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mini-stats div { display: grid; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.mini-stats strong { font-size: 22px; }
.mini-stats span { color: var(--muted); font-size: 12px; }
.mini-stats .is-warn { background: var(--warn-soft); }

.role-row { flex-wrap: wrap; }
.role-form { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 8px; }
.role-form input[name="name"] { flex: 1; min-width: 160px; }
.role-form input[type="color"] { width: 44px; height: 40px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); cursor: pointer; }
.input-narrow { width: 80px !important; flex: none; }
.role-new { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }

.video-row { align-items: flex-start; }
.video-row-thumb { flex: none; width: 144px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px; background: var(--surface-3); }
.video-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-row-thumb-lg { width: 240px; }
.video-row .row-main { gap: 4px; }
.video-row .row-main a { text-decoration: none; }

.dropzone {
    position: relative;
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 36px 20px;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone svg { width: 36px; height: 36px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dropzone strong { overflow-wrap: anywhere; }

.upload-progress { display: grid; gap: 8px; }
.upload-stats { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 13px; }

.copy { display: flex; gap: 8px; }
.copy input { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

/* --- Dialog ---------------------------------------------------------------- */

.dialog {
    width: min(420px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
}

.dialog::backdrop { background: rgba(10, 6, 4, .55); backdrop-filter: blur(3px); }
.dialog form { padding: 22px; }
.dialog h2 { margin-bottom: 8px; font-size: 18px; }
.dialog p { color: var(--text-2); font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* --- Anmeldung ------------------------------------------------------------- */

body.auth {
    background:
        radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
        var(--bg);
}

body.auth .page { display: grid; place-items: center; min-height: 100vh; min-height: 100svh; padding: 24px 16px; }

.auth-card {
    width: min(420px, 100%);
    padding: 30px 28px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

body:not(.auth) .auth-card { margin: 40px auto; }
.auth-card h1 { margin: 18px 0 6px; font-size: 22px; text-align: center; }
.auth-card > .muted { text-align: center; }
.auth-card > .muted { margin-bottom: 20px; }
.auth-card .flash { margin-bottom: 16px; }
.auth-brand { display: grid; place-items: center; margin: -6px 0 4px; }
.auth-brand img { width: 210px; height: auto; border-radius: 18px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 14px; }
.auth-foot a { color: var(--accent-text); font-weight: 600; text-decoration: none; }

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

@media (max-width: 1100px) {
    .watch { grid-template-columns: minmax(0, 1fr); }
    .watch-side .vlist { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px 18px; }
    .watch-side .vcard { grid-template-columns: 1fr; }
    .user-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
    .topbar-nav { display: none; }
    .topbar-search { margin-left: auto; max-width: 260px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cards-2 { grid-template-columns: minmax(0, 1fr); }

    :root { --tabbar: 62px; }

    .tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        display: flex;
        height: calc(var(--tabbar) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: color-mix(in srgb, var(--surface) 92%, transparent);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        border-top: 1px solid var(--border);
    }

    .tabbar a {
        display: grid;
        flex: 1;
        place-items: center;
        align-content: center;
        gap: 3px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 600;
        text-decoration: none;
    }

    .tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    .tabbar a.active { color: var(--accent-text); }
    .tabbar a.active .avatar { box-shadow: 0 0 0 2px var(--accent); }

    .page { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 30px); }
    .menu { display: none; }
}

@media (max-width: 600px) {
    .topbar { gap: 10px; padding: 0 14px; }
    .brand-text small { font-size: 10px; letter-spacing: .05em; }
    .brand-text strong { font-size: 16px; }
    .brand { gap: 8px; }
    .topbar-search { max-width: none; }
    .topbar-search input { height: 38px; }
    .page { padding: 16px 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 30px); }
    h1 { font-size: 21px; }

    .page-wide { padding-left: 0; padding-right: 0; padding-top: 0; }
    .page-wide .player { border-radius: 0; }
    .page-wide .watch-main > :not(.player), .page-wide .watch-side { padding-left: 16px; padding-right: 16px; }
    .page-wide .flashes { margin: 12px 16px; }
    .player.is-portrait { height: min(70svh, calc(100vw * 16 / 9)); }

    .vgrid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
    .vgrid-row { grid-auto-flow: column; grid-auto-columns: 78%; grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
    .vgrid-row .vcard { scroll-snap-align: start; }
    .members { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card { padding: 16px; border-radius: 14px; }
    .table-wrap { margin: 0 -16px; padding: 0 16px; }
    ul.card.rows .row { padding: 12px 14px; }
    .row { flex-wrap: wrap; }
    .row-side { justify-items: start; text-align: left; }
    .video-row-thumb { width: 112px; }
    .video-row .row-side { width: 100%; justify-content: flex-start; }
    .live-thumb { width: 96px; }
    .profile-head { flex-direction: column; text-align: center; }
    .profile-head .chips { justify-content: center; }
    .form-actions .btn { flex: 1; }
    .copy { flex-direction: column; }
    .avatar-edit, .thumb-edit { flex-direction: column; align-items: flex-start; }
    .video-row-thumb-lg { width: 100%; }
}

.logout-form { margin-top: 16px; }

/* Eigene Player-Steuerung: große Knöpfe, auch am Handy gut zu treffen */
.pc {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    grid-template-rows: 1fr auto;
    color: #fff;
    transition: opacity .25s ease;
    -webkit-tap-highlight-color: transparent;
}

.pc::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, .7), transparent 34%, transparent 70%, rgba(0, 0, 0, .25));
    pointer-events: none;
}

.player.is-idle .pc { opacity: 0; }
.player.is-idle { cursor: none; }

.pc-center {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(20px, 8vw, 56px);
}

.pc-btn {
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .42);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.pc-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pc-play { width: 84px; height: 84px; background: color-mix(in srgb, var(--accent) 92%, transparent); color: var(--on-accent); box-shadow: 0 8px 30px rgba(0, 0, 0, .45); }
.pc-play svg { width: 40px; height: 40px; fill: currentColor; stroke: none; }
.pc-play .i-play { margin-left: -2px; }
.pc-skip { width: 58px; height: 58px; }
.pc-skip svg { width: 32px; height: 32px; }
.pc-small { width: 46px; height: 46px; flex: none; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.pc-small svg { width: 26px; height: 26px; }
.pc-small .i-vol path:first-child, .pc-small .i-muted path:first-child { fill: currentColor; }

.i-pause, .player.is-playing .i-play { display: none; }
.player.is-playing .i-pause { display: block; }
.i-muted, .player.is-muted .i-vol { display: none; }
.player.is-muted .i-muted { display: block; }
.player:not(.is-started) .pc-skip, .player:not(.is-started) .pc-bar { visibility: hidden; }

.pc-bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 8px 16px;
}

.pc-time { flex: none; min-width: 40px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }

.pc-seek {
    --p: 0%;
    flex: 1;
    min-width: 0;
    height: 28px;
    margin: 0;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.pc-seek::-webkit-slider-runnable-track { height: 5px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--p), rgba(255, 255, 255, .35) var(--p)); }
.pc-seek::-moz-range-track { height: 5px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--p), rgba(255, 255, 255, .35) var(--p)); }
.pc-seek::-webkit-slider-thumb { width: 16px; height: 16px; margin-top: -5.5px; border: 0; border-radius: 50%; background: #fff; -webkit-appearance: none; box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.pc-seek::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff; }

.pc-spinner {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 96px;
    height: 96px;
    margin: -48px 0 0 -48px;
    border: 3px solid transparent;
    border-top-color: var(--accent);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    animation: spin .9s linear infinite;
}

.player.is-waiting .pc-spinner { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

.player:fullscreen { width: 100%; height: 100%; max-height: none; border-radius: 0; aspect-ratio: auto; }
.player:-webkit-full-screen { width: 100%; height: 100%; border-radius: 0; }

@media (max-width: 600px) {
    .pc-play { width: 76px; height: 76px; }
    .pc-time { min-width: 36px; font-size: 12px; }
}

.pc-menu-wrap { position: relative; flex: none; }
.pc-badge { position: absolute; top: 5px; right: 2px; padding: 0 3px; border-radius: 4px; background: var(--accent); color: var(--on-accent); font-size: 9px; font-weight: 800; line-height: 13px; }
[data-quality-btn] { position: relative; }

.pc-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    display: grid;
    min-width: 190px;
    padding: 6px;
    border-radius: 12px;
    background: rgba(20, 16, 13, .94);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pc-menu strong { padding: 6px 10px 4px; color: rgba(255, 255, 255, .6); font-size: 12px; font-weight: 600; }

.pc-menu button {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    padding: 0 10px 0 30px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    position: relative;
}

.pc-menu button small { color: rgba(255, 255, 255, .55); font-weight: 500; }
.pc-menu button:hover { background: rgba(255, 255, 255, .1); }
.pc-menu button.active::before { content: "✓"; position: absolute; left: 10px; color: var(--accent); }

.flash { transition: opacity .4s ease, transform .4s ease; }
.flash.is-leaving { opacity: 0; transform: translateY(-6px); }

/* Rollenfarben im Dunkelmodus heller, damit auch dunkle Farben lesbar bleiben */
:root[data-theme="dark"] .chip, :root[data-theme="dark"] .role-option input:checked + span { color: color-mix(in srgb, var(--chip) 45%, #fff); background: color-mix(in srgb, var(--chip) 30%, transparent); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .chip, :root:not([data-theme="light"]) .role-option input:checked + span { color: color-mix(in srgb, var(--chip) 45%, #fff); background: color-mix(in srgb, var(--chip) 30%, transparent); }
}

/* Vorschaubild aus dem Video wählen */
.frame-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.frame-head > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.frames { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.frames-portrait { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.frame { position: relative; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 10px; background: var(--surface-3); cursor: pointer; aspect-ratio: 16 / 9; }
.frames-portrait .frame { aspect-ratio: 9 / 16; }
.frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.frame span { position: absolute; right: 5px; bottom: 5px; padding: 0 5px; border-radius: 5px; background: rgba(0, 0, 0, .75); color: #fff; font-size: 11px; font-weight: 600; }
.frame:hover { border-color: var(--border-strong); }
.frame.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.frame-picker { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 16px; align-items: start; }
.frame-picker video { width: 100%; max-height: 420px; border-radius: 10px; background: #000; }
.frame-picker.is-portrait { grid-template-columns: 260px minmax(0, 1fr); }
.frame-picker.is-portrait video { max-height: 460px; }
@media (max-width: 700px) {
    .frames, .frames-portrait { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .frame-picker, .frame-picker.is-portrait { grid-template-columns: minmax(0, 1fr); }
}

/* Ansicht als anderer Benutzer */
.viewas {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 14px;
    padding: 8px 16px;
    padding-top: calc(8px + env(safe-area-inset-top));
    background: var(--warn);
    color: #1a1206;
    font-size: 14px;
    text-align: center;
}

.viewas button {
    min-height: 30px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: #1a1206;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.viewas + .topbar { top: 46px; }

/* Zeitmarken in Kommentaren */
:root { --link: #065fd4; }
:root[data-theme="dark"] { --link: #3ea6ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --link: #3ea6ff; } }
a.ts { color: var(--link); font-weight: 600; text-decoration: none; }
a.ts:hover { text-decoration: underline; }
.player { scroll-margin-top: calc(var(--topbar) + 8px); }
