/* ============================================================
   HOLONOVISION — stage styles
   ============================================================ */

:root {
  --bg-deep: #071322;
  --bg-mid: #0c2038;
  --bg-card: rgba(13, 33, 60, 0.88);
  --bg-panel: #0b1a30;
  --accent: #2ea8ff;
  --accent-2: #49e0c9;
  --accent-3: #ffd166;
  --text: #eaf2fc;
  --text-dim: #9fb6d4;
  --danger: #ff5a5a;
  --ok: #4ce68a;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: radial-gradient(120% 100% at 50% 0%, var(--bg-mid) 0%, var(--bg-deep) 60%, #050e1c 100%);
  overflow-x: hidden;
}

body { min-height: 100dvh; }

.hidden { display: none !important; }

/* ---------------- background stars ---------------- */
#bg-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff8 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 70%, #fff6 0%, transparent 100%),
    radial-gradient(2px 2px at 60% 20%, #fff7 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 50%, #fff5 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 10% 80%, #fff6 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 85%, #fff7 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 70% 90%, #fff5 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 10%, #fff8 0%, transparent 100%);
  animation: twinkle 5s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.5; } to { opacity: 1; } }

.screen { position: relative; z-index: 1; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------------- logo ---------------- */
.logo {
  font-weight: 900;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 0;
  filter: drop-shadow(0 0 18px rgba(46, 168, 255, 0.45));
}
/* The "O" is a tiny disco ball — always visible, always spinning */
.logo-o {
  display: inline-block;
  width: 0.74em;
  height: 0.74em;
  margin: 0 0.05em;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95) 0 8%, transparent 34%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.25) 0 2px, transparent 2px 5px),
    repeating-linear-gradient(90deg, #cfe6ff 0 3px, #86b9e8 3px 6px);
  box-shadow: 0 0 10px rgba(150, 205, 255, 0.9), inset -3px -3px 7px rgba(0, 5, 20, 0.5);
  animation: ball-shine 2.4s linear infinite;
  vertical-align: -0.04em;
}
@keyframes ball-shine { from { background-position: 0 0, 0 0, 0 0; } to { background-position: 0 0, 0 0, 24px 0; } }
.logo-small { font-size: 1.05rem; }
.tagline { color: var(--text-dim); margin: 6px 0 0; letter-spacing: 0.2em; text-transform: uppercase; font-size: 0.72rem; }

/* ---------------- buttons & inputs ---------------- */
.btn {
  font: inherit;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 18px;
  background: #1c3a63;
  color: var(--text);
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s;
  user-select: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1px) scale(0.97); }
.btn-glow {
  background: linear-gradient(90deg, var(--accent), #1465e0);
  box-shadow: 0 0 18px rgba(46, 168, 255, 0.5);
  font-weight: 700;
}
.btn-big { font-size: 1.15rem; padding: 14px 30px; }
.btn-dim { background: #152c4c; color: var(--text-dim); }
.btn-small { font-size: 0.8rem; padding: 6px 12px; }
.btn-danger { background: #6e1830; box-shadow: 0 0 12px rgba(255, 90, 90, 0.25); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

input, textarea, select {
  font: inherit;
  color: var(--text);
  background: rgba(5, 14, 28, 0.6);
  border: 2px solid #1c3a63;
  border-radius: 10px;
  padding: 10px 14px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-2); }
textarea { resize: vertical; }

.error-msg { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; font-size: 0.9rem; }
.muted { color: var(--text-dim); font-size: 0.85rem; }

.pop-in { animation: pop-in 0.45s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes pop-in { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ============================================================
   LOGIN
   ============================================================ */
#screen-login { align-items: center; justify-content: center; }
.login-card {
  background: var(--bg-card);
  border: 1px solid #2b5590;
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 40px 34px;
  width: min(420px, 92vw);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  backdrop-filter: blur(6px);
}
.login-card .logo { font-size: clamp(1.6rem, 6vw, 2.3rem); }
.logo-wrap { margin-bottom: 8px; }
.host-toggle {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--text-dim); font-size: 0.9rem; cursor: pointer;
}
.host-toggle input { width: auto; }

/* ============================================================
   COUNTRY PICK
   ============================================================ */
.mini-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
}
.hello { color: var(--text-dim); font-size: 0.9rem; }
.country-body { flex: 1; display: flex; flex-direction: column; padding: 0 16px 120px; max-width: 1100px; width: 100%; margin: 0 auto; }
.country-title { text-align: center; margin: 4px 0 14px; font-size: clamp(1.1rem, 4vw, 1.6rem); }
.map-toolbar { display: flex; gap: 10px; margin-bottom: 10px; }
.map-toolbar input { flex: 1; }
.zoom-btns { display: flex; gap: 6px; }
.btn-zoom { padding: 8px 14px; font-size: 1.1rem; }

.map-holder {
  position: relative;
  background: rgba(6, 15, 30, 0.65);
  border: 1px solid #1c3a63;
  border-radius: var(--radius);
  overflow: hidden;
  flex: 1;
  min-height: 300px;
  touch-action: none;
}
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-dim); }
.map-holder svg { width: 100%; height: 100%; display: block; cursor: grab; }
.map-holder svg:active { cursor: grabbing; }
.map-holder svg path {
  fill: #2b5288;
  stroke: #071322;
  stroke-width: 0.5;
  transition: fill 0.15s;
  cursor: pointer;
}
.map-holder svg path:hover { fill: var(--accent-2); }
.map-holder svg path.taken { fill: #152943; cursor: not-allowed; }
.map-holder svg path.selected { fill: var(--accent); filter: drop-shadow(0 0 6px var(--accent)); }

.map-tooltip {
  position: fixed;
  pointer-events: none;
  background: #050e1c;
  border: 1px solid var(--accent-2);
  color: var(--text);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.85rem;
  z-index: 50;
  white-space: nowrap;
}

.country-list {
  max-height: 260px;
  overflow-y: auto;
  background: rgba(6, 15, 30, 0.9);
  border: 1px solid #1c3a63;
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.country-list button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: none; border: none; color: var(--text);
  padding: 10px 14px; cursor: pointer; font: inherit;
}
.country-list button:hover { background: #152c4c; }
.country-list button.taken { color: #5d7899; cursor: not-allowed; }
.country-list .taken-by { margin-left: auto; font-size: 0.75rem; color: var(--text-dim); }

.flag { width: 28px; height: 21px; border-radius: 3px; object-fit: cover; box-shadow: 0 1px 4px #0008; vertical-align: middle; }
.flag-big { width: 46px; height: 34px; }

.country-confirm {
  position: fixed;
  left: 50%; bottom: 22px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 12px 20px;
  box-shadow: 0 0 30px rgba(46, 168, 255, 0.4);
  z-index: 60;
  animation: pop-in 0.3s cubic-bezier(0.2, 1.6, 0.4, 1);
  max-width: 94vw;
}
.floating-error { position: fixed; bottom: 90px; left: 0; right: 0; text-align: center; z-index: 61; }

/* ============================================================
   LOBBY
   ============================================================ */
#screen-lobby { align-items: center; justify-content: center; }
.lobby-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid #2b5590;
  border-radius: 22px;
  padding: 36px 30px;
  width: min(460px, 92vw);
  text-align: center;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.lobby-spot {
  position: absolute; top: -60px; left: 50%;
  width: 160px; height: 160px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(73, 224, 201, 0.35) 0%, transparent 70%);
  animation: lobby-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes lobby-pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.lobby-you { font-size: 1.15rem; }
.lobby-wait { color: var(--text-dim); }
.dots span { animation: dot-blink 1.4s infinite; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-blink { 0%, 60%, 100% { opacity: 0.2; } 30% { opacity: 1; } }
.lobby-others h3 { font-size: 0.85rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; }
.lobby-list { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; min-height: 40px; }
.lobby-peer { display: flex; align-items: center; gap: 6px; background: #152c4c; border-radius: 999px; padding: 5px 12px 5px 6px; font-size: 0.85rem; animation: pop-in 0.3s; }
.lobby-tip { color: var(--accent-3); font-size: 0.85rem; min-height: 1.2em; margin-top: 18px; }

/* ============================================================
   CROWD — header & layout
   ============================================================ */
.crowd-header {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: rgba(5, 14, 28, 0.7);
  border-bottom: 1px solid #182f52;
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(8px);
}
.header-me { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.host-badge {
  background: var(--accent); color: #fff; font-size: 0.6rem;
  padding: 2px 8px; border-radius: 999px; vertical-align: middle;
  letter-spacing: 0.1em;
}
.btn-chat-toggle { position: relative; padding: 8px 12px; background: #152c4c; }
.badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--accent); color: white;
  font-size: 0.65rem; min-width: 18px; height: 18px;
  border-radius: 999px; display: grid; place-items: center;
  padding: 0 4px;
}

.crowd-main { flex: 1; display: flex; min-height: 0; }
.stage-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 14px; gap: 12px; overflow-y: auto; }

/* ---------------- the stage ---------------- */
.stage {
  position: relative;
  border-radius: 18px;
  background:
    radial-gradient(80% 90% at 50% 110%, #123e6d 0%, transparent 60%),
    linear-gradient(180deg, #06122a 0%, #0a1f3a 100%);
  border: 1px solid #1c3a63;
  overflow: hidden;
  padding: 26px 18px 0;
  box-shadow: var(--shadow);
}

.stage-lights { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.beam {
  position: absolute;
  top: -30px;
  width: 90px; height: 130%;
  background: linear-gradient(180deg, rgba(46, 168, 255, 0.30) 0%, transparent 80%);
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0% 100%);
  transform-origin: 50% 0;
  animation: beam-sway 5s ease-in-out infinite alternate;
}
.beam-1 { left: 8%; animation-delay: 0s; }
.beam-2 { left: 32%; background: linear-gradient(180deg, rgba(73, 224, 201, 0.28) 0%, transparent 80%); animation-delay: -1.4s; }
.beam-3 { right: 32%; background: linear-gradient(180deg, rgba(255, 209, 102, 0.24) 0%, transparent 80%); animation-delay: -2.7s; }
.beam-4 { right: 8%; background: linear-gradient(180deg, rgba(240, 248, 255, 0.18) 0%, transparent 80%); animation-delay: -3.6s; }
@keyframes beam-sway { from { transform: rotate(-16deg); } to { transform: rotate(16deg); } }

.disco-ball {
  position: absolute; top: 8px; left: 50%;
  transform: translateX(-50%);
  width: 44px; height: 44px;
  border-radius: 50%;
  background:
    repeating-linear-gradient(0deg, #cfd8ff22 0 4px, transparent 4px 8px),
    repeating-linear-gradient(90deg, #ffffff55 0 4px, #9db4ff88 4px 8px);
  box-shadow: 0 0 24px rgba(180, 200, 255, 0.7), inset -6px -6px 12px #0006;
  animation: ball-spin 6s linear infinite;
  z-index: 3;
}
.disco-ball::before {
  content: ""; position: absolute; top: -10px; left: 50%;
  width: 2px; height: 10px; background: #888; transform: translateX(-50%);
}
@keyframes ball-spin { from { background-position: 0 0, 0 0; } to { background-position: 0 0, 80px 0; } }
.disco-sparkle {
  position: absolute; inset: -12px;
  background: radial-gradient(circle, #fff9 0 2px, transparent 3px);
  background-size: 22px 22px;
  animation: sparkle-rot 4s linear infinite;
  opacity: 0.5;
  border-radius: 50%;
}
@keyframes sparkle-rot { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.stage-inner {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  z-index: 4;
  padding-bottom: 34px;
  max-width: 900px;
  margin: 0 auto;
}

.big-screen {
  position: relative;
  flex: 1;
  aspect-ratio: 16 / 9;
  background: #020810;
  border: 3px solid #2b5590;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 34px rgba(73, 224, 201, 0.25);
  min-width: 0;
}
#video-container, #video-container iframe, #video-container video { width: 100%; height: 100%; display: block; border: 0; }
.video-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background:
    radial-gradient(60% 60% at 50% 45%, #2a145e 0%, transparent 100%),
    #020810;
}
.placeholder-logo {
  font-weight: 900; letter-spacing: 0.1em;
  font-size: clamp(0.9rem, 3.4vw, 1.6rem);
  background: linear-gradient(90deg, var(--accent-2), var(--accent), var(--accent-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: placeholder-glow 3s ease-in-out infinite alternate;
}
@keyframes placeholder-glow { from { filter: drop-shadow(0 0 4px #2ea8ff44); } to { filter: drop-shadow(0 0 16px #49e0c988); } }
.placeholder-sub { color: var(--text-dim); font-size: clamp(0.65rem, 2vw, 0.85rem); }
/* invisible layer so the audience can't click/pause the player */
.video-shield { position: absolute; inset: 0; z-index: 3; }
.video-tap {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  background: rgba(3, 9, 18, 0.82);
  color: var(--text);
  font-size: 1.2rem; font-weight: 700;
  border: none; cursor: pointer; border-radius: 0;
  z-index: 5;
}
.now-playing {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(5, 14, 28, 0.85);
  border: 1px solid var(--accent-2);
  border-radius: 999px;
  font-size: 0.75rem;
  padding: 4px 12px;
  z-index: 4;
  max-width: 85%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------------- host on stage ---------------- */
.host-spot {
  position: relative;
  width: 130px;
  flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 4px;
}
.host-avatar { width: 92px; height: 92px; animation: host-bob 2.6s ease-in-out infinite; }
.host-avatar svg { width: 100%; height: 100%; }
.host-avatar.away { opacity: 0.35; filter: grayscale(1); }
@keyframes host-bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
.host-name-tag {
  background: linear-gradient(90deg, var(--accent), #1465e0);
  font-size: 0.72rem; font-weight: 700;
  padding: 3px 12px; border-radius: 999px;
  margin-top: 4px;
  max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bubble {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  width: max-content;
  max-width: min(340px, 60vw);
  background: #fff;
  color: #0a1a33;
  border-radius: 16px;
  padding: 10px 14px;
  font-size: 0.92rem;
  line-height: 1.35;
  box-shadow: 0 6px 24px #0008;
  z-index: 6;
  animation: bubble-pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
  transform-origin: bottom right;
}
.bubble::after {
  content: "";
  position: absolute;
  bottom: -9px; right: 28px;
  border: 10px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}
@keyframes bubble-pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.stage-floor {
  position: relative;
  height: 26px;
  margin: 0 -18px;
  background: linear-gradient(180deg, #1b4979 0%, #0a1f3a 100%);
  border-top: 2px solid #3e77b8;
  box-shadow: 0 -4px 30px rgba(62, 119, 184, 0.55);
  z-index: 2;
}

.reactions-layer { position: absolute; inset: 0; pointer-events: none; z-index: 10; overflow: hidden; }
.float-emoji {
  position: absolute;
  bottom: 0;
  font-size: 1.9rem;
  animation: float-up 2.6s ease-out forwards;
  filter: drop-shadow(0 2px 6px #0008);
}
@keyframes float-up {
  0% { transform: translateY(0) scale(0.6) rotate(0); opacity: 0; }
  12% { opacity: 1; transform: translateY(-8%) scale(1.1); }
  100% { transform: translateY(-105%) scale(1) rotate(14deg); opacity: 0; }
}

/* ---------------- audience ---------------- */
.audience-wrap {
  background: linear-gradient(180deg, rgba(20, 8, 46, 0.4), rgba(5, 14, 28, 0.8));
  border: 1px solid #182f52;
  border-radius: 18px;
  padding: 14px;
}
.audience {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 10px;
  justify-content: center;
  min-height: 96px;
}
.audience-member {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 76px;
  animation: pop-in 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.audience-member .avatar { width: 54px; height: 54px; animation: crowd-bob var(--bob-dur, 2.4s) ease-in-out infinite; animation-delay: var(--bob-delay, 0s); }
.audience-member .avatar svg { width: 100%; height: 100%; }
.audience-member.dancing .avatar { animation: crowd-dance var(--bob-dur, 0.9s) ease-in-out infinite; animation-delay: var(--bob-delay, 0s); }
.audience-member.me .name-tag { background: var(--accent-2); color: #062030; font-weight: 700; }
.audience-member.offline { opacity: 0.35; filter: grayscale(0.8); }
@keyframes crowd-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes crowd-dance {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-9px) rotate(6deg); }
}
.audience-member .flag { width: 20px; height: 15px; }
.name-tag {
  font-size: 0.68rem;
  background: #152c4c;
  padding: 2px 8px;
  border-radius: 999px;
  max-width: 76px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------------- chat ---------------- */
.chat-panel {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-left: 1px solid #182f52;
  min-height: 0;
}
.chat-head {
  padding: 12px 14px;
  font-weight: 700;
  border-bottom: 1px solid #182f52;
  display: flex; align-items: center; justify-content: space-between;
}
.btn-chat-close { display: none; background: none; font-size: 1.3rem; padding: 0 6px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { font-size: 0.86rem; line-height: 1.3; animation: chat-in 0.25s ease-out; word-wrap: break-word; }
@keyframes chat-in { from { transform: translateX(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.chat-msg .chat-from { font-weight: 700; color: var(--accent-2); margin-right: 4px; }
.chat-msg.host-msg .chat-from { color: var(--accent-3); }
.chat-msg.host-msg { background: rgba(255, 209, 102, 0.08); border-radius: 8px; padding: 4px 8px; }
.chat-msg .flag { width: 16px; height: 12px; margin-right: 4px; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #182f52; }
.chat-form input { flex: 1; padding: 8px 12px; }
.btn-send { background: var(--accent); padding: 8px 14px; }

/* ---------------- bottom bar ---------------- */
.bottom-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(5, 14, 28, 0.85);
  border-top: 1px solid #182f52;
  position: sticky; bottom: 0; z-index: 30;
  backdrop-filter: blur(8px);
}
.reaction-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-react { font-size: 1.25rem; padding: 7px 11px; background: #152c4c; }
.btn-react:active { transform: scale(1.3); }
.btn-vote {
  background: linear-gradient(90deg, var(--accent-3), #ff9d2e);
  color: #0e2036;
  font-weight: 900;
  font-size: 1rem;
  padding: 12px 22px;
  animation: vote-pulse 1.2s ease-in-out infinite;
}
@keyframes vote-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255, 209, 102, 0.5); transform: scale(1); }
  50% { box-shadow: 0 0 28px rgba(255, 209, 102, 0.9); transform: scale(1.05); }
}

/* ============================================================
   HOST DASHBOARD
   ============================================================ */
.host-main { flex: 1; display: flex; min-height: 0; }
.host-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  align-content: start;
}
.card {
  background: var(--bg-card);
  border: 1px solid #1c3a63;
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.card h3 { margin: 0; font-size: 1rem; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card h4 { margin: 6px 0 0; font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: center; font-size: 0.85rem; color: var(--text-dim); cursor: pointer; }
.check input { width: auto; }

.invite-row { display: flex; gap: 14px; align-items: center; }
.invite-qr { width: 110px; height: 110px; border-radius: 10px; background: #fff; }
.invite-url { font-weight: 700; color: var(--accent-2); word-break: break-all; }
.counts { margin-top: 6px; font-size: 0.85rem; color: var(--text-dim); }
.counts span { color: var(--accent-3); font-weight: 700; }

.people-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.person {
  display: flex; align-items: center; gap: 8px;
  background: #152c4c; border-radius: 10px; padding: 7px 10px;
  font-size: 0.9rem;
  animation: pop-in 0.25s;
}
.person .flag { width: 22px; height: 16px; }
.person .person-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person.offline { opacity: 0.45; }
.person .btn { padding: 4px 10px; font-size: 0.75rem; }

.host-player-wrap { aspect-ratio: 16/9; background: #020810; border-radius: 10px; overflow: hidden; border: 2px solid #2b5590; }
#host-video-container, #host-video-container iframe, #host-video-container video { width: 100%; height: 100%; display: block; border: 0; }
.video-controls .btn { flex: 1; min-width: 90px; }

.tally { display: flex; flex-direction: column; gap: 4px; }
.tally-head { font-weight: 700; color: var(--accent-3); }
.tally-row { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.tally-row .flag { width: 18px; height: 13px; }
.tally-pts { margin-left: auto; font-weight: 900; color: var(--accent-2); }

.songs-list { display: flex; flex-direction: column; gap: 6px; }
.song-row {
  display: flex; align-items: center; gap: 8px;
  background: #112440; border-radius: 10px; padding: 7px 10px; font-size: 0.85rem;
}
.song-row.current { border: 1px solid var(--accent-2); }
.song-row .flag { width: 20px; height: 15px; }
.song-row .song-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-row .song-pts { font-weight: 900; color: var(--accent-3); }
.song-row .btn { padding: 3px 8px; font-size: 0.7rem; }

.sfx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.btn-sfx { background: #152c4c; font-size: 0.85rem; padding: 10px 6px; border-radius: 10px; }
.btn-sfx:active { background: var(--accent); }

.q-results { display: flex; flex-direction: column; gap: 6px; }
.q-bar-row { font-size: 0.85rem; }
.q-bar-label { display: flex; justify-content: space-between; margin-bottom: 2px; }
.q-bar {
  height: 10px; border-radius: 999px; background: #112440; overflow: hidden;
}
.q-bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.5s ease;
}
.q-answer-row { background: #112440; border-radius: 8px; padding: 6px 10px; font-size: 0.85rem; }
.q-answer-row .q-who { color: var(--accent-2); font-weight: 700; margin-right: 6px; }

/* ============================================================
   OVERLAYS
   ============================================================ */

/* vote sheet */
.sheet {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(3, 9, 18, 0.75);
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(4px);
}
.sheet-inner {
  background: linear-gradient(180deg, #113054, #0b1a30);
  border: 1px solid var(--accent);
  border-bottom: none;
  border-radius: 26px 26px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  width: min(560px, 100vw);
  text-align: center;
  animation: sheet-up 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
  box-shadow: 0 -10px 60px rgba(46, 168, 255, 0.35);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-title { margin: 0 0 4px; }
.vote-song { color: var(--accent-3); font-weight: 700; margin: 0 0 16px; }
.vote-song .flag { width: 24px; height: 18px; }
.points-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 14px; }
.btn-points {
  font-size: 1.25rem; font-weight: 900;
  padding: 14px 0;
  border-radius: 14px;
  background: #1c3a63;
  border: 2px solid transparent;
}
.btn-points.picked {
  background: linear-gradient(135deg, var(--accent-3), #ff9d2e);
  color: #0e2036;
  border-color: #fff;
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(255, 209, 102, 0.7);
}
.btn-points.douze { background: #2b5590; }
.vote-status { min-height: 1.3em; color: var(--ok); font-weight: 700; margin: 0 0 10px; }

/* modals */
.modal {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(3, 9, 18, 0.8);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.modal-inner {
  background: linear-gradient(180deg, #113054, #0b1a30);
  border: 1px solid var(--accent-2);
  border-radius: 20px;
  padding: 26px 24px;
  width: min(480px, 94vw);
  max-height: 86dvh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 0 50px rgba(73, 224, 201, 0.3);
}
.modal-inner h2 { margin: 0 0 10px; font-size: 1.2rem; }
.q-text { font-size: 1.1rem; font-weight: 700; }
.q-options { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.q-options .btn { width: 100%; padding: 13px; font-size: 1rem; }
.q-options .btn.picked {
  background: linear-gradient(90deg, var(--accent-2), #1465e0); font-weight: 900;
  box-shadow: 0 0 16px rgba(73, 224, 201, 0.6);
}
#q-free-form { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.results-body { text-align: left; margin: 14px 0; display: flex; flex-direction: column; gap: 8px; }

/* scoreboard */
.scoreboard-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(4, 11, 22, 0.95);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
  animation: fade-in 0.4s;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.scoreboard-inner { width: min(640px, 94vw); max-height: 92dvh; overflow-y: auto; padding: 20px; }
.scoreboard-title {
  text-align: center;
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  margin: 0 0 20px;
  background: linear-gradient(90deg, var(--accent-3), var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 20px rgba(255, 209, 102, 0.5));
}
.scoreboard-rows { display: flex; flex-direction: column; gap: 10px; }
.sb-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card);
  border: 1px solid #1c3a63;
  border-radius: 14px;
  padding: 10px 16px;
  animation: sb-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
  position: relative;
  overflow: hidden;
}
@keyframes sb-in { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sb-row.first {
  border-color: var(--accent-3);
  box-shadow: 0 0 26px rgba(255, 209, 102, 0.45);
}
.sb-rank { font-size: 1.1rem; font-weight: 900; width: 34px; color: var(--text-dim); }
.sb-row.first .sb-rank { color: var(--accent-3); }
.sb-row .flag { width: 30px; height: 22px; }
.sb-name { flex: 1; font-weight: 700; min-width: 0; }
.sb-name small { display: block; color: var(--text-dim); font-weight: 400; font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-points { font-size: 1.35rem; font-weight: 900; color: var(--accent-2); }
.sb-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width 1s ease; }

/* douze banner */
.douze-banner {
  position: fixed; top: 30%; left: 50%; z-index: 130;
  transform: translate(-50%, -50%) rotate(-6deg);
  font-size: clamp(2rem, 9vw, 4.5rem);
  font-weight: 900;
  letter-spacing: 0.05em;
  background: linear-gradient(90deg, var(--accent-3), #ff9d2e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(255, 209, 102, 0.8));
  animation: douze-pop 2.4s cubic-bezier(0.2, 1.5, 0.4, 1) forwards;
  pointer-events: none;
  white-space: nowrap;
}
@keyframes douze-pop {
  0% { transform: translate(-50%, -50%) rotate(-6deg) scale(0); opacity: 0; }
  16% { transform: translate(-50%, -50%) rotate(-6deg) scale(1.15); opacity: 1; }
  26% { transform: translate(-50%, -50%) rotate(-6deg) scale(1); }
  78% { opacity: 1; }
  100% { transform: translate(-50%, -60%) rotate(-6deg) scale(1.05); opacity: 0; }
}

/* sound unlock + toast */
.sound-unlock {
  position: fixed; inset: 0; z-index: 140;
  background: rgba(3, 9, 18, 0.8);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(5px);
}
.toast {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  background: #050e1c; border: 1px solid var(--accent-2);
  border-radius: 999px; padding: 10px 20px;
  z-index: 150; font-size: 0.9rem;
  box-shadow: 0 6px 30px #000a;
  animation: pop-in 0.25s;
  max-width: 90vw; text-align: center;
}
.toast.toast-error { border-color: var(--danger); color: #ffb3b3; }

#confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 861px) {
  .chat-panel.closed { display: none; }
}

@media (max-width: 860px) {
  .chat-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(320px, 88vw);
    z-index: 90;
    transform: translateX(105%);
    transition: transform 0.28s cubic-bezier(0.2, 1, 0.3, 1);
    box-shadow: -10px 0 40px #000a;
  }
  .chat-panel.open { transform: none; }
  .btn-chat-close { display: block; }
  .stage-inner { gap: 8px; padding-bottom: 24px; }
  .host-spot { width: 84px; }
  .host-avatar { width: 64px; height: 64px; }
  .bubble { max-width: min(260px, 72vw); font-size: 0.82rem; }
  .audience-member { width: 62px; }
  .audience-member .avatar { width: 44px; height: 44px; }
  .name-tag { max-width: 62px; font-size: 0.62rem; }
  .points-grid { gap: 7px; }
  .btn-points { font-size: 1.05rem; padding: 12px 0; }
  .stage-wrap { padding: 10px; }
  .bottom-bar { padding-left: 10px; padding-right: 10px; }
  .btn-react { font-size: 1.05rem; padding: 6px 9px; }
  .btn-vote { font-size: 0.85rem; padding: 10px 14px; }
  .host-grid { grid-template-columns: 1fr; padding: 10px; }
  .invite-qr { width: 88px; height: 88px; }
}

@media (max-width: 420px) {
  .reaction-btns { gap: 4px; }
  .btn-react { font-size: 1rem; padding: 5px 8px; }
}

/* Reduced motion: calm everything down */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
}
