/* The wall screen: a tablet or TV showing what plays, with big touch controls.
   Idle (nothing playing, or paused a while): a dimmed clock; a tap wakes it. */
:root {
  --bg: #000; --text: #F4F1EA; --muted: #B7B2A8; --faint: #6F6B64; --red: #E63B2E; --yellow: #F2C230;
  --display: "Jost", "Futura", "Century Gothic", sans-serif; --ui: "Inter", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.4 var(--ui); overflow: hidden;
  -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

/* the wallpaper and grain: shared/wallpaper.css. While the idle clock shows, nothing in it drifts */
body.idle .wp { --wp: still; }
.stage { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 5vw; align-items: center;
  padding: max(5vh, env(safe-area-inset-top)) 5vw max(5vh, env(safe-area-inset-bottom)); transition: opacity .6s; }
.stage.nolyrics { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
.left { display: flex; flex-direction: column; gap: 2.6vh; min-width: 0; align-items: center; text-align: center; }
.cover { width: min(38vw, 44vh); aspect-ratio: 1; object-fit: cover; background: #222; box-shadow: 0 30px 80px #000a; display: block; }
.nolyrics .cover { width: min(70vw, 44vh); }
/* the cover takes gestures (wall.js): tap a half for previous or next, double-tap to like, drag up or down for the volume */
.art { position: relative; touch-action: none; }
body.noctrls .art { touch-action: auto; }
.hint { position: absolute; top: 50%; width: 22%; aspect-ratio: 1; margin-top: -11%; border-radius: 50%; display: grid; place-items: center; background: #000a;
  color: var(--text); font: 700 clamp(18px, 2.4vw, 34px) var(--display); opacity: 0; pointer-events: none; }
.hint.l { left: 8%; }
.hint.r { right: 8%; }
.hint.c { left: 39%; }
.hint svg { width: 46%; height: 46%; }
.hint.go { animation: hint .7s ease-out; }
@keyframes hint { 0% { opacity: 0; transform: scale(.7); } 25% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.1); } }
.hint.hold { opacity: 1; }
.title { font: 700 clamp(24px, min(3.6vw, 5.6vh), 50px)/1.08 var(--display); margin: 0; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.artist { font: 500 clamp(16px, min(2vw, 3vh), 26px)/1.2 var(--ui); color: var(--muted); margin-top: .5vh;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.prog { width: 100%; max-width: min(38vw, 44vh); height: 6px; background: #ffffff26; position: relative; }
.nolyrics .prog { max-width: min(70vw, 44vh); }
.prog i { position: absolute; inset: 0; background: var(--yellow); transform-origin: left; transform: scaleX(0); transition: transform 1s linear; }
.times { display: flex; justify-content: space-between; width: 100%; max-width: min(38vw, 44vh); font: 600 14px var(--display); color: var(--faint);
  letter-spacing: .06em; margin-top: -2vh; font-variant-numeric: tabular-nums; }
.nolyrics .times { max-width: min(70vw, 44vh); }
/* --b is one button: 6 buttons, the bigger play button, the volume and the gaps come to about 9 of them,
   which stays inside the left column (42.5vw) next to the lyrics */
.ctrls { --b: clamp(40px, min(4.4vw, 7vh), 76px); display: flex; align-items: center; gap: calc(var(--b) * .25); }
.ctrls button { width: var(--b); height: var(--b); flex: none; display: grid; place-items: center; border-radius: 50%; transition: background .15s, transform .25s cubic-bezier(.32, .72, 0, 1); }
.ctrls button:active { transform: scale(.92); transition-duration: .08s; }   /* a press shows at once and lets go gently */
@media (hover: hover) { .ctrls button:hover { background: #ffffff14; } }
.ctrls .play { background: var(--red); width: calc(var(--b) * 1.35); height: calc(var(--b) * 1.35); }
@media (hover: hover) { .ctrls .play:hover { background: var(--red); filter: brightness(1.1); } }
.ctrls svg { width: 46%; height: 46%; }
.ctrls .like.on { color: var(--red); }
.ctrls .like.on path { fill: currentColor; }
.by { color: var(--faint); font: 600 clamp(12px, 1.4vw, 16px) var(--display); letter-spacing: .12em; text-transform: uppercase; margin-top: 1vh; }
.next { width: 100%; max-width: min(38vw, 44vh); color: var(--muted); font-size: clamp(13px, 1.5vw, 17px); text-align: center; }
.nolyrics .next { max-width: min(70vw, 44vh); }
.next b { display: block; color: var(--faint); font: 600 11px var(--display); letter-spacing: .14em; text-transform: uppercase; margin-bottom: .6vh; }
.next span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next i { color: var(--faint); font-style: normal; }
/* what the admin left out of the wall */
body.noctrls .ctrls { display: none; }
body.noclock .clock b, body.noclock .clock span { display: none; }
.vol { font: 700 13px var(--display); color: var(--muted); min-width: 36px; text-align: center; font-variant-numeric: tabular-nums; }

/* the lyrics scroll for real: a finger or the wheel goes through them, and wall.js follows the line sung again a moment after */
.lyr { height: 84vh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; touch-action: pan-y; position: relative; padding-right: 5%; mask-image: linear-gradient(transparent, #000 18%, #000 70%, transparent);
  -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 70%, transparent); }
.lyr::-webkit-scrollbar { display: none; }
.lyr .in { position: relative; padding: 30vh 0 50vh; }
.lyr.plain .in { padding: 12vh 0 30vh; }
.lyr p { margin: 0; padding: .5vh 0; font: 700 clamp(22px, 3.1vw, 44px)/1.25 var(--display); color: #ffffff4d; transition: color .3s, transform .3s; transform-origin: left center; }
.lyr p.past { color: #ffffff2e; }
.lyr p.on { color: var(--text); transform: scale(1.04); }
.lyr p.gap { height: 3vh; }
body:not(.noctrls) .lyr:not(.plain) p { cursor: pointer; }
.lyr.plain p { font-size: clamp(18px, 2.2vw, 30px); color: var(--muted); }

.clock { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; transition: opacity .8s; }
.clock b { font: 600 clamp(90px, 22vw, 300px)/1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.clock span { font: 500 clamp(18px, 3vw, 36px) var(--display); color: var(--muted); letter-spacing: .14em; text-transform: uppercase; margin-top: 2vh; }
.clock small { color: var(--faint); margin-top: 3vh; font-size: clamp(14px, 1.6vw, 20px); }
.dim { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity 1.5s; }
body.idle .dim { opacity: .55; }
body.night .dim { opacity: .78; }
body.night .clock small { color: var(--muted); }
/* the join code (wall.js): in the idle screen's corner, and in the Add songs panel; never over a song
   playing, and not at night. Dark on light, which every phone camera reads. */
.join { position: fixed; right: max(24px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom)); z-index: 4; display: flex; align-items: center; gap: 14px; }
body:not(.idle) .join, body.night .join { display: none; }
.join .qr, .fjoin .qr { width: clamp(84px, 9vh, 140px); aspect-ratio: 1; padding: 8px; background: #8e8a83; border-radius: 10px; flex: none; }
/* soft grey and near-black, not white and black: still plenty for a phone camera, without glaring on a dark wall */
.join .qr svg rect, .fjoin .qr svg rect { fill: transparent; }
.join .qr svg path, .fjoin .qr svg path { fill: #141414; }
.join .qr svg, .fjoin .qr svg { display: block; width: 100%; height: 100%; }
.join span { order: -1; font: 600 clamp(11px, 1vw, 13px)/1.4 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); text-align: right; max-width: 10em; }
/* the burn-in shift (wall.js): what stays put drifts a few pixels, slowly */
.stage, .clock, .corner { translate: var(--sx, 0) var(--sy, 0); transition: opacity .6s, translate 4s ease-in-out; }
body.idle .stage { opacity: 0; pointer-events: none; }
body:not(.idle) .clock { opacity: 0; pointer-events: none; }
.corner { position: fixed; top: max(14px, env(safe-area-inset-top)); right: max(14px, env(safe-area-inset-right)); display: flex; gap: 8px; z-index: 5; }
.corner button, .corner a { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; color: var(--text);
  background: #ffffff14; opacity: .6; transition: opacity .3s, background .2s, transform .25s cubic-bezier(.32, .72, 0, 1); }
.corner svg { width: 24px; height: 24px; }
.corner button:active, .corner a:active { transform: scale(.94); transition-duration: .08s; }
@media (hover: hover) { .corner button:hover, .corner a:hover { opacity: 1; background: #ffffff2e; } }
/* leaving counts down: the X gives way to the presses still needed */
.corner .exit b { display: none; font: 700 22px var(--display); }
.corner .exit.counting { opacity: 1; background: var(--red); }
.corner .exit.counting svg { display: none; }
.corner .exit.counting b { display: block; }
/* full screen: the button goes while it is (Escape, or the browser's own, leaves) */
:fullscreen #fsBtn { display: none; }
/* lyrics shown or not, on this wall (wall.js): struck through while hidden; gone where there are none to show */
.lyr-btn .off { display: none; }
.lyr-btn.hidden-lyrics .off { display: inline; }
body.nolyricsfeat .lyr-btn { display: none; }
.fs-out { display: none; }
:fullscreen .fs-in { display: none; }
:fullscreen .fs-out { display: inline; }
body.noctrls .corner .find-btn { display: none; }

/* fingers: never below a 48 px target; the buttons wrap rather than squeeze the lyrics */
@media (pointer: coarse) {
  .ctrls { --b: clamp(48px, min(4.4vw, 7vh), 80px); flex-wrap: wrap; row-gap: 1.5vh; }
  .corner button, .corner a { width: 60px; height: 60px; }
}
.msg { position: fixed; left: 50%; bottom: 3vh; transform: translateX(-50%); color: var(--yellow); font: 600 14px var(--display); letter-spacing: .1em; text-transform: uppercase; }

@media (orientation: portrait) {
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); align-items: start; gap: 3vh; padding-top: max(8vh, env(safe-area-inset-top)); }
  .left { align-items: center; text-align: center; }
  .cover, .nolyrics .cover { width: min(78vw, 42vh); }
  .prog, .times, .next, .nolyrics .prog, .nolyrics .times, .nolyrics .next { max-width: min(78vw, 42vh); }
  .lyr { height: 34vh; text-align: center; }
  .lyr p { transform-origin: center; }
  .ctrls { --b: clamp(40px, min(9vw, 7vh), 76px); }
}
/* less motion: nothing slides or grows; the fades and the progress bar stay */
@media (prefers-reduced-motion: reduce) {
  .hint.go { animation-duration: .01s; }
  .lyr p { transition: color .3s; }
  .lyr p.on { transform: none; }
  .ctrls button:active { transform: none; opacity: .7; }
}

/* the server stopped answering (shared/playback.js) */
#offline { display: none; }
html[data-offline] #offline { display: block; position: fixed; top: 0; left: 0; right: 0; z-index: 10; padding: 10px 16px; background: var(--yellow); color: #111;
  font: 600 clamp(13px, 1.4vw, 18px) var(--display); letter-spacing: .08em; text-transform: uppercase; text-align: center; }
html[data-offline] .ctrls, html[data-offline] .art { opacity: .5; pointer-events: none; }

/* adding songs (wall.js): a full screen search, with rows and buttons sized for a finger across a room */
.find { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; background: #000d; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  padding: max(3vh, env(safe-area-inset-top)) 5vw max(3vh, env(safe-area-inset-bottom)); gap: 2vh; }
.fhead { display: flex; gap: 12px; align-items: center; }
/* the search bar: a pill with the magnifier inside it, the field filling the rest */
.fbar { flex: 1; min-width: 0; height: clamp(56px, 8vh, 80px); display: flex; align-items: center; gap: 14px; padding: 0 26px; border-radius: 999px;
  background: #ffffff1a; color: var(--muted); cursor: text; transition: background .2s; }
.fbar:focus-within { background: #ffffff26; color: var(--text); }
.fbar svg { width: clamp(22px, 2.4vh, 28px); height: clamp(22px, 2.4vh, 28px); flex: none; }
.fbar input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: var(--text); outline: none; appearance: none;
  font: 500 clamp(19px, 2.1vw, 26px) var(--display); }
.fbar input::placeholder { color: var(--faint); }
.fbar input::-webkit-search-cancel-button, .fbar input::-webkit-search-decoration { appearance: none; display: none; }
/* an icon, not the × character, so it sits in the middle of the circle */
.fx { width: clamp(56px, 8vh, 80px); height: clamp(56px, 8vh, 80px); flex: none; display: grid; place-items: center; border-radius: 50%; background: #ffffff1a; color: var(--text); }
.fx svg { width: 40%; height: 40%; }
.fwho { display: flex; align-items: center; gap: 3vw; }
.fwhom { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font: 600 clamp(14px, 1.5vw, 18px) var(--display); }
.fwhom > b { color: var(--text); }
.fwhom > button { height: 44px; padding: 0 18px; border-radius: 999px; background: #ffffff1a; color: var(--text); letter-spacing: .06em; text-transform: uppercase; font-size: 13px; }
.fwhom .names { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; }
.fwhom .names button { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 22px 0 10px; border-radius: 999px; background: #ffffff1a; color: var(--text); font-size: 18px; }
.av { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #fff; font: 700 17px var(--display); flex: none; font-style: normal; }
.av svg { width: 60%; height: 60%; }
.av.dark { color: #111; }
.fres { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.frow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 16px; padding: 8px; border-radius: 16px; background: #ffffff0d; }
.frow img { width: clamp(56px, 7vh, 76px); aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #222; }
.frow .t { font: 700 clamp(17px, 1.9vw, 24px)/1.2 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow .s { color: var(--muted); font-size: clamp(14px, 1.4vw, 18px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow button { height: clamp(52px, 7vh, 64px); padding: 0 22px; border-radius: 999px; background: #ffffff1a; font: 600 clamp(14px, 1.4vw, 17px) var(--display); letter-spacing: .06em; text-transform: uppercase; }
.frow button.add { background: var(--red); }
.frow.done button.add { background: #ffffff1a; }
.frow.done button.add::after { content: " ✓"; }
.min0 { min-width: 0; }
.fnote { color: var(--muted); font-size: clamp(16px, 1.6vw, 20px); text-align: center; margin-top: 4vh; }
@media (orientation: portrait) {
  .frow { grid-template-columns: auto minmax(0, 1fr) auto; }
  .frow button[data-mode="next"] { display: none; }
}
.fjoin { display: flex; align-items: center; gap: 14px; margin-left: auto; color: var(--muted); font: 600 clamp(12px, 1.2vw, 15px)/1.4 var(--display);
  letter-spacing: .1em; text-transform: uppercase; }
.fjoin .qr { width: clamp(64px, 8vh, 96px); padding: 6px; border-radius: 8px; }
.fjoin span { max-width: 11em; text-align: right; }
/* a new song: its title and artist settle in (swapIn in shared/dom.js, which skips it with less motion) */
.swapin { animation: swapin .6s cubic-bezier(.32, .72, 0, 1); }
@keyframes swapin { from { opacity: 0; translate: 0 8px; } }
