/* Kuro — dark cinema UI */
:root {
  --bg: #030406;
  --bg-soft: #080a0f;
  --panel: #0d1017;
  --panel-2: #131720;
  --line: #212734;
  --line-soft: #1a1f29;
  --text: #e8ecf4;
  --muted: #8b93a7;
  --accent: #6f9cff;
  --accent-2: #57e0c4;
  --ok: #4bd6a0;
  --warn: #f0b45c;
  --danger: #ff6b7d;
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Noto Kufi Arabic', 'Segoe UI', system-ui, sans-serif;
  --font-en: 'Manrope', 'Noto Kufi Arabic', system-ui, sans-serif;
  --shadow: 0 24px 60px -34px rgba(0, 0, 0, 0.95);
}

* { box-sizing: border-box; min-width: 0; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.35; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(20px, 2.3vw, 27px); }
h2 { font-size: 16px; }
p { margin: 0; }
::selection { background: var(--accent); color: #06080c; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #232936; border-radius: 99px; border: 3px solid var(--bg); }

/* ------------------------------------------------------------- layout */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100%; }

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh; padding: 20px 14px;
  display: flex; flex-direction: column; gap: 20px;
  border-inline-start: 1px solid var(--line-soft);
  background: var(--bg-soft);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px; }
.brand-mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px; font-size: 17px; color: #06080c; font-weight: 700;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
}
.brand-text { font-family: var(--font-en); font-weight: 700; font-size: 18px; display: grid; letter-spacing: 0.01em; }
.brand-text small { font-family: var(--font); font-size: 11px; font-weight: 400; color: var(--muted); }

nav { display: grid; gap: 2px; }
nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm); color: var(--muted);
  font-weight: 600; font-size: 13.5px; transition: 0.15s;
}
nav a:hover { background: var(--panel); color: var(--text); }
nav a.on { background: var(--panel-2); color: var(--text); }
nav a.on .ico { color: var(--accent); }
nav a .ico { width: 17px; text-align: center; font-family: var(--font-en); }
nav a .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav a .badge {
  margin-inline-start: auto; font-size: 11px; font-family: var(--font-en);
  background: var(--panel-2); color: var(--accent);
  border: 1px solid var(--line); border-radius: 20px; padding: 0 7px;
}

.net {
  margin-top: auto; font-size: 12px; color: var(--muted);
  border-top: 1px solid var(--line-soft); padding-top: 12px;
  display: grid; gap: 3px; font-family: var(--font-en);
}
.net b { color: var(--accent-2); font-weight: 600; }

.main { padding: 28px clamp(14px, 3vw, 40px) 80px; min-width: 0; max-width: 1500px; }

.head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.head p { color: var(--muted); font-size: 13.5px; }
.head .spacer { flex: 1; }

/* ------------------------------------------------------- form controls */
input[type='text'], input[type='url'], input[type='search'], select, textarea {
  width: 100%; padding: 10px 14px; font: inherit; font-size: 14px;
  color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); outline: none; transition: 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); background: var(--panel-2);
  box-shadow: 0 0 0 3px rgba(111, 156, 255, 0.14);
}
input[type='file'] { color: var(--muted); font-size: 13px; max-width: 100%; }
input[type='file']::file-selector-button {
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  margin-inline-end: 10px; padding: 7px 13px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
}
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; min-width: 0; }

.drop {
  display: grid; place-items: center; text-align: center;
  padding: 18px 14px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  color: var(--muted); font-size: 12.5px; cursor: pointer; transition: 0.15s;
  background: var(--bg-soft); word-break: break-word;
}
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); background: var(--panel-2); }
.drop.sm { padding: 14px 12px; margin-top: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border: 1px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
  font: inherit; font-weight: 700; font-size: 13.5px; color: #06080c;
  background: var(--accent); transition: 0.15s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { background: var(--panel); color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(255, 107, 125, 0.35); }
.btn.danger:hover { background: rgba(255, 107, 125, 0.1); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn.full { width: 100%; margin-top: 10px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 200px; }

.card {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 18px; min-width: 0;
}
.card + .card { margin-top: 14px; }
.card h2 { margin-bottom: 4px; }
.card .hint { color: var(--muted); font-size: 12.5px; margin-bottom: 13px; line-height: 1.55; }
.foot-note { margin-top: 12px; font-size: 12px; color: var(--muted); }
.foot-note a { color: var(--accent); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 6px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 700;
  color: var(--muted); background: var(--panel); border: 1px solid var(--line);
}
.tab:hover { color: var(--text); }
.tab.on { color: #06080c; background: var(--accent); border-color: transparent; }

.empty {
  text-align: center; color: var(--muted); padding: 64px 20px;
  border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty .big { font-size: 34px; margin-bottom: 8px; opacity: 0.7; }

/* ------------------------------------------------------------ library */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }

.tile {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--panel); border: 1px solid var(--line-soft);
  display: flex; flex-direction: column; transition: 0.16s;
}
.tile:hover { border-color: var(--line); transform: translateY(-2px); }
.tile .thumb {
  aspect-ratio: 16 / 10; display: grid; place-items: center; font-size: 26px;
  background: linear-gradient(160deg, #171b25, #0c0e14);
  color: rgba(255, 255, 255, 0.28);
}
.tile .body { padding: 12px 13px 13px; display: grid; gap: 8px; min-width: 0; }
.tile .name {
  font-weight: 700; font-size: 13.5px; line-height: 1.45; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word;
}
.tile .meta { color: var(--muted); font-size: 11.5px; font-family: var(--font-en); display: flex; gap: 8px; flex-wrap: wrap; }
.tile .actions { display: flex; gap: 8px; }
.tile .actions .btn:first-child { flex: 1; }

.chip {
  position: absolute; inset-block-start: 9px; inset-inline-start: 9px; z-index: 1;
  padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(6, 8, 12, 0.75); backdrop-filter: blur(6px); border: 1px solid var(--line);
}
.chip.live { color: var(--warn); border-color: rgba(240, 180, 92, 0.4); }
.chip.done { color: var(--ok); border-color: rgba(75, 214, 160, 0.35); }

.bar { height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.4s; }
.bar.slim { height: 3px; }

/* ----------------------------------------------------------- torrents */
.tor { display: grid; gap: 10px; padding: 15px 17px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); }
.tor + .tor { margin-top: 12px; }
.tor .top { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.tor .top b { font-size: 14px; word-break: break-word; }
.tor .stats { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; font-family: var(--font-en); }
.tor .stats span b { color: var(--text); font-weight: 600; }
.tor .files { display: grid; gap: 6px; font-size: 12.5px; }
.tor .files > div { display: flex; gap: 10px; align-items: center; }
.tor .files .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.pct { font-family: var(--font-en); font-size: 12px; color: var(--muted); min-width: 42px; text-align: end; }

/* --------------------------------------------------------- search rows */
.res { display: grid; gap: 8px; }
.res-row {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 12px 15px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel);
}
.res-row:hover { background: var(--panel-2); }
.res-row .t { flex: 1; min-width: 220px; font-size: 13px; font-weight: 600; word-break: break-word; }
.res-row .s { font-family: var(--font-en); font-size: 12.5px; color: var(--muted); display: flex; gap: 12px; }
.seed { color: var(--ok); }
.leech { color: var(--warn); }

/* -------------------------------------------------------------- watch */
.watch-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; min-width: 0; }
.watch-title {
  flex: 1; min-width: 0; font-size: clamp(15px, 1.5vw, 20px); font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: end; color: var(--text);
}

.watch-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
.watch-main { min-width: 0; }
.watch-side { min-width: 0; }

.player {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: #000; border: 1px solid var(--line-soft); outline: none;
  aspect-ratio: 16 / 9; max-height: 78vh; margin-inline: auto; width: 100%;
}
.player video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.player canvas.sub-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.player-veil { position: absolute; inset: 0; z-index: 2; cursor: pointer; }
.player.pseudo-fs {
  position: fixed; inset: 0; z-index: 2147482000; margin: 0; width: 100vw; height: 100dvh;
  max-height: none; aspect-ratio: auto; border: 0; border-radius: 0;
}
body.locked { overflow: hidden; }
.player.fs { aspect-ratio: auto; max-height: none; height: 100%; width: 100%; border: 0; border-radius: 0; }

.buffering {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 4;
  background: rgba(0, 0, 0, 0.4); font-size: 13px; color: #fff; gap: 10px; text-align: center; padding: 20px;
}
.buffering[hidden] { display: none; }
.buffering.err { background: rgba(4, 6, 10, 0.86); }
.buffering.err .spinner { display: none; }
.buffering.err #bufmsg {
  max-width: 320px; line-height: 1.7; font-size: 13px; padding: 14px 16px;
  border-radius: 14px; background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.18); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.big-play {
  position: absolute; inset-block-start: 50%; inset-inline-start: 50%; transform: translate(50%, -50%);
  z-index: 5; width: 68px; height: 68px; border-radius: 50%; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(10, 12, 18, 0.6);
  backdrop-filter: blur(8px); color: #fff; font-size: 22px; transition: 0.15s;
}
.big-play:hover { background: var(--accent); color: #06080c; }
.big-play[hidden] { display: none; }

/* control bar */
.ctrl {
  position: absolute; inset-inline: 0; inset-block-end: 0; z-index: 6;
  padding: 26px 14px 12px; direction: ltr;
  background: linear-gradient(to top, rgba(4, 5, 8, 0.92), rgba(4, 5, 8, 0.55) 55%, transparent);
  transition: opacity 0.25s, transform 0.25s;
}
.player.idle .ctrl { opacity: 0; transform: translateY(8px); pointer-events: none; }
.player.idle .player-veil { cursor: none; }

.seek { position: relative; padding: 8px 0; cursor: pointer; touch-action: none; }
.seek-track { position: relative; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.2); overflow: visible; }
.seek-track > i { position: absolute; inset-block: 0; left: 0; border-radius: 99px; display: block; }
.seek-track .buffered { background: rgba(255, 255, 255, 0.28); width: 0; }
.seek-track .played { background: var(--accent); width: 0; }
.seek-track .knob {
  position: absolute; inset-block-start: 50%; left: 0; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; transform: translate(-50%, -50%); opacity: 0; transition: opacity 0.15s;
}
.seek:hover .knob { opacity: 1; }
.seek:hover .seek-track { height: 6px; }
.seek-tip {
  position: absolute; inset-block-end: 26px; transform: translateX(-50%);
  background: rgba(6, 8, 12, 0.92); border: 1px solid var(--line); border-radius: 6px;
  padding: 1px 7px; font-size: 11.5px; font-family: var(--font-en); pointer-events: none;
}

.ctrl-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.ctrl-row .grow { flex: 1; min-width: 0; }
.ic {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 0; border-radius: 8px; background: transparent; color: #e9edf5;
  font: inherit; font-size: 14px; cursor: pointer; transition: 0.14s;
}
.ic:hover { background: rgba(255, 255, 255, 0.12); }
.ic.on { color: var(--accent); }
.ic.tiny { width: 24px; height: 24px; font-size: 12px; }
.ic.danger { color: var(--danger); }
.time { font-family: var(--font-en); font-size: 12.5px; color: #d5dbe8; padding-inline: 6px; white-space: nowrap; }

.vol { display: flex; align-items: center; gap: 4px; }
.volr {
  width: 0; opacity: 0; transition: width 0.2s, opacity 0.2s; -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.25); cursor: pointer; padding: 0; border: 0;
}
.vol:hover .volr, .volr:focus { width: 76px; opacity: 1; }
.volr::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; border-radius: 50%; background: #fff; }
.volr::-moz-range-thumb { width: 11px; height: 11px; border: 0; border-radius: 50%; background: #fff; }

.sub-menu {
  position: absolute; inset-block-end: 62px; inset-inline-end: 14px; z-index: 7; direction: rtl;
  min-width: 190px; max-width: min(320px, 70%); max-height: 46%; overflow: auto;
  background: rgba(10, 12, 18, 0.96); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 6px; box-shadow: var(--shadow);
}
.sub-menu[hidden] { display: none; }
.sub-menu .mi {
  padding: 7px 10px; border-radius: 7px; font-size: 12.5px; cursor: pointer; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sub-menu .mi:hover { background: var(--panel-2); color: var(--text); }
.sub-menu .mi.on { color: var(--accent); background: var(--panel-2); }

.dl-line { margin-top: 12px; }
.dl-meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; font-family: var(--font-en); }
.ok-note { color: var(--ok); font-size: 13px; }

.sub-list { display: grid; gap: 6px; }
.sub-item {
  display: flex; gap: 9px; align-items: center; min-width: 0;
  padding: 8px 11px; border-radius: 9px; background: var(--bg-soft);
  border: 1px solid var(--line-soft); font-size: 12.5px; cursor: pointer; transition: 0.14s;
}
.sub-item:hover { border-color: var(--line); }
.sub-item.on { border-color: var(--accent); background: var(--panel-2); }
.sub-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; text-align: start; }
.tagfmt {
  flex: none; font-family: var(--font-en); font-size: 10px; text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--line); padding: 0 5px; border-radius: 5px;
}

/* ------------------------------------------------------------- toasts */
.toasts { position: fixed; bottom: 20px; left: 20px; display: grid; gap: 8px; z-index: 2147483000; }
.toast {
  padding: 11px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; max-width: 360px;
  background: var(--panel-2); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: pop 0.2s ease-out; transition: opacity 0.3s; word-break: break-word;
}
.toast.err { border-color: rgba(255, 107, 125, 0.45); color: #ffbcc5; }
.toast.ok { border-color: rgba(75, 214, 160, 0.4); color: #a6efd3; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

/* ------------------------------------------------------- mobile chrome */
.topbar { display: none; }
.menu-btn { display: none; }
.sheet, .sheet-backdrop { display: none; }

@media (max-width: 1080px) {
  .watch-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }

  .topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
    background: rgba(7, 8, 11, 0.86); backdrop-filter: saturate(140%) blur(14px);
    border-block-end: 1px solid var(--line-soft);
  }
  .brand.mini .brand-mark { width: 32px; height: 32px; font-size: 15px; border-radius: 9px; }
  .brand.mini .brand-text { font-size: 16px; }
  .top-net { font-family: var(--font-en); font-size: 12px; color: var(--muted); }
  .top-net b { color: var(--accent-2); }

  .menu-btn {
    display: grid; gap: 4px; place-content: center; flex: none;
    width: 40px; height: 40px; border-radius: 12px; cursor: pointer;
    background: var(--panel); border: 1px solid var(--line);
  }
  .menu-btn span { display: block; width: 17px; height: 2px; border-radius: 2px; background: var(--text); }

  .sheet-backdrop {
    display: block; position: fixed; inset: 0; z-index: 60;
    background: rgba(3, 4, 7, 0.6); backdrop-filter: blur(3px);
    animation: fade 0.18s ease-out;
  }
  .sheet-backdrop[hidden] { display: none; }
  .sheet {
    display: block; position: fixed; inset-inline: 0; bottom: 0; z-index: 61;
    background: var(--panel); border-top: 1px solid var(--line);
    border-radius: 22px 22px 0 0; padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
    box-shadow: 0 -20px 60px -30px #000; animation: rise 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-height: 82vh; overflow: auto;
  }
  .sheet[hidden] { display: none; }
  .sheet-grip { width: 42px; height: 4px; border-radius: 99px; background: var(--line); margin: 2px auto 12px; }
  .sheet nav { display: grid; gap: 4px; }
  .sheet nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 14px; border-radius: 12px; font-size: 15px; font-weight: 600;
    color: var(--text); background: var(--bg-soft); border: 1px solid var(--line-soft);
  }
  .sheet nav a.on { border-color: var(--accent); background: var(--panel-2); }
  .sheet nav a.on .ico { color: var(--accent); }
  .sheet nav a .ico { width: 20px; text-align: center; font-family: var(--font-en); color: var(--muted); }
  .sheet nav a .lbl { flex: 1; }
  .sheet nav a .badge {
    font-size: 11px; font-family: var(--font-en); color: var(--accent);
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 20px; padding: 1px 8px;
  }
  .sheet-foot {
    margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft);
    display: grid; gap: 3px; font-size: 12px; color: var(--muted); font-family: var(--font-en);
  }
  .sheet-foot .who { color: var(--text); font-family: var(--font); font-weight: 600; }
  .sheet-foot b { color: var(--accent-2); }
  body.sheet-open { overflow: hidden; }

  @keyframes rise { from { transform: translateY(100%); } }
  @keyframes fade { from { opacity: 0; } }

  /* --- content --- */
  .main { padding: 16px 14px 48px; }
  .head { margin-bottom: 16px; }
  .head .btn { flex: 1; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .main .row > .grow { min-width: 100%; }
  .topbar .grow { flex: 1; min-width: 0; }
  .main .row > .btn { flex: 1; justify-content: center; }
  .tabs { gap: 7px; }
  .tab { padding: 8px 15px; font-size: 13px; white-space: nowrap; }
  .tabs::-webkit-scrollbar { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .res-row { gap: 8px; }
  .res-row .t { min-width: 100%; }
  .res-row .btn { width: 100%; }
  .tor .stats, .sub-card .stats { gap: 10px; font-size: 12px; }

  /* --- player --- */
  .watch-head { gap: 10px; margin-bottom: 12px; }
  .player {
    margin-inline: -14px; width: calc(100% + 28px); border-radius: 0; border-inline: 0; max-height: none;
  }
  .ctrl { padding: 22px 10px calc(10px + env(safe-area-inset-bottom)); }
  .ctrl-row { gap: 2px; }
  .ic { width: 42px; height: 42px; font-size: 16px; }
  .ic.tiny { width: 30px; height: 30px; font-size: 13px; }
  .seek { padding: 12px 0; }
  .seek-track { height: 5px; }
  .seek-track .knob { opacity: 1; width: 14px; height: 14px; }
  .vol .volr { display: none; }
  .time { font-size: 12px; padding-inline: 4px; }
  #pip { display: none; }
  .big-play { width: 60px; height: 60px; font-size: 20px; }
  .sub-menu { inset-block-end: 74px; inset-inline: 10px; max-width: none; max-height: 50%; }
  .sub-menu .mi { padding: 12px 12px; font-size: 14px; }
  .drop.sm { padding: 18px 12px; font-size: 13px; }
  .sub-item { padding: 11px 12px; font-size: 13px; }
  .toasts { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
}

@media (max-width: 420px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile .body { padding: 10px; }
  .tile .actions { flex-direction: column; }
  .tile .actions .btn { width: 100%; }
}

/* ---------------------------------------------------------------- auth */
.authroot { display: none; }
body.anon .shell { display: none; }
body.anon .authroot {
  display: grid; place-items: center; min-height: 100vh; padding: 24px;
  background: radial-gradient(1100px 620px at 70% -12%, rgba(111, 156, 255, 0.14), transparent 62%), var(--bg);
}
.auth-card {
  width: min(400px, 100%); display: grid; gap: 13px;
  padding: 30px 26px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 21px; }
.auth-card .brand-mark.big { width: 46px; height: 46px; font-size: 21px; }
.auth-card .hint { margin-bottom: 4px; }
.auth-card input[type='password'], .auth-card input[type='text'] {
  width: 100%; padding: 10px 14px; font: inherit; font-size: 14px;
  color: var(--text); background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); outline: none;
}
.linkbtn {
  background: none; border: 0; color: var(--accent); font: inherit; font-size: 13px;
  cursor: pointer; padding: 2px; text-align: center;
}
.auth-err {
  font-size: 13px; color: var(--danger); background: rgba(255, 107, 125, 0.09);
  border: 1px solid rgba(255, 107, 125, 0.3); border-radius: var(--radius-sm); padding: 8px 12px;
}
.net .who { color: var(--text); font-family: var(--font); font-weight: 600; }

/* ------------------------------------------------- continue watching */
.sec-title { font-size: 14px; color: var(--muted); margin: 4px 0 10px; font-weight: 600; }
.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(190px, 210px);
  gap: 12px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 22px;
  scrollbar-width: thin;
}
.cw { display: grid; gap: 7px; min-width: 0; }
.cw-thumb {
  position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center;
  border-radius: var(--radius-sm); font-size: 22px; color: var(--muted);
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); transition: 0.15s;
}
.cw:hover .cw-thumb { border-color: var(--accent); color: var(--accent); }
.cw-left {
  position: absolute; inset-block-end: 7px; inset-inline-end: 8px;
  font-size: 11px; font-family: var(--font-en); color: var(--text);
  background: rgba(6, 8, 12, 0.78); border-radius: 6px; padding: 1px 6px;
}
.cw-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------- subscriptions */
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.sub-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; margin-bottom: 12px; display: grid; gap: 10px; min-width: 0;
}
.sub-card.off { opacity: 0.62; }
.sub-card .top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sub-card .chip { position: static; inset: auto; margin-inline-start: auto; flex: none; }
.sub-card .top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.err-note {
  font-size: 12.5px; color: var(--danger);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Mobile Bottom Tab Bar */
.bottombar { display: none; }
.badge-dot { position: absolute; top: -2px; right: -4px; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; border: 2px solid var(--panel); }

/* Bidi text fix */
.name, .cw-name { unicode-bidi: plaintext; text-align: start; }
bdi { unicode-bidi: plaintext; }

@media (max-width: 900px) {
  .menu-btn { display: none !important; }
  .bottombar {
    display: flex; justify-content: space-around; align-items: center;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: rgba(7, 8, 11, 0.9); backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line-soft);
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  }
  .bottombar a, .bottombar button {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    color: var(--muted); background: none; border: none; font-family: var(--font);
    font-size: 11px; font-weight: 600; flex: 1; padding: 6px; cursor: pointer; text-decoration: none;
  }
  .bottombar a.on, .bottombar button.on { color: var(--accent); }
  .bottombar .ico { font-size: 20px; font-family: var(--font-en); margin-bottom: 2px; position: relative; }
  
  .main { padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important; }
  .sheet { padding-bottom: calc(90px + env(safe-area-inset-bottom)) !important; border-radius: 28px 28px 0 0; }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom)) !important; }
}

/* Player improvements */
.buffering.err { align-items: flex-start; padding-top: 15%; }
.buffering.err #bufmsg { margin-bottom: 80px; max-height: 50vh; overflow: auto; }
.seek:hover .seek-track { height: 8px; }
.seek-track .knob { box-shadow: 0 2px 10px rgba(0,0,0,0.5); }
@media (max-width: 900px) {
  .seek-track { height: 6px; }
  .seek-track .knob { width: 18px; height: 18px; }
  .ctrl { padding: 30px 14px calc(14px + env(safe-area-inset-bottom)); }
}
