:root {
    --bg: #050816;
    --bg-soft: #0b1224;
    --text: #eef2ff;
    --muted: #a8b3cf;
    --line: rgba(255, 255, 255, 0.12);
    --glass: rgba(255, 255, 255, 0.08);
    --glass-strong: rgba(255, 255, 255, 0.14);
    --primary: #8b5cf6;
    --primary-2: #22d3ee;
    --danger: #fb7185;
    --success: #22c55e;
    --shadow: 0 20px 60px rgba(2, 8, 23, 0.45);
    --radius: 24px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(139, 92, 246, 0.2), transparent 35%),
        radial-gradient(circle at right 20%, rgba(34, 211, 238, 0.16), transparent 28%),
        linear-gradient(180deg, #08101f 0%, #030712 100%);
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.container {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
}

.stack-lg > * + * { margin-top: 24px; }
.stack-sm > * + * { margin-top: 10px; }
.full-width { width: 100%; }

.aurora {
    position: fixed;
    inset: auto;
    border-radius: 999px;
    filter: blur(65px);
    pointer-events: none;
    opacity: 0.6;
    z-index: 0;
}
.aurora-a {
    width: 260px;
    height: 260px;
    top: 80px;
    left: -70px;
    background: rgba(139, 92, 246, 0.36);
}
.aurora-b {
    width: 320px;
    height: 320px;
    right: -90px;
    bottom: 80px;
    background: rgba(34, 211, 238, 0.22);
}

.site-header,
main,
.auth-wrap { position: relative; z-index: 1; }

.site-header {
    padding: 36px 0 16px;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: flex-start;
}
.hero-text { max-width: 680px; }
.top-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}
.wrap-actions { flex-wrap: wrap; justify-content: flex-end; }

.brand-badge,
.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
    color: #e9ddff;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.pill-success { color: #dcfce7; background: rgba(34, 197, 94, 0.16); }
.pill-muted { color: #dbeafe; background: rgba(148, 163, 184, 0.16); }

h1, h2, h3 { margin: 0 0 10px; line-height: 1.08; }
h1 { font-size: clamp(2rem, 4vw, 3.35rem); }
h2 { font-size: clamp(1.35rem, 2vw, 1.85rem); }
h3 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small-muted { color: var(--muted); font-size: 0.92rem; }

.glass-card,
.glass-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius);
}
.glass-card { padding: 22px; }
.glass-panel { padding: 18px; }
.intro-card { overflow: hidden; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.stat-grid article {
    padding: 18px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255,255,255,0.08);
}
.stat-grid strong {
    display: block;
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.grid-catalog {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}
.drama-card {
    padding: 0;
    overflow: hidden;
}
.cover-frame {
    display: block;
    aspect-ratio: 2 / 3;
    overflow: hidden;
}
.cover-frame img,
.sidebar-cover,
.thumb-mini {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cover-frame img { transition: transform 0.35s ease; }
.drama-card:hover .cover-frame img { transform: scale(1.04); }
.card-content { padding: 18px; }
.card-footer {
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}
.clamp-3,
.clamp-2 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.clamp-3 { -webkit-line-clamp: 3; }
.clamp-2 { -webkit-line-clamp: 2; }

.player-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) 360px;
    gap: 20px;
}
.player-card { padding: 18px; }
.video-shell {
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(2, 6, 23, 0.75);
}
.video-player {
    width: 100%;
    display: block;
    background: #000;
    max-height: 72vh;
}
.player-meta {
    padding-top: 18px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-end;
}
.meta-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.sidebar-card { height: fit-content; }
.sidebar-cover {
    aspect-ratio: 2 / 3;
    border-radius: 20px;
    margin-bottom: 16px;
}

.form-card { max-width: 960px; }
.form-grid {
    display: grid;
    gap: 18px;
}
.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
label { display: grid; gap: 10px; }
label > span {
    font-size: 0.95rem;
    color: #f8fafc;
}
input[type="text"],
input[type="password"],
input[type="file"],
textarea {
    width: 100%;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.08);
    color: var(--text);
    padding: 14px 16px;
    outline: none;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
textarea { resize: vertical; min-height: 140px; }
input:focus, textarea:focus {
    border-color: rgba(139, 92, 246, 0.65);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18);
}
input[type="file"]::file-selector-button {
    border: 0;
    border-radius: 12px;
    padding: 10px 14px;
    margin-right: 12px;
    color: white;
    background: linear-gradient(135deg, rgba(139,92,246,0.85), rgba(34,211,238,0.85));
}
.switch-wrap,
.checkbox-panel {
    display: flex;
    align-items: center;
    gap: 12px;
}
.checkbox-panel { min-height: 100%; }
.cover-preview {
    min-height: 280px;
    border-radius: 24px;
    border: 1px dashed rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    background-position: center;
    background-size: cover;
    background-color: rgba(255,255,255,0.03);
}
.cover-preview.has-image span {
    background: rgba(2, 6, 23, 0.58);
    padding: 8px 12px;
    border-radius: 999px;
    backdrop-filter: blur(10px);
}
.split-panels {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 16px;
}

.btn {
    min-height: 46px;
    padding: 0 18px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.08);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.btn:hover { transform: translateY(-1px); background: rgba(255,255,255,0.12); }
.btn-primary {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.94), rgba(34, 211, 238, 0.88));
    border-color: rgba(255,255,255,0.18);
}
.btn-ghost { background: rgba(255,255,255,0.05); }
.btn-danger {
    background: linear-gradient(135deg, rgba(251, 113, 133, 0.95), rgba(244, 63, 94, 0.85));
}
.btn-small {
    min-height: 38px;
    padding: 0 14px;
    border-radius: 12px;
    font-size: 0.92rem;
}

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.08);
}
.alert.success { background: rgba(34, 197, 94, 0.14); }
.alert.error { background: rgba(251, 113, 133, 0.14); }

.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}
.auth-card {
    width: min(560px, 100%);
}

.empty-state {
    text-align: center;
    padding: 32px;
}
.form-actions {
    display: flex;
    gap: 12px;
}

.table-card { padding: 10px; }
.table-wrap { overflow: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}
.admin-table th,
.admin-table td {
    padding: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    vertical-align: top;
}
.admin-table th {
    text-align: left;
    color: #dbeafe;
    font-size: 0.92rem;
    font-weight: 600;
}
.thumb-mini {
    width: 76px;
    height: 110px;
    border-radius: 14px;
}
.action-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.action-group form { margin: 0; }

@media (max-width: 1040px) {
    .grid-catalog { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .player-layout { grid-template-columns: 1fr; }
    .player-meta { flex-direction: column; align-items: flex-start; }
    .split-panels { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    .container { width: min(100% - 20px, 1200px); }
    .site-header { flex-direction: column; }
    .top-actions, .wrap-actions { width: 100%; justify-content: flex-start; }
    .grid-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-grid,
    .two-columns { grid-template-columns: 1fr; }
    .glass-card { padding: 18px; }
}

@media (max-width: 520px) {
    .grid-catalog { grid-template-columns: 1fr; }
    .card-footer { flex-direction: column; align-items: stretch; }
    .btn, .btn-small { width: 100%; }
    .action-group { flex-direction: column; }
}
