/* Encore: shared styles for guest page, DJ console and big screen. */
:root {
  --bg: #120e19;
  --bg-2: #1b1524;
  --card: #221a2e;
  --card-2: #2b2139;
  --line: #3a2e4b;
  --text: #f6f1fb;
  --muted: #b9adc9;
  --faint: #8a7d9c;
  --accent: #ff5c8a;
  --accent-ink: #1a0710;
  --accent-soft: rgba(255, 92, 138, 0.16);
  --gold: #ffc857;
  --ok: #5ee6a8;
  --warn: #ffb86b;
  --danger: #ff6b6b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Avenir Next", "Futura", "Montserrat", ui-rounded, system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 10% -10%, rgba(255, 92, 138, 0.14), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(255, 200, 87, 0.08), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.45 var(--font);
  min-height: 100vh;
}
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
img { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.01em; margin: 0; }
h2 { font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 0.85rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  padding: 9px 14px; border-radius: 999px; cursor: pointer; font-weight: 650; font-size: 0.92rem;
  text-decoration: none; white-space: nowrap; transition: transform 0.08s ease, background 0.15s ease;
  min-height: 40px;
}
.btn:hover { background: #352849; }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.5; cursor: default; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #ff7aa0; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 11px; min-height: 34px; font-size: 0.85rem; }
.btn.icon { width: 38px; padding: 0; min-height: 38px; }
.btn.done { background: transparent; color: var(--ok); border-color: rgba(94, 230, 168, 0.35); }

/* ---------- inputs ---------- */
.input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 12px 16px; color: var(--text); outline: none; min-height: 46px;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--faint); }

/* ---------- cards & lists ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; }
.row .meta { flex: 1; min-width: 0; }
.title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { color: var(--muted); font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.art { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex: none; background: var(--card-2); }
.art-empty { display: grid; place-items: center; color: var(--faint); font-size: 1.3rem; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--card-2); color: var(--muted); vertical-align: 1px; }
.tag.e { background: #3a2e4b; color: var(--text); padding: 1px 5px; border-radius: 4px; font-size: 0.68rem; }
.tag.hot { background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: rgba(94, 230, 168, 0.14); color: var(--ok); }
.tag.lock { background: rgba(255, 200, 87, 0.14); color: var(--gold); }
.empty { color: var(--faint); padding: 18px 4px; text-align: center; }

.progress { height: 4px; background: rgba(255, 255, 255, 0.1); border-radius: 4px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }

.banner { border-radius: var(--radius-sm); padding: 10px 14px; background: rgba(255, 184, 107, 0.12); border: 1px solid rgba(255, 184, 107, 0.35); color: var(--warn); font-size: 0.92rem; }
.banner.error { background: rgba(255, 107, 107, 0.1); border-color: rgba(255, 107, 107, 0.35); color: #ff9c9c; }
.banner.ok { background: rgba(94, 230, 168, 0.1); border-color: rgba(94, 230, 168, 0.3); color: var(--ok); }

.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px);
  background: #f6f1fb; color: #1b1524; padding: 12px 18px; border-radius: 999px; font-weight: 650;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all 0.2s ease; z-index: 50;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #ffd6d6; color: #4a0d0d; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(94, 230, 168, 0.2); }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.eq i { width: 3px; background: var(--accent); border-radius: 1px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.3s; }
.eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }
@media (prefers-reduced-motion: reduce) { .eq i { animation: none; height: 8px; } .toast { transition: none; } }

/* =========================================================
   Guest page
   ========================================================= */
.guest { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
.g-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 14px; }
.g-head h1 { font-size: 1.5rem; line-height: 1.1; }
.g-head .brand { font-size: 0.78rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 700; }
.now { display: flex; gap: 14px; align-items: center; padding: 14px; }
.now .art { width: 64px; height: 64px; border-radius: 10px; }
.now .label { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.now .progress { margin-top: 8px; }
.search-wrap { position: sticky; top: 0; z-index: 5; padding: 12px 0; margin: 0 -16px; padding-left: 16px; padding-right: 16px; background: linear-gradient(var(--bg) 70%, transparent); }
.search { position: relative; }
.search .input { padding-left: 44px; font-size: 1.02rem; }
.search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.section { margin-top: 18px; }
.section > h2 { margin: 0 0 8px 2px; display: flex; justify-content: space-between; align-items: baseline; }
.section > h2 .count { font-size: 0.8rem; letter-spacing: 0; text-transform: none; color: var(--faint); font-weight: 600; }
.ticket { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); margin-top: 8px; }
.ticket .no { font-family: var(--font-display); font-weight: 800; color: var(--faint); font-size: 0.8rem; min-width: 28px; text-align: center; }
.ticket .status { font-size: 0.85rem; font-weight: 700; margin-top: 2px; }
.ticket.set .status { color: var(--gold); }
.ticket.playing { border-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft), var(--card)); }
.ticket.playing .status { color: var(--accent); }
.ticket.played .status, .ticket.passed .status { color: var(--faint); }
.ticket.passed, .ticket.played { opacity: 0.75; }
.vote { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 46px; min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); cursor: pointer; font-weight: 800; font-size: 0.85rem; gap: 0; line-height: 1; }
.vote.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.vote svg { margin-bottom: 2px; }
.pos { font-family: var(--font-display); font-weight: 800; color: var(--faint); width: 22px; text-align: right; flex: none; font-size: 0.9rem; }
.namebar { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.namebar .input { flex: 1; }
.closed { text-align: center; padding: 22px 16px; }
.closed h3 { font-size: 1.2rem; margin-bottom: 4px; }
.more { display: block; margin: 10px auto 0; }
.foot { margin-top: 32px; text-align: center; color: var(--faint); font-size: 0.8rem; }
.conn { position: fixed; top: 10px; right: 10px; z-index: 30; background: var(--warn); color: #2b1800; font-weight: 700; font-size: 0.8rem; padding: 6px 12px; border-radius: 999px; display: none; }
.conn.show { display: block; }

/* =========================================================
   DJ console
   ========================================================= */
.dj { padding: 0 20px 40px; max-width: 1400px; margin: 0 auto; }
.dj-top { display: flex; align-items: center; gap: 12px; padding: 14px 0; flex-wrap: wrap; position: sticky; top: 0; z-index: 10; background: rgba(18, 14, 25, 0.92); backdrop-filter: blur(10px); }
.dj-top .brand { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; }
.dj-top .brand span { color: var(--accent); }
.dj-top .party-name { color: var(--muted); font-weight: 650; }
.dj-top .grow { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.85rem; font-weight: 650; color: var(--muted); background: var(--bg-2); }
.dj-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.dj-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }
.dj .card > h2 { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dj .card > h2 .count { color: var(--faint); font-size: 0.8rem; text-transform: none; letter-spacing: 0; font-weight: 600; }
.dj-now { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.dj-now .art { width: 96px; height: 96px; border-radius: 12px; }
.dj-now .title { font-size: 1.25rem; }
.dj-now .times { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.8rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.dj-now .acts { display: flex; flex-direction: column; gap: 8px; }
.q-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-top: 1px solid var(--line); background: var(--card); border-radius: 10px; min-width: 0; }
.q-row:first-child { border-top-color: transparent; }
.q-row .art { width: 44px; height: 44px; }
.q-row .meta { flex: 1; min-width: 0; }
.q-row .acts { display: flex; gap: 6px; flex: none; }
.q-row.dragging { position: relative; z-index: 3; box-shadow: var(--shadow); border-color: var(--accent); outline: 2px solid var(--accent); }
.q-row.queued { background: linear-gradient(90deg, rgba(255, 200, 87, 0.08), var(--card)); }
.handle { cursor: grab; touch-action: none; color: var(--faint); padding: 8px 4px; border: 0; background: none; display: grid; place-items: center; }
.handle:active { cursor: grabbing; }
.q-num { width: 22px; text-align: right; color: var(--faint); font-weight: 800; font-size: 0.85rem; flex: none; font-variant-numeric: tabular-nums; }
.who { color: var(--gold); font-weight: 650; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 650; font-size: 0.85rem; color: var(--muted); }
.tab[aria-selected="true"] { background: var(--card-2); color: var(--text); border-color: var(--accent); }
.set-grid { display: grid; gap: 14px; }
.field { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.field:first-child { border-top: 0; }
.field label { font-weight: 650; }
.field .hint { display: block; font-weight: 400; color: var(--faint); font-size: 0.82rem; margin-top: 2px; }
.field .input { border-radius: 10px; padding: 8px 12px; min-height: 38px; max-width: 220px; }
.field.stack { flex-direction: column; align-items: stretch; }
.field.stack .input { max-width: none; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background 0.15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: transform 0.15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: 2px; }
.seg { display: grid; gap: 8px; margin-top: 8px; }
.seg label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400; }
.seg label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.seg input { margin-top: 4px; accent-color: var(--accent); }
.seg b { display: block; }
.connect { text-align: center; padding: 26px 18px; }
.connect h3 { font-size: 1.3rem; margin-bottom: 6px; }
.connect p { max-width: 460px; margin: 0 auto 16px; }
.share-box { display: flex; gap: 16px; align-items: center; }
.share-box img { width: 120px; height: 120px; background: #fff; border-radius: 10px; padding: 6px; flex: none; }
.share-box .url { font-weight: 700; word-break: break-all; }
.copy-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.qr-modal { position: fixed; inset: 0; background: rgba(8, 5, 12, 0.92); z-index: 60; display: none; place-items: center; padding: 20px; }
.qr-modal.show { display: grid; }
.qr-modal .inner { text-align: center; }
.qr-modal img { width: min(70vh, 80vw); height: min(70vh, 80vw); background: #fff; padding: 16px; border-radius: 20px; margin: 0 auto 16px; }
.qr-modal .big { font-family: var(--font-display); font-size: clamp(1.2rem, 3vw, 2rem); font-weight: 800; word-break: break-all; }
.search-results { margin-top: 10px; max-height: 420px; overflow: auto; }
.badges { display: inline-flex; gap: 4px; flex-wrap: wrap; margin-left: 4px; }
.kbd { font-size: 0.75rem; color: var(--faint); }
details.more-box summary { cursor: pointer; color: var(--muted); font-weight: 650; padding: 6px 0; }
.ext-note { font-size: 0.82rem; color: var(--faint); }

@media (max-width: 960px) {
  .dj-grid { grid-template-columns: minmax(0, 1fr); }
  .dj { padding: 0 12px 40px; }
}
@media (max-width: 560px) {
  .dj-now { grid-template-columns: 64px minmax(0, 1fr); }
  .dj-now .art { width: 64px; height: 64px; }
  .dj-now .acts { grid-column: 1 / -1; flex-direction: row; }
  .dj-now .acts .btn { flex: 1; }
  .q-row .acts .opt { display: none; }
  .share-box { flex-direction: column; align-items: flex-start; }
  .dj-top .party-name { display: none; }
}

/* =========================================================
   Big screen
   ========================================================= */
.screen { height: 100vh; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 4vw; padding: 5vh 4vw; position: relative; }
.screen .bg { position: fixed; inset: -10%; background-size: cover; background-position: center; filter: blur(80px) saturate(1.3) brightness(0.45); z-index: -1; transition: background-image 1s ease; }
.s-now { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.s-now .label { font-size: clamp(0.9rem, 1.4vw, 1.4rem); letter-spacing: 0.18em; text-transform: uppercase; font-weight: 800; color: var(--accent); display: flex; gap: 12px; align-items: center; }
.s-now .cover { width: min(44vh, 34vw); height: min(44vh, 34vw); border-radius: 24px; object-fit: cover; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); margin: 3vh 0; background: var(--card); }
.s-now .t { font-family: var(--font-display); font-size: clamp(2rem, 5vw, 5.4rem); font-weight: 800; line-height: 1.02; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.s-now .a { font-size: clamp(1.1rem, 2.4vw, 2.4rem); color: var(--muted); margin-top: 0.6vh; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-now .by { font-size: clamp(0.9rem, 1.6vw, 1.5rem); color: var(--gold); margin-top: 1.4vh; font-weight: 700; }
.s-now .progress { height: 8px; margin-top: 3vh; max-width: 80%; }
.s-side { display: flex; flex-direction: column; gap: 3vh; min-height: 0; }
.s-side h2 { font-size: clamp(0.9rem, 1.3vw, 1.3rem); }
.s-next { flex: 1; min-height: 0; overflow: hidden; }
.s-next .row { padding: 1.3vh 0; gap: 1.2vw; border-top-color: rgba(255, 255, 255, 0.1); }
.s-next .art { width: clamp(40px, 5vh, 72px); height: clamp(40px, 5vh, 72px); }
.s-next .title { font-size: clamp(1rem, 1.6vw, 1.7rem); }
.s-next .sub { font-size: clamp(0.85rem, 1.1vw, 1.2rem); }
.s-next .pos { font-size: clamp(0.9rem, 1.3vw, 1.4rem); width: 2.2em; }
.s-join { display: flex; gap: 1.6vw; align-items: center; background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 24px; padding: 2vh 1.6vw; }
.s-join img { width: clamp(120px, 20vh, 260px); height: clamp(120px, 20vh, 260px); background: #fff; padding: 10px; border-radius: 14px; flex: none; }
.s-join .cta { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.2rem, 2.2vw, 2.4rem); line-height: 1.1; }
.s-join .u { color: var(--muted); font-size: clamp(0.8rem, 1vw, 1.1rem); margin-top: 1vh; word-break: break-all; }
.s-idle .t { color: var(--muted); }
@media (max-aspect-ratio: 1/1) {
  .screen { grid-template-columns: 1fr; grid-template-rows: auto 1fr; height: auto; min-height: 100vh; overflow: auto; }
  .s-now .cover { width: 60vw; height: 60vw; }
}

/* fixes */
.list.card { padding: 4px 14px; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
