:root {
  --bg: #0B0C10; --bg-2: #16181F; --panel: rgba(22, 24, 31, 0.86); --line: rgba(255, 255, 255, 0.12);
  --fill: rgba(236, 237, 241, 0.08); --fill-2: rgba(236, 237, 241, 0.14);
  --ink: #ECEDF1; --ink-2: #9A9CA8; --ink-3: #6B6E7B; --accent: #FF6B6F; --ok: #7BE0A6;
  --radius: 12px; --tabs-h: 58px; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --font: 'Manrope', -apple-system, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.35; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
body { min-height: 100vh; font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; }
input { font: inherit; }
[hidden] { display: none !important; }
.view { padding: calc(var(--sat) + 8px) 16px calc(var(--tabs-h) + var(--sab) + 24px); min-height: 100vh; }
.view.is-full { padding: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-6 { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }

/* Onglets */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabs-h) + var(--sab)); padding-bottom: var(--sab); display: flex; background: var(--panel); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border-top: 1px solid var(--line); z-index: 20; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--ink-3); }
.tabs a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.is-current { color: var(--ink); }

/* Titres et sections */
.page-title { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 8px 0 14px; }
.page-title small { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; margin-top: 2px; }
.section-title { font-size: 19px; font-weight: 700; margin: 22px 0 10px; letter-spacing: -0.01em; }
.section-title small { font-size: 14px; color: var(--ink-2); font-weight: 600; margin-left: 6px; }
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.topbar .page-title { flex: 1; margin: 0; }
.icon-btn { width: 40px; height: 40px; border-radius: 20px; background: var(--fill); display: flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Chips et boutons */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; margin: 0 -16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 36px; padding: 0 14px; border-radius: 18px; background: var(--fill); font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--ink); }
.chip.is-active { background: var(--ink); color: var(--bg); }
.chip small { color: inherit; opacity: 0.6; font-size: 12px; }
.btn { height: 48px; padding: 0 20px; border-radius: var(--radius); background: var(--fill-2); font-size: 16px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.btn.is-primary { background: var(--ink); color: var(--bg); }
.btn.is-accent { background: var(--accent); color: #fff; }
.btn.is-small { height: 38px; padding: 0 14px; font-size: 14px; }
.btn.is-on { color: var(--accent); }
.btn:active { opacity: 0.7; }
.btn[disabled] { opacity: 0.4; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btns.is-stack { flex-direction: column; }
.btns.is-stack .btn { width: 100%; }

/* Listes et rangées de chaînes */
.list { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--fill); min-height: 64px; }
.row:active { background: var(--fill-2); }
.row .logo { width: 62px; height: 40px; flex: none; border-radius: 8px; background: #2a2f3f; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; text-align: center; line-height: 1.1; padding: 0 4px; }
.row .logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.row .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.row .name .num { color: var(--ink-3); font-weight: 600; font-size: 13px; }
.row .name .heart { color: var(--accent); font-size: 13px; }
.row .now { font-size: 13px; color: var(--ink-2); }
.row .bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); overflow: hidden; margin-top: 4px; }
.row .bar i { display: block; height: 100%; background: var(--ink); width: 0; }
.row .bar.is-empty { visibility: hidden; }
.row.is-active .name::after { content: "● TV"; color: var(--accent); font-size: 11px; font-weight: 800; }
.prog { display: flex; gap: 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--fill); align-items: flex-start; }
.prog .time { width: 48px; flex: none; color: var(--ink-2); font-weight: 600; font-size: 14px; padding-top: 2px; }
.prog .t { flex: 1; min-width: 0; }
.prog .t b { display: block; font-size: 15px; }
.prog .t span { font-size: 13px; color: var(--ink-2); }
.prog.is-now { background: var(--fill-2); }
.prog.is-past { opacity: 0.6; }
.prog .tag { font-size: 11px; font-weight: 800; color: var(--accent); }
.day-sep { font-size: 13px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; margin: 14px 0 6px; }

/* Grille d'affiches et cartes */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 10px; }
.poster { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.poster .img { aspect-ratio: 2 / 3; border-radius: 10px; background: linear-gradient(160deg, #23262F, #12141A); overflow: hidden; position: relative; }
.poster .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poster .corner { position: absolute; right: 6px; top: 6px; height: 20px; padding: 0 6px; border-radius: 5px; background: rgba(11, 12, 16, 0.75); font-size: 11px; font-weight: 800; display: flex; align-items: center; }
.poster .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, 0.25); }
.poster .progress i { display: block; height: 100%; background: var(--ink); }
.poster .t { font-size: 13px; font-weight: 600; }
.poster .s { font-size: 12px; color: var(--ink-2); margin-top: -3px; }
.rail { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.rail::-webkit-scrollbar { display: none; }
.rail .poster { flex: none; width: 110px; }
.rail .poster.is-person .img { border-radius: 10px; }
.rail .card-land { flex: none; width: 220px; }
.card-land .img { aspect-ratio: 16 / 9; border-radius: 10px; background: linear-gradient(160deg, #23262F, #12141A); overflow: hidden; position: relative; }
.card-land .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-land .img .chip { position: absolute; left: 8px; bottom: 8px; height: 24px; padding: 0 8px; font-size: 12px; background: rgba(11, 12, 16, 0.75); }
.card-land .t { font-size: 13px; font-weight: 600; margin-top: 6px; }
.card-land .s { font-size: 12px; color: var(--ink-2); }
.empty { padding: 28px 16px; border-radius: var(--radius); background: var(--fill); color: var(--ink-2); text-align: center; font-size: 15px; }

/* Fiche */
.hero { margin: -8px -16px 0; padding: calc(var(--sat) + 8px) 16px 16px; position: relative; min-height: 300px; display: flex; flex-direction: column; justify-content: flex-end; background: var(--bg-2); overflow: hidden; }
.hero .bg { position: absolute; inset: 0; }
.hero .bg img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.75; }
.hero .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11, 12, 16, 0.2) 0%, rgba(11, 12, 16, 0.4) 50%, #0B0C10 100%); }
.hero .back { position: absolute; left: 12px; top: calc(var(--sat) + 10px); z-index: 2; }
.hero .content { position: relative; z-index: 1; display: flex; gap: 14px; align-items: flex-end; }
.hero .poster { width: 110px; flex: none; }
.hero .meta { font-size: 13px; color: var(--ink-2); font-weight: 600; display: flex; flex-wrap: wrap; gap: 4px 0; }
.hero .meta > * + *::before { content: "·"; margin: 0 6px; }
.hero h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 6px; line-height: 1.1; }
.tagline { font-style: italic; color: var(--ink-2); font-size: 14px; margin: 8px 0 0; }
.plot { font-size: 15px; line-height: 1.45; color: var(--ink); margin: 12px 0 0; }
.credits { font-size: 13px; color: var(--ink-2); margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.credits b { color: var(--ink); font-weight: 600; }
.detail-actions { margin-top: 16px; }
.season-chips { margin-top: 6px; }
.ep-list { display: flex; flex-direction: column; gap: 8px; }
.ep { display: flex; gap: 12px; padding: 10px; border-radius: var(--radius); background: var(--fill); align-items: center; }
.ep .thumb { width: 120px; aspect-ratio: 16 / 9; flex: none; border-radius: 8px; background: #23262F; overflow: hidden; position: relative; }
.ep .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ep .thumb .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, 0.25); }
.ep .thumb .progress i { display: block; height: 100%; background: var(--ink); }
.ep .t { flex: 1; min-width: 0; }
.ep .t b { display: block; font-size: 14px; }
.ep .t span { font-size: 12px; color: var(--ink-2); }
.person-hero { display: flex; gap: 16px; align-items: flex-start; margin-top: 8px; }
.person-hero .photo { width: 120px; flex: none; aspect-ratio: 2 / 3; border-radius: 10px; background: #23262F; overflow: hidden; }
.person-hero .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Recherche */
.search-box { display: flex; align-items: center; gap: 10px; height: 46px; border-radius: 23px; background: var(--fill); padding: 0 14px; margin-bottom: 12px; }
.search-box input { flex: 1; background: none; border: 0; outline: 0; color: var(--ink); font-size: 16px; min-width: 0; }
.search-box input::placeholder { color: var(--ink-3); }
.search-box svg { width: 20px; height: 20px; fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; }

/* Télécommande */
.tv-card { padding: 16px; border-radius: 16px; background: var(--fill); display: flex; flex-direction: column; gap: 10px; }
.tv-card .status { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.tv-card .status i { width: 10px; height: 10px; border-radius: 5px; background: var(--ink-3); }
.tv-card .status.is-on i { background: var(--ok); }
.tv-card .now { display: flex; gap: 12px; align-items: center; }
.tv-card .now .img { width: 96px; aspect-ratio: 16 / 9; flex: none; border-radius: 8px; background: #23262F; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.tv-card .now .img img { width: 100%; height: 100%; object-fit: contain; }
.tv-card .now .t { flex: 1; min-width: 0; }
.tv-card .now .t b { display: block; font-size: 16px; }
.tv-card .now .t span { font-size: 13px; color: var(--ink-2); }
.tv-card .bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.tv-card .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 1s linear; }
.tv-card .times { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.transport { display: flex; justify-content: center; gap: 12px; margin-top: 4px; }
.transport .btn { width: 64px; padding: 0; height: 52px; font-size: 14px; }
.transport .btn.is-main { width: 84px; background: var(--ink); color: var(--bg); font-size: 20px; }
.dpad { display: grid; grid-template-columns: repeat(3, 76px); grid-template-rows: repeat(3, 76px); gap: 8px; justify-content: center; margin: 18px auto 0; }
.dpad .btn { width: 76px; height: 76px; padding: 0; font-size: 22px; border-radius: 16px; }
.dpad .btn.is-ok { background: var(--ink); color: var(--bg); font-size: 16px; }
.dpad .blank { visibility: hidden; }
.keys { display: flex; justify-content: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.keys .btn { height: 44px; padding: 0 16px; font-size: 14px; }
.keys .dot { width: 14px; height: 14px; border-radius: 7px; }
.fav-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fav-grid .logo { aspect-ratio: 16 / 10; border-radius: 10px; background: var(--fill); display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 11px; font-weight: 800; text-align: center; padding: 6px; }
.fav-grid .logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }

/* Réglages */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 14px; border-radius: var(--radius); background: var(--fill); font-size: 15px; font-weight: 600; }
.setting span:first-child { flex: none; }
.setting span:last-child { flex: 1; min-width: 0; color: var(--ink-2); font-weight: 500; text-align: right; overflow-wrap: anywhere; font-size: 14px; }
.setting.is-danger { color: var(--accent); }

/* Connexion */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 32px 24px; }
.login .logo { width: 88px; height: 88px; border-radius: 22px; }
.login h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.login p { color: var(--ink-2); margin: 0; }
.login input { height: 52px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg-2); color: var(--ink); padding: 0 16px; font-size: 18px; outline: 0; }
.login .err { color: var(--accent); font-weight: 600; font-size: 14px; min-height: 1.3em; }

/* Feuilles, lecteur, toasts */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-end; }
.sheet { width: 100%; max-height: 85vh; overflow-y: auto; background: var(--bg-2); border-radius: 18px 18px 0 0; padding: 18px 16px calc(var(--sab) + 18px); display: flex; flex-direction: column; gap: 10px; animation: up 0.22s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h2 { font-size: 20px; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.01em; }
.sheet p { color: var(--ink-2); margin: 0 0 6px; font-size: 14px; }
.sheet .btn { justify-content: flex-start; height: 52px; }
.sheet .btn.is-ghost { background: transparent; color: var(--ink-2); justify-content: center; }
.player { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player .top { position: absolute; left: 0; right: 0; top: 0; padding: calc(var(--sat) + 10px) 12px 24px; display: flex; align-items: center; gap: 10px; background: linear-gradient(180deg, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0)); z-index: 2; }
.player .top .t { flex: 1; min-width: 0; }
.player .top b { display: block; font-size: 15px; }
.player .top span { font-size: 12px; color: var(--ink-2); }
.player .big-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); height: 64px; padding: 0 34px; font-size: 18px; z-index: 3; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6); }
.player .status { position: absolute; left: 0; right: 0; bottom: calc(var(--sab) + 20px); text-align: center; font-size: 14px; color: var(--ink-2); font-weight: 600; z-index: 2; }
.player .jump { position: absolute; right: 12px; bottom: calc(var(--sab) + 90px); display: flex; flex-direction: column; gap: 8px; z-index: 2; }
.player .jump .btn { background: rgba(22, 24, 31, 0.8); height: 40px; font-size: 13px; }
.toasts { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabs-h) + var(--sab) + 14px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { padding: 10px 18px; border-radius: 22px; background: var(--panel); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: up 0.2s ease; }
.skeleton { background: var(--fill); border-radius: 10px; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
