:root{
  --bg:#0b0f14;
  --panel:#131a22;
  --accent:#3ba7ff;
  --text:#eef2f6;
  --text-dim:#8593a3;
  --focus:#3ba7ff;
  --surface:#1c2630;
  --surface2:#0e151d;
}
:root[data-theme="gris"]{
  --bg:#1b1d20; --panel:#26292d; --accent:#9aa5b1; --text:#f2f3f4; --text-dim:#9aa3ac; --focus:#9aa5b1;
  --surface:#33373c; --surface2:#212327;
}
:root[data-theme="bleu"]{
  --bg:#081326; --panel:#0f1f3d; --accent:#4da3ff; --text:#eef4ff; --text-dim:#8ea3c2; --focus:#4da3ff;
  --surface:#16294d; --surface2:#0a1730;
}
:root[data-theme="rouge"]{
  --bg:#1c0d0d; --panel:#2b1414; --accent:#ff5c5c; --text:#fdeeee; --text-dim:#c79797; --focus:#ff5c5c;
  --surface:#3a1c1c; --surface2:#220f0f;
}
:root[data-theme="vert"]{
  --bg:#0a1a10; --panel:#123420; --accent:#3ddc84; --text:#eafff3; --text-dim:#8fc2a4; --focus:#3ddc84;
  --surface:#1a4028; --surface2:#0e2417;
}
:root[data-theme="turquoise"]{
  --bg:#071a19; --panel:#0e2c2a; --accent:#1abcb0; --text:#eafffd; --text-dim:#82bdb6; --focus:#1abcb0;
  --surface:#153b38; --surface2:#0a2220;
}
:root[data-theme="violet"]{
  --bg:#160c26; --panel:#241640; --accent:#a06cff; --text:#f4eeff; --text-dim:#b19dcf; --focus:#a06cff;
  --surface:#33205a; --surface2:#1c1035;
}
*{box-sizing:border-box; margin:0; padding:0;}
html,body{
  width:100%; height:100%;
  background:var(--bg); color:var(--text);
  font-family:"Helvetica Neue",Arial,sans-serif;
  overflow:hidden;
  font-size:24px; /* base confortable pour TV, vue à distance */
}
.screen{display:none; width:100vw; height:100vh;}
.screen.active{display:flex;}

/* ---------- LOGIN ---------- */
#screen-login{align-items:center; justify-content:center;}
.login-box{
  width:640px; background:var(--panel); padding:48px;
  border-radius:16px;
}
.login-box h1{font-size:42px; margin-bottom:8px;}
.subtitle{color:var(--text-dim); margin-bottom:32px;}
.login-box label{display:block; margin:16px 0 8px; color:var(--text-dim); font-size:18px;}
.login-box input{
  width:100%; padding:14px 16px; font-size:22px;
  background:var(--surface); border:3px solid transparent; border-radius:8px;
  color:var(--text); outline:none;
}
.btn-primary{
  margin-top:28px; width:100%; padding:16px; font-size:24px; font-weight:600;
  background:var(--accent); color:#04151f; border:3px solid transparent;
  border-radius:8px; cursor:pointer;
}
.error{color:#ff6b6b; margin-top:16px; min-height:24px;}

/* ---------- FOCUS (essentiel pour télécommande) ---------- */
.focusable{transition:transform .08s ease, box-shadow .08s ease;}
.focusable:focus, .focusable.focused{
  outline:none;
  box-shadow:0 0 0 3px var(--focus);
  transform:scale(1.02);
}

/* ---------- HOME (grosses tuiles) ---------- */
#screen-home{align-items:center; justify-content:center; position:relative;}
#home-logo{
  position:absolute; top:36px; left:44px; height:56px; width:auto;
}
#home-greeting{
  position:absolute; top:36px; right:44px; text-align:right;
  font-size:19px; color:var(--text-dim); max-width:400px;
}
#home-greeting b{color:var(--text); font-size:22px; display:block; margin-bottom:2px;}

/* ---------- CONFIRMATION DE SORTIE ---------- */
#exit-modal{
  display:none; position:fixed; inset:0; z-index:50;
  background:rgba(0,0,0,.72);
  align-items:center; justify-content:center; flex-direction:column; gap:18px;
}
#exit-modal.show{display:flex;}
#exit-emoji{font-size:80px; transition:transform .15s ease;}
#exit-question{font-size:26px; color:var(--text);}
#exit-buttons{display:flex; gap:16px; margin-top:8px;}
#exit-buttons .list-item{margin:0; min-width:220px; text-align:center;}
#home-footer{
  position:absolute; bottom:32px; right:44px; text-align:right;
}
#sub-days{font-size:17px; color:var(--text-dim); margin-bottom:4px;}
#sub-days.warn{color:#ffb84d;}
#sub-days.danger{color:#ff6b6b;}
#app-version{font-size:14px; color:#546274;}
#home-grid{
  display:grid; grid-template-columns:repeat(4, 220px); gap:24px;
  max-width:1000px;
}
.home-tile{
  height:180px; background:var(--panel); border-radius:16px;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px;
  cursor:pointer;
}
.home-tile-icon{font-size:56px;}
.home-tile-label{font-size:20px; color:var(--text);}
.home-tile.focused{
  background:var(--surface); box-shadow:0 0 0 3px var(--focus); transform:scale(1.03);
}

/* ---------- MAIN ---------- */
#screen-main{width:100vw; height:100vh;}
#sidebar{
  width:260px; flex-shrink:0; background:var(--panel);
  display:flex; flex-direction:column; padding:32px 0;
}
.nav-item{
  padding:18px 28px; font-size:22px; color:var(--text-dim);
  cursor:pointer; border-left:4px solid transparent;
}
.nav-item.focused, .nav-item.active{
  color:var(--text); border-left-color:var(--accent); background:#1a2530;
}

#content-area{flex:1; display:flex; height:100vh; overflow:hidden;}
.column{
  height:100%; overflow-y:auto; padding:20px;
  border-right:1px solid var(--surface);
}
#col-categories{width:280px; flex-shrink:0;}
#col-items{width:380px; flex-shrink:0;}
#col-detail{flex:1;}

.list-item{
  padding:20px 20px; margin-bottom:8px; border-radius:8px;
  background:#131a22; cursor:pointer; font-size:24px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.list-item.focused{background:var(--surface);}
.list-item.selected{
  box-shadow:inset 4px 0 0 var(--accent);
  background:#111a23; color:var(--text);
}
.list-item.selected.focused{background:var(--surface);}
.list-item .badge{color:var(--text-dim); font-size:14px; display:block; margin-top:2px;}

.toggle-row{
  background:#1a2733; font-weight:600; color:var(--accent);
  border:1px solid #24405a;
}
.toggle-row.active-mode{background:#24405a;}
.list-item.picked{
  background:#24405a; box-shadow:inset 0 0 0 2px var(--accent);
}
.hint-text{color:var(--text-dim); font-size:14px; margin:6px 0 12px; line-height:1.4;}

/* Sélecteur de thème */
.theme-swatches{display:flex; gap:14px; flex-wrap:wrap; margin-top:10px;}
.theme-swatch{
  width:52px; height:52px; border-radius:50%; cursor:pointer;
  border:3px solid transparent; flex-shrink:0;
}
.theme-swatch.focused{border-color:#fff; transform:scale(1.1);}
.theme-swatch.active{box-shadow:0 0 0 3px var(--bg), 0 0 0 6px currentColor;}

/* Jaquettes Films/Séries */
.list-item-poster{display:flex; align-items:center; gap:12px; padding:8px;}
.poster-thumb{
  width:60px; height:86px; object-fit:cover; border-radius:5px; flex-shrink:0;
  background:var(--surface2);
}
.poster-thumb-empty{background:linear-gradient(135deg,var(--surface),var(--surface2));}
.poster-name{white-space:normal; line-height:1.3;}
.poster-detail{
  width:180px; max-width:40%; border-radius:8px; float:left; margin:0 20px 12px 0;
}
.channel-logo{
  width:58px; height:58px; object-fit:contain; border-radius:6px; flex-shrink:0;
  background:#f4f6f8; padding:5px;
}
.channel-logo-empty{background:linear-gradient(135deg,var(--surface),var(--surface2));}

.detail-title{font-size:32px; margin-bottom:14px;}
.detail-meta{color:var(--text-dim); margin-bottom:20px; font-size:20px;}
.epg-entry{padding:14px 0; border-bottom:1px solid var(--surface);}
.epg-entry .time{color:var(--accent); font-size:19px;}
.epg-entry .title{font-size:23px;}
.epg-entry .desc{color:var(--text-dim); font-size:18px; margin-top:6px;}

/* ---------- SETTINGS ---------- */
.settings-panel{padding:20px;}
.settings-panel .btn-logout{
  padding:14px 20px; background:#3a1c1c; color:#ff8b8b; border-radius:8px;
  display:inline-block; cursor:pointer;
}

/* ---------- PLAYER ---------- */
#screen-player{position:relative; background:#000; align-items:center; justify-content:center;}
#video{width:100%; height:100%; background:#000;}
#player-info{
  position:absolute; bottom:0; left:0; right:0;
  background:linear-gradient(to top, rgba(0,0,0,.9), rgba(0,0,0,0));
  padding:40px 44px 32px;
  transform:translateY(100%); opacity:0;
  transition:transform .35s ease, opacity .35s ease;
  pointer-events:none;
}
#player-info.show{transform:translateY(0); opacity:1;}
#player-info.slide-out{transform:translateY(100%); opacity:0;}
.banner-main{font-size:38px; font-weight:700; color:var(--text);}
.banner-sub{font-size:25px; color:#d5dde5; margin-top:8px;}

#player-controls{
  position:absolute; bottom:0; left:0; right:0;
  background:linear-gradient(to top, rgba(0,0,0,.92), rgba(0,0,0,0) 85%);
  padding:60px 48px 30px;
  display:flex; flex-direction:column; align-items:center; gap:18px;
  transform:translateY(100%); opacity:0;
  transition:transform .3s ease, opacity .3s ease;
  pointer-events:none;
}
#player-controls.show{transform:translateY(0); opacity:1;}
#play-pause-icon{
  font-size:54px; color:#fff; background:rgba(255,255,255,.16);
  width:90px; height:90px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
}
#progress-row{width:100%; max-width:1100px; display:flex; align-items:center; gap:16px;}
#time-current, #time-total{font-size:20px; color:#d5dde5; min-width:56px;}
#time-total{text-align:right;}
#progress-bar{flex:1; height:10px; background:rgba(255,255,255,.25); border-radius:5px; overflow:hidden;}
#progress-fill{height:100%; width:0%; background:var(--accent); border-radius:5px;}
#player-loading{
  position:absolute; font-size:22px; color:var(--text-dim);
  display:none;
}
#player-loading.show{display:block;}

::-webkit-scrollbar{width:0; height:0;}
