:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #667085;
    --border: #dfe3ea;
    --accent: #4f46e5;
    --accent-text: #ffffff;
    --danger: #c0352b;
    --success-bg: #e7f6ec;
    --success-text: #1e6b3a;
    --error-bg: #fdecea;
    --error-text: #8c2a21;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12141a;
        --surface: #1c1f27;
        --text: #e6e8ee;
        --muted: #9aa3b5;
        --border: #2e3340;
        --accent: #818cf8;
        --accent-text: #12141a;
        --danger: #f07167;
        --success-bg: #183824;
        --success-text: #9be0b2;
        --error-bg: #3d1d1a;
        --error-text: #f5b4ad;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--accent); }

.site-header {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--text); }
.site-header nav form { display: contents; }
.link-button { padding: 0; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.link-button:hover { color: var(--text); }

main { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem; }

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.1rem; margin: 0; }
.muted { color: var(--muted); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.narrow { max-width: 440px; margin-inline: auto; }
.empty { text-align: center; }

.page-heading { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.page-heading h1 { margin: 0; }

.video-row { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; }
.video-meta { flex: 1; min-width: 0; }
.video-meta p { margin: 0.25rem 0 0.75rem; }
.video-meta h2 a { color: var(--text); text-decoration: none; }

.share-link { display: flex; gap: 0.5rem; }
.share-link input { flex: 1; min-width: 0; margin: 0; font-family: ui-monospace, monospace; font-size: 0.85rem; }

.badge { display: inline-block; margin-left: 0.25rem; padding: 0 0.5rem; border-radius: 999px; font-size: 0.8rem; background: var(--error-bg); color: var(--error-text); }
.badge-open { background: var(--success-bg); color: var(--success-text); }

label { display: block; font-weight: 600; margin: 0.75rem 0 0.25rem; }
label:has(input[type=checkbox]) { display: inline; font-weight: normal; }
input[type=text], input[type=email], input[type=password], input[type=file] {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}
.help-text, form .form-help { color: var(--muted); font-size: 0.85rem; margin-top: 0.25rem; }
form ul { list-style: none; padding: 0; margin: 0.25rem 0; color: var(--danger); font-size: 0.9rem; }

.button {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: var(--accent-text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.page-heading .button, .video-row .button, .share-link .button { margin-top: 0; }
.button-secondary { background: var(--border); color: var(--text); }
.button-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }

.flash { padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 1rem; }
.flash-success { background: var(--success-bg); color: var(--success-text); }
.flash-error { background: var(--error-bg); color: var(--error-text); }

.player video { width: 100%; max-height: 75vh; background: #000; border-radius: 10px; }

.table { width: 100%; border-collapse: separate; border-spacing: 0; padding: 0; }
.table th, .table td { text-align: left; padding: 0.65rem 1rem; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }

@media (max-width: 600px) {
    .video-row { flex-direction: column; }
    .share-link { flex-direction: column; }
}

.new-token { border-color: var(--accent); }
.new-token .share-link { margin-top: 0.75rem; }
.table .button { margin-top: 0; }
code { font-family: ui-monospace, monospace; font-size: 0.9em; }
