/* ==========================================================================
   PLAYER — onglets, mini-player, lecture plein écran. Thème "Noir".
   Verre dépoli ("Liquid Glass") sur onglets + mini-player, cf. tokens.css.
   ========================================================================== */

/* ================= ONGLETS ================= */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-tabs);
  display: flex;
  background: var(--glass-1);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--hairline-2);
  box-shadow: var(--glass-edge);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  max-width: 640px; margin: 0 auto;
}
.tab {
  position: relative; /* réf pour ::before (trait actif) et .tab-badge */
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--ink-faint); font-family: var(--font);
  padding: 4px 0 2px; min-height: 44px; /* cible tactile : 42px mesurés avant */
}
.tab-ico { font-size: 22px; }
.tab-txt { font-size: 10px; font-weight: var(--w-medium); letter-spacing: .01em; }
/* onglet actif = icône + label en blanc (convention iOS, pas de trait) */
.tab.is-on { color: var(--ink); }
.tab.is-on .tab-ico { color: var(--red); }
.tab:active { opacity: .6; }
.tab .tab-badge {
  position: absolute; top: 0; left: 50%; margin-left: 6px;
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: var(--w-bold); border-radius: var(--r-round);
  min-width: 15px; height: 15px; line-height: 15px; text-align: center; padding: 0 4px;
}

/* ================= MINI-PLAYER ================= */
.miniplayer {
  position: fixed; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: var(--z-mini); max-width: 624px; margin: 0 auto;
  display: flex; align-items: center; gap: var(--s2);
  background: var(--glass-1);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--hairline-2); border-radius: var(--r-2);
  padding: 8px 8px 11px 8px;
  box-shadow: var(--glass-edge), var(--shadow-2);
  animation: mini-in var(--slow) var(--ease);
}
.miniplayer[hidden] { display: none; }
.mini-cover { background: none; border: none; padding: 0; cursor: pointer; }
.mini-cover canvas { width: 42px; height: 42px; border-radius: 6px; display: block; }
.mini-info {
  flex: 1; min-width: 0; background: none; border: none; padding: 0;
  color: var(--ink); font-family: var(--font); text-align: left; cursor: pointer;
}
.mini-title { display: block; font-size: var(--t-meta); font-weight: var(--w-medium);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-artist { display: block; font-size: 12px; color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* text-overflow:ellipsis (hérité de .mini-title) peint un "…" fixe au bord
   du cadre, qui ne bouge pas avec l'animation -> ça mangeait des lettres
   pendant le défilement. Le clip (pas de "…") + le vrai overflow calculé en
   JS suffisent, le mouvement fait déjà comprendre que ça continue. */
.mini-title.scroll { animation: marquee 9s linear infinite; text-overflow: clip; }
.mini-play {
  width: 42px; height: 42px; border-radius: 50%; border: none;
  background: var(--ink); color: var(--bg); font-size: 17px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.mini-play:active { background: var(--ink-dim); }
/* chargement : la pochette pulse tant que le titre n'est pas prêt */
#np-art.loading { animation: np-pulse 1.1s ease-in-out infinite; }
@keyframes np-pulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  #np-art.loading { animation: none; opacity: .7; }
}

.miniplayer .icon-btn { width: 44px; height: 44px; background: none; }
.mini-progress {
  position: absolute; left: 10px; right: 10px; bottom: 5px; height: 2px;
  background: var(--surface-3); border-radius: 1px; overflow: hidden;
}
.mini-progress i {
  display: block; height: 100%; width: 0%;
  background: var(--red); border-radius: 1px;
}

/* ================= LECTURE PLEIN ÉCRAN ================= */
/* fond = pochette de l'album, floutée et assombrie — donne au verre des
   pilules (Paroles / Télécharger) quelque chose de vivant à flouter. */
#sheet-player { background: var(--bg); }
.np-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.np-bg canvas {
  width: 100%; height: 100%; object-fit: cover;
  filter: blur(60px) brightness(.5) saturate(1.35);
  transform: scale(1.25);
}
.np-bg i {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,10,11,.42), rgba(10,10,11,.62) 45%, rgba(10,10,11,.92));
}
#sheet-player > *:not(.np-bg) { position: relative; z-index: 1; }
.np-top { display: flex; align-items: center; justify-content: space-between; padding-top: 2px; }
.np-context {
  background: none; border: none; padding: 4px; margin: -4px;
  font-family: var(--font); cursor: pointer;
  font-size: var(--t-micro); font-weight: var(--w-bold); letter-spacing: .12em; color: var(--ink-faint);
  max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.np-context:active { color: var(--ink); }
.np-cover-wrap { padding: var(--s5) var(--s4) var(--s4); touch-action: pan-y; }
#np-art {
  display: block;
  width: 100%; max-width: 380px;
  max-height: 42vh; max-height: 42dvh;
  aspect-ratio: 1; object-fit: cover;
  margin: 0 auto;
  border-radius: var(--r-2);
  box-shadow: var(--shadow-2);
}
#np-art.playing { animation: none; }
.np-meta { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s2); }
.np-title { margin: 0; font-size: 22px; font-weight: var(--w-bold); letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { margin: 3px 0 0; color: var(--ink-dim); font-size: var(--t-body);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-src { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s3); min-height: 16px; }
.np-seek { margin-top: var(--s3); }
.np-times { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.np-controls { display: flex; align-items: center; justify-content: space-between; margin-top: var(--s2); padding: 0 var(--s1); }
.np-play {
  width: 64px; height: 64px; border-radius: 50%; border: none;
  background: var(--ink); color: var(--bg); font-size: 26px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.np-play:active { background: var(--ink-dim); }
.np-actions { display: flex; gap: var(--s3); justify-content: center; margin-top: var(--s5); flex-wrap: wrap; }
.np-actions .action-pill { flex: 1 1 0; max-width: 220px; }
.np-vol { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s4); color: var(--ink-faint); }
.np-vol input { flex: 1; }
.np-vol .icon-btn { width: 32px; height: 32px; font-size: 15px; }
#np-repeat[data-mode="one"] { color: var(--red); }

@media (orientation: landscape) and (max-height: 500px) {
  #sheet-player { display: grid; grid-template-columns: 1fr 1.2fr; gap: 0 var(--s4); }
  #sheet-player[hidden] { display: none; }
  .np-top { grid-column: 1 / -1; }
  .np-cover-wrap { padding: var(--s2); }
  .np-actions { grid-column: 1 / -1; margin-top: var(--s2); }
}
