:root {
    /* Site accent, matched to the logo's amber tile (#FFB020) so buttons,
       links and highlights read as one brand with the wordmark. Amber is
       light, so anything filled with --mt-primary uses --mt-on-primary
       (near-black, also lifted from the logo's triangle mark) for text -
       white text on amber fails contrast. */
    --mt-primary: #ffb020;
    --mt-primary-2: #ff7a3d;
    --mt-on-primary: #14110b;
    --mt-accent: #7a5cff;
    --mt-bg: #0f0f0f;
    --mt-surface: #181818;
    --mt-surface-alt: #212121;
    --mt-border: #303030;
    --mt-text: #f1f1f1;
    --mt-text-muted: #aaaaaa;
    --mt-radius: 10px;
    --mt-max-width: 1600px;
    --mt-ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scrollbar-color: var(--mt-surface-alt) transparent; }
body {
    background: var(--mt-bg);
    color: var(--mt-text);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
/* Baseline styling for every native <select> that isn't already covered by
   something more specific (.mt-field select, [data-quality-select], or an
   inline style) - a bare <select> otherwise falls back to the browser's
   default light widget, which is nearly illegible against this dark theme
   (this bit the admin "Nutzer" page's Rolle dropdown). */
select {
    background: var(--mt-surface-alt);
    border: 1px solid var(--mt-border);
    border-radius: 8px;
    color: var(--mt-text);
    padding: 6px 10px;
}
select:focus { outline: none; border-color: var(--mt-primary); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--mt-surface-alt); border-radius: 8px; border: 2px solid var(--mt-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--mt-border); }
::selection { background: color-mix(in srgb, var(--mt-primary) 45%, transparent); }

/* ---------- Animated ambient background ---------- */
/* Three soft, slowly-drifting colour blobs behind everything, fixed so they
   don't affect layout/scroll performance. Pure CSS, no JS/images. Respects
   prefers-reduced-motion further down. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(38vw 38vw at 12% 18%, color-mix(in srgb, var(--mt-primary) 20%, transparent), transparent 60%),
        radial-gradient(32vw 32vw at 88% 12%, color-mix(in srgb, var(--mt-accent) 16%, transparent), transparent 60%),
        radial-gradient(40vw 40vw at 50% 100%, color-mix(in srgb, var(--mt-primary-2) 14%, transparent), transparent 60%);
    background-repeat: no-repeat;
    opacity: .55;
    filter: blur(10px) saturate(120%);
    animation: mt-bg-drift 26s ease-in-out infinite alternate;
}
@keyframes mt-bg-drift {
    0%   { transform: translate3d(0, 0, 0) scale(1); }
    50%  { transform: translate3d(-1.5%, 1.5%, 0) scale(1.08); }
    100% { transform: translate3d(1.5%, -1.5%, 0) scale(1); }
}
.mt-navbar, .mt-layout, .mt-footer, .admin-layout, .auth-box { position: relative; z-index: 1; }

@media (prefers-reduced-motion: reduce) {
    body::before { animation: none; }
    * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

[dir="rtl"] body { direction: rtl; }

.container { max-width: var(--mt-max-width); margin-inline: auto; padding-inline: 20px; }

/* ---------- Top navbar ---------- */
.mt-navbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 16px;
    padding: 10px 20px;
    background: color-mix(in srgb, var(--mt-bg) 78%, transparent);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--mt-border);
    transition: background .3s var(--mt-ease);
}
.mt-navbar .brand { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; white-space: nowrap; }
.mt-navbar .brand img { height: 28px; }

/* ---------- Brand word-mark (uploaded logo: amber tile + wordmark) ---------- */
/* Colours match the supplied logo artwork exactly, kept as their own tokens
   rather than tied to --mt-primary (the site's red accent stays independent
   of the logo's amber tile, so the two can be tuned separately later). */
:root { --mt-logo-tile: #ffb020; --mt-logo-mark: #14110b; --mt-logo-word: #faf7f0; }
.mt-logo { display: inline-flex; align-items: center; gap: 10px; vertical-align: middle; }
.mt-logo-tile {
    position: relative; width: 34px; height: 34px; flex-shrink: 0;
    background: var(--mt-logo-tile); border-radius: 9px; overflow: hidden;
    animation: mt-logo-mark .8s var(--mt-ease) both;
}
.mt-logo-tile span {
    position: absolute; inset: 0; background: var(--mt-logo-mark);
    clip-path: polygon(34% 26%, 34% 74%, 74% 50%);
}
.mt-logo-word {
    font-family: "DM Sans", "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 22px; font-weight: 700; letter-spacing: -0.03em; color: var(--mt-logo-word);
    animation: mt-logo-word .8s var(--mt-ease) .15s both;
}
.mt-logo.small .mt-logo-tile { width: 26px; height: 26px; border-radius: 7px; }
.mt-logo.small .mt-logo-word { font-size: 17px; }
/* One-shot "iris reveal" entrance, not an infinite loop - this sits in the
   navbar on every page, and a looping animation would replay on every
   single navigation (this is a classic server-rendered app, not an SPA). */
@keyframes mt-logo-mark { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes mt-logo-word { 0% { clip-path: inset(0 100% 0 0); opacity: 0; } 100% { clip-path: inset(0 0 0 0); opacity: 1; } }
.mt-search { flex: 1; max-width: 640px; margin-inline: auto; display: flex; }
.mt-search input {
    flex: 1; padding: 8px 14px; background: var(--mt-surface-alt);
    border: 1px solid var(--mt-border); border-start-start-radius: 20px; border-end-start-radius: 20px;
    border-inline-end: none; color: var(--mt-text);
    transition: border-color .2s var(--mt-ease), box-shadow .2s var(--mt-ease);
}
.mt-search input:focus {
    outline: none; border-color: var(--mt-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mt-primary) 25%, transparent);
}
.mt-search button {
    display: flex; align-items: center; justify-content: center;
    padding: 8px 16px; background: var(--mt-surface); border: 1px solid var(--mt-border);
    border-start-end-radius: 20px; border-end-end-radius: 20px; cursor: pointer;
    transition: background .2s var(--mt-ease), transform .15s var(--mt-ease);
}
.mt-search button:hover { background: var(--mt-surface-alt); }
.mt-search button:active { transform: scale(.92); }
.mt-nav-actions { display: flex; align-items: center; gap: 14px; }
.mt-nav-actions a.icon-btn {
    display: flex; align-items: center; justify-content: center; position: relative;
    padding: 8px; border-radius: 50%; transition: background .2s var(--mt-ease), transform .2s var(--mt-ease);
}
.mt-nav-actions a.icon-btn:hover { background: var(--mt-surface-alt); transform: translateY(-1px); }
.locale-menu { position: relative; }
.locale-menu-trigger {
    display: flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex-shrink: 0;
    background: none; border: none; border-radius: 50%; color: var(--mt-text); cursor: pointer; padding: 0;
    transition: background .18s var(--mt-ease);
}
.locale-menu-trigger:hover { background: var(--mt-surface-alt); }
.locale-dropdown {
    position: absolute; top: calc(100% + 10px); inset-inline-end: 0; z-index: 60; width: 190px;
    max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px;
    background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: var(--mt-radius);
    padding: 6px; box-shadow: 0 14px 32px rgba(0,0,0,.4); animation: mt-alert-in .18s var(--mt-ease);
}
.locale-dropdown[hidden] { display: none; }
.locale-dropdown button {
    display: block; width: 100%; padding: 9px 10px; border-radius: 8px; font-size: 13.5px;
    background: none; border: none; color: var(--mt-text); text-align: start; cursor: pointer;
    transition: background .18s var(--mt-ease);
}
.locale-dropdown button:hover { background: var(--mt-surface-alt); }
.locale-dropdown button.is-active { color: var(--mt-primary); font-weight: 600; }

/* ---------- Icon set (assets/img/icons/, inlined via partials/icon_sprite.php) ---------- */
.mt-icon { width: 19px; height: 19px; flex-shrink: 0; vertical-align: -4px; }
.category-icon-img { object-fit: contain; border-radius: 4px; }
.mt-sidebar a .mt-icon, .mt-search button .mt-icon, .mt-nav-actions a.icon-btn .mt-icon { vertical-align: 0; }
.mt-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--mt-surface-alt); transition: box-shadow .2s var(--mt-ease); }
.mt-avatar:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--mt-primary) 55%, transparent); }

/* ---------- Buttons: animated gradient + shine sweep + lift ---------- */
.mt-btn {
    position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px;
    background: linear-gradient(120deg, var(--mt-primary), var(--mt-primary-2));
    background-size: 220% auto;
    color: var(--mt-on-primary); border: none; border-radius: 18px;
    font-weight: 600; cursor: pointer; overflow: hidden;
    box-shadow: 0 2px 10px color-mix(in srgb, var(--mt-primary) 30%, transparent);
    transition: background-position .5s var(--mt-ease), transform .18s var(--mt-ease), box-shadow .25s var(--mt-ease);
}
.mt-btn::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.35) 48%, transparent 65%);
    background-size: 220% 100%; background-position: 130% 0;
    transition: background-position .7s var(--mt-ease);
    pointer-events: none;
}
.mt-btn:hover { background-position: 100% center; transform: translateY(-2px); box-shadow: 0 6px 18px color-mix(in srgb, var(--mt-primary) 45%, transparent); }
.mt-btn:hover::after { background-position: -30% 0; }
.mt-btn:active { transform: translateY(0) scale(.97); }
.mt-btn.secondary { background: var(--mt-surface-alt); color: var(--mt-text); box-shadow: none; }
.mt-btn.secondary:hover { background: var(--mt-border); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.mt-btn.outline { background: transparent; border: 1px solid var(--mt-border); color: var(--mt-text); box-shadow: none; }
.mt-btn.outline:hover { border-color: var(--mt-primary); color: var(--mt-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mt-primary) 15%, transparent); }
.mt-btn:focus-visible { outline: 2px solid var(--mt-primary); outline-offset: 2px; }
.badge-count {
    background: var(--mt-primary); color: var(--mt-on-primary); border-radius: 10px; font-size: 11px;
    padding: 1px 6px; margin-inline-start: -10px; margin-block-start: -10px; position: relative; top: -8px; inset-inline-start: -8px;
}

/* ---------- Account menu (navbar avatar dropdown) ---------- */
.account-menu { position: relative; }
.account-menu-trigger { background: none; border: none; padding: 0; cursor: pointer; display: flex; border-radius: 50%; }
.account-dropdown {
    position: absolute; top: calc(100% + 10px); inset-inline-end: 0; z-index: 60; width: 240px;
    background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: var(--mt-radius);
    padding: 6px; box-shadow: 0 14px 32px rgba(0,0,0,.4); animation: mt-alert-in .18s var(--mt-ease);
}
.account-dropdown-header { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; }
.account-dropdown-header .mt-avatar { width: 38px; height: 38px; }
.account-dropdown-header .name { font-weight: 600; font-size: 14px; }
.account-dropdown-header .handle { color: var(--mt-text-muted); font-size: 12.5px; }
.account-dropdown a, .account-dropdown-logout {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px;
    font-size: 13.5px; background: none; border: none; color: var(--mt-text); text-align: start; cursor: pointer;
    transition: background .18s var(--mt-ease);
}
.account-dropdown a:hover, .account-dropdown-logout:hover { background: var(--mt-surface-alt); }
.account-dropdown hr { border-color: var(--mt-border); margin: 6px 4px; }

/* ---------- Layout ---------- */
/* z-index:2 (not the shared z-index:1 from further up) is deliberate: .mt-layout
   and .mt-footer are SIBLINGS in the DOM (see layouts/main.php), each their own
   stacking context (position:relative + z-index, only there to sit above the
   animated background blobs). At equal z-index, same-context siblings paint in
   DOM order - so .mt-footer (which comes after .mt-layout in the markup) would
   otherwise always render on top of everything inside .mt-layout, including the
   fixed-position mobile sidebar drawer (z-index:150, but that number only means
   something *inside* .mt-layout's own context) - exactly the "footer text
   bleeding through the open mobile menu" bug. Giving .mt-layout a higher
   z-index than .mt-footer's fixes that regardless of DOM order, while staying
   below the sticky navbar's own z-index:50. */
.mt-layout { display: flex; position: relative; z-index: 2; }
.mt-sidebar {
    width: 230px; flex-shrink: 0; padding: 16px 8px; border-inline-end: 1px solid var(--mt-border);
    position: sticky; top: 57px; height: calc(100vh - 57px); overflow-y: auto;
}
.mt-sidebar a {
    position: relative; display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-radius: 10px; font-size: 14px;
    transition: background .2s var(--mt-ease), transform .2s var(--mt-ease), padding-inline-start .2s var(--mt-ease);
}
.mt-sidebar a:hover { background: var(--mt-surface-alt); transform: translateX(3px); }
.mt-sidebar a.active {
    background: linear-gradient(90deg, color-mix(in srgb, var(--mt-primary) 18%, var(--mt-surface-alt)), var(--mt-surface-alt));
    box-shadow: inset 3px 0 0 var(--mt-primary);
}
.mt-sidebar hr { border-color: var(--mt-border); margin: 12px 8px; }
.mt-main { flex: 1; padding: 20px; min-width: 0; }

/* ---------- Video grid ---------- */
.video-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px;
}
.video-card {
    display: block; border-radius: var(--mt-radius); padding: 6px; margin: -6px;
    transition: transform .28s var(--mt-ease), background .28s var(--mt-ease);
}
.video-card:hover { transform: translateY(-4px); background: color-mix(in srgb, var(--mt-surface) 60%, transparent); }
.video-card .thumb-wrap {
    position: relative; width: 100%; aspect-ratio: 16/9; border-radius: var(--mt-radius);
    overflow: hidden; background: var(--mt-surface-alt);
    box-shadow: 0 0 0 1px transparent;
    transition: box-shadow .28s var(--mt-ease);
}
.video-card:hover .thumb-wrap { box-shadow: 0 10px 26px rgba(0,0,0,.45), 0 0 0 1px color-mix(in srgb, var(--mt-primary) 35%, transparent); }
.video-card .thumb-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--mt-ease); }
.video-card:hover .thumb-wrap img { transform: scale(1.06); }
.video-card .duration {
    position: absolute; inset-block-end: 6px; inset-inline-end: 6px; background: rgba(0,0,0,.8);
    color: #fff; font-size: 12px; padding: 1px 5px; border-radius: 4px;
}
.video-card .meta { display: flex; gap: 10px; padding-block-start: 10px; }
.video-card .meta img.mt-avatar { width: 36px; height: 36px; }
.video-card .title { font-weight: 600; font-size: 14.5px; line-height: 1.3; margin-block-end: 4px; }
.video-card .channel { color: var(--mt-text-muted); font-size: 13px; }
.video-card .stats { color: var(--mt-text-muted); font-size: 13px; }

/* ---------- Section titles ---------- */
h1, h2, h3 { font-weight: 700; }
.section-title { font-size: 20px; margin-block: 22px 14px; }

/* ---------- Watch page ---------- */
.watch-layout { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.watch-main { flex: 2; min-width: 320px; }
.watch-side { flex: 1; min-width: 280px; }
.video-player-wrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--mt-radius); overflow: hidden; }
.video-player-wrap video { width: 100%; height: 100%; }
.video-player-wrap.ppv-locked { display: flex; align-items: center; justify-content: center; }
.ppv-paywall { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.ppv-paywall-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(6px) brightness(0.45); }
.ppv-paywall-inner { position: relative; z-index: 1; max-width: 320px; text-align: center; padding: 24px; color: #fff; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.ppv-paywall-price { font-size: 26px; font-weight: 700; margin: 0; }
.ppv-paywall-hint { margin: 0; opacity: 0.9; font-size: 14px; }
.ppv-buy-form { width: 100%; }
.ppv-buy-form .mt-btn { width: 100%; }
.watch-title { font-size: 20px; margin-block: 14px 8px; }
.watch-channel-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-block: 10px; border-block: 1px solid var(--mt-border); margin-block-end: 14px; }
.watch-channel-row .channel-info { display: flex; align-items: center; gap: 12px; }
.watch-channel-row .channel-info .name { font-weight: 600; }
.watch-channel-row .channel-info .subs { color: var(--mt-text-muted); font-size: 13px; }
.reaction-group { display: flex; background: var(--mt-surface-alt); border-radius: 20px; overflow: hidden; }
.reaction-group button {
    background: none; border: none; color: var(--mt-text); padding: 8px 16px; cursor: pointer; display: flex; gap: 6px; align-items: center;
    transition: background .18s var(--mt-ease), color .18s var(--mt-ease), transform .15s var(--mt-ease);
}
.reaction-group button:hover { background: var(--mt-border); }
.reaction-group button:active { transform: scale(.92); }
.reaction-group button.active { color: var(--mt-primary); }
.reaction-group button + button { border-inline-start: 1px solid var(--mt-border); }
.video-description-box {
    background: var(--mt-surface-alt);
    border: 1px solid var(--mt-border);
    border-radius: var(--mt-radius);
    padding: 14px 16px 16px;
    margin-block-end: 20px;
    transition: border-color .2s var(--mt-ease), box-shadow .2s var(--mt-ease);
}
.video-description-box:hover { border-color: color-mix(in srgb, var(--mt-primary) 35%, var(--mt-border)); }
.video-description-meta { font-weight: 600; font-size: 13px; color: var(--mt-text-muted); margin-block-end: 8px; }
.video-description-text { white-space: pre-wrap; line-height: 1.55; }
.video-description-box.is-collapsible .video-description-text {
    max-height: 4.8em;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 65%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 65%, transparent 100%);
    transition: max-height .35s var(--mt-ease);
}
.video-description-box.is-collapsible.is-expanded .video-description-text {
    max-height: 1000px;
    -webkit-mask-image: none;
    mask-image: none;
}
.desc-toggle {
    display: inline-block;
    margin-block-start: 10px;
    background: none;
    border: none;
    color: var(--mt-primary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}
.desc-toggle:hover { text-decoration: underline; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 12px; }
.tag-pill {
    background: var(--mt-surface);
    border: 1px solid var(--mt-border);
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 12.5px;
    color: var(--mt-text-muted);
    transition: transform .15s var(--mt-ease), border-color .15s var(--mt-ease), color .15s var(--mt-ease);
}
.tag-pill:hover { transform: translateY(-1px); border-color: var(--mt-primary); color: var(--mt-text); }

/* comments */
.comment { display: flex; gap: 12px; margin-block-end: 18px; }
.comment .body { flex: 1; }
.comment .comment-header { display: flex; gap: 8px; align-items: baseline; }
.comment .comment-header .name { font-weight: 600; font-size: 13.5px; }
.comment .comment-header .date { color: var(--mt-text-muted); font-size: 12px; }
.comment .actions { display: flex; gap: 14px; align-items: center; margin-block-start: 4px; font-size: 12.5px; color: var(--mt-text-muted); }
.comment .actions button { background: none; border: none; color: inherit; cursor: pointer; padding: 0; }
.comment .replies { margin-inline-start: 48px; margin-block-start: 10px; }
.comment .replies .comment { margin-block-end: 14px; }
.comment-action-btn:hover { color: var(--mt-text); }
.comment-pinned { background: color-mix(in srgb, var(--mt-primary) 6%, transparent); border-radius: 10px; padding: 10px; margin-inline-start: -10px; margin-inline-end: -10px; }
.comment-pinned-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--mt-primary); margin-block-end: 4px; }
.comment-pinned-label .mt-icon { width: 13px; height: 13px; }
.mention-link { color: var(--mt-primary); font-weight: 600; text-decoration: none; }
.mention-link:hover { text-decoration: underline; }
.channel-about-meta { display: flex; gap: 20px; flex-wrap: wrap; color: var(--mt-text-muted); font-size: 13.5px; margin-block: 6px 14px; }
.channel-links-list { display: flex; flex-direction: column; gap: 8px; margin-block-end: 20px; }
.channel-links-list a { display: inline-flex; align-items: center; gap: 8px; color: var(--mt-text); text-decoration: none; width: fit-content; }
.channel-links-list a:hover { color: var(--mt-primary); }
.channel-links-list .mt-icon { width: 15px; height: 15px; }
.comment-form { display: flex; gap: 12px; margin-block-end: 24px; }
/* Same [hidden]-vs-unconditional-display issue as .autoplay-overlay/
   .report-modal-backdrop above - reply forms are class="comment-form
   reply-form" hidden and toggled via JS, so without this they'd show
   under every comment right away instead of only after "Antworten". */
.comment-form[hidden] { display: none; }
.comment-form textarea { flex: 1; background: transparent; border: none; border-block-end: 1px solid var(--mt-border); color: var(--mt-text); resize: vertical; min-height: 36px; padding-block-end: 6px; }
.comment-form.reply-form { margin-inline-start: 48px; margin-block: 10px 4px; }
.comment-form.reply-form .mt-avatar { width: 28px; height: 28px; }

/* ---------- Chapter markers (watch page, parsed from description) ---------- */
.chapters-box {
    background: var(--mt-surface-alt); border: 1px solid var(--mt-border); border-radius: var(--mt-radius);
    padding: 6px; margin-block-end: 20px;
}
.chapters-title { font-weight: 600; font-size: 13px; padding: 8px 10px 4px; color: var(--mt-text-muted); }
.chapter-item {
    display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: none; color: var(--mt-text);
    text-align: start; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px;
    transition: background .15s var(--mt-ease);
}
.chapter-item:hover { background: var(--mt-surface); }
.chapter-item.active { background: color-mix(in srgb, var(--mt-primary) 12%, transparent); color: var(--mt-primary); }
.chapter-time { color: var(--mt-text-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.chapter-item.active .chapter-time { color: var(--mt-primary); }

/* ---------- Autoplay / "Nächstes Video" overlay (watch page) ---------- */
.autoplay-toggle-row { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; color: var(--mt-text-muted); margin-block-end: 12px; }
.mt-switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.mt-switch input { opacity: 0; width: 0; height: 0; }
.mt-switch-slider { position: absolute; inset: 0; background: var(--mt-border); border-radius: 22px; cursor: pointer; transition: background .18s var(--mt-ease); }
.mt-switch-slider::before { content: ""; position: absolute; width: 16px; height: 16px; inset-inline-start: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .18s var(--mt-ease); }
.mt-switch input:checked + .mt-switch-slider { background: var(--mt-primary); }
.mt-switch input:checked + .mt-switch-slider::before { transform: translateX(16px); }

.autoplay-overlay {
    position: absolute; inset: 0; z-index: 20; background: rgba(10,10,10,.88);
    display: flex; align-items: center; justify-content: center; padding: 16px;
    animation: mt-alert-in .18s var(--mt-ease);
}
/* [hidden] must win over the class's own "display: flex" above - an
   unconditional class-level display declaration has the same specificity
   as the browser's built-in "[hidden]{display:none}" rule, and author
   styles always beat that built-in rule, so without this the overlay
   showed permanently regardless of the hidden attribute JS toggles.
   The extra attribute selector here outranks the plain class above. */
.autoplay-overlay[hidden] { display: none; }
.autoplay-overlay-inner { display: flex; gap: 16px; align-items: center; max-width: 420px; width: 100%; }
.autoplay-thumb { width: 120px; height: 68px; flex-shrink: 0; border-radius: 8px; background-color: var(--mt-surface-alt); background-size: cover; background-position: center; }
.autoplay-info { flex: 1; min-width: 0; }
.autoplay-label { font-size: 12px; color: var(--mt-text-muted); margin-block-end: 4px; }
.autoplay-title { font-weight: 600; font-size: 14px; margin-block-end: 10px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.autoplay-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 480px) {
    .autoplay-overlay-inner { flex-direction: column; text-align: center; }
    .autoplay-actions { justify-content: center; }
}

/* ---------- Comment report modal (shared, one instance per watch page) ---------- */
.report-modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
/* Same fix as .autoplay-overlay[hidden] above - the unconditional
   "display: flex" needs an [hidden] override or the modal never hides. */
.report-modal-backdrop[hidden] { display: none; }
.report-modal {
    position: relative; width: 320px; max-width: 100%; background: var(--mt-surface);
    border: 1px solid var(--mt-border); border-radius: var(--mt-radius); padding: 22px 16px 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,.5); animation: mt-alert-in .18s var(--mt-ease);
}
.report-modal-close { position: absolute; top: 8px; inset-inline-end: 10px; background: none; border: none; color: var(--mt-text-muted); font-size: 22px; cursor: pointer; line-height: 1; padding: 4px; }
.report-modal-close:hover { color: var(--mt-text); }

/* Quality selector (site/video/watch.php) - was an unstyled native <select>
   sitting right under the dark video player, effectively illegible (default
   light browser chrome + tiny size against the site's dark theme). */
[data-quality-select] {
    background: var(--mt-surface-alt); color: var(--mt-text); border: 1px solid var(--mt-border);
    border-radius: 8px; padding: 6px 10px; font-size: 13.5px; font-weight: 600; cursor: pointer;
    transition: border-color .2s var(--mt-ease), background .2s var(--mt-ease);
}
[data-quality-select]:hover { border-color: var(--mt-primary); }
[data-quality-select]:focus { outline: none; border-color: var(--mt-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mt-primary) 22%, transparent); }
[data-quality-select] option { background: var(--mt-surface); color: var(--mt-text); }

/* related video list item */
.related-item { display: flex; gap: 10px; margin-block-end: 12px; }
.related-item .thumb-wrap { width: 168px; flex-shrink: 0; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--mt-surface-alt); }
.related-item .thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.related-item .title { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.related-item .channel, .related-item .stats { font-size: 12px; color: var(--mt-text-muted); }

/* ---------- Forms ---------- */
.mt-form { max-width: 520px; }
.mt-form.wide { max-width: 720px; }
.mt-field { margin-block-end: 16px; }
.mt-field label { display: block; margin-block-end: 6px; font-size: 13.5px; color: var(--mt-text-muted); }
.mt-field input[type=text], .mt-field input[type=email], .mt-field input[type=password],
.mt-field input[type=file], .mt-field input[type=url], .mt-field input[type=number],
.mt-field input[type=datetime-local], .mt-field select, .mt-field textarea {
    width: 100%; padding: 10px 12px; background: var(--mt-surface-alt); border: 1px solid var(--mt-border);
    border-radius: 8px; color: var(--mt-text);
    transition: border-color .2s var(--mt-ease), box-shadow .2s var(--mt-ease);
}
/* input[type=color] needs its own rule, separate from the text-field styles
   above: browsers render its native color swatch INSIDE the input box, so
   the same width:100%/padding used for text fields squashed that swatch
   down to an illegible sliver (reported: showed as a bare line, no visible
   color chip). Keep it small and let the native swatch render normally. */
.mt-field input[type=color] {
    width: 64px; height: 40px; padding: 4px; background: var(--mt-surface-alt); border: 1px solid var(--mt-border);
    border-radius: 8px; cursor: pointer;
    transition: border-color .2s var(--mt-ease), box-shadow .2s var(--mt-ease);
}
.mt-field input:focus, .mt-field select:focus, .mt-field textarea:focus {
    outline: none; border-color: var(--mt-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--mt-primary) 22%, transparent);
}
.mt-field textarea { min-height: 100px; resize: vertical; }
.mt-checkbox { display: flex; align-items: center; gap: 8px; }
.mt-alert { padding: 10px 14px; border-radius: 8px; margin-block-end: 16px; font-size: 14px; animation: mt-alert-in .3s var(--mt-ease); }
@keyframes mt-alert-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.mt-alert.error { background: #3a1414; border: 1px solid #7a2323; color: #ffb4b4; }
.mt-alert.success { background: #123a1c; border: 1px solid #256b3a; color: #a9f5bf; }
.auth-box { max-width: 400px; margin: 60px auto; background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: var(--mt-radius); padding: 32px; }
.auth-box h1 { text-align: center; font-size: 22px; margin-block-end: 24px; }
.auth-links { text-align: center; font-size: 13.5px; color: var(--mt-text-muted); margin-block-start: 16px; }

/* ---------- Channel page ---------- */
.channel-banner { width: 100%; aspect-ratio: 6/1; background: var(--mt-surface-alt); border-radius: var(--mt-radius); overflow: hidden; margin-block-end: 16px; }
.channel-banner img { width: 100%; height: 100%; object-fit: cover; }
.channel-header { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-block-end: 20px; }
.channel-header .mt-avatar { width: 84px; height: 84px; }
.channel-header h1 { margin: 0 0 4px 0; font-size: 24px; }
.channel-tabs { display: flex; gap: 4px; border-block-end: 1px solid var(--mt-border); margin-block-end: 20px; }
.channel-tabs a { padding: 10px 16px; color: var(--mt-text-muted); border-block-end: 2px solid transparent; transition: color .2s var(--mt-ease), border-color .2s var(--mt-ease); }
.channel-tabs a:hover { color: var(--mt-text); }
.channel-tabs a.active { color: var(--mt-text); border-color: var(--mt-primary); }
.channel-header .mt-avatar { transition: transform .3s var(--mt-ease); }
.channel-header .mt-avatar:hover { transform: scale(1.05) rotate(-2deg); }

/* Verified checkmark - used inline next to a channel/username wherever it
   appears (channel header, watch page uploader row, comment author, admin
   users table, video cards). Small, brand-accent, never its own line. */
.verified-badge { width: 15px; height: 15px; color: var(--mt-primary); flex-shrink: 0; vertical-align: -2px; margin-inline-start: 3px; }
.channel-header .verified-badge { width: 20px; height: 20px; vertical-align: -3px; }

/* Achievement badges (BadgeService, computed live from stats - see
   channel/show.php "about" tab) and the "Mitglied" pill (free channel
   memberships, Membership model) - same chip language as .pill above but
   its own class so they're not mistaken for status pills. */
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-block: 12px; }
.badge-chip { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--mt-surface-alt); border: 1px solid var(--mt-border); color: var(--mt-text-muted); }
.member-chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; background: color-mix(in srgb, var(--mt-primary) 18%, transparent); color: var(--mt-primary); margin-inline-start: 6px; vertical-align: 1px; }

/* Membership perks box + "Mitglied werden" button on the channel "Info" tab. */
.membership-box { background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: var(--mt-radius); padding: 16px; margin-block-start: 18px; max-width: 520px; }
.membership-box h3 { margin: 0 0 8px 0; font-size: 15px; }
.membership-box .perks-text { color: var(--mt-text-muted); white-space: pre-line; margin-block-end: 12px; }
.membership-tiers-list { margin-block-start: 18px; max-width: 520px; }
.membership-tier-card { background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: var(--mt-radius); padding: 16px; margin-block-end: 12px; }
.membership-tier-name { font-weight: 600; font-size: 15px; }
.membership-tier-price { color: var(--mt-text-muted); margin-block: 4px 8px; }
.membership-tier-card .ppv-buy-form { margin-block-start: 8px; }

/* ---------- Ad slots (Monetarisierung) ---------- */
.ad-slot { margin-block-end: 16px; text-align: center; }
.ad-slot img { max-width: 100%; height: auto; border-radius: var(--mt-radius); }
.ad-slot-footer { margin-block: 16px 0; }
.ad-slot-sidebar { margin-block-start: 16px; }
.mt-ad-overlay { position: absolute; inset: 0; background: #000; z-index: 2; }
.mt-ad-overlay video { width: 100%; height: 100%; object-fit: contain; cursor: pointer; }
.mt-ad-label { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,0.65); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 4px; }
.mt-ad-skip { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,0.75); color: #fff; border: 1px solid rgba(255,255,255,0.5); border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.mt-ad-skip:hover { background: rgba(0,0,0,0.9); }

/* ---------- Admin ---------- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 230px; background: var(--mt-surface); border-inline-end: 1px solid var(--mt-border); padding: 16px 10px; flex-shrink: 0; }
.admin-sidebar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; padding: 10px; margin-block-end: 10px; }
.admin-sidebar .brand img, .admin-topbar .brand img { height: 24px; }
.admin-sidebar a { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; color: var(--mt-text-muted); margin-block-end: 2px; }
.admin-sidebar a .mt-icon { flex-shrink: 0; vertical-align: 0; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: var(--mt-surface-alt); color: var(--mt-text); }
.admin-main { flex: 1; padding: 24px; min-width: 0; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 14px; margin-block-end: 26px; }
.stat-card {
    background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: var(--mt-radius); padding: 16px;
    transition: transform .25s var(--mt-ease), border-color .25s var(--mt-ease), box-shadow .25s var(--mt-ease);
}
.stat-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--mt-primary) 40%, var(--mt-border)); box-shadow: 0 10px 24px rgba(0,0,0,.35); }
.stat-card .value {
    font-size: 26px; font-weight: 700;
    background: linear-gradient(90deg, var(--mt-text), var(--mt-primary-2));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-card .label { color: var(--mt-text-muted); font-size: 13px; }
table.mt-table { width: 100%; border-collapse: collapse; background: var(--mt-surface); border-radius: var(--mt-radius); overflow: hidden; }
table.mt-table th, table.mt-table td { padding: 12px 16px; border-block-end: 1px solid var(--mt-border); text-align: start; font-size: 13.5px; }
table.mt-table th:last-child, table.mt-table td:last-child { padding-inline-end: 20px; }
table.mt-table th { color: var(--mt-text-muted); font-weight: 600; background: var(--mt-surface-alt); }
table.mt-table tbody tr { transition: background .18s var(--mt-ease); }
table.mt-table tbody tr:hover { background: var(--mt-surface-alt); }
.pill { padding: 2px 9px; border-radius: 10px; font-size: 11.5px; font-weight: 600; }
.pill.ready, .pill.active { background: #123a1c; color: #a9f5bf; }
.pill.queued, .pill.processing, .pill.pending { background: #3a3312; color: #f5e6a9; }
.pill.failed, .pill.banned, .pill.blocked { background: #3a1414; color: #ffb4b4; }
.admin-toolbar { display: flex; justify-content: space-between; align-items: center; margin-block-end: 16px; gap: 12px; flex-wrap: wrap; }
.inline-form { display: inline; }

/* ---------- Footer ---------- */
.mt-footer { border-block-start: 1px solid var(--mt-border); padding: 24px 20px; color: var(--mt-text-muted); font-size: 13px; text-align: center; }

/* ---------- Pagination ---------- */
.mt-pagination { display: flex; gap: 8px; justify-content: center; margin-block-start: 30px; }
.mt-pagination a, .mt-pagination span {
    padding: 8px 14px; border-radius: 8px; background: var(--mt-surface-alt);
    transition: transform .18s var(--mt-ease), background .18s var(--mt-ease);
}
.mt-pagination a:hover { transform: translateY(-2px); background: var(--mt-border); }
.mt-pagination .current { background: linear-gradient(120deg, var(--mt-primary), var(--mt-primary-2)); color: var(--mt-on-primary); }

@media (max-width: 900px) {
    .watch-layout { flex-direction: column; }
}

/* ================================================================
   Responsive: hamburger-triggered off-canvas menus (site sidebar +
   admin sidebar) and general small-screen polish. Desktop layout
   (>900px) is untouched below this point. Mobile-first drawers were
   chosen over "just hide it" because that left tablet/phone visitors
   with no way at all to reach categories/subscriptions or the admin
   nav - only the drawer trigger differs between the two contexts.
   ================================================================ */

.mt-menu-toggle, .admin-menu-toggle {
    display: none; flex-direction: column; justify-content: center; gap: 4px;
    width: 38px; height: 38px; flex-shrink: 0; background: none; border: none;
    border-radius: 8px; cursor: pointer; padding: 0;
    transition: background .18s var(--mt-ease);
}
.mt-menu-toggle:hover, .admin-menu-toggle:hover { background: var(--mt-surface-alt); }
.mt-menu-toggle span, .admin-menu-toggle span {
    display: block; width: 20px; height: 2px; margin-inline: auto; background: var(--mt-text); border-radius: 2px;
    transition: transform .2s var(--mt-ease), opacity .2s var(--mt-ease);
}

.mt-sidebar-backdrop, .admin-sidebar-backdrop {
    position: fixed; inset: 0; z-index: 149; background: rgba(0,0,0,.6);
}

@media (max-width: 900px) {
    .mt-menu-toggle, .admin-menu-toggle { display: flex; }

    /* Site sidebar becomes an off-canvas drawer */
    .mt-sidebar {
        position: fixed; inset-block: 0; inset-inline-start: 0; top: 0; height: 100vh;
        z-index: 150; width: 250px; max-width: 82vw; background: var(--mt-surface);
        box-shadow: 0 0 0 1px var(--mt-border);
        transform: translateX(-100%); transition: transform .25s var(--mt-ease);
        overflow-y: auto; -webkit-overflow-scrolling: touch;
    }
    .mt-sidebar.is-open { transform: translateX(0); }
    [dir="rtl"] .mt-sidebar { transform: translateX(100%); }
    [dir="rtl"] .mt-sidebar.is-open { transform: translateX(0); }

    /* Admin sidebar: same drawer treatment, opened from .admin-topbar */
    .admin-layout { display: block; }
    .admin-sidebar {
        position: fixed; inset-block: 0; inset-inline-start: 0; top: 0; height: 100vh;
        z-index: 150; width: 250px; max-width: 82vw;
        transform: translateX(-100%); transition: transform .25s var(--mt-ease);
        overflow-y: auto;
    }
    .admin-sidebar.is-open { transform: translateX(0); }
    [dir="rtl"] .admin-sidebar { transform: translateX(100%); }
    [dir="rtl"] .admin-sidebar.is-open { transform: translateX(0); }
    .admin-main { padding: 16px; }
}

.admin-topbar {
    position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: var(--mt-surface); border-block-end: 1px solid var(--mt-border);
}
.admin-topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; }
/* Must come AFTER the unconditional rule above - same specificity, so
   source order decides, and this needs to win on desktop. */
@media (min-width: 901px) {
    .admin-topbar { display: none; }
}

/* ---------- General small-screen polish ---------- */
@media (max-width: 900px) {
    .mt-navbar { padding: 10px 14px; gap: 10px; }
    .mt-nav-actions { gap: 8px; }
    .container { padding-inline: 14px; }
}
/* ---------- Mobile search: collapses to an icon, expands into a
   full-width overlay bar over the navbar (there just isn't room for a
   logo + open search field + hamburger + login/register on a phone). ---------- */
.mt-search-toggle, .mt-search-close {
    display: none; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex-shrink: 0;
    background: none; border: none; border-radius: 50%; color: var(--mt-text); cursor: pointer; padding: 0;
    transition: background .18s var(--mt-ease);
}
.mt-search-toggle:hover, .mt-search-close:hover { background: var(--mt-surface-alt); }
@media (max-width: 600px) {
    .mt-search-toggle { display: flex; }
    .mt-search {
        display: none;
        position: absolute; inset: 0; z-index: 55;
        max-width: none; margin: 0; padding: 8px 10px;
        background: var(--mt-bg);
        align-items: center;
    }
    .mt-search.is-open { display: flex; }
    .mt-search-close { display: flex; margin-inline-start: 4px; }
}
@media (max-width: 600px) {
    .mt-logo-word { display: none; }
    .mt-search { min-width: 0; }
    .mt-btn { padding: 8px 14px; font-size: 13.5px; }
    .mt-nav-actions { gap: 6px; }
    .video-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .related-item .thumb-wrap { width: 128px; }
    .watch-channel-row { gap: 8px; }
    .comment .replies { margin-inline-start: 22px; }
    .comment-form.reply-form { margin-inline-start: 22px; }
    .upload-thumb-picker { flex-wrap: wrap; }
    .channel-header { gap: 12px; }
    .channel-header h1 { font-size: 19px; }
    .channel-header .mt-avatar { width: 64px; height: 64px; }
}

/* Any admin table (users, videos, comments, categories, reports ...)
   gets wrapped in a horizontally-scrolling container (rendered server-side
   in the admin views, and also enforced by app.js as a safety net for any
   table that isn't) so wide tables don't blow out the layout on a phone,
   or squeeze their own cells into an ugly wrapped mess, instead of just
   scrolling. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table.mt-table { min-width: 560px; }

/* Dependency-free SVG bar charts - see partials/bar_chart.php */
.bar-chart-wrap { background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: var(--mt-radius); padding: 16px; margin-block-end: 20px; }
.bar-chart-label { font-size: 13px; font-weight: 600; color: var(--mt-text-muted); margin-block-end: 10px; }
.bar-chart-svg { width: 100%; height: 120px; display: block; }
.bar-chart-svg rect { fill: var(--mt-primary); opacity: .85; }
.bar-chart-svg rect:hover { opacity: 1; }
.bar-chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--mt-text-muted); margin-block-start: 6px; }
.admin-charts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 16px; }
/* Honeypot anti-spam field (register form) - visually and functionally hidden
   from real visitors but still present in the DOM/tab order removed, so a
   bot that fills every field (rather than only visible ones) trips it. */
.hp-field { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.storyboard-picker-strip { display: flex; gap: 6px; overflow-x: auto; padding-block: 4px; }
.storyboard-picker-cell { flex: 0 0 auto; border: 2px solid transparent; border-radius: 6px; cursor: pointer; padding: 0; background-repeat: no-repeat; }
.storyboard-picker-cell:hover { border-color: var(--mt-primary); }
.storyboard-picker-status { font-size: 13px; color: var(--mt-primary); margin-block-start: 4px; }
.bulk-action-bar { display: flex; align-items: center; gap: 10px; background: var(--mt-surface-alt); border: 1px solid var(--mt-border); border-radius: var(--mt-radius); padding: 10px 14px; margin-block-end: 12px; }
.bulk-action-bar select { padding: 6px 10px; background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: 6px; color: var(--mt-text); }
.analytics-stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-block-end: 20px; }
.analytics-stat-box { background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: var(--mt-radius); padding: 14px 18px; min-width: 130px; }
.analytics-stat-box .value { font-size: 22px; font-weight: 700; }
.analytics-stat-box .label { font-size: 12px; color: var(--mt-text-muted); }

/* Native <input type="file"> outside .mt-field (e.g. the per-row upload
   fields in admin/categories) inherited no styling at all, so it rendered
   as the browser's plain grey system button - visually clashing with the
   dark theme everywhere around it. Reset + restyle to match. */
input[type="file"] {
    color: var(--mt-text-muted);
    font-size: 12px;
}
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
    background: var(--mt-surface-alt);
    color: var(--mt-text);
    border: 1px solid var(--mt-border);
    border-radius: 6px;
    padding: 6px 10px;
    margin-inline-end: 8px;
    font-size: 11.5px;
    cursor: pointer;
    transition: background .18s var(--mt-ease), border-color .18s var(--mt-ease);
}
input[type="file"]:hover::file-selector-button,
input[type="file"]:hover::-webkit-file-upload-button {
    background: var(--mt-surface);
    border-color: var(--mt-primary);
}

/* ---------- Upload wizard (resources/views/site/video/upload.php) ---------- */
/* A YouTube-style multi-step dialog: drag & drop -> Details -> Sichtbarkeit ->
   Fertig, all driven by assets/js/upload.js. Kept in the site's own dark
   surface/border/radius tokens rather than YouTube's literal white-modal
   skin, so it reads as part of MeinTube. */
.upload-wizard { max-width: 860px; margin-inline: auto; }
.upload-dialog {
    background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: var(--mt-radius);
    padding: 22px 26px 26px; box-shadow: 0 14px 36px rgba(0,0,0,.35);
}
.upload-dialog-header { display: flex; align-items: center; justify-content: space-between; margin-block-end: 6px; }
.upload-dialog-title { font-size: 19px; font-weight: 700; }
.upload-dialog-close {
    display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;
    border-radius: 50%; color: var(--mt-text-muted); transition: background .2s var(--mt-ease), color .2s var(--mt-ease);
}
.upload-dialog-close:hover { background: var(--mt-surface-alt); color: var(--mt-text); }
.upload-footnote { color: var(--mt-text-muted); font-size: 13px; margin-block-start: 14px; max-width: 860px; }

.upload-steps-nav { display: flex; gap: 4px; border-block-end: 1px solid var(--mt-border); margin-block: 14px 20px; }
.upload-steps-nav-item {
    background: none; border: none; color: var(--mt-text-muted); font-size: 14px; font-weight: 600; cursor: pointer;
    padding: 10px 4px; margin-inline-end: 22px; border-block-end: 2px solid transparent;
    transition: color .2s var(--mt-ease), border-color .2s var(--mt-ease);
}
.upload-steps-nav-item:hover { color: var(--mt-text); }
.upload-steps-nav-item.active { color: var(--mt-text); border-color: var(--mt-primary); }

.upload-step-title { font-size: 18px; margin-block: 4px 6px; }
.upload-field-hint { color: var(--mt-text-muted); font-size: 13px; margin-block: 0 12px; }
.settings-logo-preview { display: flex; align-items: center; gap: 12px; margin-block-end: 10px; flex-wrap: wrap; }
.settings-logo-preview img { height: 36px; max-width: 160px; object-fit: contain; background: var(--mt-surface-alt); border: 1px solid var(--mt-border); border-radius: 8px; padding: 4px; }
.mt-checkbox-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--mt-text-muted); font-weight: 400; }

/* Dropzone */
.upload-dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px;
    min-height: 360px; border: 2px dashed var(--mt-border); border-radius: var(--mt-radius); padding: 40px 24px;
    cursor: pointer; transition: border-color .2s var(--mt-ease), background .2s var(--mt-ease);
}
.upload-dropzone:hover, .upload-dropzone:focus-visible { border-color: color-mix(in srgb, var(--mt-primary) 55%, var(--mt-border)); outline: none; }
.upload-dropzone.is-dragover { border-color: var(--mt-primary); background: color-mix(in srgb, var(--mt-primary) 8%, transparent); }
.upload-dropzone-icon { width: 64px; height: 64px; color: var(--mt-text-muted); margin-block-end: 4px; }
.upload-dropzone-title { font-size: 16px; font-weight: 600; max-width: 380px; }
.upload-dropzone-sub { color: var(--mt-text-muted); font-size: 13.5px; max-width: 380px; margin-block-end: 6px; }
.upload-dropzone-error { color: #ffb4b4; font-size: 13.5px; margin-block-start: 4px; }

/* Details step */
.upload-details-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; align-items: start; }
.upload-char-count { text-align: end; color: var(--mt-text-muted); font-size: 12px; margin-block-start: 4px; }
.mt-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.upload-thumb-picker { display: flex; gap: 12px; }
.upload-thumb-option {
    display: flex; flex-direction: column; align-items: center; gap: 6px; width: 108px; cursor: pointer;
    font-size: 12px; color: var(--mt-text-muted);
}
.upload-thumb-option-img {
    width: 100%; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--mt-surface-alt);
    border: 2px solid transparent; display: flex; align-items: center; justify-content: center; color: var(--mt-text-muted);
    transition: border-color .2s var(--mt-ease);
}
.upload-thumb-option-img img { width: 100%; height: 100%; object-fit: cover; }
.upload-thumb-option-img .mt-icon { width: 24px; height: 24px; }
.upload-thumb-option.is-selected .upload-thumb-option-img { border-color: var(--mt-primary); }
.upload-thumb-option.is-selected { color: var(--mt-text); }

.upload-video-preview { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--mt-radius); overflow: hidden; }
.upload-video-preview video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.upload-progress-block { margin-block-start: 12px; }
.upload-progress-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--mt-text-muted); margin-block-end: 6px; }
.upload-progress-filename { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress-bar { height: 6px; border-radius: 4px; background: var(--mt-surface-alt); overflow: hidden; }
.upload-progress-fill {
    height: 100%; width: 0%; border-radius: 4px;
    background: linear-gradient(120deg, var(--mt-primary), var(--mt-primary-2)); background-size: 220% auto;
    transition: width .2s var(--mt-ease);
}
.upload-progress-fill.indeterminate { animation: upload-progress-shimmer 1.4s linear infinite; }
@keyframes upload-progress-shimmer { 0% { background-position: 0% 0; } 100% { background-position: 220% 0; } }
.upload-progress-status { font-size: 12.5px; color: var(--mt-text-muted); margin-block-start: 8px; }
.upload-link-hint { font-size: 12.5px; color: var(--mt-text-muted); margin-block-start: 10px; overflow-wrap: anywhere; }

.upload-actions { display: flex; justify-content: flex-end; gap: 10px; margin-block-start: 22px; }
.upload-actions .mt-btn[disabled] { opacity: .5; pointer-events: none; }

/* Sichtbarkeit step */
.upload-visibility-options { display: flex; flex-direction: column; gap: 10px; margin-block-end: 4px; }
.upload-visibility-option {
    display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid var(--mt-border);
    border-radius: var(--mt-radius); cursor: pointer; transition: border-color .2s var(--mt-ease), background .2s var(--mt-ease);
}
.upload-visibility-option:hover { background: var(--mt-surface-alt); }
.upload-visibility-option input[type=radio] { margin-block-start: 3px; accent-color: var(--mt-primary); }
.upload-visibility-option strong { font-size: 14px; }
.upload-visibility-option p { margin: 2px 0 0; font-size: 13px; color: var(--mt-text-muted); }
.upload-visibility-option:has(input:checked) { border-color: var(--mt-primary); background: color-mix(in srgb, var(--mt-primary) 7%, transparent); }

/* Fertig step */
[data-step="done"] { text-align: center; padding-block: 10px; }
.upload-done-icon { color: var(--mt-primary); margin-block-end: 6px; }
.upload-done-icon .mt-icon { width: 56px; height: 56px; }
[data-step="done"] .upload-actions { justify-content: center; }

@media (max-width: 760px) {
    .upload-details-grid { grid-template-columns: 1fr; }
    .mt-field-row { grid-template-columns: 1fr; }
    .upload-dialog { padding: 16px 16px 20px; }
}

/* ---------- Rich text editor (admin: Quill, pages/blog "Inhalt" field) ---------- */
/* Quill's "snow" theme is light by default - overridden here to match the
   dark admin panel. The visible textarea it replaces (see [data-rich-text]
   in app.js) stays in the DOM (hidden) as the actual form field. */
.rich-text-editor { background: var(--mt-surface-alt); border: 1px solid var(--mt-border); border-radius: var(--mt-radius); margin-block-end: 4px; overflow: hidden; }
.rich-text-editor .ql-toolbar.ql-snow { border: none; border-bottom: 1px solid var(--mt-border); background: var(--mt-surface); }
.rich-text-editor .ql-container.ql-snow { border: none; font-size: 14px; }
.rich-text-editor .ql-editor { min-height: 280px; color: var(--mt-text); }
.rich-text-editor .ql-editor.ql-blank::before { color: var(--mt-text-muted); font-style: normal; }
.rich-text-editor .ql-snow.ql-toolbar button, .rich-text-editor .ql-snow .ql-picker-label { color: var(--mt-text-muted); }
.rich-text-editor .ql-snow .ql-stroke { stroke: var(--mt-text-muted); }
.rich-text-editor .ql-snow .ql-fill { fill: var(--mt-text-muted); }
.rich-text-editor .ql-snow.ql-toolbar button:hover,
.rich-text-editor .ql-snow.ql-toolbar button.ql-active,
.rich-text-editor .ql-snow .ql-picker-label:hover,
.rich-text-editor .ql-snow .ql-picker-label.ql-active,
.rich-text-editor .ql-snow .ql-picker-item:hover { color: var(--mt-primary); }
.rich-text-editor .ql-snow.ql-toolbar button:hover .ql-stroke,
.rich-text-editor .ql-snow.ql-toolbar button.ql-active .ql-stroke,
.rich-text-editor .ql-snow .ql-picker-label:hover .ql-stroke { stroke: var(--mt-primary); }
.rich-text-editor .ql-snow.ql-toolbar button:hover .ql-fill,
.rich-text-editor .ql-snow.ql-toolbar button.ql-active .ql-fill { fill: var(--mt-primary); }
.rich-text-editor .ql-snow .ql-picker-options { background: var(--mt-surface); border: 1px solid var(--mt-border); box-shadow: 0 10px 24px rgba(0,0,0,.4); }
.rich-text-editor .ql-snow .ql-picker.ql-expanded .ql-picker-label { border-color: var(--mt-border); }
.rich-text-editor .ql-snow .ql-tooltip { background: var(--mt-surface); border: 1px solid var(--mt-border); color: var(--mt-text); box-shadow: 0 10px 24px rgba(0,0,0,.4); }
.rich-text-editor .ql-snow .ql-tooltip input[type=text] { background: var(--mt-surface-alt); border: 1px solid var(--mt-border); color: var(--mt-text); }
.rich-text-editor .ql-editor pre.ql-syntax { background: #0c0c0c; color: #eee; border-radius: 6px; }
.rich-text-editor .ql-editor blockquote { border-inline-start: 3px solid var(--mt-primary); color: var(--mt-text-muted); }

/* ---------- Share link + icon row ---------- */
/* Shared between the upload wizard's Fertig step and the watch page's
   "Teilen" popover (site/video/watch.php) - one copy/share widget, two places. */
.share-link-row {
    display: flex; align-items: center; gap: 10px; max-width: 480px; margin: 14px auto; padding: 8px 8px 8px 14px;
    border: 1px solid var(--mt-border); border-radius: 22px; background: var(--mt-surface-alt);
}
.share-link-row .mt-icon { color: var(--mt-text-muted); flex-shrink: 0; }
.share-link-row input { flex: 1; background: none; border: none; color: var(--mt-text); min-width: 0; }
.share-link-row input:focus { outline: none; }
.share-icons-row { display: flex; justify-content: center; gap: 12px; margin-block-end: 22px; }
.share-icon-btn {
    display: flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%;
    background: var(--mt-surface-alt); color: var(--mt-text); font-weight: 700; font-size: 15px;
    transition: transform .18s var(--mt-ease), background .18s var(--mt-ease);
}
.share-icon-btn:hover { transform: translateY(-2px); background: var(--mt-border); }
.share-icon-btn .mt-icon { width: 19px; height: 19px; }

/* ---------- Watch page "Teilen" button + popover ---------- */
.share-wrap { position: relative; }
.share-popover {
    position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 30; width: 300px;
    background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: var(--mt-radius);
    padding: 16px 14px 4px; box-shadow: 0 14px 32px rgba(0,0,0,.4); animation: mt-alert-in .18s var(--mt-ease);
}
.share-popover .share-link-row { margin: 0 0 14px; max-width: none; }
.share-popover .share-icons-row { margin-block-end: 12px; }

@media (max-width: 480px) {
    .share-popover { width: 260px; }
}

/* ---------- Watch page "Melden" button + popover ---------- */
.report-wrap { position: relative; }
.report-popover {
    position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 30; width: 280px;
    background: var(--mt-surface); border: 1px solid var(--mt-border); border-radius: var(--mt-radius);
    padding: 16px; box-shadow: 0 14px 32px rgba(0,0,0,.4); animation: mt-alert-in .18s var(--mt-ease);
}
.report-popover-label { display: block; font-size: 13px; font-weight: 600; margin-block-end: 10px; }
.report-popover select, .report-popover textarea,
.report-modal select, .report-modal textarea {
    width: 100%; background: var(--mt-surface-alt); border: 1px solid var(--mt-border); border-radius: 8px;
    color: var(--mt-text); padding: 8px 10px; margin-block-end: 10px; font-size: 13.5px;
}
.report-popover textarea, .report-modal textarea { min-height: 60px; resize: vertical; }
.report-popover button[type="submit"], .report-modal button[type="submit"] { width: 100%; }
.report-popover-done { font-size: 13.5px; color: var(--mt-text-muted); text-align: center; padding: 8px 0; }

@media (max-width: 480px) {
    .report-popover { width: 240px; }
}

/* ---------- Shorts feed (vertical swipe, TikTok-style) ---------- */
/* Full height minus the sticky navbar (57px, see .mt-navbar/.mt-sidebar
   above); one snap point per clip, so a single wheel/swipe lands exactly on
   the next short instead of stopping mid-scroll. */
.shorts-feed {
    height: calc(100vh - 57px);
    max-width: 460px;
    margin: 0 auto;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    border-radius: var(--mt-radius);
}
.shorts-feed::-webkit-scrollbar { display: none; }
.short-slide {
    position: relative;
    height: calc(100vh - 57px);
    scroll-snap-align: start;
    scroll-snap-stop: always;
    background: #000;
    border-radius: var(--mt-radius);
    overflow: hidden;
}
.short-slide + .short-slide { margin-block-start: 10px; }
.short-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.short-tap-layer { position: absolute; inset: 0; cursor: pointer; }
.short-mute-btn {
    position: absolute; top: 14px; inset-inline-end: 14px; z-index: 2;
    width: 38px; height: 38px; border-radius: 50%; border: none;
    background: rgba(0,0,0,.5); color: #fff; font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.short-overlay {
    position: absolute; inset-block-end: 0; inset-inline: 0; z-index: 2;
    display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
    padding: 16px 14px 20px;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,.75) 55%);
    pointer-events: none;
}
.short-overlay > * { pointer-events: auto; }
.short-info { flex: 1; min-width: 0; color: #fff; }
.short-channel-link { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; font-size: 14px; margin-block-end: 8px; }
.short-channel-link .mt-avatar { width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.5); }
.short-sub-btn { display: block; margin-block-end: 10px; padding: 6px 16px; font-size: 13px; }
.short-title { font-size: 13.5px; line-height: 1.4; margin: 0; overflow-wrap: anywhere; }
.short-actions { display: flex; flex-direction: column; align-items: center; gap: 16px; flex-shrink: 0; }
.short-action-btn {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; color: #fff; font-size: 11.5px; font-weight: 600;
    cursor: pointer; text-decoration: none;
}
.short-action-btn .mt-icon { width: 26px; height: 26px; filter: drop-shadow(0 1px 3px rgba(0,0,0,.6)); }
.short-action-btn.active { color: var(--mt-primary); }
.shorts-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; height: calc(100vh - 57px); color: var(--mt-text-muted); }

@media (max-width: 600px) {
    .shorts-feed { max-width: none; border-radius: 0; }
    .short-slide { border-radius: 0; }
    .short-slide + .short-slide { margin-block-start: 0; }
}

/* ---- Scrub-bar hover preview (storyboard sprite) ---- */
.storyboard-preview {
    position: absolute;
    bottom: 50px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 5;
    background: #000;
    border: 2px solid #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
.storyboard-preview[hidden] { display: none; }
.storyboard-preview-img { background-repeat: no-repeat; }
.storyboard-preview-time {
    text-align: center;
    font-size: 11px;
    color: #fff;
    background: rgba(0, 0, 0, .75);
    padding: 2px 0;
}

/* ---- Community posts (channel "Community" tab) ---- */
.community-post-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    background: var(--mt-surface-alt);
    border: 1px solid var(--mt-border);
    border-radius: var(--mt-radius);
    margin-block-end: 16px;
}
.community-post-form textarea {
    width: 100%;
    min-height: 70px;
    padding: 10px;
    background: var(--mt-surface);
    border: 1px solid var(--mt-border);
    border-radius: 8px;
    color: var(--mt-text);
    resize: vertical;
}
.community-form-row { display: flex; gap: 8px; }
.community-file-btn { cursor: pointer; display: inline-flex; align-items: center; }
.community-poll-fields { display: flex; flex-direction: column; gap: 8px; }
.community-poll-fields input {
    padding: 8px 10px;
    background: var(--mt-surface);
    border: 1px solid var(--mt-border);
    border-radius: 8px;
    color: var(--mt-text);
}
.community-feed { display: flex; flex-direction: column; gap: 14px; }
.community-post {
    padding: 14px;
    background: var(--mt-surface-alt);
    border: 1px solid var(--mt-border);
    border-radius: var(--mt-radius);
}
.community-post-header { display: flex; align-items: center; gap: 10px; margin-block-end: 8px; }
.community-post-header .name { font-weight: 600; }
.community-post-header .date { font-size: 12px; color: var(--mt-text-muted); }
.community-post-body { white-space: pre-wrap; margin-block-end: 8px; }
.community-post-image { max-width: 100%; border-radius: 8px; margin-block-end: 8px; display: block; }
.community-poll { display: flex; flex-direction: column; gap: 6px; margin-block-end: 8px; }
.poll-question { font-weight: 600; margin-block-end: 4px; }
.poll-option-btn {
    text-align: start;
    padding: 8px 12px;
    background: var(--mt-surface);
    border: 1px solid var(--mt-border);
    border-radius: 8px;
    color: var(--mt-text);
    cursor: pointer;
}
.poll-option-btn:hover { border-color: var(--mt-primary); }
.poll-option-result {
    position: relative;
    padding: 8px 12px;
    border: 1px solid var(--mt-border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.poll-option-result.is-mine { border-color: var(--mt-primary); }
.poll-bar {
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    background: var(--mt-surface-hover, rgba(255, 46, 46, .15));
    z-index: 0;
}
.poll-option-label, .poll-option-pct { position: relative; z-index: 1; }
.poll-option-pct { color: var(--mt-text-muted); white-space: nowrap; }
.poll-total { font-size: 12px; color: var(--mt-text-muted); }
.community-post-actions { display: flex; gap: 10px; }
