:root {
  --bg: #0b1f2a;
  --bg2: #103040;
  --card: #15384a;
  --accent: #2ec4b6;
  --accent2: #ff9f1c;
  --text: #eaf6f6;
  --muted: #8fb3bd;
  --danger: #ff5d5d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(160deg, var(--bg), var(--bg2));
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); }

.wrap { max-width: 680px; margin: 0 auto; padding: 16px; }

header.app {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  position: sticky; top: 0;
  background: rgba(11,31,42,0.92);
  backdrop-filter: blur(6px);
  z-index: 5;
}
header.app h1 { font-size: 1.2rem; margin: 0; }
header.app .logo { font-size: 1.6rem; }

input[type="search"], input[type="text"] {
  width: 100%; padding: 14px 16px; font-size: 1rem;
  border-radius: 12px; border: 1px solid #245; background: #0e2a38;
  color: var(--text);
}
input::placeholder { color: var(--muted); }

/* checkboxes — native size is tiny next to our large text; enlarge + theme the check */
input[type="checkbox"] {
  width: 22px; height: 22px; flex: none;
  accent-color: var(--accent); cursor: pointer;
}

/* search box with clear button */
.search-wrap { position: relative; }
.search-wrap input { padding-right: 46px; }
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; padding: 0; border-radius: 50%;
  background: #0e2a38; color: var(--muted); font-size: 1.2rem; line-height: 1;
  align-items: center; justify-content: center;
}
.search-clear:hover { color: var(--text); }
/* hide the browser's native search clear so we only show ours */
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

button {
  cursor: pointer; border: none; border-radius: 10px;
  padding: 10px 14px; font-size: 0.95rem; font-weight: 600;
  background: var(--accent); color: #042; transition: transform .05s ease;
}
button:active { transform: scale(0.97); }
button.ghost { background: transparent; color: var(--text); border: 1px solid #356; }
button.danger { background: var(--danger); color: #300; }
button:disabled { opacity: .5; cursor: default; }

.muted { color: var(--muted); font-size: .85rem; }

/* result + queue cards */
.card {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: 12px; padding: 10px; margin: 8px 0;
}
.card img.art { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: #07202b; flex: none; }
.card .meta { flex: 1; min-width: 0; }
.card .meta .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta .sub { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .added { font-size: .75rem; color: var(--accent2); }

.section-title { margin: 18px 0 6px; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* request history cards */
.hist-stats { display: flex; align-items: center; gap: 12px; flex: none; }
.hist-stats .stat { display: flex; flex-direction: column; align-items: center; line-height: 1.05; min-width: 34px; }
.hist-stats .stat b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.hist-stats .stat small { font-size: .6rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pill { font-size: .7rem; padding: 4px 10px; border-radius: 999px; white-space: nowrap; flex: none; }
.pill.ready { background: rgba(46, 196, 182, .18); color: var(--accent); }
.pill.cooling { background: rgba(255, 159, 28, .16); color: var(--accent2); }

/* expandable history cards + host-only actions */
.hist-item { margin: 6px 0; }
.hist-card { margin: 0; cursor: pointer; }
.hist-card .chev { color: var(--muted); font-size: .8rem; width: 14px; text-align: center; }
.hist-actions { display: flex; gap: 8px; padding: 8px 4px 2px; }
.hist-actions button { padding: 6px 12px; font-size: .85rem; }
button.ghost.danger-btn { color: var(--danger); border-color: var(--danger); }

/* who requested a song — shown in the admin's expanded history card */
.hist-requesters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 4px 2px; }
.hist-requesters .req-label { width: 100%; font-size: .6rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.req-chip { font-size: .82rem; padding: 4px 10px; border-radius: 999px; background: #0e2a38; color: var(--text); }
.req-chip b { color: var(--accent2); }

/* expanded account card (admin): what that account requested + delete */
.acct-detail { padding: 8px 4px 2px; }
.acct-detail .req-label { font-size: .6rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.acct-song { display: flex; align-items: center; gap: 10px; padding: 6px 2px; border-top: 1px solid rgba(255,255,255,.05); }
.acct-song:first-of-type { border-top: none; }
.acct-song-name { flex: 1; min-width: 0; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-song-count { flex: none; color: var(--accent2); font-weight: 700; font-variant-numeric: tabular-nums; }

/* admin photo-moderation grid — tap a photo to open it big with remove options */
.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photo-cell { position: relative; border-radius: 10px; overflow: hidden; background: #07202b; aspect-ratio: 1; cursor: pointer; }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cell:active { transform: scale(.97); }
.photo-cell.deleted { outline: 2px solid var(--danger); outline-offset: -2px; opacity: .85; }   /* archived/removed */
.photo-by {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 6px 8px 4px; font-size: .72rem; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(to top, rgba(0,0,0,.8), rgba(0,0,0,0));
  pointer-events: none;   /* taps fall through to the cell → opens the modal */
}

/* photo review modal — a wider box, the full photo scaled to fit, big tap targets */
.overlay .box.photo-modal-box { max-width: min(560px, 92vw); }
#photoModalImg { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 10px; background: #07202b; display: block; }
.photo-modal-acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.photo-modal-acts button { padding: 12px 18px; font-size: 1rem; }

/* name gate */
.overlay {
  position: fixed; inset: 0; background: rgba(4,15,20,.96);
  display: flex; align-items: center; justify-content: center; z-index: 20; padding: 24px;
}
.overlay .box { background: var(--card); padding: 24px; border-radius: 16px; width: 100%; max-width: 360px; text-align: center; }
.overlay .box h2 { margin-top: 0; }

/* audio unlock modal — centered message over a 50% translucent backdrop */
.audio-modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(4,15,20,.5); backdrop-filter: blur(2px);
}
.audio-modal .box {
  background: var(--card); padding: 32px 28px; border-radius: 16px;
  width: 100%; max-width: 420px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.audio-modal .box h2 { margin-top: 0; }
.audio-modal .box p { margin-bottom: 22px; }
.audio-modal .box button { font-size: 1.1rem; padding: 12px 30px; }

/* search-in-progress spinner (shown in the results area while a search is loading) */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .15);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.results-loading {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 22px; color: var(--muted); font-weight: 600;
}

/* toast — centered confirmation modal over a 50% dimmed backdrop.
   Tap the backdrop or the OK button to dismiss; also auto-dismisses (see guest.js). */
.toast {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(4, 15, 20, .78);
  opacity: 0; transition: opacity .2s ease;
  pointer-events: none; cursor: pointer;
}
.toast.show { opacity: 1; pointer-events: auto; }
.toast .toast-box {
  background: #04313a; color: var(--text); text-align: center;
  border: 1px solid var(--accent); border-radius: 16px;
  padding: 26px 22px; width: 100%; max-width: 420px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
  transform: scale(.96); transition: transform .2s ease;
}
.toast.show .toast-box { transform: scale(1); }
.toast .toast-msg { font-size: 1.1rem; font-weight: 600; line-height: 1.4; }
.toast .toast-ok { margin-top: 20px; font-size: 1rem; padding: 10px 32px; }

/* host display */
.host-now {
  display: flex; gap: 20px; align-items: center;
  background: var(--card); border-radius: 18px; padding: 22px; margin-bottom: 18px;
}
.host-now img { width: 140px; height: 140px; border-radius: 14px; object-fit: cover; background: #07202b; flex: none; }
.host-now .big-title { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.host-now .big-sub { color: var(--muted); font-size: 1.1rem; margin-top: 6px; }
.host-now .by { color: var(--accent2); margin-top: 10px; }

.pbar { height: 6px; background: #0e2a38; border-radius: 999px; overflow: hidden; }
.pbar-fill { height: 100%; width: 0%; background: var(--accent); transition: width .5s linear; }
.ptimes { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; margin-top: 5px; }

/* Host page: left rail (join + who's here) beside the main show column. */
.host-layout { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.host-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 72px; }
.host-main { min-width: 0; }   /* let the queue's ellipsis work inside the grid track */
.cta { color: var(--accent); font-weight: 600; font-size: 1.05rem; }

/* Host page: outdoor weather pinned lower-left — current-conditions card + today's
   high/low box, in a row floating just above the bottom ticker (server-fed). */
.weather-dock {
  position: fixed; left: 16px; bottom: 84px; z-index: 21;
  display: flex; align-items: stretch; gap: 14px;
}
.weather-card {
  display: flex; align-items: center; gap: 20px;
  background: var(--card); border-radius: 18px; padding: 18px 30px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .4);
}
.weather-card .wx-emoji { font-size: 4.4rem; line-height: 1; }
.weather-card .wx-temp { font-size: 4rem; font-weight: 700; line-height: 1.05; }
.weather-card .wx-feels { color: #fff; font-size: 1.6rem; margin-top: 4px; }
/* Live clock, leftmost box in the dock (host browser local time + date). */
.weather-clock { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; }
.weather-clock .wx-clock-time { font-size: 3.6rem; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.weather-clock .wx-clock-date { color: var(--muted); font-size: 1.5rem; font-weight: 600; align-self: center; }
/* Today's high / low, to the right of the current-conditions card. */
.weather-hilo { padding: 18px 28px; }
.weather-hilo .wx-hl { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.weather-hilo .wx-hl-row { display: flex; align-items: baseline; gap: 14px; }
.weather-hilo .wx-hl-label { color: var(--muted); font-size: 1.6rem; font-weight: 700; width: 1.1em; }
.weather-hilo .wx-hl-val { font-size: 2.6rem; font-weight: 700; line-height: 1.05; }
/* Next-6-hours strip, to the right of the high/low box. */
.weather-hourly { padding: 14px 24px; }
.weather-hourly .wx-hours { display: flex; align-items: stretch; gap: 20px; }
.weather-hourly .wx-hour { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 2.3em; }
.weather-hourly .wx-h-time { color: var(--muted); font-size: 1.1rem; font-weight: 700; }
.weather-hourly .wx-h-emoji { font-size: 2rem; line-height: 1.1; }
.weather-hourly .wx-h-temp { font-size: 1.6rem; font-weight: 700; }
.weather-hourly .wx-h-pop { color: var(--accent2); font-size: 1rem; font-weight: 600; }
/* Sunrise/sunset markers interleaved into the strip — warm-tinted, no temp/rain. */
.weather-hourly .wx-hour--sun .wx-h-time { color: var(--accent2); }
.weather-hourly .wx-h-note { color: var(--accent2); font-size: 1.1rem; font-weight: 700; white-space: nowrap; }

/* Bottom marquee: continuously scrolling top-requests ticker on the host display. */
.ticker {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--card); border-top: 1px solid #0e2a38;
  overflow: hidden; white-space: nowrap; padding: 12px 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .35);
  font-size: 20px;   /* base size in px; the admin page overrides this live (per-em children scale with it) */
}
.ticker-track { display: inline-block; white-space: nowrap; will-change: transform; animation: ticker-scroll linear infinite; }
.ticker-item { display: inline-flex; align-items: baseline; gap: .5em; margin: 0 1.6em; font-size: 1em; }
.ticker-item.blank { min-width: 12em; }   /* empty slot when there are fewer than 10 requests */
.ticker-item .rank { color: var(--accent); font-weight: 700; }
.ticker-item .t-title { font-weight: 600; }
.ticker-item .t-artist { color: var(--muted); }
.ticker-item .t-req { color: var(--accent2); font-size: .72em; }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.qr-panel { background: var(--card); border-radius: 16px; padding: 18px; text-align: center; }
.qr-panel img { width: 180px; height: 180px; background: #fff; border-radius: 10px; padding: 6px; }
.qr-panel .url { font-size: .85rem; color: var(--accent); word-break: break-all; margin-top: 8px; }

/* Who's in the party + how many songs each requested. */
.people-panel { background: var(--card); border-radius: 16px; padding: 16px 16px 10px; }
.people-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; margin-top: 2px; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 8px 11px; background: #0e2a38; border-radius: 10px; }
.person-row .crown { flex: none; font-size: .95rem; }
.person-row .pname { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-row .pcount { display: flex; flex-direction: column; align-items: center; line-height: 1.05; flex: none; min-width: 32px; }
.person-row .pcount b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.person-row .pcount small { font-size: .56rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.person-row.zero { opacity: .55; }   /* joined but hasn't requested yet */

@media (max-width: 720px) {
  .host-layout { grid-template-columns: 1fr; }
  .host-side { position: static; }
  .host-now img { width: 90px; height: 90px; }
  .host-now .big-title { font-size: 1.3rem; }
}

/* ==================== poolside display (/display) ====================
   Full-bleed 16:9 canvas for a TV, 10-foot type, overscan-safe insets. A photo
   slideshow fills the background (Phase 4); the show sits on top. Sizes use vh so
   the layout scales to whatever panel it lands on. */
body.display { height: 100vh; overflow: hidden; }

/* Background slideshow layer (empty in Phase 1 → the page gradient shows). */
.photo-layer { position: fixed; inset: 0; z-index: 0; background: #05121a; }
/* Gradient scrim so overlaid text stays legible on any photo. */
.display-scrim {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(4,15,20,.55) 0%, rgba(4,15,20,0) 22%),
    linear-gradient(to top, rgba(4,15,20,.65) 0%, rgba(4,15,20,0) 34%);
}

/* Static "Now Playing" line, pinned just above the scroller (full width, left-
   aligned, single line — no cover art, no progress; the scroller below carries
   "up next"). Its height is published as --nowline-h so the dock floats above it. */
.display .now-line {
  position: fixed; left: 0; right: 0; z-index: 21;
  bottom: var(--ticker-h, 56px);
  padding: 1vh 3vw; font-size: 2.6vh; font-weight: 700; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(to top, rgba(4,15,20,.6), rgba(4,15,20,0));
}
.display .now-line .nl-label { color: var(--accent); }
.display .now-line .nl-song { color: #fff; }
.display .now-line .nl-from { color: var(--accent2); font-weight: 600; margin-left: .5vw; }
.display .now-line .nl-idle { color: var(--muted); font-weight: 600; }

/* Top-right scan-to-join chip. */
.display .join-chip {
  position: fixed; top: 1.5vh; right: 1.5vh; z-index: 22;   /* equal top + right gaps */
  display: flex; flex-direction: column; align-items: center; gap: .8vh;
  background: rgba(16,48,64, var(--bug-alpha, .85)); border-radius: 16px; padding: 1.4vh 1.4vw;
  box-shadow: 0 6px 22px rgba(0,0,0,.4);
}
.display .join-chip .join-label { font-weight: 800; font-size: 1.9vh; }
.display .join-chip img { width: 12vh; height: 12vh; background: #fff; border-radius: 10px; padding: .6vh; }

/* Clock/weather "bugs" — top-left corner (insets match the QR chip), with an admin-
   adjustable background opacity (--bug-alpha, default .85 to match the QR chip) and
   per-bug hide toggles. */
.display .weather-dock { left: 2vw; top: 1.5vh; bottom: auto; z-index: 22; }
.display .weather-card { background: rgba(16,48,64, var(--bug-alpha, .85)); }
.display.hide-clock .weather-clock { display: none; }
.display.hide-weather #weatherCard,
.display.hide-weather #weatherHilo,
.display.hide-weather #weatherHourly { display: none !important; }   /* beats renderWeather's inline display */

/* Bottom scroller — tightened, and driven by a true right-to-left marquee (see
   runMarquee in display.js). Disable the shared seamless-loop CSS animation here. */
.display .ticker { z-index: 21; padding: .5vh 0; }
.display .ticker-track { animation: none; }
.display .ticker-item.scroller-msg { color: var(--text); font-weight: 700; }

/* --- slideshow layers + composite mode (photos present) --- */
.photo-slide {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.6s ease; will-change: opacity, transform;
}
.photo-slide.show { opacity: 1; }
.photo-slide.kb { animation: kenburns 12s ease-out forwards; }
@keyframes kenburns {
  from { transform: scale(1.05); }
  to   { transform: scale(1.16) translate(-2%, -2%); }
}

/* Scroller message styling lives with the .display .ticker rules above. */
