:root {
  color-scheme: dark;
  --ink: #070304;
  --panel: #130508;
  --raised: #22080b;
  --projector: #e50914;
  --amber: #ff5a36;
  --signal: #52d39c;
  --text: #fffafa;
  --muted: #b88c95;
  --stroke: rgba(255, 255, 255, 0.09);
  --subtle: rgba(255, 255, 255, 0.06);
  --danger: #ff4f61;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next", system-ui, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --ink: #fff6f6;
  --panel: #ffffff;
  --raised: #f6e5e5;
  --text: #29060b;
  --muted: #6e4149;
  --stroke: rgba(41, 6, 11, 0.12);
  --subtle: rgba(41, 6, 11, 0.06);
  --shadow: 0 28px 80px rgba(67, 13, 21, 0.14);
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body {
  background:
    radial-gradient(circle at 88% 3%, rgba(229, 9, 20, 0.13), transparent 31rem),
    linear-gradient(180deg, var(--ink), color-mix(in srgb, var(--panel) 42%, var(--ink)));
  color: var(--text);
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, video:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--signal) 72%, white);
  outline-offset: 3px;
}

.shell { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 24px 18px;
  border-right: 1px solid var(--stroke); background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: blur(24px); display: flex; flex-direction: column; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; margin: 2px 5px 34px; }
.brand img { width: 52px; height: 52px; border-radius: 16px; object-fit: cover; border: 1px solid rgba(229,9,20,.28); }
.brand strong { display: block; font-size: 16px; letter-spacing: .05em; }
.brand span { color: var(--muted); font-size: 12px; }
.nav { display: grid; gap: 8px; }
.nav-button, .profile-button {
  border: 1px solid transparent; background: transparent; border-radius: 16px; cursor: pointer;
  display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px; color: var(--muted);
}
.nav-button svg { width: 20px; height: 20px; }
.nav-button:hover { color: var(--text); background: var(--subtle); }
.nav-button.active { color: var(--text); background: rgba(229,9,20,.09); border-color: rgba(229,9,20,.65); }
.nav-button.active svg { color: var(--projector); }
.sidebar-foot { margin-top: auto; display: grid; gap: 12px; }
.connection { display:flex; align-items:center; gap:8px; color:var(--muted); font-size:12px; padding:0 12px; }
.dot { width:8px; height:8px; border-radius:50%; background:var(--amber); box-shadow:0 0 12px currentColor; }
.dot.online { background: var(--signal); }
.profile-button { background: var(--panel); border-color: var(--stroke); color: var(--text); }
.avatar { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; background: var(--profile, var(--projector)); flex: 0 0 auto; }
.avatar.color { display: grid; place-items: center; color: #130508; font-weight: 800; }
.profile-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-button svg { margin-left: auto; width: 16px; }

.content { min-width: 0; padding: 40px clamp(24px, 4vw, 64px) 80px; }
.page { max-width: 1100px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 24px; }
.eyebrow { color: var(--projector); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 8px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(32px, 4vw, 52px); line-height: .98; letter-spacing: -.04em; margin-bottom: 10px; max-width: 16ch; }
h2 { font-size: 23px; letter-spacing: -.02em; }
h3 { font-size: 16px; }
.lede { color: var(--muted); max-width: 650px; line-height: 1.55; margin-bottom: 0; }
.panel { padding: 22px; border-radius: 22px; background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--stroke); }
.hero-panel { padding: clamp(22px, 4vw, 34px); border-radius: 28px; background: linear-gradient(135deg, var(--raised), color-mix(in srgb, var(--panel) 94%, transparent)); border: 1px solid rgba(229,9,20,.16); overflow: hidden; position: relative; }
.hero-panel::after { content:""; position:absolute; width:300px; height:300px; border-radius:50%; background:rgba(229,9,20,.08); filter:blur(28px); right:-130px; top:-170px; pointer-events:none; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 12px; background: color-mix(in srgb, var(--ink) 72%, transparent); border: 1px solid var(--stroke); border-radius: 17px; min-height: 58px; padding: 0 17px; flex: 1; min-width: 260px; }
.search-box:focus-within { border-color: var(--projector); }
.search-box svg { color: var(--projector); width: 20px; }
.search-box input { border: 0; outline: 0; background: transparent; color: var(--text); font-size: 18px; width: 100%; }
.search-box input::placeholder { color: var(--muted); }
.button { border: 1px solid var(--stroke); border-radius: 14px; min-height: 44px; padding: 0 16px; background: var(--subtle); cursor: pointer; font-weight: 700; display:inline-flex; align-items:center; justify-content:center; gap:8px; text-decoration:none; }
.button:hover { filter: brightness(1.1); }
.button.primary { background: var(--signal); color: #07120e; border-color: transparent; }
.button.red { background: var(--projector); color: white; border-color: transparent; }
.button.amber { background: var(--amber); color: #180503; border-color: transparent; }
.button.danger { color: var(--danger); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.icon-button { width: 46px; padding: 0; }
.button svg, .icon-button svg { width: 18px; height: 18px; }
.filters, .segments { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.filters select, .segments button { min-height: 38px; border:1px solid var(--stroke); border-radius:999px; color:var(--text); background:var(--subtle); padding:0 13px; font-weight:650; cursor:pointer; }
.segments button.active { background:var(--signal); color:#07120e; border-color:transparent; }
.list { display: grid; gap: 14px; margin-top: 20px; }
.result, .transfer { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:16px; align-items:center; }
.rank { color:var(--projector); width:32px; font:700 14px ui-monospace, monospace; }
.title { font-weight:750; line-height:1.35; overflow-wrap:anywhere; }
.meta { display:flex; gap:15px; flex-wrap:wrap; color:var(--muted); font:600 12px ui-monospace, monospace; margin-top:9px; }
.meta .good { color:var(--signal); }
.status-icon { width:48px; height:48px; display:grid; place-items:center; border-radius:14px; color:var(--amber); background:color-mix(in srgb, var(--amber) 13%, transparent); }
.status-icon.complete { color:var(--signal); background:color-mix(in srgb, var(--signal) 13%, transparent); }
.status-icon svg { width:22px; height:22px; }
.rail { height:8px; margin-top:17px; border-radius:999px; background:var(--stroke); overflow:hidden; }
.rail span { display:block; height:100%; width:var(--progress); background:var(--amber); border-radius:inherit; }
.rail.complete span { background:var(--signal); }
.transfer-main { min-width:0; }
.transfer-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:15px; }
.added-by { display:flex; align-items:center; gap:7px; color:var(--muted); font-size:12px; margin-top:9px; }
.added-by .avatar { width:22px; height:22px; border-radius:7px; }
.empty { min-height:280px; display:grid; place-items:center; text-align:center; color:var(--muted); padding:30px; }
.empty svg { width:45px; height:45px; color:var(--projector); margin-bottom:13px; }
.empty h2 { color:var(--text); margin-bottom:8px; }
.section-label { display:flex; justify-content:space-between; color:var(--muted); font:800 12px ui-monospace,monospace; letter-spacing:.1em; margin:28px 4px 10px; }
.section-label.amber { color:var(--amber); } .section-label.green { color:var(--signal); }
.grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:14px; }
.metric-value { font:700 18px ui-monospace,monospace; margin:8px 0 3px; }
.metric-label { color:var(--muted); font-size:12px; }
.profile-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(104px, 126px)); justify-content:center; gap:18px; width:min(700px,100%); margin:32px auto 0; }
.profile-card { border:0; background:transparent; cursor:pointer; color:var(--text); padding:8px; border-radius:20px; }
.profile-card .avatar { width:100%; max-width:110px; aspect-ratio:1; height:auto; margin:auto; border-radius:20px; box-shadow:var(--shadow); }
.profile-card strong { display:block; font-size:15px; margin-top:10px; }
.profile-card:hover .avatar { transform:translateY(-3px); }
.profile-card .avatar { transition:transform .18s ease; }
.center-screen { min-height:100vh; display:grid; place-items:center; padding:30px; }
.login { width:min(430px,100%); }
.language-picker { display:flex; align-items:center; justify-content:flex-end; gap:8px; color:var(--muted); font-size:12px; margin-bottom:16px; }
.language-picker select { min-height:32px; border:1px solid var(--stroke); border-radius:999px; padding:0 10px; background:var(--subtle); color:var(--text); }
.login-brand { text-align:center; margin-bottom:26px; }
.login-brand img { width:86px; height:86px; border-radius:25px; box-shadow:0 0 70px rgba(229,9,20,.22); }
.field { display:grid; gap:7px; margin-bottom:14px; }
.field label { color:var(--muted); font-size:12px; font-weight:700; }
.field input, .field select { width:100%; height:50px; border-radius:13px; border:1px solid var(--stroke); padding:0 14px; background:color-mix(in srgb,var(--ink) 65%,transparent); color:var(--text); }
.error { color:var(--danger); background:rgba(255,79,97,.09); border:1px solid rgba(255,79,97,.22); border-radius:13px; padding:12px; font-size:13px; margin-bottom:14px; }
.modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.72); backdrop-filter:blur(12px); z-index:20; display:grid; place-items:center; padding:24px; }
.modal { width:min(680px,100%); max-height:min(820px,92vh); overflow:auto; background:var(--panel); border:1px solid var(--stroke); border-radius:25px; box-shadow:var(--shadow); padding:24px; }
.modal-head { display:flex; justify-content:space-between; gap:20px; align-items:flex-start; margin-bottom:20px; }
.modal-head h2 { margin-bottom:5px; overflow-wrap:anywhere; }
.modal-head p { color:var(--muted); margin:0; }
.profile-options { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin:14px 0; }
.profile-option { border:2px solid transparent; padding:0; background:transparent; border-radius:16px; cursor:pointer; }
.profile-option.selected { border-color:var(--signal); }
.profile-option img, .profile-option span { width:100%; aspect-ratio:1; border-radius:13px; display:grid; place-items:center; }
.color-options { display:flex; gap:10px; flex-wrap:wrap; margin:14px 0 20px; }
.color-swatch { width:38px; height:38px; border-radius:50%; border:3px solid transparent; background:var(--swatch); cursor:pointer; }
.color-swatch.selected { border-color:var(--text); box-shadow:0 0 0 2px var(--ink); }
.file-row { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:14px; align-items:center; padding:15px 0; border-bottom:1px solid var(--stroke); }
.file-row:last-child { border:0; }
.video-overlay { position:fixed; inset:0; z-index:50; background:#000; display:grid; place-items:center; }
.video-overlay video { width:100%; height:100%; object-fit:contain; }
.video-overlay video::cue { color:#fff; background:rgba(0,0,0,.78); font-size:clamp(16px,2.2vw,30px); line-height:1.35; }
.subtitle-display { position:absolute; left:8%; right:8%; bottom:var(--subtitle-bottom,145px); z-index:2; color:#fff; font-size:var(--subtitle-font-size,30px); font-weight:650; line-height:1.35; text-align:center; white-space:pre-line; text-shadow:0 2px 4px #000,0 0 10px #000; pointer-events:none; }
.video-top { position:absolute; left:0; right:0; top:0; padding:22px; display:flex; align-items:center; gap:15px; background:linear-gradient(#000d,transparent); z-index:2; }
.video-top .button { background:#0008; color:white; }
.video-top strong { color:white; text-shadow:0 2px 8px #000; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.player-center { position:absolute; inset:0; display:grid; place-items:center; pointer-events:none; z-index:2; }
.player-center button { width:76px; height:76px; border:0; border-radius:50%; background:rgba(0,0,0,.58); color:white; cursor:pointer; pointer-events:auto; backdrop-filter:blur(12px); }
.player-center button svg { width:30px; height:30px; }
.video-tools { position:absolute; left:18px; right:18px; bottom:18px; z-index:3; padding:16px; border:1px solid rgba(255,255,255,.14); border-radius:20px; background:linear-gradient(180deg,rgba(16,7,9,.78),rgba(5,2,3,.94)); backdrop-filter:blur(20px); color:white; box-shadow:0 20px 60px #0008; }
.player-timeline { display:grid; grid-template-columns:auto minmax(100px,1fr) auto; align-items:center; gap:12px; font:650 12px ui-monospace,monospace; color:#d6c8ca; }
.player-timeline input { width:100%; accent-color:var(--projector); cursor:pointer; }
.player-row { display:flex; align-items:center; gap:8px; margin-top:11px; }
.player-row .spacer { flex:1; }
.video-tools .button { min-height:40px; border-color:rgba(255,255,255,.14); background:rgba(255,255,255,.08); color:white; }
.video-tools select { height:40px; max-width:205px; border:1px solid rgba(255,255,255,.14); border-radius:12px; padding:0 30px 0 11px; background:#171112; color:white; }
.video-tools select:disabled { opacity:.48; }
.subtitle-control { display:flex; align-items:center; gap:6px; }
.subtitle-settings { position:relative; }
.subtitle-settings summary { min-width:44px; height:40px; display:grid; place-items:center; padding:0 10px; cursor:pointer; list-style:none; font-weight:800; }
.subtitle-settings summary::-webkit-details-marker { display:none; }
.subtitle-settings[open] summary { border-color:var(--projector); background:rgba(255,107,103,.18); }
.subtitle-settings-panel { position:absolute; right:0; bottom:52px; width:min(310px,calc(100vw - 36px)); display:grid; gap:15px; padding:18px; border:1px solid rgba(255,255,255,.16); border-radius:18px; background:#171112; color:white; box-shadow:0 22px 60px #000b; }
.subtitle-settings-panel label { display:grid; gap:7px; }
.subtitle-settings-panel label span { display:flex; justify-content:space-between; gap:16px; font-size:13px; font-weight:700; }
.subtitle-settings-panel output { color:#d8c9cb; font:650 12px ui-monospace,monospace; }
.subtitle-settings-panel input { width:100%; accent-color:var(--projector); }
.subtitle-settings-panel small { color:#b9aaad; line-height:1.4; }
.subtitle-settings-panel .button { justify-self:start; }
.volume { display:flex; align-items:center; gap:7px; padding:0 8px; }
.volume input { width:80px; accent-color:white; }
.toast-region { position:fixed; right:22px; bottom:22px; z-index:80; display:grid; gap:9px; }
.toast { max-width:380px; padding:13px 16px; border:1px solid var(--stroke); border-radius:14px; background:var(--panel); box-shadow:var(--shadow); }
.toast.error-toast { border-color:rgba(255,79,97,.35); }
.spinner { width:18px; height:18px; border:2px solid currentColor; border-right-color:transparent; border-radius:50%; animation:spin .7s linear infinite; }
.hide { display:none !important; }
.mobile-bar { display:none; }
@keyframes spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important; transition:none!important; animation-duration:.001ms!important; } }
@media (max-width:800px) {
  .shell { display:block; }
  .sidebar { position:static; height:auto; padding:16px; border-right:0; border-bottom:1px solid var(--stroke); }
  .brand { margin:0; }
  .sidebar .nav, .sidebar-foot .connection { display:none; }
  .sidebar-foot { position:absolute; right:16px; top:18px; margin:0; }
  .profile-button { padding:8px; }
  .profile-button span, .profile-button svg { display:none; }
  .content { padding:28px 16px 100px; }
  .mobile-bar { display:flex; position:fixed; left:12px; right:12px; bottom:12px; z-index:10; justify-content:space-around; padding:8px; border:1px solid var(--stroke); border-radius:20px; background:color-mix(in srgb,var(--panel) 90%,transparent); backdrop-filter:blur(20px); }
  .mobile-bar .nav-button { padding:10px; }
  .mobile-bar .nav-button span { display:none; }
  .result, .transfer { grid-template-columns:auto minmax(0,1fr); }
  .result > .button, .transfer > .button { grid-column:2; justify-self:start; }
  .page-head { display:block; }
  .profile-grid { grid-template-columns:repeat(auto-fit, minmax(94px, 112px)); }
  .video-tools { left:8px; right:8px; bottom:8px; padding:11px; }
  .player-row { overflow-x:auto; }
  .video-tools select { max-width:145px; flex:0 0 auto; }
  .volume { display:none; }
  .subtitle-display { left:4%; right:4%; }
  .subtitle-settings-panel { position:fixed; left:12px; right:12px; bottom:82px; width:auto; }
}
@media (max-width:480px) { .profile-options { grid-template-columns:repeat(2,1fr); } h1 { font-size:36px; } }
