:root {
  --bg: #0b0d12;
  --bg2: #12151d;
  --card: #181c26;
  --line: #262b38;
  --txt: #e9ecf3;
  --muted: #8a92a6;
  --accent: #e5484d;
  --accent2: #ff7a59;
  --ok: #3ecf8e;
  --radius: 12px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--txt); font-family: 'Outfit', system-ui, sans-serif; font-size: 15px; }
body.noscroll { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; padding: 40px 0; }
.error { color: #ff8a8a; }
.mono { font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; }

/* ---------- Boutons ---------- */
.btn { border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; font-weight: 600; background: var(--card); transition: .15s; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--card); }
.btn.danger { background: transparent; border-color: #5a2328; color: #ff8a8a; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% -10%, #3a1218 0%, transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 28px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; outline: none; }
.login-card input:focus { border-color: var(--accent); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; }
.brand.big { font-size: 26px; justify-content: center; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-size: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.login-card p { margin: 0; text-align: center; }

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; padding: 12px 20px;
  background: rgba(11, 13, 18, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 6px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 9px 14px; border-radius: 10px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.tabs button:hover { color: var(--txt); background: var(--card); }
.tabs button.active { color: #fff; background: var(--card); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- Layout ---------- */
.main { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 60px); }
.cats { border-right: 1px solid var(--line); background: var(--bg2); position: sticky; top: 59px; height: calc(100vh - 59px); overflow-y: auto; }
.cat-select { display: none; }
.cat-list { list-style: none; margin: 0; padding: 10px; }
.cat-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; }
.cat-list button:hover { background: var(--card); color: var(--txt); }
.cat-list button.active { background: var(--card); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.content { padding: 18px 22px 40px; min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; font-size: 22px; flex: 1; }
.search input, .sort, .cat-select { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; }
.search input { width: 260px; }
.search input:focus { border-color: var(--accent); }

/* ---------- Grille ---------- */
.grid { display: grid; gap: 14px; }
.grid-poster { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid-live { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.card { background: none; border: 0; padding: 0; text-align: left; border-radius: var(--radius); }
.card:hover .thumb, .card:focus-visible .thumb { transform: translateY(-3px); border-color: var(--accent); }
.thumb { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--card); border: 1px solid var(--line); transition: .15s; }
.grid-poster .thumb { aspect-ratio: 2 / 3; }
.grid-live .thumb { aspect-ratio: 16 / 10; padding: 14px; display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid-live .thumb img { object-fit: contain; }
.ph { width: 100%; height: 100%; display: grid; place-items: center; font-size: 28px; font-weight: 700; color: var(--muted);
  background: linear-gradient(135deg, #1d2230, #141821); }
.cname { margin-top: 7px; font-size: 13.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badge { position: absolute; top: 7px; left: 7px; background: rgba(0, 0, 0, .75); color: #ffd166; font-size: 12px; padding: 2px 7px; border-radius: 6px; font-weight: 600; }
.badge.inline { position: static; display: inline-block; margin: 0 0 8px; }
.favdot { position: absolute; top: 6px; right: 8px; color: #ffd166; text-shadow: 0 0 4px #000; }
.loading, .ploading { display: grid; place-items: center; padding: 40px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#sentinel { height: 1px; }

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .75); display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal-box { position: relative; background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 900px; max-height: calc(100vh - 40px); overflow-y: auto; padding: 24px; }
.close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--card); font-size: 16px; }
.close:hover { background: var(--accent); }
.dtop { display: grid; grid-template-columns: 200px 1fr; gap: 22px; }
.dposter { border-radius: var(--radius); overflow: hidden; aspect-ratio: 2 / 3; background: var(--card); }
.dposter img { width: 100%; height: 100%; object-fit: cover; }
.dinfo h2 { margin: 4px 40px 10px 0; font-size: 24px; }
.meta { color: var(--muted); margin: 0 0 10px; }
.plot { line-height: 1.55; margin: 0 0 12px; }
.dinfo .small { margin: 0 0 6px; color: #c3c8d4; }
.dactions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.seasons { display: flex; gap: 8px; flex-wrap: wrap; margin: 24px 0 14px; }
.seasons button { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 7px 16px; color: var(--muted); }
.seasons button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.episodes { display: grid; gap: 8px; }
.ep { cursor: pointer; display: grid; grid-template-columns: 140px 1fr auto; gap: 14px; align-items: center; background: var(--card); border: 1px solid transparent; border-radius: 10px; padding: 8px; text-align: left; }
.ep:hover { border-color: var(--accent); }
.epthumb { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #0f1218; display: grid; place-items: center; }
.epthumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.epthumb span { position: relative; font-weight: 700; font-size: 20px; text-shadow: 0 0 6px #000; }
.prog { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); }
.eptxt { display: grid; gap: 3px; min-width: 0; }
.epplot { color: #aab1c0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Téléchargement ---------- */
.season-tools { display: flex; justify-content: flex-end; margin: -6px 0 10px; }
.epdl { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg2); font-size: 16px; }
.epdl:hover { background: var(--accent); border-color: var(--accent); }
.dl-box { max-width: 680px; }
.dl-box h2 { margin: 0 40px 6px 0; font-size: 20px; }
.dl-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.dl-actions a { text-decoration: none; color: inherit; }
.dl-list { display: grid; gap: 6px; max-height: 45vh; overflow-y: auto; margin-bottom: 14px; }
.dl-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px; align-items: center; background: var(--card); border-radius: 10px; padding: 6px 6px 6px 12px; }
.dl-row a { text-decoration: none; color: inherit; }
.dl-name { font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-tip { background: var(--card); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 14px; font-size: 13.5px; color: #c3c8d4; }
.dl-tip ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.dl-tip a { color: var(--accent2); }

/* ---------- Lecteur ---------- */
.player-modal { padding: 0; background: #000; }
.player-box { width: 100%; height: 100%; display: flex; flex-direction: column; }
.player-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #0b0d12; }
.ptitle-wrap { flex: 1; min-width: 0; display: grid; }
.ptitle-wrap strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptitle-wrap small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-actions { display: flex; align-items: center; gap: 8px; }
.player-actions .close { position: static; }
.video-wrap { position: relative; flex: 1; min-height: 0; background: #000; }
.video-wrap video { width: 100%; height: 100%; display: block; background: #000; }
.ploading { position: absolute; inset: 0; pointer-events: none; }
.perr { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; text-align: center; padding: 20px; background: rgba(0, 0, 0, .8); }
.perr p { margin: 0; max-width: 420px; }
.pnav { display: flex; justify-content: center; gap: 10px; padding: 8px; background: #0b0d12; }

/* ---------- Compte ---------- */
.main.account { display: block; padding: 24px 16px; }
.account-card { max-width: 720px; margin: 0 auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 18px; padding: 26px; }
.account-card h2 { margin-top: 0; }
.acc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.acc-grid > div { background: var(--card); border-radius: 10px; padding: 12px 14px; display: grid; gap: 4px; }
.acc-grid .wide { grid-column: 1 / -1; }
.acc-grid span { font-size: 12px; }
.ok { color: var(--ok); } .bad { color: #ff8a8a; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100; background: #fff; color: #111; padding: 10px 18px; border-radius: 10px; font-weight: 500; box-shadow: 0 8px 30px rgba(0, 0, 0, .4); max-width: calc(100% - 32px); }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
  .brand { font-size: 17px; }
  .tabs button span { display: none; }
  .tabs button { flex: 1; font-size: 20px; padding: 6px; }
  .main { grid-template-columns: 1fr; }
  .cats { position: static; height: auto; border: 0; background: none; padding: 12px 16px 0; }
  .cat-list { display: none; }
  .cat-select { display: block; width: 100%; }
  .content { padding: 12px 16px 30px; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .grid-poster { grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 10px; }
  .grid-live { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
  .modal { padding: 0; }
  .modal-box { border-radius: 0; max-height: 100vh; min-height: 100vh; padding: 18px 16px; }
  .dtop { grid-template-columns: 110px 1fr; gap: 14px; }
  .dinfo h2 { font-size: 19px; }
  .ep { grid-template-columns: 96px 1fr auto; gap: 10px; }
  .dl-row { grid-template-columns: 1fr auto auto; }
  .dl-row [data-c] { display: none; }
  .acc-grid { grid-template-columns: 1fr; }
  #copyLink { font-size: 0; padding: 6px 10px; }
  #copyLink::before { content: '🔗'; font-size: 15px; }
}
