/* Écran téléphone : compact, une main, tout au pouce. */
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  font-size: 15px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}
button { cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico .fill { fill: currentColor; stroke: none; }

/* ---------- en-tête ---------- */
.top {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
}
.brand { display: flex; align-items: center; gap: 7px; font-weight: 750; font-size: 19px; letter-spacing: -0.01em; }
.brand .ico { color: var(--accent); width: 22px; height: 22px; }
.link {
  font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-right: auto;
  border: 0; background: none; padding: 6px 0; cursor: default;
}
.link.action { color: var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.link[data-s="ok"]::before { background: var(--ok); }
.link[data-s="notv"]::before { background: var(--accent); }
.link[data-s="off"]::before { background: var(--danger); }
.who {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font-size: 13.5px; font-weight: 600; max-width: 40%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- chanson en cours ---------- */
.now {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px; margin-bottom: 12px;
}
.now-row { display: flex; gap: 12px; align-items: center; }
.now-thumb { width: 72px; height: 40.5px; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.now-text { min-width: 0; }
.now-label { margin: 0; font-size: 12.5px; color: var(--muted); }
.now-label b { color: var(--accent); font-weight: 650; }
.now-title { margin: 2px 0 0; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 4px; border-radius: 2px; background: var(--surface-2); margin-top: 12px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width 1s linear; }
.times { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.controls { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 4px; }
.ctl {
  position: relative; width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: var(--surface-2); display: grid; place-items: center;
  transition: transform 0.12s ease-out, background-color 0.15s;
}
.ctl:active { transform: scale(0.94); }
.ctl.main { width: 56px; height: 56px; background: var(--accent); color: var(--accent-ink); }
.ctl.main .ico { width: 24px; height: 24px; }
.ctl.wide { width: auto; padding: 0 22px; border-radius: 999px; font-weight: 700; }
.ctl .confirm { display: none; }
.ctl.arming { width: auto; padding: 0 14px; border-radius: 999px; background: var(--danger); color: #1c0905; font-weight: 700; gap: 6px; display: flex; }
.ctl.arming .confirm { display: inline; }
.ctl.on { background: var(--accent-soft); color: var(--accent); }
.vol-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.vol-row input { flex: 1; accent-color: var(--accent); }
.vol-row span { width: 2.5em; text-align: right; color: var(--muted); font-size: 13px; }

/* ---------- onglets ---------- */
.tabs {
  position: sticky; top: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 4px; margin: 0 -4px 12px; border-radius: 12px;
  background: rgba(18, 15, 13, 0.9);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.tab {
  border: 0; background: transparent; border-radius: 9px; padding: 9px 4px;
  font-size: 14px; font-weight: 600; color: var(--muted);
}
.tab[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.count { color: var(--accent); }

/* ---------- recherche ---------- */
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 12px; height: 48px;
}
.search:focus-within { border-color: rgba(255, 181, 71, 0.6); }
.search .ico { color: var(--muted); }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent;
  font-size: 16px; /* 16 px : iOS ne zoome pas la page */
}
.search input::-webkit-search-cancel-button { filter: invert(0.7); }
.toggle { display: inline-flex; align-items: center; gap: 8px; margin: 10px 2px 2px; font-size: 13.5px; color: var(--muted); }
.toggle input { accent-color: var(--accent); width: 17px; height: 17px; margin: 0; }
.hint { margin: 0 2px 8px; font-size: 13px; color: var(--muted); }
.msg { margin: 14px 2px; font-size: 14px; color: var(--muted); }
.msg:empty { display: none; }
.msg.error { color: var(--danger); }

/* ---------- listes ---------- */
.list { list-style: none; margin: 6px 0 0; padding: 0; }
.song { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.song:last-child { border-bottom: 0; }
.thumb { width: 96px; height: 54px; object-fit: cover; border-radius: 7px; background: var(--surface-2); flex: none; }
.meta { flex: 1; min-width: 0; }
.title {
  margin: 0; font-size: 14.5px; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sub { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { color: var(--ok); }
.add {
  width: 42px; height: 42px; flex: none; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: grid; place-items: center; transition: transform 0.12s ease-out, background-color 0.15s;
}
.add:active { transform: scale(0.92); }
.add.done { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.add:disabled { cursor: default; }

/* Spotify : choix de la source, attribution, pochettes carrées jamais recadrées (règles Spotify) */
.sources { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.src {
  display: flex; align-items: center; justify-content: center; gap: 7px; height: 42px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  font-size: 14px; font-weight: 650; color: var(--muted);
}
.src small { font-size: 12.5px; font-weight: 500; }
.src[aria-pressed="true"] { background: var(--surface-2); border-color: rgba(247, 241, 232, 0.28); color: var(--text); }
.spi { width: 21px; height: 21px; flex: none; fill: #fff; }
.credit { display: flex; align-items: flex-start; gap: 9px; margin: 12px 2px 2px; font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.thumb.sq { width: 54px; height: 54px; border-radius: 4px; object-fit: contain; margin: 0 21px; }
.splink { display: inline-block; margin-top: 3px; font-size: 12px; font-weight: 650; color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.song.sp .meta { cursor: pointer; }
.song.sp.open .title { -webkit-line-clamp: unset; }
.song.sp.open .sub { white-space: normal; }
.now-thumb.sq { width: 48px; height: 48px; border-radius: 4px; object-fit: contain; }
.spvol-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.spvol-row p { margin: 0; font-size: 13.5px; color: var(--muted); }
.spvol-row b { color: var(--text); margin-left: 4px; }
.spvol-row .ctl { font-size: 22px; font-weight: 600; }

/* file d'attente */
.qitem { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.qitem:last-child { border-bottom: 0; }
.pos { width: 22px; text-align: center; font-weight: 700; color: var(--faint); flex: none; }
.singer { margin: 0; font-size: 13px; font-weight: 700; color: var(--accent); }
.qitem .title { -webkit-line-clamp: 1; }
.status { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.status.ready { color: var(--ok); }
.status.error { color: var(--danger); }
.qbar { display: inline-block; vertical-align: middle; width: 54px; height: 3px; border-radius: 2px; background: var(--surface-2); margin-left: 6px; overflow: hidden; }
.qbar i { display: block; height: 100%; background: var(--muted); }
.qactions { display: flex; gap: 6px; flex: none; }
.iconbtn {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface);
  color: var(--muted); display: grid; place-items: center;
}
.iconbtn .ico { width: 17px; height: 17px; }
.iconbtn.arming { width: auto; padding: 0 12px; border-radius: 999px; background: var(--danger); color: #1c0905; font-size: 13px; font-weight: 700; }

/* ---------- fenêtre du nom ---------- */
.sheet {
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text);
  width: min(420px, calc(100vw - 32px)); padding: 22px;
}
.sheet::backdrop { background: rgba(8, 6, 5, 0.7); }
.sheet h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -0.01em; }
.sheet p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.sheet input {
  width: 100%; height: 50px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); padding: 0 14px; font-size: 18px; font-weight: 600; outline: 0;
}
.sheet input:focus { border-color: var(--accent); }
.primary {
  width: 100%; height: 50px; margin-top: 12px; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font-weight: 750; font-size: 16px;
}

/* ---------- messages ---------- */
.toasts {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 20; pointer-events: none;
  width: calc(100% - 32px); max-width: 420px;
}
.toast {
  background: var(--text); color: var(--bg); border-radius: 12px; padding: 11px 16px;
  font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.toast.error { background: var(--danger); color: #1c0905; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.spin {
  display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 8px;
  border: 2px solid var(--faint); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* « C'est bientôt à toi » */
.cue {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom)); text-align: center; background: var(--bg);
  animation: cue-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.cue[hidden] { display: none; }
.cue-kicker { margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.cue-title { margin: 0; font-size: 40px; line-height: 1.05; font-weight: 800; letter-spacing: -0.02em; }
.cue-song { margin: 14px 0 32px; font-size: 17px; color: var(--muted); }
.cue .primary { min-width: 180px; }
.cue.now { background: var(--accent); color: var(--accent-ink); }
.cue.now .cue-kicker, .cue.now .cue-song { color: var(--accent-ink); }
.cue.now .primary { background: var(--accent-ink); color: var(--accent); }
@keyframes cue-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cue { animation: none; } }
