:root {
  color-scheme: dark;
  --bg: #111219;
  --surface: #1b1d26;
  --surface-2: #242735;
  --surface-3: #2c3040;
  --text: #f4f5f8;
  --muted: #aeb3c2;
  --primary: #b9a7ff;
  --primary-strong: #8e78f0;
  --on-primary: #1b1239;
  --good: #6fdd9a;
  --warn: #ffca62;
  --bad: #ff7e87;
  --border: #353948;
  --shadow: rgba(0,0,0,.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.app-shell { width: 100%; height: 100dvh; min-height: 100%; position: relative; overflow: hidden; background: var(--bg); }
.pager { display: flex; width: 200%; height: 100%; transform: translateX(0); transition: transform 230ms cubic-bezier(.2,.8,.2,1); will-change: transform; touch-action: pan-y; }
.pager.show-queue { transform: translateX(-50%); }
.page { width: 50%; height: 100%; flex: 0 0 50%; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.topbar { height: calc(60px + var(--safe-top)); padding: var(--safe-top) 8px 0; display: flex; align-items: center; flex: 0 0 auto; background: var(--bg); }
.icon-button { width: 48px; height: 48px; border: 0; border-radius: 999px; background: transparent; color: var(--text); font-size: 30px; line-height: 1; cursor: pointer; }
.icon-button:active { background: var(--surface-2); }
.topbar-title { font-size: 21px; line-height: 1.1; font-weight: 750; letter-spacing: -.2px; }
.topbar-subtitle { margin-top: 2px; color: var(--muted); font-size: 12px; letter-spacing: 1.5px; }
.topbar-spacer { flex: 1; }
.party-banner { min-height: 34px; padding: 5px 14px 7px; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; flex: 0 0 auto; }
.party-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px rgba(255,202,98,.1); }
.party-banner.active .party-dot { background: var(--good); box-shadow: 0 0 0 3px rgba(111,221,154,.11); }
.party-banner.ended .party-dot, .party-banner.error .party-dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(255,126,135,.11); }
.scroll-area { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
.search-results { padding: 4px 10px 18px; }
.empty-state { min-height: 100%; padding: 32px 22px 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.empty-state .empty-icon { font-size: 60px; line-height: 1; color: #777d90; }
.empty-state h2 { margin: 12px 0 6px; color: var(--text); font-size: 17px; font-weight: 650; }
.empty-state p { margin: 0; line-height: 1.5; font-size: 14px; }
.search-footer { flex: 0 0 auto; padding: 5px 10px calc(10px + var(--safe-bottom)); background: rgba(27,29,38,.98); border-top: 1px solid rgba(255,255,255,.04); box-shadow: 0 -8px 24px rgba(0,0,0,.22); }
.adding-to { min-height: 22px; padding: 0 4px 5px; font-size: 12px; color: var(--muted); }
.search-box { height: 56px; border-radius: 28px; display: flex; align-items: center; background: var(--surface-2); border: 1px solid #313544; overflow: hidden; }
.search-icon { width: 48px; text-align: center; color: var(--muted); font-size: 26px; transform: rotate(-18deg); }
.search-box input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; padding: 0 4px; background: transparent; color: var(--text); font-size: 16px; }
.search-box input::placeholder { color: #9499a8; }
.search-box input:disabled { opacity: .55; }
.clear-button { width: 50px; height: 50px; border: 0; background: transparent; color: var(--muted); font-size: 28px; cursor: pointer; }
.clear-button:disabled { opacity: .35; }
.result-card { margin: 4px 0; border-radius: 13px; background: var(--surface); border: 1px solid rgba(255,255,255,.035); overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,.12); }
.result-row { height: 74px; display: flex; align-items: center; gap: 8px; padding: 5px; cursor: pointer; }
.result-thumb { flex: 0 0 116px; width: 116px; height: 65px; border-radius: 8px; object-fit: cover; background: var(--surface-3); }
.result-text { min-width: 0; flex: 1; height: 64px; display: flex; flex-direction: column; justify-content: center; }
.result-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; font-weight: 650; }
.result-channel { margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 12px; }
.result-actions { margin-top: 3px; display: flex; justify-content: flex-end; }
.queue-add { border: 0; padding: 5px 9px; border-radius: 999px; background: transparent; color: var(--primary); font-weight: 700; font-size: 12px; cursor: pointer; }
.queue-add:active { background: rgba(185,167,255,.10); }
.preview-wrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; }
.preview-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }
.preview-close { position: absolute; top: 6px; right: 6px; z-index: 2; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(0,0,0,.64); color: white; font-size: 24px; }
.preview-info { display: flex; align-items: center; gap: 8px; padding: 9px 10px; }
.preview-meta { flex: 1; min-width: 0; }
.preview-title { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-channel { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.more-wrap { padding: 14px 4px 20px; text-align: center; }
.more-button { border: 1px solid var(--border); color: var(--primary); background: var(--surface); border-radius: 999px; padding: 10px 18px; font-weight: 700; }
.loading { padding: 24px; text-align: center; color: var(--muted); }
.spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid #4c5060; border-top-color: var(--primary); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.queue-list { padding: 4px 10px 18px; }
.queue-item { min-height: 76px; margin: 4px 0; border-radius: 13px; display: flex; align-items: center; gap: 9px; padding: 6px; background: var(--surface); border: 1px solid rgba(255,255,255,.035); }
.queue-number { width: 28px; flex: 0 0 28px; text-align: center; color: var(--muted); font-weight: 750; }
.queue-thumb { flex: 0 0 96px; width: 96px; height: 54px; object-fit: cover; border-radius: 7px; background: var(--surface-3); }
.queue-meta { flex: 1; min-width: 0; }
.queue-title { font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-channel { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.requested-by { color: var(--primary); font-size: 11.5px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-footer { min-height: calc(48px + var(--safe-bottom)); padding: 10px 14px calc(10px + var(--safe-bottom)); display: flex; justify-content: space-between; align-items: center; gap: 14px; background: var(--surface); border-top: 1px solid rgba(255,255,255,.05); color: var(--muted); font-size: 11.5px; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.54); }
.drawer { position: fixed; z-index: 31; inset: 0 auto 0 0; width: min(86vw, 360px); background: #171922; transform: translateX(-102%); transition: transform 220ms cubic-bezier(.2,.8,.2,1); box-shadow: 12px 0 35px rgba(0,0,0,.38); padding-top: var(--safe-top); }
.drawer.open { transform: translateX(0); }
.drawer-head { height: 84px; padding: 16px 10px 12px 18px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.06); }
.drawer-head > div:first-child { flex: 1; }
.drawer-kicker { color: var(--muted); font-size: 11px; letter-spacing: 1.4px; }
.drawer-code { margin-top: 4px; font-size: 24px; font-weight: 850; letter-spacing: 3px; }
.drawer-body { padding: 18px 14px; }
.setting-label { margin: 12px 7px 6px; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px; }
.setting-button { width: 100%; min-height: 52px; border: 0; border-radius: 13px; padding: 0 14px; display: flex; justify-content: space-between; align-items: center; color: var(--text); background: var(--surface-2); text-align: left; }
.drawer-note { margin: 22px 8px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.65); }
.modal-card { width: min(100%, 430px); border-radius: 22px; padding: 22px; background: var(--surface); box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.modal-card h2 { margin: 0 0 7px; font-size: 21px; }
.modal-card p { margin: 0 0 16px; color: var(--muted); line-height: 1.45; font-size: 13.5px; }
.name-input { width: 100%; height: 52px; border-radius: 12px; padding: 0 13px; border: 1px solid var(--border); outline: 0; color: var(--text); background: var(--surface-2); }
.name-input:focus { border-color: var(--primary-strong); box-shadow: 0 0 0 2px rgba(142,120,240,.22); }
.modal-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 8px; }
.text-button, .filled-button { border: 0; border-radius: 999px; padding: 10px 14px; font-weight: 750; }
.text-button { color: var(--primary); background: transparent; }
.filled-button { color: var(--on-primary); background: var(--primary); }
.toast { position: fixed; left: 50%; bottom: calc(86px + var(--safe-bottom)); z-index: 70; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); padding: 11px 15px; border-radius: 999px; background: #e9e8ef; color: #1a1b20; box-shadow: 0 8px 24px rgba(0,0,0,.35); font-size: 13px; transition: opacity 160ms, transform 160ms; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[hidden] { display: none !important; }
@media (min-width: 700px) {
  .page { padding-left: calc((50vw - 520px)/2); padding-right: calc((50vw - 520px)/2); }
  .search-footer, .queue-footer { margin-left: calc(-1 * ((50vw - 520px)/2)); margin-right: calc(-1 * ((50vw - 520px)/2)); padding-left: max(10px, calc((50vw - 520px)/2 + 10px)); padding-right: max(10px, calc((50vw - 520px)/2 + 10px)); }
}

/* v0.6.1a persistent identity, voting, live queue, swipe chat + message overlay */
.app-shell { display: flex; flex-direction: column; }
.pager { flex: 1 1 auto; min-height: 0; height: auto; }
body.chat-visible .search-footer,
body.chat-visible .queue-footer { padding-bottom: 10px; }
.live-pill { display: inline-flex; align-items: center; gap: 5px; margin-right: 10px; padding: 5px 8px; border-radius: 999px; background: rgba(111,221,154,.09); color: var(--good); font-size: 10px; font-weight: 800; letter-spacing: .7px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(111,221,154,.1); }
.queue-item { min-height: 104px; align-items: flex-start; padding-top: 8px; padding-bottom: 8px; }
.queue-number { padding-top: 18px; }
.queue-thumb { margin-top: 8px; }
.requested-by { color: var(--primary); font-size: 12px; font-weight: 650; margin-top: 5px; }
.vote-row { margin-top: 7px; display: flex; align-items: center; gap: 6px; }
.vote-button { min-width: 66px; height: 30px; border: 1px solid var(--border); border-radius: 999px; padding: 0 9px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 750; cursor: pointer; }
.vote-button.selected.up { color: #a9f0c3; border-color: rgba(111,221,154,.48); background: rgba(111,221,154,.12); }
.vote-button.selected.down { color: #ffadb2; border-color: rgba(255,126,135,.48); background: rgba(255,126,135,.12); }
.vote-button:disabled { opacity: .5; }
.vote-score { min-width: 28px; text-align: center; color: var(--text); font-size: 12px; font-weight: 850; }
.setting-button span:first-child { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.setting-button small { color: var(--muted); font-size: 11px; font-weight: 450; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.split-actions { justify-content: space-between; align-items: center; }
.code-input { text-align: center; text-transform: uppercase; letter-spacing: 4px; font-weight: 850; font-size: 20px; }
.rejoin-code-big { margin: 18px 0; padding: 14px; border-radius: 14px; background: var(--surface-2); text-align: center; font-size: 30px; font-weight: 900; letter-spacing: 7px; color: var(--primary); }

.chat-dock { flex: 0 0 auto; z-index: 12; background: #171922; border-top: 1px solid rgba(255,255,255,.08); box-shadow: 0 -10px 30px rgba(0,0,0,.30); padding-bottom: var(--safe-bottom); overflow: hidden; transition: max-height 240ms cubic-bezier(.2,.8,.2,1); max-height: 210px; }
.chat-handle { width: 42px; height: 4px; margin: 5px auto 0; border-radius: 999px; background: rgba(255,255,255,.24); }
.chat-head { min-height: 34px; padding: 3px 9px 4px 12px; display: flex; align-items: center; gap: 8px; touch-action: pan-x; user-select: none; }
.chat-head strong { font-size: 12px; }
.chat-head span { flex: 1; min-width: 0; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-collapse { width: 32px; height: 28px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 18px; }
.chat-body { padding: 0 8px 7px; max-height: 164px; opacity: 1; transform: translateY(0); transition: max-height 220ms ease, opacity 160ms ease, transform 220ms ease, padding 220ms ease; }
.chat-dock.collapsed { max-height: 46px; }
.chat-dock.collapsed .chat-body { max-height: 0; opacity: 0; transform: translateY(12px); padding-top: 0; padding-bottom: 0; pointer-events: none; }
.chat-messages { height: 74px; overflow-y: auto; border-radius: 10px; padding: 5px 7px; background: rgba(0,0,0,.18); overscroll-behavior: contain; }
.chat-empty { height: 100%; display: grid; place-items: center; color: #7f8595; font-size: 10.5px; text-align: center; }
.chat-message { padding: 3px 2px; border-bottom: 1px solid rgba(255,255,255,.035); }
.chat-message:last-child { border-bottom: 0; }
.chat-message-head { color: var(--primary); font-size: 10px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-message.mine .chat-message-head { color: var(--good); }
.chat-message-text { margin-top: 1px; color: var(--text); font-size: 12px; line-height: 1.25; overflow-wrap: anywhere; }
.chat-recipients { min-height: 34px; display: flex; gap: 5px; align-items: center; overflow-x: auto; padding: 5px 1px 4px; scrollbar-width: none; }
.chat-recipients::-webkit-scrollbar { display: none; }
.recipient-chip { flex: 0 0 auto; height: 26px; max-width: 130px; border: 1px solid var(--border); border-radius: 999px; padding: 0 9px; background: var(--surface-2); color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recipient-chip.online::before { content: '• '; color: var(--good); }
.recipient-chip.selected { color: var(--on-primary); background: var(--primary); border-color: var(--primary); font-weight: 750; }
.recipient-chip.selected.online::before { color: var(--on-primary); }
.chat-compose { height: 43px; display: flex; align-items: center; gap: 6px; border-radius: 24px; padding: 3px 4px 3px 13px; background: var(--surface-2); border: 1px solid #313544; }
.chat-compose input { flex: 1; min-width: 0; height: 34px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 14px; }
.chat-compose input::placeholder { color: #8e94a4; }
.chat-send { width: 35px; height: 35px; flex: 0 0 35px; border: 0; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: 17px; font-weight: 900; display: grid; place-items: center; padding: 0 0 0 2px; }
.chat-send:disabled { opacity: .5; }
.toast { bottom: calc(205px + var(--safe-bottom)); }
.chat-dock.collapsed ~ .toast { bottom: calc(86px + var(--safe-bottom)); }

@media (min-width: 700px) {
  .chat-dock { padding-left: max(8px, calc((100vw - 520px)/2)); padding-right: max(8px, calc((100vw - 520px)/2)); }
}


/* v0.6.1a full-screen dramatic live party message overlay */
.message-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  display: grid;
  place-items: center;
}
.message-overlay-stage {
  position: relative;
  width: min(92vw, 760px);
  min-height: min(52vw, 340px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 20px;
  animation: singnextMessageDramatic 3.8s cubic-bezier(.2,.8,.2,1) both;
}
.message-overlay-aura {
  position: absolute;
  border-radius: 999px;
  filter: blur(26px);
  opacity: .82;
  mix-blend-mode: screen;
  animation: singnextAuraFloat 3.8s ease-in-out both;
}
.message-overlay-aura-1 {
  width: min(72vw, 540px);
  height: 140px;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.78), rgba(164,137,255,.42) 34%, rgba(85,203,255,.14) 62%, rgba(85,203,255,0) 74%);
}
.message-overlay-aura-2 {
  width: min(48vw, 360px);
  height: 110px;
  transform: translate(-26vw, -48px) rotate(-12deg);
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.42), rgba(255,255,255,.06) 52%, rgba(255,255,255,0) 72%);
  animation-delay: 120ms;
}
.message-overlay-aura-3 {
  width: min(44vw, 320px);
  height: 110px;
  transform: translate(25vw, 42px) rotate(12deg);
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.38), rgba(255,255,255,.06) 56%, rgba(255,255,255,0) 74%);
  animation-delay: 210ms;
}
.message-overlay-meta {
  position: relative;
  z-index: 1;
  font-size: clamp(13px, 2.3vw, 18px);
  font-weight: 900;
  letter-spacing: .36em;
  text-transform: uppercase;
  color: rgba(255,255,255,.92);
  text-shadow: 0 0 14px rgba(255,255,255,.70), 0 0 34px rgba(156,134,255,.55);
}
.message-overlay-sender {
  position: relative;
  z-index: 1;
  max-width: 92%;
  font-size: clamp(24px, 4.4vw, 38px);
  line-height: 1.0;
  font-weight: 900;
  text-align: center;
  letter-spacing: .03em;
  color: rgba(255,255,255,.98);
  text-shadow: 0 0 16px rgba(255,255,255,.80), 0 0 34px rgba(141,118,255,.55), 0 0 54px rgba(0,0,0,.35);
}
.message-overlay-text {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 760px);
  padding: 0 10px;
  font-size: clamp(34px, 7.2vw, 64px);
  line-height: .98;
  font-weight: 900;
  text-align: center;
  color: #fff;
  text-shadow: 0 0 12px rgba(255,255,255,.92), 0 0 28px rgba(255,255,255,.76), 0 0 52px rgba(150,123,255,.58), 0 0 82px rgba(95,208,255,.24);
  overflow-wrap: anywhere;
}
@keyframes singnextMessageDramatic {
  0% { opacity: 0; transform: scale(.84) translateY(18px); filter: blur(12px); }
  8% { opacity: 1; transform: scale(1.03) translateY(-4px); filter: blur(0); }
  15% { transform: scale(1) translateY(0); }
  84% { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(1.04) translateY(-6px); filter: blur(4px); }
}
@keyframes singnextAuraFloat {
  0% { opacity: 0; transform: scale(.78) translateY(20px); }
  12% { opacity: .95; }
  55% { opacity: .88; }
  100% { opacity: 0; transform: scale(1.12) translateY(-10px); }
}
