/*!
 * KaraDicky — feuille de style
 * Direction : l'écran de karaoké d'autrefois. Fond bleu, paroles blanches détourées d'encre,
 * balayage rose qui se remplit au fil de la chanson, papier blanc pour le code d'entrée.
 */
@font-face {
  font-family: "Bagel Fat One";
  src: url("../assets/fonts/bagel-fat-one-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("../assets/fonts/dm-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 1000; font-style: normal; font-display: swap;
}
@property --p { syntax: "<percentage>"; inherits: false; initial-value: 0%; }

:root {
  --screen: #3817a6;
  --deep: #261492;
  --ink: #130a45;
  --white: #ffffff;
  --cream: #f7eddc;
  --pink: #ff5fa8;
  --pink-text: #ff9fc8;
  --hot: #ff5fa2;
  --hot-dark: #b8336f;
  --line: rgba(255, 255, 255, .26);
  --muted: rgba(255, 255, 255, .74);
  --display: "Bagel Fat One", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1.6px 1.6px at 12% 18%, rgba(255,255,255,0.9), transparent 60%) 0 0 / 460px 460px repeat,
    radial-gradient(1.1px 1.1px at 33% 64%, rgba(255,255,255,0.7), transparent 60%) 0 0 / 460px 460px repeat,
    radial-gradient(1.6px 1.6px at 71% 27%, rgba(255,255,255,0.8), transparent 60%) 0 0 / 460px 460px repeat,
    radial-gradient(1.1px 1.1px at 88% 72%, rgba(255,255,255,0.6), transparent 60%) 0 0 / 460px 460px repeat,
    radial-gradient(2.1px 2.1px at 54% 90%, rgba(255,160,200,0.8), transparent 60%) 0 0 / 460px 460px repeat,
    radial-gradient(1.1px 1.1px at 46% 40%, rgba(255,255,255,0.55), transparent 60%) 0 0 / 460px 460px repeat,
    radial-gradient(130% 70% at 50% 0%, #3d1db8 0%, #261492 55%, #1b0c70 100%) no-repeat;
  background-color: var(--deep);
  color: var(--white);
  font: 400 1rem/1.5 var(--body);
}
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 6px; }
a { color: var(--pink-text); }
h1, h2, h3, p { margin: 0; }
h2 { font: 400 1.7rem/1.15 var(--display); letter-spacing: .01em; margin-bottom: 14px; }
.count { font-size: 1.1rem; color: var(--pink-text); margin-left: .35em; }
.grow { flex: 1 1 auto; }
.muted { color: var(--muted); }

/* ---------- Texte « paroles » : blanc détouré d'encre, balayage rose ---------- */
.lyric { position: relative; display: inline-block; font-family: var(--display); line-height: 1.04; isolation: isolate; }
.lyric::before {
  content: attr(data-t);
  position: absolute; inset: 0; z-index: 0;
  color: var(--ink); -webkit-text-stroke: .2em var(--ink);
  pointer-events: none;
}
.lyric::after {
  content: attr(data-t);
  position: absolute; inset: 0; z-index: -1;
  color: var(--pink); -webkit-text-stroke: .36em var(--pink);
  pointer-events: none;
}
.lyric-fill {
  position: relative; z-index: 1; display: inline-block;
  background: linear-gradient(90deg, var(--pink) var(--p), var(--cream) var(--p));
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  transition: --p .6s linear;
}
.brand { font-weight: 400; margin: 0; }
.brand.sm { font-size: 1.55rem; display: inline-block; transform: rotate(-2.5deg); }
.brand.sm .lyric::before { -webkit-text-stroke-width: .26em; }
.brand.sm .lyric::after { -webkit-text-stroke-width: .46em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Boutons et champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: .75rem 1.2rem;
  font: 700 1rem/1.1 var(--body); color: var(--white);
  background: transparent; border: 2px solid var(--line); border-radius: 14px;
  cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.btn:hover { border-color: rgba(255, 255, 255, .6); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: var(--hot); color: var(--ink); border-color: var(--hot);
  box-shadow: 0 4px 0 var(--hot-dark);
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--hot-dark); }
.btn.primary:disabled { box-shadow: none; background: rgba(255, 255, 255, .14); color: var(--muted); border-color: transparent; opacity: 1; }
.btn.big { min-height: 60px; font-size: 1.2rem; border-radius: 16px; width: 100%; }
.btn.sm { min-height: 40px; padding: .5rem .9rem; font-size: .92rem; border-radius: 11px; }
.btn.ghost { border-color: transparent; background: rgba(255, 255, 255, .1); }
.btn.light { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--pink-text); border-color: rgba(255, 140, 196, .55); }

input[type="text"], input:not([type]), input[type="search"], input[type="password"], select {
  width: 100%; min-height: 48px; padding: .7rem .95rem;
  font: 500 1rem/1.3 var(--body); color: var(--white);
  background: var(--ink); border: 2px solid var(--line); border-radius: 12px;
}
input::placeholder { color: rgba(255, 255, 255, .5); }
input:focus-visible, select:focus-visible { outline: 3px solid #fff; outline-offset: 2px; border-color: #fff; }
.code-in { font: 400 1.7rem/1 var(--display); letter-spacing: .22em; text-transform: uppercase; text-align: left; }
label { font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 6px; }
.hint { font-size: .9rem; color: var(--muted); }
.err { min-height: 1.4em; color: var(--pink-text); font-weight: 600; }
.row { display: flex; gap: 10px; align-items: stretch; }
.row.wrap { flex-wrap: wrap; }
.check { display: flex; gap: 12px; align-items: center; font-weight: 600; min-height: 44px; cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--hot); flex: none; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(135deg, #fff 50%, transparent 50%); background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 2.2rem; }

/* ---------- Écrans ---------- */
.view { min-height: 100dvh; }

.home { display: flex; align-items: center; }
.home-in { text-align: center; align-items: center; width: 100%; max-width: 560px; margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 22px; }
.hero { display: block; width: min(100%, 460px); height: auto; margin: 0 0 6px; filter: drop-shadow(0 6px 18px rgba(15,11,32,.45)); }
.tag { font-size: 1.2rem; line-height: 1.45; max-width: 30ch; margin-inline: auto; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 22px; margin-top: 6px; }
.join-inline { display: flex; flex-direction: column; gap: 8px; padding-top: 22px; border-top: 2px solid var(--line); }
.join-inline .row .code-in { flex: 1 1 auto; min-width: 0; }
.foot { font-size: .88rem; color: var(--muted); }

.resume { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 2px solid var(--line); border-radius: 14px; }
.resume p { font-weight: 700; }
.resume .row { flex-wrap: wrap; }

.narrow-in { max-width: 520px; margin: 0 auto; padding: max(22px, env(safe-area-inset-top)) 22px 40px; display: flex; flex-direction: column; gap: 22px; align-items: flex-start; }
.narrow-in .form { width: 100%; }
.form { display: flex; flex-direction: column; gap: 20px; }

.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: max(12px, env(safe-area-inset-top)) clamp(14px, 3vw, 36px) 12px;
  border-bottom: 2px solid var(--line); background: rgba(19, 10, 69, .62);
  position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px);
}
.chip { font-weight: 600; font-size: .95rem; padding: .3rem .7rem; border: 2px solid var(--line); border-radius: 999px; }
.chip b { font-family: var(--display); font-weight: 400; letter-spacing: .12em; color: var(--pink-text); margin-left: .25em; }
.conn { font-size: .85rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.conn::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #62f0a0; }
.conn.off { color: var(--pink-text); }
.conn.off::before { background: var(--pink); }

/* Onglets */
.tabs { display: flex; gap: 6px; }
.tab {
  font: 700 1rem/1 var(--body); color: var(--muted); background: none; border: 0;
  padding: .8rem .9rem; cursor: pointer; border-bottom: 4px solid transparent; margin-bottom: -14px;
}
.tab[aria-selected="true"] { color: #fff; border-bottom-color: var(--hot); }
.badge { display: inline-block; min-width: 1.7em; padding: .1em .45em; margin-left: .3em; border-radius: 999px; background: var(--pink); color: var(--ink); font-size: .85rem; text-align: center; }

/* Listes « paroles » : le rang compte, donc il est numéroté */
.lines { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.line { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line:first-child { border-top: 1px solid var(--line); }
.num { font: 400 1.5rem/1 var(--display); color: var(--pink-text); }
.t { font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.s { font-size: .95rem; color: var(--pink-text); font-weight: 600; }
.line.mine { border-left: 5px solid var(--hot); padding-left: 12px; margin-left: -17px; }
.line .acts { display: flex; gap: 6px; }
.empty { color: var(--muted); padding: 14px 0; }
.mini { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .1); border: 0; border-radius: 10px; color: #fff; cursor: pointer; }
.mini:hover:not(:disabled) { background: rgba(255, 255, 255, .22); }
.mini:disabled { opacity: .3; cursor: default; }
.mini.warn { color: var(--pink-text); }
.mini.go { background: var(--hot); color: var(--ink); }

/* ---------- Chanteur ---------- */
.col { max-width: 560px; margin: 0 auto; padding: 22px 18px 70px; display: flex; flex-direction: column; gap: 34px; }
.banner { padding: 16px 18px; border-radius: 14px; background: var(--hot); color: var(--ink); font: 400 1.5rem/1.15 var(--display); box-shadow: 0 4px 0 var(--hot-dark); }
.banner small { display: block; font: 600 .95rem/1.35 var(--body); margin-top: 4px; }
.onstage { display: flex; flex-direction: column; gap: 6px; padding-bottom: 6px; }
.onstage .who { font-size: 2.2rem; }
.onstage .what { font-weight: 600; color: var(--muted); }
.onstage .lyric-fill { --p: 100%; }

/* Formulaire d'ajout (chanteur + admin) */
.addform { display: flex; flex-direction: column; gap: 14px; }
.addform .or-search { display: flex; gap: 10px; }
.addform .preview { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: start; }
.addform .preview img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--ink); display: block; }
.addform .preview.nothumb { grid-template-columns: minmax(0, 1fr); }
.result.nothumb { grid-template-columns: minmax(0, 1fr); }
.addform .help { font-size: .92rem; color: var(--muted); }
.addform .msg { min-height: 1.3em; font-weight: 600; color: var(--pink-text); }
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.result { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; width: 100%; text-align: left; padding: 8px; background: rgba(255, 255, 255, .08); border: 2px solid transparent; border-radius: 12px; color: #fff; font: inherit; cursor: pointer; }
.result:hover { border-color: var(--hot); }
.result img { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; display: block; }
.result b { display: block; line-height: 1.25; }
.result span { font-size: .88rem; color: var(--pink-text); }

/* ---------- Admin : scène ---------- */
.admin main { max-width: 1560px; margin: 0 auto; padding: 22px clamp(14px, 3vw, 36px) 48px; }
.panel.tabhidden { position: absolute; left: -200vw; top: 0; width: 100%; pointer-events: none; }
.stage-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 30px; align-items: start; }
.player-wrap { position: relative; aspect-ratio: 16 / 9; background: var(--screen); border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; }
.player-wrap #yt, .player-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.overlay { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: clamp(18px, 4vw, 56px); background: var(--screen); }
.overlay .ov-big { font-size: clamp(1.9rem, 5.2vw, 4.4rem); }
.overlay .ov-sub { font-size: clamp(1rem, 2vw, 1.5rem); font-weight: 600; max-width: 42ch; }
.overlay .ov-count { font: 400 clamp(4rem, 14vw, 10rem)/1 var(--display); color: var(--cream); -webkit-text-stroke: .08em var(--ink); paint-order: stroke fill; }
.overlay .btn { align-self: flex-start; }
.overlay .lyric-fill { --p: 100%; }
.nowbar { display: flex; gap: 18px; align-items: center; justify-content: space-between; padding: 18px 2px 0; min-height: 96px; }
.nowtext { min-width: 0; }
.now-title { font-size: clamp(1.4rem, 2.6vw, 2.3rem); }
.now-title .lyric { max-width: 100%; }
.now-title .lyric-fill { white-space: normal; }
.now-singer { margin-top: 6px; font-size: 1.15rem; font-weight: 700; color: var(--pink-text); }
.ctl { display: flex; gap: 10px; flex: none; }
.round { width: 54px; height: 54px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--hot); color: var(--ink); border: 0; cursor: pointer; box-shadow: 0 4px 0 var(--hot-dark); }
.round:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--hot-dark); }
.round svg { width: 26px; height: 26px; }
#c-stop, #c-next { background: rgba(255, 255, 255, .14); color: #fff; box-shadow: none; }
#c-stop:active, #c-next:active { transform: none; }

.stage-side { display: flex; flex-direction: column; gap: 30px; }
.slip { position: relative; background: #fff; color: var(--ink); padding: 20px 20px 22px; border-radius: 6px 6px 0 0; text-align: left; display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.slip::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 12px; background: linear-gradient(135deg, #fff 50%, transparent 50%) 0 0 / 16px 12px repeat-x, linear-gradient(225deg, #fff 50%, transparent 50%) 0 0 / 16px 12px repeat-x; }
.qr { width: min(100%, 280px); align-self: center; }
.qr svg { display: block; width: 100%; height: auto; }
.slip-line { font-weight: 600; font-size: .95rem; margin-top: 10px; }
.slip-url { font-weight: 800; font-size: 1.05rem; overflow-wrap: anywhere; }
.slip-code { font: 400 3.2rem/1.05 var(--display); letter-spacing: .14em; }
.slip .btn { margin-top: 12px; align-self: flex-start; }

/* ---------- Admin : file d'attente ---------- */
.queue-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 36px; align-items: start; }
.queue-side { display: flex; flex-direction: column; gap: 34px; }
.settings { display: flex; flex-direction: column; gap: 16px; }
.strip { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 14px 16px; margin-bottom: 26px; background: var(--ink); border-radius: 12px; border-left: 6px solid var(--pink); }
.strip .t { -webkit-line-clamp: 1; }
.admin-lines .line { grid-template-columns: 2.4rem minmax(0, 1fr) auto; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 20px); max-width: min(92vw, 480px); padding: .8rem 1.1rem; background: var(--ink); border-left: 6px solid var(--hot); border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Écrans étroits ---------- */
@media (max-width: 1020px) {
  .stage-grid, .queue-grid { grid-template-columns: minmax(0, 1fr); }
  .stage-side { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 28px; align-items: start; }
}
@media (max-width: 680px) {
  .stage-side { display: flex; }
  .slip { align-self: stretch; }
  .tab { padding: .7rem .6rem; font-size: .95rem; }
  .nowbar { flex-direction: column; align-items: flex-start; }
  .line { grid-template-columns: 2rem minmax(0, 1fr) auto; gap: 10px; }
  .admin-lines .line { grid-template-columns: 2rem minmax(0, 1fr); }
  .admin-lines .line .acts { grid-column: 2; }
  .line.mine { margin-left: -12px; padding-left: 8px; }
  .addform .preview { grid-template-columns: 96px minmax(0, 1fr); }
  .addform .preview img { width: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  .lyric-fill, .toast { transition: none; }
}

/* accueil centré */
.home-in .stack, .home-in .resume { width: 100%; }
.join-inline { align-items: center; text-align: center; }
.join-inline .row { width: 100%; }
.resume .row { justify-content: center; }
.home-in .hero { margin-inline: auto; }
.home-in .err { text-align: center; }
/* chansons non lisibles (Karafun) */
.tag-ext { display: inline-block; margin-left: .5em; padding: .05rem .5rem; border: 2px solid var(--line); border-radius: 999px; font-size: .78rem; font-weight: 700; color: var(--pink-text); }
.ov-link { color: var(--pink-text); font-weight: 600; }
/* mode admin */
.adm-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.adm-list li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px; }
.adm-list .info { flex: 1 1 auto; min-width: 0; }
.adm-list .c { font-family: var(--display); letter-spacing: .12em; color: var(--pink-text); font-size: 1.2rem; }
.adm-list .d { font-size: .9rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#adm-lobby { width: 100%; }
.hist { opacity: .85; }
#h-hist, #s-hist { margin-top: 28px; }
.overlay .row { justify-content: flex-start; }
.foot { line-height: 1.7; }
#adm-secret { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
/* fenêtre d'information */
.modal-bg { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(10, 6, 40, .72); }
.modal { width: 100%; max-width: 440px; max-height: 90vh; overflow: auto; padding: 22px; border: 2px solid var(--line); border-radius: 18px; background: #1b0c70; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .5); }
.modal h2 { margin: 0; }
.modal .steps { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 8px; }
