:root {
    --bg: #f7f8fc;
    --surface: #fff;
    --text: #18212f;
    --muted: #687385;
    --primary: #ff4e63;
    --primary-dark: #df3049;
    --line: #e5e9f0;
    font-family: Inter, ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
.container { width: min(1160px, calc(100% - 32px)); margin: 0 auto; min-height: calc(100vh - 150px); }

.site-header {
    height: 72px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 max(16px, calc((100vw - 1160px) / 2)); background: var(--surface);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.site-header nav { display: flex; gap: 20px; align-items: center; }
.site-header a { text-decoration: none; font-weight: 650; }
.brand { font-size: 20px; }
.brand span { color: var(--primary); }
.inline-form { display: inline; }
.link-button { border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; padding: 0; }

.hero { padding: 72px 0 48px; display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, .55fr); gap: 48px; align-items: center; }
.hero h1 { margin: 8px 0 18px; font-size: clamp(38px, 6vw, 68px); line-height: 1.02; letter-spacing: -.045em; }
.hero h1 span { color: #7667f5; }
.hero-content > p:not(.eyebrow) { color: var(--muted); font-size: 19px; line-height: 1.6; max-width: 680px; }
.hero-button { margin-top: 12px; gap: 24px; padding: 14px 20px; }
.hero-visual { position: relative; min-height: 310px; display: grid; place-items: center; }
.hero-play {
    position: relative; z-index: 2; display: grid; place-items: center; width: 150px; height: 150px;
    padding-left: 8px; border-radius: 42% 58% 55% 45%; color: white; font-size: 48px;
    background: linear-gradient(145deg, #ff526b, #ff8b64); box-shadow: 0 28px 60px rgba(255, 78, 99, .3);
    transform: rotate(-6deg);
}
.hero-orbit { position: absolute; display: grid; place-items: center; border-radius: 50%; font-weight: 900; }
.orbit-one { width: 58px; height: 58px; right: 8%; top: 8%; color: #725ff2; background: #e8e4ff; transform: rotate(15deg); }
.orbit-two { width: 38px; height: 38px; left: 8%; bottom: 14%; color: #29a472; background: #dff8ec; }
.eyebrow { margin: 0; color: var(--primary-dark); font-size: 13px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h2 { font-size: 26px; }

.trust-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; margin-bottom: 64px; border: 1px solid var(--line); border-radius: 18px; background: var(--line); }
.trust-strip > div { display: grid; grid-template-columns: 42px 1fr; column-gap: 12px; padding: 22px; background: var(--surface); }
.trust-strip span { grid-row: 1 / 3; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #7667f5; background: #eeebff; font-size: 20px; font-weight: 900; }
.trust-strip strong { align-self: end; }
.trust-strip small { color: var(--muted); margin-top: 3px; }
.catalog-section { padding-bottom: 36px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.section-heading h2 { margin: 5px 0 0; font-size: 34px; }
.search-box { position: relative; display: block; width: min(300px, 100%); }
.search-box span { position: absolute; left: 14px; top: 9px; color: var(--muted); font-size: 22px; }
.search-box input { padding-left: 42px; border-radius: 999px; }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; padding-bottom: 60px; }
.video-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.video-card:hover { transform: translateY(-3px); box-shadow: 0 14px 40px rgba(31, 44, 68, .11); }
.video-preview { position: relative; aspect-ratio: 16/9; display: grid; place-items: center; overflow: hidden; background: linear-gradient(135deg, #7667f5, #51c8d3); color: white; font-size: 34px; }
.video-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.video-card:hover .video-preview img { transform: scale(1.035); }
.card-play { position: relative; z-index: 1; display: grid; place-items: center; width: 54px; height: 54px; padding-left: 4px; border-radius: 50%; background: rgba(12, 16, 25, .72); font-size: 20px; backdrop-filter: blur(6px); }
.duration { position: absolute; right: 10px; bottom: 10px; z-index: 1; padding: 4px 7px; border-radius: 6px; background: rgba(12, 16, 25, .8); font-size: 12px; font-weight: 750; }
.video-card:nth-child(3n+2) .video-preview { background: linear-gradient(135deg, #ff7082, #ffb261); }
.video-card:nth-child(3n+3) .video-preview { background: linear-gradient(135deg, #58c98c, #64b7e9); }
.video-card-body { padding: 18px; }
.video-series-label { display: block; margin-bottom: 7px; color: #7667f5; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.video-card h3 { margin: 0 0 8px; font-size: 18px; }
.video-card p, .muted { margin: 0; color: var(--muted); line-height: 1.5; }

.back-link { display: inline-block; margin: 28px 0 16px; color: var(--muted); text-decoration: none; }
.player-shell { position: relative; background: #080b11; border-radius: 18px; overflow: hidden; }
.player-shell video { display: block; width: 100%; max-height: 72vh; aspect-ratio: 16/9; }
.player-error { position: absolute; inset: 0; display: grid; place-items: center; color: white; background: #151923; }
.player-error[hidden] { display: none !important; }
.watch-page { max-width: 1000px; margin: auto; }
.watch-page h1 { font-size: 32px; margin-bottom: 8px; }
.description { color: var(--muted); line-height: 1.7; white-space: normal; }

.auth-card, .panel, .empty-state { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; }
.auth-card { max-width: 440px; margin: 72px auto; }
.auth-card h1, .panel h2 { margin-top: 0; }
label { display: grid; gap: 8px; font-weight: 700; }
input, textarea, select {
    width: 100%; padding: 12px 14px; border: 1px solid #cbd2dc; border-radius: 10px;
    background: white; color: var(--text); font: inherit;
}
input[type="color"] {
    box-sizing: border-box;
    width: 100%;
    min-height: 48px;
    padding: 6px;
    border: 1px solid #cbd2dc;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 7px;
}
input[type="color"]::-moz-color-swatch {
    border: 0;
    border-radius: 7px;
}
.color-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 108px;
    gap: 10px;
    align-items: center;
}
.color-field input[type="text"] {
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
    text-transform: lowercase;
}
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(118, 103, 245, .18); border-color: #7667f5; }
form { display: grid; gap: 18px; }
.button {
    display: inline-flex; justify-content: center; align-items: center; width: fit-content;
    border: 0; border-radius: 10px; padding: 11px 18px; background: var(--primary);
    color: white; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--primary-dark); }
.button-secondary { background: #edf0f5; color: var(--text); }
.button-secondary:hover { background: #dde2ea; }
.button-danger { background: #fff0f2; color: #b4233a; }
.button-danger:hover { background: #ffe0e5; color: #92182c; }

.admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 44px 0 22px; }
.admin-heading h1 { margin: 6px 0 0; font-size: 40px; }
.admin-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 24px; align-items: start; padding-bottom: 48px; }
.admin-main { min-width: 0; }
.admin-sidebar { position: sticky; top: 92px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.sidebar-title { margin: 0 0 12px; font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.admin-nav { display: grid; gap: 6px; }
.admin-nav a { display: flex; gap: 11px; align-items: center; padding: 11px; border-radius: 11px; text-decoration: none; }
.admin-nav a:hover, .admin-nav a.is-active { color: #5f50d6; background: #f0edff; }
.admin-nav > a > span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: rgba(118,103,245,.1); font-size: 15px; }
.admin-nav strong, .admin-nav small { display: block; }
.admin-nav strong { font-size: 14px; }
.admin-nav small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.sidebar-summary { display: grid; grid-template-columns: 1fr auto; gap: 9px 12px; margin: 20px 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; }
.sidebar-summary span { color: var(--muted); }
.sidebar-summary strong { max-width: 130px; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-summary i { width: 20px; height: 20px; border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.sidebar-site-link { display: block; padding: 10px; border-radius: 10px; background: #f5f6f9; text-align: center; text-decoration: none; font-size: 13px; font-weight: 750; }
.text-success { color: #147245; }
.text-danger { color: #b4233a; }
.panel { margin-bottom: 24px; }
.panel-title { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-title h2 { margin-bottom: 4px; }
.live-indicator { display: inline-flex; align-items: center; gap: 7px; color: #147245; font-size: 13px; font-weight: 750; }
.live-indicator i { width: 8px; height: 8px; border-radius: 50%; background: #2db879; box-shadow: 0 0 0 4px #def6e9; }
.upload-form { max-width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid-3 { grid-template-columns: 2fr 1fr 1fr; }
.admin-list { display: grid; gap: 12px; }
.admin-video { display: flex; justify-content: space-between; gap: 20px; padding: 18px 0; border-top: 1px solid var(--line); }
.admin-video-main { min-width: 0; flex: 1; }
.admin-video h3 { margin: 0 0 5px; }
.admin-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; flex-shrink: 0; max-width: 270px; }
.admin-actions form { gap: 0; }
.admin-video-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.admin-video-title-row h3 { margin-right: 4px; }
.quality-chip { padding: 3px 7px; border-radius: 999px; color: #31588e; background: #e5efff; font-size: 10px; font-weight: 850; }
.episode-meta { margin: 5px 0; color: #6958d4; font-size: 12px; font-weight: 750; }
.status { border-radius: 999px; padding: 6px 10px; font-size: 13px; font-weight: 750; }
.status-ready { color: #147245; background: #def6e9; }
.status-queued { color: #71570a; background: #fff0bd; }
.status-processing { color: #2459a4; background: #deebff; }
.status-failed { color: #a12638; background: #ffe1e5; }
.conversion-info { max-width: 560px; margin-top: 14px; }
.progress-track { width: 100%; height: 7px; overflow: hidden; border-radius: 999px; background: #e8ebf1; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #7667f5, #ff526b); transition: width .35s ease; }
.progress-text { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.worker-hint { margin-bottom: 16px; padding: 13px 16px; border: 1px solid #cbdcff; border-radius: 10px; color: #31588e; background: #eef5ff; line-height: 1.5; }
.worker-hint code { padding: 2px 5px; border-radius: 4px; background: #dfeaff; }
.live-indicator.is-offline { color: #a12638; }
.live-indicator.is-offline i { background: #e1586d; box-shadow: 0 0 0 4px #ffe1e5; }
.settings-panel { min-height: 420px; }
.settings-form { max-width: 680px; margin-top: 26px; }
.settings-preview { display: grid; grid-template-columns: minmax(250px, 1fr) 1fr; gap: 24px; align-items: center; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.mini-player { --mini-accent: #ff4e63; position: relative; display: grid; place-items: center; aspect-ratio: 16/9; overflow: hidden; border-radius: 14px; color: white; background: #0a0a0a; }
.mini-play { display: grid; place-items: center; width: 50px; height: 50px; padding-left: 3px; border-radius: 50%; background: var(--mini-accent); }
.mini-timeline { position: absolute; right: 10px; bottom: 34px; left: 10px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.3); }
.mini-timeline span { display: block; width: 42%; height: 100%; border-radius: inherit; background: var(--mini-accent); }
.mini-controls { position: absolute; right: 0; bottom: 0; left: 0; display: flex; justify-content: space-between; padding: 8px 10px; background: #000; font-size: 11px; }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.toggle-row input { width: 20px; height: 20px; }
.toggle-row span, .toggle-row strong, .toggle-row small { display: block; }
.toggle-row small { margin-top: 3px; color: var(--muted); font-weight: 400; }
.player-feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.storage-info { margin-bottom: 16px; padding: 14px 16px; border: 1px solid #cbdcff; border-radius: 11px; color: #31588e; background: #eef5ff; line-height: 1.55; font-size: 13px; }
.storage-info code, .field-help code { padding: 2px 5px; border-radius: 4px; background: rgba(49,88,142,.09); }
.field-help { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.5; }
.storage-driver-badge { padding: 6px 10px; border-radius: 999px; color: #5f50d6; background: #f0edff; font-size: 11px; font-weight: 850; }
[data-storage-fields][hidden] { display: none; }
.error-details { margin-top: 10px; color: #a12638; }
.error-details pre { max-width: 680px; overflow: auto; white-space: pre-wrap; font-size: 12px; }
.flash { margin-top: 18px; padding: 13px 16px; border-radius: 10px; }
.flash-success { color: #147245; background: #def6e9; }
.flash-error { color: #a12638; background: #ffe1e5; }
.empty-state { margin: 60px auto; max-width: 620px; text-align: center; }
.public-empty { padding: 48px 28px; }
.empty-illustration { display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto 18px; padding-left: 4px; border-radius: 24px; color: white; background: linear-gradient(145deg, #7667f5, #51c8d3); font-size: 26px; transform: rotate(-4deg); }
.public-empty p { color: var(--muted); line-height: 1.6; }
.public-empty .button { margin: 20px auto 0; }
.search-empty { padding: 38px; color: var(--muted); text-align: center; }
footer { padding: 28px; color: var(--muted); text-align: center; }

@media (max-width: 680px) {
    .site-header { height: 62px; }
    .site-header nav > a { display: none; }
    .hero { grid-template-columns: 1fr; padding-top: 48px; }
    .hero-visual { display: none; }
    .trust-strip { grid-template-columns: 1fr; }
    .section-heading, .admin-heading { align-items: stretch; flex-direction: column; }
    .search-box { width: 100%; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; grid-row: 1; }
    .form-grid, .form-grid-3, .settings-preview, .player-feature-grid { grid-template-columns: 1fr; }
    .admin-video { display: grid; }
    .admin-actions { justify-content: space-between; }
    .panel { padding: 20px; }
}
