* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #121212; --card: #181818; --card2: #282828; --elev: #2a2a2a;
  --text: #ffffff; --muted: #b3b3b3; --green: #1db954; --green-hi: #1ed760; --err: #f15e6c;
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top);
  overscroll-behavior-y: none;
}
.net {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); right: 16px;
  font-size: 10px; color: var(--green); z-index: 40;
}
.net.off { color: var(--err); }

main { flex: 1; overflow-y: auto; padding: 8px 16px 170px; -webkit-overflow-scrolling: touch; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }

h1 { font-size: 26px; font-weight: 800; letter-spacing: -.4px; margin: 10px 0 14px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.page-head h1 { flex: 1; min-width: 0; }

#search-form { position: sticky; top: 0; padding: 4px 0 12px; background: var(--bg); z-index: 5; }
#search-input {
  width: 100%; padding: 11px 14px; font-size: 16px; font-weight: 500;
  border: none; border-radius: 8px; background: #fff; color: #000; outline: none;
}
#search-input::placeholder { color: #5f5f5f; font-weight: 600; }

.list { display: flex; flex-direction: column; }
.card {
  padding: 8px 0; border-radius: 6px;
  display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: center;
}
/* La cover s'étend sur les deux lignes (titre + boutons) : quasi toute la hauteur de la section. */
.card img.thumb {
  width: 92px; height: 100%; min-height: 92px; grid-row: 1 / span 2; align-self: stretch;
  object-fit: cover; border-radius: 6px; background: #333;
}
.card .title { font-size: 15px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .sub { font-size: 13px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .actions { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

.btn {
  border: none; border-radius: 999px; padding: 7px 14px; font-size: 12px; font-weight: 700;
  background: var(--card2); color: var(--text); cursor: pointer; letter-spacing: .2px;
}
.btn.primary { background: var(--green); color: #000; }
.btn.ok { background: rgba(30, 215, 96, .12); color: var(--green-hi); }
.btn.danger { background: transparent; color: var(--muted); }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: .55; }
.btn:active { transform: scale(.97); }

/* Icônes SVG dans les boutons */
.btn svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 3px; }
.btn.icon {
  display: inline-flex; align-items: center; justify-content: center;
  height: 33px; min-width: 38px; padding: 0 10px; font-size: 11px;
}
.btn.icon svg { width: 17px; height: 17px; margin: 0; }
.card .title svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 2px; }
dialog .opt svg { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
#pl-new svg { width: 13px; height: 13px; vertical-align: -2px; }

.player {
  position: fixed; left: 8px; right: 8px; bottom: calc(62px + env(safe-area-inset-bottom));
  background: var(--elev); border-radius: 8px; padding: 8px 10px 10px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.6); z-index: 20; overflow: hidden;
}
.player img { width: 40px; height: 40px; border-radius: 4px; object-fit: cover; background: #333; }
.pl-meta { flex: 1; min-width: 0; }
.pl-track { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbtn { background: none; border: none; color: var(--text); padding: 6px; cursor: pointer; line-height: 0; }
.pbtn svg { width: 22px; height: 22px; }
.pbtn.big svg { width: 28px; height: 28px; }
.pl-bar { position: absolute; left: 10px; right: 10px; bottom: 4px; height: 2px; background: rgba(255,255,255,.18); border-radius: 2px; }
.pl-bar-fill { height: 100%; width: 0%; background: var(--green-hi); border-radius: 2px; }

nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex;
  background: linear-gradient(to top, #000 65%, rgba(0,0,0,.86));
  backdrop-filter: blur(16px);
  padding: 6px 0 calc(4px + env(safe-area-inset-bottom));
  z-index: 30;
}
.tab {
  flex: 1; background: none; border: none; color: var(--muted);
  padding: 4px 0 2px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer;
}
.tab svg { width: 24px; height: 24px; }
.tab span { font-size: 10px; font-weight: 500; letter-spacing: .1px; }
.tab.active { color: var(--text); }

/* Lecture en cours — plein écran */
.np {
  position: fixed; inset: 0; z-index: 40; background: var(--bg);
  display: flex; flex-direction: column; gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) 24px calc(30px + env(safe-area-inset-bottom));
  transform: translateY(100%); visibility: hidden;
  transition: transform .3s ease, visibility .3s;
}
.np.show { transform: none; visibility: visible; }
.np-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: auto; }
.np-spacer { width: 42px; }
.np-btn { background: none; border: none; color: var(--text); padding: 8px; cursor: pointer; line-height: 0; }
.np-btn svg { width: 26px; height: 26px; }
.np-cover {
  width: min(86vw, 46vh); aspect-ratio: 1/1; object-fit: cover; display: block;
  margin: 0 auto; border-radius: 10px; background: #333;
  box-shadow: 0 20px 55px rgba(0,0,0,.55);
}
.np-info { margin-top: 8px; }
.np-title {
  font-size: 21px; font-weight: 800; line-height: 1.25; letter-spacing: -.2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.np-channel { font-size: 15px; margin-top: 3px; }
.np-bar { position: relative; height: 4px; background: rgba(255,255,255,.22); border-radius: 4px; touch-action: none; }
.np-bar::before { content: ''; position: absolute; left: 0; right: 0; top: -14px; bottom: -14px; } /* zone tactile élargie */
.np-fill { height: 100%; width: 0; background: #fff; border-radius: 4px; position: relative; }
.np-fill::after {
  content: ''; position: absolute; right: -5px; top: 50%; transform: translateY(-50%);
  width: 10px; height: 10px; border-radius: 50%; background: #fff;
}
.np-times { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; }
.np-controls { display: flex; align-items: center; justify-content: space-evenly; margin-top: 2px; }
.np-controls .np-btn svg { width: 32px; height: 32px; }
.np-toggle {
  width: 68px; height: 68px; border-radius: 50%; border: none;
  background: #fff; color: #000; display: grid; place-items: center; cursor: pointer;
}
.np-toggle svg { width: 30px; height: 30px; }
.np-toggle:active { transform: scale(.96); }

.video-overlay {
  position: fixed; inset: 0; background: #000; z-index: 50;
  display: flex; flex-direction: column; justify-content: center;
}
.video-overlay video { width: 100%; max-height: 80vh; }
.video-close {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 14px;
  background: rgba(255,255,255,.12); color: #fff; border: none; border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 700;
}
.video-close svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }

dialog {
  border: none; border-radius: 12px; background: var(--card2); color: var(--text);
  width: min(92vw, 360px); padding: 18px; margin: auto;
}
dialog::backdrop { background: rgba(0,0,0,.7); }
dialog h3 { font-size: 16px; font-weight: 800; margin-bottom: 12px; }
dialog .opt { display: block; width: 100%; text-align: left; margin-bottom: 8px; padding: 11px 14px; font-size: 14px; }
dialog input.btn { background: #3e3e3e; font-weight: 500; }

.seg { display: flex; gap: 8px; margin: 2px 0 12px; }
.seg-btn {
  flex: 1; padding: 9px 0; border: none; border-radius: 999px;
  background: var(--card2); color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer;
}
.seg-btn.active { background: var(--green); color: #000; }
.seg-btn:active { transform: scale(.98); }

.empty { text-align: center; color: var(--muted); padding: 48px 20px; font-size: 14px; line-height: 1.6; }
.badge {
  font-size: 9px; font-weight: 800; letter-spacing: .6px; padding: 2px 6px; border-radius: 3px;
  background: var(--card2); color: var(--muted); vertical-align: 2px;
}
