:root {
  --bg: #0b0b10;
  --panel: #15151d;
  --panel-2: #1e1e29;
  --line: #2b2b3a;
  --text: #ecebf3;
  --muted: #8f8da3;
  --red: #ff2a6d;
  --cyan: #05d9e8;
  --yellow: #ffd23f;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 500px at 15% -10%, rgba(255, 42, 109, .10), transparent 60%),
    radial-gradient(1000px 500px at 90% -20%, rgba(5, 217, 232, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.45 Inter, system-ui, sans-serif;
}
main { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 16px 40px; flex: 1; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); }
.muted { color: var(--muted); }

/* ------------------------------------------------------------------ en-tête */
header { text-align: center; padding: 28px 16px 18px; }
#home { text-decoration: none; color: inherit; display: inline-block; }
.logo {
  position: relative;
  margin: 0;
  font: 400 clamp(56px, 13vw, 104px)/0.9 "Archivo Black", Impact, sans-serif;
  letter-spacing: .02em;
  color: #fff;
  text-shadow: -4px 0 var(--red), 4px 0 var(--cyan);
  mix-blend-mode: screen;
}
#home:hover .logo { animation: glitch .35s steps(2) 2; }
@keyframes glitch {
  0%   { text-shadow: -4px 0 var(--red), 4px 0 var(--cyan); transform: none; }
  33%  { text-shadow: 6px 1px var(--red), -6px -1px var(--cyan); transform: translateX(2px) skewX(-4deg); }
  66%  { text-shadow: -2px -2px var(--red), 3px 2px var(--cyan); transform: translateX(-2px); }
  100% { text-shadow: -4px 0 var(--red), 4px 0 var(--cyan); transform: none; }
}
.tagline {
  margin: 8px 0 0;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .5em;
  text-transform: uppercase;
  color: var(--yellow);
  padding-left: .5em;
}

/* ------------------------------------------------------------------ recherche */
#q, #ep-filter {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#ep-filter { font-size: 16px; padding: 10px 14px; margin-bottom: 12px; }
#q:focus, #ep-filter:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(5, 217, 232, .15); }
#count { min-height: 1.4em; margin: 10px 2px; font-size: 14px; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color .12s, transform .12s, background .12s;
}
.item:hover, .item:focus-visible { border-color: var(--red); background: var(--panel-2); outline: none; }
.item:active { transform: scale(.995); }
.item .txt { font-size: 17px; font-weight: 600; }
.item .ctx { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.item .ctx::before { content: "… "; }
.item .meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--muted); }
.item .meta b { color: var(--cyan); font-weight: 600; }
.item .meta .likes { color: var(--red); }
mark { background: none; color: var(--yellow); box-shadow: inset 0 -.35em rgba(255, 210, 63, .18); }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button, .btn, .actions button, #fine button, dialog button, .row button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  display: inline-block;
}
.tabs button:hover, .btn:hover, .actions button:hover, #fine button:hover, dialog button:hover { border-color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
#random { margin-left: auto; border-color: var(--yellow); color: var(--yellow); }

.episodes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.episodes a {
  display: block;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
  min-height: 92px;
}
.episodes a:hover { border-color: var(--cyan); }
.episodes .num { font: 400 13px "Archivo Black", sans-serif; color: var(--red); letter-spacing: .08em; }
.episodes .t { display: block; font-weight: 800; font-size: 18px; margin: 2px 0 4px; }
.episodes .m { font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------------ épisode */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
#ep-heading { font: 400 28px/1.1 "Archivo Black", sans-serif; margin: 6px 0 14px; }
#ep-heading small { display: block; font: 600 14px Inter, sans-serif; color: var(--red); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; }
.lines .item { display: flex; gap: 12px; align-items: baseline; padding: 8px 12px; }
.lines .tc { font: 12.5px ui-monospace, Consolas, monospace; color: var(--muted); flex: none; width: 52px; }
.lines .txt { font-size: 15.5px; font-weight: 400; }
.lines .item.current { border-color: var(--yellow); }

/* ------------------------------------------------------------------ éditeur */
.ep-link { font-weight: 600; text-decoration: none; color: var(--muted); text-align: right; }
.ep-link:hover { color: var(--cyan); }
.ep-link b { color: var(--red); font-weight: 600; }

.player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: -3px 0 0 rgba(255, 42, 109, .5), 3px 0 0 rgba(5, 217, 232, .5);
}
.player video { width: 100%; height: 100%; display: block; object-fit: contain; }
#subtitle {
  position: absolute;
  left: 6%; right: 6%; bottom: 6%;
  text-align: center;
  font: 800 clamp(15px, 3.6vw, 26px)/1.25 Arial, Inter, sans-serif;
  color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 2px 2px 2px #000, -2px -2px 2px #000, 2px -2px 2px #000, -2px 2px 2px #000;
  pointer-events: none;
}
.overlay { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.overlay button {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  font-weight: 800;
  font-size: 15px;
}
.overlay button[aria-pressed="true"] { background: var(--yellow); color: #000; border-color: var(--yellow); }
.player.paused #play { background: var(--red); border-color: var(--red); }
#loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .55); font-weight: 600; }

#timeline { position: relative; margin: 14px 14px 4px; height: 64px; touch-action: none; user-select: none; }
#lane { position: absolute; left: 0; right: 0; top: 0; height: 18px; }
#lane .blk {
  position: absolute; top: 0; height: 14px;
  border-radius: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  cursor: pointer;
  overflow: hidden;
}
#lane .blk:hover { border-color: var(--cyan); }
#lane .blk.in { background: rgba(5, 217, 232, .25); border-color: rgba(5, 217, 232, .5); }
#track {
  position: absolute; left: 0; right: 0; top: 22px; height: 40px;
  background: repeating-linear-gradient(90deg, var(--panel) 0 9px, var(--panel-2) 9px 10px);
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: pointer;
}
#sel {
  position: absolute; top: -1px; bottom: -1px;
  background: rgba(255, 42, 109, .22);
  border-top: 2px solid var(--red);
  border-bottom: 2px solid var(--red);
}
.handle {
  position: absolute; top: -4px; bottom: -4px; width: 16px;
  background: var(--red);
  border-radius: 6px;
  cursor: ew-resize;
  touch-action: none;
}
.handle::after { content: ""; position: absolute; left: 6px; top: 30%; bottom: 30%; width: 4px; border-left: 1px solid rgba(0,0,0,.5); border-right: 1px solid rgba(0,0,0,.5); }
#h-start { left: -14px; border-radius: 6px 2px 2px 6px; }
#h-end { right: -14px; border-radius: 2px 6px 6px 2px; }
#playhead { position: absolute; top: 18px; bottom: 0; width: 2px; background: var(--yellow); pointer-events: none; box-shadow: 0 0 6px var(--yellow); }
#times { text-align: center; font: 13.5px ui-monospace, Consolas, monospace; margin: 6px 0 14px; }
#times b { color: var(--text); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.actions button { padding: 10px 18px; }
.actions .primary { background: var(--red); border-color: var(--red); color: #fff; }
.actions .primary:hover { border-color: #fff; }
.actions .like[aria-pressed="true"] { color: var(--red); border-color: var(--red); }
.actions button.busy { opacity: .6; cursor: progress; }
.hint { text-align: center; min-height: 1.4em; font-size: 14px; }

#fine { margin-top: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
#fine summary { cursor: pointer; font-weight: 600; }
#fine .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
#fine .row > span { display: inline-flex; gap: 6px; align-items: center; margin-right: 12px; }
#fine button { padding: 6px 12px; font-size: 14px; }
.keys { font-size: 13px; margin: 12px 0 2px; }

/* ------------------------------------------------------------------ dialogues */
dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  max-width: min(520px, 92vw);
}
dialog::backdrop { background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 12px; font: 400 22px "Archivo Black", sans-serif; }
#share-dialog button[data-share] { display: flex; width: 100%; gap: 10px; align-items: baseline; border-radius: 10px; margin-bottom: 8px; text-align: left; }
#share-dialog button[data-share] span { color: var(--muted); font-weight: 400; font-size: 14px; }
#share-dialog button.ready { border-color: var(--yellow); }
dialog form { margin-top: 12px; text-align: right; }
#credits p { font-size: 14.5px; }
.fonts { color: var(--muted); font-size: 13px !important; }

footer { text-align: center; padding: 20px; }
.linklike { background: none; border: 0; color: var(--muted); text-decoration: underline; }

@media (max-width: 520px) {
  .actions button { padding: 9px 13px; }
  #random { margin-left: 0; }
}
