/* Needle Drop : interface. Style cartoon plat : gros contours noirs, ombres decalees, couleurs franches.
   --c0, --c1, --c2 = couleurs de la pochette en cours (mises a jour par main.js) : tout le decor les suit. */
:root {
  --c0: #7b2cbf; --c1: #ff006e; --c2: #3a0ca3;
  --ink: #111014; --paper: #fffdf6; --soft: #6b6676; --line: #e4e0d6;
  --yellow: #ffe14d; --pink: #ff006e; --green: #06d6a0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--c0) 70%, #fff 0%) 0%, color-mix(in srgb, var(--c2) 60%, #000) 60%, #0b0914 100%);
  transition: background 1.2s;
}
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; font-weight: 700; cursor: pointer; border: 3px solid var(--ink); border-radius: 12px; background: #fff;
  color: var(--ink); padding: 9px 16px; box-shadow: 0 4px 0 var(--ink); transition: transform .06s; }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
button.primary { background: var(--yellow); }
button.quiet { border-color: transparent; box-shadow: none; background: transparent; color: var(--soft); font-weight: 600; }
button:disabled { opacity: .45; cursor: default; transform: none; }
kbd { font: 700 11px/1 ui-monospace, Consolas, monospace; padding: 2px 5px; border: 2px solid var(--ink); border-radius: 5px;
  background: #fff; color: var(--ink); margin: 0 1px; }
input { font: inherit; border: 3px solid var(--ink); border-radius: 10px; padding: 8px 10px; background: #fff; color: var(--ink); }
a { color: inherit; }
.sub { color: var(--soft); font-size: 13px; }
.tile { background: var(--paper); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 5px 0 var(--ink); padding: 10px 14px; }

/* ------------------------------------------------------------------ ecrans */
/* flex + marge auto : centre, et defile sans couper le haut quand l ecran est trop bas (telephone couche) */
.screen { position: fixed; inset: 0; display: flex; overflow-y: auto; padding: 16px; z-index: 20;
  background: rgba(11, 9, 20, .45); }
.card { margin: auto; width: min(440px, 100%); background: var(--paper); border: 4px solid var(--ink); border-radius: 22px; padding: 26px 26px 18px;
  box-shadow: 0 8px 0 var(--ink); text-align: center; }
.card.small { width: min(340px, 100%); }
.logo { display: grid; place-items: center; margin-bottom: 4px; }
.logo-disc { width: 96px; height: 96px; border-radius: 50%; border: 4px solid var(--ink);
  background: radial-gradient(circle, var(--ink) 0 6%, var(--pink) 6% 26%, #1a1820 26% 30%, #222029 30% 40%, #1a1820 40% 50%, #222029 50% 60%, #1a1820 60%);
  animation: spin 3s linear infinite; box-shadow: 0 5px 0 var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
h1 { margin: 8px 0 6px; font-size: 40px; font-weight: 900; letter-spacing: -.02em; }
.pitch { margin: 0 0 16px; color: var(--soft); line-height: 1.5; }
.account { font-weight: 700; margin: 0 0 12px; }
.error { color: #d00045; font-weight: 700; margin: 0 0 12px; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.help { list-style: none; padding: 12px 0 0; margin: 16px 0 0; border-top: 2px dashed var(--line); color: var(--soft); font-size: 13px; line-height: 2; }
.credit { font-size: 12px; color: var(--soft); margin: 8px 0 0; }
.links { font-size: 12px; margin: 6px 0 0; }
.links a { color: var(--soft); font-weight: 700; }
button.wide { width: 100%; }

/* ------------------------------------------------------------------ interface en jeu */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > *, #hud button, #hud input { pointer-events: auto; }
#now { position: absolute; left: 12px; top: 12px; display: flex; gap: 12px; align-items: center;
  width: min(480px, calc(100% - 410px)); min-width: 300px; padding: 8px 12px 8px 8px; }
#now-cover { width: 64px; height: 64px; border-radius: 10px; border: 3px solid var(--ink); object-fit: cover; background: var(--c0); flex: none; }
.now-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.now-line { display: flex; gap: 6px; align-items: center; }
.now-line b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.tag { font-size: 10px; font-weight: 900; background: var(--ink); color: #fff; border-radius: 4px; padding: 1px 4px; }
#now-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dj { font-size: 12px; font-weight: 800; color: color-mix(in srgb, var(--c1) 80%, #000); }
.bar { height: 7px; border: 2px solid var(--ink); border-radius: 6px; margin-top: 4px; background: #fff; overflow: hidden; }
#now-bar { height: 100%; width: 0; background: var(--c1); }
.votes { display: flex; flex-direction: column; gap: 5px; }
.votes button { padding: 3px 10px; font-size: 13px; box-shadow: 0 3px 0 var(--ink); }
.votes button.on { background: var(--yellow); }
.votes small { color: var(--soft); font-weight: 600; margin-left: 2px; }
.deezer { position: absolute; right: 12px; bottom: -22px; font-size: 11px; font-weight: 700; color: #fff; text-decoration: none;
  text-shadow: 0 1px 2px #000; }

#stats { position: absolute; left: 12px; top: 124px; min-width: 150px; display: flex; flex-direction: column; }
.label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); }
#vibes { font-size: 26px; font-weight: 900; line-height: 1.1; }
.gold { font-weight: 900; color: #b8860b; }
#dance-state.on { color: color-mix(in srgb, var(--c1) 80%, #000); font-weight: 800; }
#yt-box { position: absolute; right: 12px; top: 12px; padding: 6px; background: var(--ink); }
#yt-player, #yt-box iframe { display: block; width: 356px; height: 200px; border-radius: 10px; }
#play-hint { position: absolute; left: 6px; right: 6px; bottom: 6px; margin: 0; padding: 6px; text-align: center; font-size: 12px; font-weight: 800;
  background: var(--yellow); border-radius: 0 0 10px 10px; pointer-events: none; }
#volume { position: absolute; right: 12px; top: 236px; display: flex; gap: 8px; align-items: center; padding: 6px 12px; }
#volume input { width: 90px; padding: 0; border: 0; }
#dj { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center;
  background: var(--yellow); }
#dj span { font-size: 12px; color: var(--soft); }
#dj { flex-wrap: wrap; justify-content: center; width: min(600px, calc(100% - 24px)); bottom: 66px; }
#dj-mood { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
#dj-mood span { font-weight: 800; color: var(--ink); }
#dj-mood button { padding: 4px 8px; font-size: 12px; box-shadow: 0 3px 0 var(--ink); }
#dj-mood button.on { background: var(--ink); color: #fff; }
#chat { position: absolute; right: 12px; bottom: 12px; width: min(320px, calc(100% - 24px)); padding: 8px; display: flex; flex-direction: column; gap: 6px;
  background: rgba(255, 253, 246, .92); }
#chat-log { list-style: none; margin: 0; padding: 0 4px; max-height: 190px; overflow-y: auto; font-size: 13px; line-height: 1.4; }
#chat-log li { overflow-wrap: anywhere; }
#chat-log b { color: color-mix(in srgb, var(--c2) 70%, #000); }
#chat-log .sys { color: var(--soft); font-style: italic; }
#chat-input { width: 100%; padding: 6px 8px; font-size: 13px; }
#bottom-left { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#bottom-left .tile { padding: 8px 14px; }
#players { font-weight: 700; font-size: 14px; }
#btn-shop { position: relative; }
#shop-dot { position: absolute; top: -7px; right: -7px; width: 16px; height: 16px; border-radius: 50%; background: var(--pink);
  border: 3px solid var(--ink); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }
#crosshair { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 2px var(--ink); pointer-events: none !important; }
#look-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, 40px); background: rgba(17,16,20,.75); color: #fff;
  padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 700; pointer-events: none !important; }
#toasts { position: absolute; left: 12px; top: 260px; display: flex; flex-direction: column; gap: 8px; pointer-events: none !important; }
.toast { background: var(--yellow); border: 3px solid var(--ink); border-radius: 12px; padding: 8px 12px; font-weight: 800;
  box-shadow: 0 4px 0 var(--ink); animation: toast 4.5s forwards; max-width: 280px; }
.toast small { display: block; font-weight: 600; color: #4a4530; }
@keyframes toast { 0% { transform: translateX(-120%); } 8%, 85% { transform: none; opacity: 1; } 100% { opacity: 0; } }

/* ------------------------------------------------------------------ panneaux */
.panel { position: fixed; top: 0; bottom: 0; width: min(400px, 100%); background: var(--paper); z-index: 8; overflow-y: auto;
  padding: 0 18px 24px; border: 4px solid var(--ink); }
#queue { left: 0; border-left: 0; }
#shop { right: 0; border-right: 0; }
.panel header { position: sticky; top: 0; z-index: 2; background: var(--paper); display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0 8px; }
.panel h2 { margin: 0; font-size: 24px; font-weight: 900; }
.panel h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); }
#search-form { display: flex; gap: 8px; }
#search { flex: 1; min-width: 0; }
.tracks { list-style: none; margin: 8px 0 0; padding: 0; }
.tracks li { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 2px dashed var(--line); }
.tracks img { width: 44px; height: 44px; border-radius: 8px; border: 2px solid var(--ink); object-fit: cover; }
.tracks .t { min-width: 0; }
.tracks .t b, .tracks .t span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tracks .t b { font-size: 14px; }
.tracks .t span { font-size: 12px; color: var(--soft); }
.tracks button { padding: 5px 10px; font-size: 13px; box-shadow: 0 3px 0 var(--ink); }
.tracks .mine { background: color-mix(in srgb, var(--yellow) 35%, transparent); }
.tracks li.sub { display: block; }
#chat-log .mod b { color: #c2005a; }

#tabs { position: sticky; top: 56px; z-index: 2; background: var(--paper); display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding-bottom: 10px; }
#tabs button { padding: 7px 2px; font-size: 11px; box-shadow: 0 3px 0 var(--ink); }
#tabs button.on { background: var(--yellow); }
#upgrade-list, #feat-list, .rules, #rates { list-style: none; margin: 0; padding: 0; }
.upgrade { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 10px 0; border-bottom: 2px dashed var(--line); }
.upgrade p { margin: 0; font-size: 13px; color: var(--soft); }
.upgrade .lvl { font-size: 12px; color: var(--soft); margin-left: 6px; }
.upgrade button { grid-row: 1 / span 2; grid-column: 2; min-width: 96px; }
.gold-card { margin: 6px 0 12px; padding: 16px; border: 3px solid var(--ink); border-radius: 16px; text-align: center; background: #fff6d6; box-shadow: 0 4px 0 var(--ink); }
.big-gold { margin: 0 0 4px; font-size: 40px; font-weight: 900; color: #b8860b; }
.rules { padding-left: 18px !important; list-style: disc !important; font-size: 13px; color: var(--soft); line-height: 1.5; }
#crate-box { margin: 6px 0 12px; padding: 18px 14px 12px; border: 3px solid var(--ink); border-radius: 16px; text-align: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c0) 25%, #fff), #fff); box-shadow: 0 4px 0 var(--ink); }
#crate { display: block; width: 100%; height: 190px; margin: -6px 0 4px; }
.crate-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#crate-info { margin: 10px 0 4px; }
#crate-results { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin: 10px 0 0; }
.drop { border: 3px solid var(--ink); border-radius: 12px; padding: 8px; text-align: center; font-size: 12px; background: #fff; animation: pop .35s ease-out backwards; }
.drop canvas { display: block; margin: 0 auto 4px; }
.drop b { display: block; font-size: 13px; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.r-common { border-color: #8e8a99; } .r-rare { border-color: #3a86ff; background: #eaf2ff; }
.r-epic { border-color: #8338ec; background: #f1e9ff; } .r-legendary { border-color: #ffbe0b; background: #fff6d6; box-shadow: 0 0 0 3px #ffbe0b; }
.k-common { color: #6b6676; } .k-rare { color: #1d5fd8; } .k-epic { color: #6a1fd0; } .k-legendary { color: #b8860b; }
.rates { margin-top: 14px; font-size: 13px; color: var(--soft); }
.rates summary { cursor: pointer; font-weight: 700; }
.slot h4 { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--soft); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.grid button { padding: 4px 2px 6px; font-size: 11px; line-height: 1.2; box-shadow: 0 3px 0 var(--ink); }
.grid button canvas { display: block; margin: 0 auto 2px; }
.grid button.on { outline: 4px solid var(--yellow); outline-offset: 1px; }
.grid button:disabled { opacity: .35; filter: grayscale(1); }
.feat { display: flex; gap: 10px; padding: 8px 0; border-bottom: 2px dashed var(--line); font-size: 14px; }
.feat .check { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--line); display: grid; place-items: center; font-size: 12px; }
.feat.done .check { background: var(--green); border-color: var(--ink); }
.feat small { display: block; color: var(--soft); }

@media (max-width: 760px) {
  #now { top: 8px; }
  #stats { top: 100px; min-width: 0; }
  #volume { top: 100px; }
  #chat { width: calc(100% - 24px); bottom: 64px; }
  #chat-log { max-height: 90px; }
  #toasts { top: 200px; }
  kbd { display: none; }
}

/* ------------------------------------------------------------------ telephone et tablette (ecran tactile) */
.touch-only { display: none !important; }
html.touch .touch-only { display: revert !important; }
html.touch .desk-only, html.touch #volume, html.touch #look-hint, html.touch kbd { display: none !important; }
html.touch button { touch-action: manipulation; -webkit-user-select: none; user-select: none; }
html.touch #hud { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
html.touch #now { left: 8px; top: 8px; width: calc(100% - 232px); min-width: 0; padding: 6px 8px 6px 6px; gap: 8px; }
html.touch #now-cover { width: 46px; height: 46px; }
html.touch .now-line b { font-size: 13px; }
html.touch .deezer { bottom: -20px; }
/* le lecteur YouTube : 200 x 200 au minimum (regles de YouTube), en haut a droite */
html.touch #yt-box { right: 8px; top: 8px; padding: 4px; }
html.touch #yt-player, html.touch #yt-box iframe { width: 200px; height: 200px; }
html.touch #stats { left: 8px; top: 96px; padding: 6px 10px; }
html.touch #vibes { font-size: 20px; }
html.touch #toasts { left: 8px; top: 170px; }
html.touch .toast { max-width: 220px; font-size: 13px; }
/* le chat s'ouvre avec le bouton 💬 */
html.touch #chat { display: none; left: 50%; right: auto; top: 96px; bottom: auto; transform: translateX(-50%); width: min(340px, calc(100% - 16px)); z-index: 3; }
html.touch #chat.open { display: flex; }
html.touch #chat-log { max-height: 120px; }
html.touch #bottom-left { left: 50%; bottom: 10px; transform: translateX(-50%); flex-wrap: nowrap; gap: 6px; }
html.touch #bottom-left .tile { padding: 8px 10px; font-size: 14px; }
html.touch #players { display: none; }
html.touch #dj { bottom: 66px; padding: 6px 8px; gap: 6px; }
html.touch #dj button { padding: 6px 8px; font-size: 13px; }
#stick { position: absolute; left: 18px; bottom: 18px; width: 128px; height: 128px; border-radius: 50%;
  background: rgba(255, 253, 246, .22); border: 3px solid rgba(17, 16, 20, .55); touch-action: none; }
#knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); pointer-events: none; }
#touch-buttons { position: absolute; right: 16px; bottom: 18px; gap: 10px; align-items: flex-end; }
html.touch #touch-buttons { display: flex !important; }
#touch-buttons button { width: 72px; height: 72px; border-radius: 50%; padding: 0; font-size: 14px; touch-action: none; }
#t-jump { width: 84px !important; height: 84px !important; }
/* telephone en hauteur : les boutons du milieu remontent au-dessus du joystick */
@media (max-width: 560px) {
  html.touch #now { width: calc(100% - 16px); }
  html.touch #yt-box { top: 96px; }
  html.touch #stats { top: 96px; }
  html.touch #toasts { top: 170px; }
  html.touch #bottom-left { bottom: 160px; }
  html.touch #dj { bottom: 214px; }
  html.touch #chat { top: auto; bottom: 214px; }
}

#search::placeholder { font-size: 14px; }
.keys-card { text-align: left; width: min(520px, 100%); }
.keys-card h2 { margin: 0 0 10px; font-size: 26px; font-weight: 900; }
.keys-list { list-style: none; margin: 0 0 12px; padding: 0; font-size: 14px; }
.keys-list li { display: grid; grid-template-columns: 150px 1fr; gap: 10px; padding: 6px 0; border-bottom: 2px dashed var(--line); }
.keys-list li > span { font-weight: 800; }
.keys-list li > em { font-style: normal; }
html.touch .keys-list.touch-only { display: block !important; }
html.touch #keys kbd { display: inline !important; }
button.google { display: flex; align-items: center; justify-content: center; gap: 10px; }
button.google svg { width: 20px; height: 20px; }
html.touch #bottom-left .tile { white-space: nowrap; }
html.touch #stats { max-width: calc(100% - 232px); }
html.touch #stats .sub { font-size: 12px; }
