/* ============================================================
   VideoHub — design system
   ------------------------------------------------------------
   Palette   bg #0B0D12 · surface #14171F · surface-2 #1B1F29
             border #262B37 · text #ECEEF3 · text-dim #8B92A4
             gold (primary) #D3A24C · jade (secondary) #34A895
             rose (danger) #E0637C
   Type      Display: 'Fraunces' (serif, used sparingly for
             headings/logo) · UI/body: 'Manrope'
   Signature A single warm-gold thread — a hairline ring that
             draws in on hover, echoed in the active nav pill,
             the player frame glow, and primary buttons — reads
             as a curated broadcast mark rather than a generic
             accent color.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,wght@0,600;0,700;1,600&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #0b0d12;
    --surface: #14171f;
    --surface-2: #1b1f29;
    --surface-3: #232834;
    --border: #262b37;
    --border-soft: #1d212b;
    --text: #eceef3;
    --text-dim: #8b92a4;
    --text-faint: #5b6273;

    --gold: #d3a24c;
    --gold-hover: #e2b563;
    --gold-ink: #221604;
    --jade: #34a895;
    --jade-soft: rgba(52, 168, 149, 0.14);
    --rose: #e0637c;
    --rose-soft: rgba(224, 99, 124, 0.13);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 28px -14px rgba(0, 0, 0, 0.55);
    --shadow-panel: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 16px 40px -20px rgba(0, 0, 0, 0.6);
    --shadow-gold: 0 10px 30px -12px rgba(211, 162, 76, 0.35);

    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

    --glow-1: rgba(211, 162, 76, 0.07);
    --glow-2: rgba(52, 168, 149, 0.06);
}

/* ---------- Light theme override ----------
   Same brand hues (gold + jade), re-tuned for contrast on a light
   background. Toggled via data-theme="light" on <html> (see the
   inline anti-flash script in header.php and js/theme-toggle.js). */
:root[data-theme="light"] {
    --bg: #f3f4f7;
    --surface: #ffffff;
    --surface-2: #edeff3;
    --surface-3: #e2e5ec;
    --border: #dde0e7;
    --border-soft: #e7e9ef;
    --text: #181b22;
    --text-dim: #5b6273;
    --text-faint: #8b92a4;

    --gold: #b1793a;
    --gold-hover: #c28a49;
    --gold-ink: #ffffff;
    --jade: #1f8272;
    --jade-soft: rgba(31, 130, 114, 0.1);
    --rose: #c43e5a;
    --rose-soft: rgba(196, 62, 90, 0.09);

    --shadow-card: 0 1px 2px rgba(30, 34, 44, 0.06), 0 12px 24px -14px rgba(30, 34, 44, 0.12);
    --shadow-panel: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 16px 32px -20px rgba(30, 34, 44, 0.16);
    --shadow-gold: 0 10px 24px -12px rgba(177, 121, 58, 0.28);

    --glow-1: rgba(177, 121, 58, 0.06);
    --glow-2: rgba(31, 130, 114, 0.05);
}

* { box-sizing: border-box; }

::selection { background: var(--gold); color: var(--gold-ink); }

* { scrollbar-width: thin; scrollbar-color: var(--border) var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

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

body {
    margin: 0;
    background:
        radial-gradient(ellipse 900px 500px at 12% -10%, var(--glow-1), transparent 60%),
        radial-gradient(ellipse 700px 500px at 100% 0%, var(--glow-2), transparent 55%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15.5px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.2s ease, color 0.2s ease;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin: 0 0 0.5em;
}

p { margin: 0 0 1em; }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(11, 13, 18, 0.78);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--border-soft);
}
.header-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    gap: 28px;
}
.logo {
    font-family: var(--font-display);
    font-weight: 700;
    font-style: italic;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    letter-spacing: -0.01em;
    color: var(--text);
}
.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(155deg, var(--gold-hover), var(--gold) 65%);
    color: var(--gold-ink);
    font-size: 0.7rem;
    font-style: normal;
    box-shadow: 0 4px 14px -4px rgba(211, 162, 76, 0.55);
}
.search-form {
    flex: 1;
    display: flex;
    max-width: 460px;
}
.search-form input {
    flex: 1;
    min-width: 0;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 999px 0 0 999px;
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: 0.92rem;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.search-form input::placeholder { color: var(--text-faint); }
.search-form input:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--surface-3);
}
.search-form button {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-left: 1px solid var(--border);
    border-radius: 0 999px 999px 0;
    background: var(--surface-3);
    color: var(--text-dim);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}
.search-form button:hover { color: var(--gold); background: var(--surface-2); }
.main-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 0.9rem;
    white-space: nowrap;
    color: var(--text-dim);
}
.main-nav a { transition: color 0.15s ease; }
.main-nav a:hover { color: var(--text); }
.nav-user { color: var(--gold); font-weight: 700; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-2);
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.theme-toggle:hover { border-color: var(--gold); }
.theme-icon-dark, .theme-icon-light { display: none; }
/* Dark theme (default): show the moon so the button reads "switch to dark" is already active — icon shown is the action available, i.e. sun to switch to light */
:root:not([data-theme="light"]) .theme-toggle .theme-icon-light { display: inline; }
:root[data-theme="light"] .theme-toggle .theme-icon-dark { display: inline; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.88rem;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.btn:hover { border-color: var(--text-faint); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-accent {
    background: linear-gradient(155deg, var(--gold-hover), var(--gold) 75%);
    color: var(--gold-ink);
    border-color: transparent;
    box-shadow: var(--shadow-gold);
}
.btn-accent:hover { background: var(--gold-hover); filter: brightness(1.03); }

/* ---------- Main / layout ---------- */
.site-main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 28px 64px;
}

.category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-soft);
}
.toolbar-row .category-bar { flex: 1; margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.sort-toggle {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    flex-shrink: 0;
}
.sort-option {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim);
    white-space: nowrap;
    transition: color 0.15s ease, background 0.15s ease;
}
.sort-option:hover { color: var(--text); }
.sort-option-active, .sort-option-active:hover {
    background: var(--jade);
    color: #06231d;
}
.chip {
    padding: 7px 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    font-size: 0.87rem;
    font-weight: 600;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.chip:hover { color: var(--text); border-color: var(--text-faint); }
.chip-active {
    background: var(--gold);
    color: var(--gold-ink);
    border-color: var(--gold);
}
.chip-active:hover { color: var(--gold-ink); border-color: var(--gold); }

/* ---------- Video grid ---------- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
    gap: 26px;
}
.video-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-card);
    transition: transform 0.25s cubic-bezier(.2,.8,.2,1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.video-card:hover {
    transform: translateY(-4px);
    border-color: rgba(211, 162, 76, 0.4);
    box-shadow: var(--shadow-card), var(--shadow-gold);
}
.thumb-wrap {
    aspect-ratio: 16 / 9;
    background: var(--surface-2);
    position: relative;
    overflow: hidden;
}
.thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
}
.video-card:hover .thumb-wrap img { transform: scale(1.06); }
/* signature: gold ring draws in on hover */
.thumb-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 0 rgba(211, 162, 76, 0);
    transition: box-shadow 0.25s ease;
    pointer-events: none;
    z-index: 2;
}
.video-card:hover .thumb-wrap::before { box-shadow: inset 0 0 0 2px rgba(211, 162, 76, 0.9); }
.thumb-wrap::after {
    content: "▶";
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: var(--gold);
    background: rgba(11, 13, 18, 0.55);
    backdrop-filter: blur(3px);
    border: 1.5px solid rgba(211, 162, 76, 0.75);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.82);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 3;
}
.video-card:hover .thumb-wrap::after { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.video-info { padding: 14px 16px 18px; }
.video-title {
    font-family: var(--font-body);
    font-size: 0.96rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.005em;
}
.video-meta {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin: 0 0 8px;
}
.video-cat {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 3px 11px;
    border-radius: 999px;
    background: var(--jade-soft);
    color: var(--jade);
}
.empty-state { color: var(--text-dim); padding: 48px 0; text-align: center; font-size: 0.95rem; }

/* ---------- Watch page ---------- */
.watch-layout { max-width: 100%; margin: 0 auto; }
.player-col { display: flex; flex-direction: column; }
.server-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0 20px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    width: fit-content;
    max-width: 100%;
}
.server-tab {
    padding: 7px 18px;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.84rem;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease;
}
.server-tab:hover { color: var(--text); }
.server-tab-active, .server-tab-active:hover {
    background: var(--gold);
    color: var(--gold-ink);
}
.player-wrap {
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 22px;
    aspect-ratio: 16 / 9;
    box-shadow: var(--shadow-panel), 0 0 0 1px var(--border-soft);
}
.player-wrap video { width: 100%; height: 100%; display: block; }
.player-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}
.watch-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 12px;
}
.watch-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 6px;
}
.watch-meta, .watch-author { color: var(--text-dim); font-size: 0.88rem; margin: 0; }
.watch-meta a { color: var(--jade); font-weight: 600; }
.watch-meta a:hover { text-decoration: underline; }
.watch-actions { display: flex; gap: 8px; }
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.action-btn:hover { border-color: var(--text-faint); color: var(--text); }
.action-btn:disabled { opacity: 0.6; cursor: default; }
.action-icon { font-size: 0.95rem; line-height: 1; }
.action-btn-active {
    border-color: var(--rose);
    color: var(--rose);
    background: var(--rose-soft);
}
.action-btn-active:hover { border-color: var(--rose); color: var(--rose); }

/* ---------- Share modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 4, 6, 0.62);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}
.modal-overlay[hidden] { display: none; }
body.modal-open { overflow: hidden; }
.modal-panel {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-panel);
    padding: 20px 22px 22px;
    width: 100%;
    max-width: 360px;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.modal-header h3 { font-size: 1.05rem; margin: 0; }
.modal-close {
    border: none;
    background: var(--surface-2);
    color: var(--text-dim);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
}
.modal-close:hover { color: var(--text); }
.share-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.share-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}
.share-item:hover { border-color: var(--gold); background: var(--surface-3); }
.share-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    color: #fff;
}
.share-icon-fb { background: #1877f2; }
.share-icon-x { background: #000; }
.share-icon-reddit { background: #ff4500; font-size: 0.68rem; }
.share-icon-tumblr { background: #35465c; }
.share-icon-ig { background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af, #515bd4); }
.share-icon-link { background: var(--text-faint); }

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 12px);
    background: var(--surface-3);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 11px 20px;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 600;
    box-shadow: var(--shadow-panel);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 50;
}
.toast-visible { opacity: 1; transform: translate(-50%, 0); }
.watch-description-wrap { position: relative; margin: 16px 0 10px; }
.watch-description {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 18px 20px;
    font-size: 0.94rem;
    line-height: 1.7;
}
.watch-description a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }

.description-collapsed .watch-description {
    max-height: 220px;
    overflow: hidden;
}
.description-collapsed::after {
    content: "";
    position: absolute;
    left: 1px;
    right: 1px;
    bottom: 0;
    height: 70px;
    border-radius: 0 0 var(--radius) var(--radius);
    background: linear-gradient(to bottom, transparent, var(--surface));
    pointer-events: none;
}
.description-toggle {
    display: block;
    margin: 0 0 26px;
    padding: 8px 0;
    border: none;
    background: none;
    color: var(--gold);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.87rem;
    cursor: pointer;
}
.description-toggle:hover { text-decoration: underline; }

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 34px;
}
.tag-chip {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 5px 13px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    transition: color 0.15s ease, border-color 0.15s ease;
}
.tag-chip:hover { color: var(--gold); border-color: var(--gold); }

/* ---------- Forms (login/register/upload) ---------- */
.form-page {
    max-width: 480px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 32px 36px 40px;
    box-shadow: var(--shadow-panel);
}
.form-page h1 { font-size: 1.4rem; margin-bottom: 22px; }
.auth-form, .upload-form { display: flex; flex-direction: column; gap: 18px; }
.auth-form label, .upload-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 0.87rem;
    font-weight: 600;
    color: var(--text-dim);
}
.auth-form input, .upload-form input, .upload-form select, .upload-form textarea {
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 400;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.auth-form input:focus, .upload-form input:focus, .upload-form select:focus, .upload-form textarea:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--surface-3);
}
.form-error {
    background: var(--rose-soft);
    color: var(--rose);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 10px;
    border: 1px solid rgba(224, 99, 124, 0.25);
}
.search-heading { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; margin-bottom: 24px; }

/* ---------- Admin panel ---------- */
.admin-header { border-bottom-color: rgba(211, 162, 76, 0.18); }
.admin-main { min-height: calc(100vh - 64px); }
.admin-main.site-main:has(.form-page):not(:has(.admin-toolbar)) {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8vh;
}
.admin-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: var(--jade);
    color: #06231d;
    padding: 3px 10px;
    border-radius: 999px;
    margin-left: 6px;
    vertical-align: middle;
}
.admin-hint { color: var(--text-faint); font-size: 0.83rem; font-weight: 400; }
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.admin-toolbar h1 { font-size: 1.4rem; margin: 0; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.admin-table th, .admin-table td {
    padding: 13px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
    font-size: 0.88rem;
}
.admin-table th {
    background: var(--surface-2);
    color: var(--text-dim);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.admin-table tbody tr { transition: background 0.15s ease; }
.admin-table tbody tr:hover { background: var(--surface-2); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-thumb {
    width: 92px;
    height: 52px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    display: block;
    border: 1px solid var(--border-soft);
}
.admin-actions {
    display: flex;
    gap: 14px;
    align-items: center;
    white-space: nowrap;
}
.admin-actions a { color: var(--jade); font-weight: 600; font-size: 0.85rem; }
.admin-actions a:hover { text-decoration: underline; }
.admin-actions form { margin: 0; }
.link-danger {
    background: none;
    border: none;
    color: var(--rose);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0;
}
.link-danger:hover { text-decoration: underline; }
.status-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}
.status-published { background: var(--jade-soft); color: var(--jade); }
.status-hidden { background: rgba(139, 146, 164, 0.15); color: var(--text-dim); }

.form-page-wide { max-width: 640px; }
.inline-form {
    display: flex;
    gap: 10px;
    margin-bottom: 22px;
}
.inline-form input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
}
.inline-form input[type="text"]:focus { outline: none; border-color: var(--gold); }
.comment-cell { max-width: 320px; word-break: break-word; }

/* ---------- Rich-text description editor ---------- */
.rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 9px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.rte-toolbar button {
    padding: 6px 11px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.83rem;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.rte-toolbar button:hover { border-color: var(--gold); color: var(--gold); }
.rte-toolbar select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.83rem;
    max-width: 260px;
}
.rte-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 3px;
}
.rte-editor {
    min-height: 170px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.65;
}
.rte-editor:focus { outline: none; border-color: var(--gold); }
.rte-editor a { color: var(--gold); text-decoration: underline; }
.rte-hidden-field { display: none; }

/* ---------- Mode pickers: upload-vs-link (thumbnail, video source) ---------- */
.thumb-fieldset, .source-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.thumb-fieldset legend, .source-fieldset legend {
    padding: 0 8px;
    color: var(--text-dim);
    font-size: 0.83rem;
    font-weight: 700;
}
.mode-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin-bottom: 14px;
}
.upload-form label.radio-inline, .radio-inline {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.89rem;
    font-weight: 500;
    color: var(--text);
    flex-direction: row;
}
.radio-inline input[type="radio"] { accent-color: var(--gold); }

/* ---------- Category multi-select (checkboxes) ---------- */
.category-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.category-fieldset legend {
    padding: 0 8px;
    color: var(--text-dim);
    font-size: 0.83rem;
    font-weight: 700;
}
.category-checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
}
.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.89rem;
    font-weight: 500;
    color: var(--text);
}
.checkbox-inline input[type="checkbox"] { accent-color: var(--gold); width: 16px; height: 16px; }
.mode-toggle-panel { margin-top: 6px; }
.mode-toggle-panel input[type="url"], .mode-toggle-panel .source-url-input {
    width: 100%;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
}
.mode-toggle-panel input[type="url"]:focus { outline: none; border-color: var(--gold); }
.mode-toggle-panel .admin-hint {
    display: block;
    margin-top: 6px;
}
.source-fieldset { margin-top: 4px; }
.extra-servers-fieldset { margin-top: 4px; }
#extra-servers-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.extra-server-row {
    display: grid;
    grid-template-columns: 1fr 170px 2fr auto;
    gap: 8px;
    align-items: center;
}
.extra-server-row input, .extra-server-row select {
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-family: inherit;
    font-size: 0.87rem;
}
.extra-server-row input:focus, .extra-server-row select:focus { outline: none; border-color: var(--gold); }
.extra-server-row .remove-server-row {
    font-size: 1rem;
    padding: 7px 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
}
.extra-server-row .remove-server-row:hover { border-color: var(--rose); }
@media (max-width: 720px) {
    .extra-server-row { grid-template-columns: 1fr; }
}

/* ---------- Related videos & footer keywords ---------- */
.related-videos { margin-top: 40px; }
.related-videos h2 { font-size: 1.15rem; margin-bottom: 16px; }
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
    gap: 26px;
}
.footer-keywords-wrap {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 28px 22px;
}
.footer-keywords {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
}
.footer-keywords-label {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 4px;
}
.footer-keywords a {
    font-size: 0.78rem;
    color: var(--text-dim);
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    transition: color 0.15s ease, background 0.15s ease;
}
.footer-keywords a:hover { color: var(--gold); background: var(--surface-3); }

/* ---------- Footer ---------- */
.site-footer {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.83rem;
    padding: 26px;
    border-top: 1px solid var(--border-soft);
}
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--gold); }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
    .header-inner { flex-wrap: wrap; gap: 12px 20px; }
    .search-form { order: 3; width: 100%; max-width: none; }
    .site-main { padding: 24px 18px 48px; }
    .video-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
    .related-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
    .form-page { padding: 26px 22px 30px; }
    .watch-title { font-size: 1.3rem; }
    .toolbar-row { flex-direction: column; align-items: stretch; }
    .sort-toggle { align-self: flex-start; }
    .watch-toolbar { flex-direction: column; align-items: flex-start; }
    .footer-keywords-wrap { padding: 0 18px 20px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .video-card, .thumb-wrap img, .thumb-wrap::before, .thumb-wrap::after, .btn, .chip, .server-tab {
        transition: none;
    }
}

/* Visible keyboard focus */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
