/* ============================================================
   SPLATCAST — design system v2
   Ink-splat dark theme · glass cards · animated results
   ============================================================ */

:root {
  --bg: #0a0a12;
  --bg-2: #11121c;
  --card: rgba(22, 23, 34, 0.72);
  --card-solid: #161722;
  --card-border: rgba(255, 255, 255, 0.08);
  --text: #f2f3f8;
  --muted: #9aa0ae;
  --accent: #38e1ff;
  --accent-2: #ff3db5;
  --accent-3: #b6ff3d;
  --danger: #ff5470;
  --ok: #3ddc84;
  --bar-track: rgba(255, 255, 255, 0.07);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  min-height: 100%;
}

/* ---- decorative splat background ---- */
#splatBg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(600px 480px at 12% -8%, rgba(56, 225, 255, 0.13), transparent 65%),
    radial-gradient(720px 560px at 105% 18%, rgba(255, 61, 181, 0.11), transparent 65%),
    radial-gradient(640px 520px at 45% 115%, rgba(182, 255, 61, 0.08), transparent 65%),
    var(--bg);
}

/* ============================================================
   Generic elements
   ============================================================ */

h1, h2, h3 { margin: 0 0 10px; font-weight: 800; letter-spacing: -0.02em; }
h1 { font-size: 30px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

.muted { color: var(--muted); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.card {
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

input, select, textarea {
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 225, 255, 0.15);
}
input::placeholder { color: #6c7280; }

button {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
button:hover { background: rgba(255, 255, 255, 0.14); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

button.primary {
  background: linear-gradient(135deg, var(--accent), #2bb8ff 55%, var(--accent-2));
  background-size: 160% 160%;
  border: none;
  color: #04121a;
  font-weight: 800;
}
button.primary:hover { background-position: 80% 50%; }

button.danger {
  background: rgba(255, 84, 112, 0.12);
  border-color: rgba(255, 84, 112, 0.4);
  color: #ff8aa0;
}
button.danger:hover { background: rgba(255, 84, 112, 0.22); }

button.ghost { background: transparent; border-color: rgba(255, 255, 255, 0.14); }
button.mini { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
button.big { padding: 14px 22px; font-size: 17px; border-radius: 14px; }

code, .code { font-family: ui-monospace, Consolas, monospace; }

a { color: var(--accent); }

/* ============================================================
   Wordmark / logo
   ============================================================ */

.wordmark {
  font-weight: 900;
  letter-spacing: -0.04em;
  /* one consistent violet, like the original's solid purple wordmark
     (very subtle depth shift, all within the same hue family) */
  background: linear-gradient(105deg, #7c46e0 15%, #9743d8 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  user-select: none;
  white-space: nowrap;
}
.wordmark .dot { color: inherit; -webkit-text-fill-color: inherit; }

.hero-mark {
  display: block;
  margin: 0 auto 2px;
  height: clamp(115px, 18vw, 168px);   /* source art is 168px tall — avoid upscaling blur */
  filter: drop-shadow(0 10px 36px rgba(141, 59, 240, 0.4));
}

/* ============================================================
   Landing screen
   ============================================================ */

.screen { min-height: 100vh; }

#screenLanding {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7vh 18px 48px;
}

.landing-hero { text-align: center; margin-bottom: 36px; }
.landing-hero .wordmark { font-size: clamp(38px, 7.5vw, 68px); line-height: 1.05; }
.tagline {
  color: var(--muted);
  font-size: clamp(15px, 2.4vw, 19px);
  max-width: 560px;
  margin: 12px auto 0;
}

.landing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 380px));
  gap: 20px;
  justify-content: center;
  width: 100%;
  max-width: 820px;
}
.landing-cards .card { display: flex; flex-direction: column; gap: 12px; }

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  font-family: ui-monospace, Consolas, monospace;
}

.feature-chips {
  margin-top: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 640px;
}
.feature-chips span {
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.03);
}

#resumeRooms { display: flex; flex-direction: column; gap: 8px; }
.resume-chip {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.resume-chip .code { font-weight: 700; letter-spacing: 0.12em; }

/* ============================================================
   Session screen — topbar
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(10, 10, 18, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--card-border);
}
.topbar .brand { display: flex; align-items: center; gap: 8px; }
.topbar .brand img { height: 30px; }
.topbar .brand .wordmark { font-size: 22px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.room-pill {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 15px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(56, 225, 255, 0.1);
  border: 1px solid rgba(56, 225, 255, 0.35);
  color: var(--accent);
}
.room-pill:hover { background: rgba(56, 225, 255, 0.2); }

.presence {
  font-size: 13px;
  color: var(--muted);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 5px 11px;
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}
.presence b { color: var(--text); }

/* dropdown menu (export) */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--card-solid);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 180px;
  overflow: hidden;
  z-index: 60;
}
.menu button {
  background: none; border: none; border-radius: 0;
  text-align: left; padding: 10px 14px; font-weight: 500;
}
.menu button:hover { background: rgba(255, 255, 255, 0.07); }

/* ============================================================
   Session layout
   ============================================================ */

.session-main {
  display: grid;
  gap: 18px;
  padding: 18px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  grid-template-columns: 1fr;
  grid-template-areas: "stage" "qa";
}
.session-main.host {
  grid-template-columns: 360px minmax(0, 1fr);
  grid-template-areas:
    "builder stage"
    "builder qa";
  align-items: start;
}
#builderPane { grid-area: builder; }
#stagePane { grid-area: stage; }
#qaPane { grid-area: qa; }

@media (max-width: 920px) {
  .session-main.host {
    grid-template-columns: 1fr;
    grid-template-areas: "stage" "builder" "qa";
  }
}

/* participant: narrower centered column */
.session-main.participant {
  max-width: 680px;
}

.pane { min-width: 0; }

/* ============================================================
   Session builder (decks)
   ============================================================ */

.builder-main {
  display: grid;
  gap: 18px;
  padding: 18px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 920px) {
  .builder-main { grid-template-columns: 1fr; }
}

ul.saved-list li.active-deck { border-color: var(--accent); background: rgba(56, 225, 255, 0.07); }
.deck-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.move-btn { padding: 4px 9px; font-size: 12px; border-radius: 7px; }

/* ============================================================
   Builder pane (host)
   ============================================================ */

.type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
}
.type-btn .ico { font-size: 22px; }
.type-btn.active {
  border-color: var(--accent);
  background: rgba(56, 225, 255, 0.1);
  color: var(--accent);
}

.builder-field { margin-bottom: 12px; }
.builder-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
#optList { display: flex; flex-direction: column; gap: 8px; }
.opt-row { display: flex; align-items: center; gap: 8px; }
.opt-row input[type="text"] { flex: 1; min-width: 0; }
.opt-row .correct-pick { accent-color: var(--accent-3); width: 18px; height: 18px; cursor: pointer; }

details.saved {
  margin-top: 16px;
  border-top: 1px solid var(--card-border);
  padding-top: 12px;
}
details.saved summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
details.saved summary::before { content: "▸"; transition: transform 0.15s; color: var(--muted); }
details.saved[open] summary::before { transform: rotate(90deg); }
.saved-count {
  font-size: 12px; color: var(--muted);
  background: rgba(255,255,255,0.06); border-radius: 999px; padding: 1px 9px;
}

ul.saved-list { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
ul.saved-list li {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}
ul.saved-list .q-text { font-weight: 600; font-size: 14px; }
ul.saved-list .q-type { font-size: 12px; color: var(--muted); }

/* ============================================================
   Stage (current activity)
   ============================================================ */

.stage-card { min-height: 280px; display: flex; flex-direction: column; }

.stage-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.live-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; letter-spacing: 0.08em;
  padding: 4px 11px; border-radius: 999px;
}
.live-pill.live { background: rgba(61, 220, 132, 0.13); color: var(--ok); }
.live-pill.live::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  animation: pulse 1.6s ease-in-out infinite;
}
.live-pill.closed { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.vote-count { font-size: 13px; color: var(--muted); }
.stage-head .spacer { flex: 1; }

.stage-question { font-size: clamp(20px, 3vw, 27px); font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 18px; }

.stage-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 30px 10px;
  color: var(--muted);
}
.stage-empty .pulse-dot {
  width: 56px; height: 56px; border-radius: 50%;
  background: radial-gradient(circle, rgba(56,225,255,0.35), transparent 70%);
  display: grid; place-items: center; font-size: 26px;
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }

.stage-empty .share-inline { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.stage-empty .share-inline img { border-radius: 12px; background: #fff; padding: 6px; }
.stage-empty .big-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: clamp(28px, 5vw, 44px); font-weight: 800; letter-spacing: 0.22em;
  color: var(--text);
}

/* ---- answer choices (participant) ---- */
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice-btn {
  display: flex; align-items: center; gap: 12px;
  text-align: left; font-size: 16px; font-weight: 600;
  padding: 14px 16px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
}
.choice-btn:hover { border-color: var(--accent); background: rgba(56, 225, 255, 0.07); }
.choice-btn .letter {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px; font-size: 14px; font-weight: 800;
  background: rgba(255, 255, 255, 0.09);
}
.choice-btn.selected {
  border-color: var(--accent);
  background: rgba(56, 225, 255, 0.13);
}
.choice-btn.selected .letter { background: var(--accent); color: #04121a; }
.choice-btn.correct { border-color: var(--ok); background: rgba(61, 220, 132, 0.12); }
.choice-btn.correct .letter { background: var(--ok); color: #04121a; }
.choice-btn.wrong { border-color: var(--danger); background: rgba(255, 84, 112, 0.1); }

/* ---- result bars ---- */
.bars { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.bar { display: flex; flex-direction: column; gap: 5px; }
.bar .bar-label {
  display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; font-weight: 600;
}
.bar .bar-label em { font-style: normal; color: var(--muted); font-weight: 500; white-space: nowrap; }
.bar .bar-track {
  height: 22px; border-radius: 8px; background: var(--bar-track); overflow: hidden;
}
.bar .bar-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--accent), #2bb8ff);
  min-width: 3px;
  transition: width 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar.win .bar-fill { background: linear-gradient(90deg, var(--accent-3), #6ee76e); }
.bar.correct-bar .bar-fill { background: linear-gradient(90deg, var(--ok), #2ec97a); }

/* ---- word cloud ---- */
.cloud {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  align-items: center; justify-content: center;
  padding: 20px 6px; min-height: 140px;
}
.cloud span {
  font-weight: 800; line-height: 1.1; letter-spacing: -0.01em;
  animation: popIn 0.4s cubic-bezier(0.18, 1.4, 0.4, 1);
  white-space: nowrap;
}
.cloud .c0 { color: var(--accent); }
.cloud .c1 { color: var(--accent-2); }
.cloud .c2 { color: var(--accent-3); }
.cloud .c3 { color: #ffb938; }
.cloud .c4 { color: #b78cff; }
@keyframes popIn { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* word-cloud entry chips */
.chip-input { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(56, 225, 255, 0.12); border: 1px solid rgba(56, 225, 255, 0.4);
  color: var(--accent); border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: 14px;
}
.chip button { background: none; border: none; color: inherit; padding: 0 2px; font-size: 15px; }

/* ---- rating scale ---- */
.scale-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 6px; }
.scale-btn {
  width: 52px; height: 52px; font-size: 19px; font-weight: 800;
  border-radius: 13px; flex: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
}
.scale-btn:hover { border-color: var(--accent); }
.scale-btn.selected { background: var(--accent); color: #04121a; border-color: var(--accent); }
.scale-labels { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); max-width: 100%; }
.scale-avg { text-align: center; margin: 14px 0 4px; }
.scale-avg .num {
  font-size: clamp(38px, 6vw, 54px); font-weight: 900;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.scale-avg .out-of { color: var(--muted); font-size: 16px; }

/* ---- ranking ---- */
.rank-list { display: flex; flex-direction: column; gap: 10px; }
.rank-item {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px; border-radius: 13px; font-weight: 600; font-size: 15.5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
}
.rank-item .rank-num {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center;
  border-radius: 50%; font-size: 13px; font-weight: 800;
  background: rgba(255, 255, 255, 0.09); color: var(--muted);
}
.rank-item.ranked { border-color: var(--accent-2); background: rgba(255, 61, 181, 0.08); }
.rank-item.ranked .rank-num { background: var(--accent-2); color: #fff; }

/* ---- quiz leaderboard ---- */
.leaderboard { margin-top: 18px; }
.leaderboard ol { margin: 8px 0 0; padding: 0 0 0 6px; list-style: none; display: flex; flex-direction: column; gap: 7px; }
.leaderboard li {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 8px 12px; font-weight: 600;
}
.leaderboard .medal { width: 26px; text-align: center; font-size: 17px; }
.leaderboard .pts { margin-left: auto; color: var(--accent-3); font-weight: 800; }

/* ---- short-answer feed ---- */
ul.answers { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 8px; }
ul.answers li {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 9px 13px;
  animation: slideIn 0.3s ease;
}
ul.answers li .count {
  margin-left: auto; flex: none; font-size: 13px; font-weight: 700; color: var(--accent);
  background: rgba(56, 225, 255, 0.1); border-radius: 999px; padding: 2px 10px;
}
@keyframes slideIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.voted-note { margin-top: 14px; font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.voted-note::before { content: "✓"; color: var(--ok); font-weight: 800; }

/* ============================================================
   Q&A pane
   ============================================================ */

.qa-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.qa-tab {
  padding: 7px 15px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: transparent; border: 1px solid var(--card-border); color: var(--muted);
}
.qa-tab.active { background: rgba(56, 225, 255, 0.1); border-color: var(--accent); color: var(--accent); }
.qa-tab .badge {
  background: var(--accent-2); color: #fff; border-radius: 999px;
  font-size: 11px; padding: 0 7px; margin-left: 5px;
}

.sort-toggle { margin-left: auto; display: flex; gap: 4px; }
.sort-toggle button { padding: 5px 11px; font-size: 12.5px; border-radius: 999px; }
.sort-toggle button.active { background: rgba(255, 255, 255, 0.13); }

ul.qa { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 10px; }
ul.qa li {
  display: flex; align-items: flex-start; gap: 12px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--card-border);
  border-radius: var(--radius-sm); padding: 11px 13px;
  animation: slideIn 0.25s ease;
}
ul.qa li.answered { opacity: 0.62; }
ul.qa li.answered .qa-text { text-decoration: line-through; text-decoration-color: rgba(255,255,255,0.4); }
ul.qa li.hidden-q { border-style: dashed; opacity: 0.55; }
.qa-body { flex: 1; min-width: 0; }
.qa-text { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.qa-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.qa-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.upvote {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  min-width: 46px; padding: 6px 8px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05); font-size: 13px; font-weight: 700;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
}
.upvote .tri { font-size: 11px; }
.upvote.mine { border-color: var(--accent); color: var(--accent); background: rgba(56, 225, 255, 0.1); }

.tag-answered {
  font-size: 11px; font-weight: 700; color: var(--ok);
  border: 1px solid rgba(61,220,132,0.45); border-radius: 999px; padding: 1px 8px;
}

/* ============================================================
   Reactions
   ============================================================ */

.react-bar {
  position: fixed;
  left: 50%; bottom: 18px;
  transform: translateX(-50%);
  display: flex; gap: 6px;
  background: rgba(14, 15, 24, 0.85);
  backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 7px 10px;
  z-index: 70;
  box-shadow: var(--shadow);
}
.react-bar button {
  background: none; border: none; font-size: 23px; padding: 4px 7px; border-radius: 50%;
}
.react-bar button:hover { background: rgba(255, 255, 255, 0.1); transform: scale(1.18); }

#reactLayer {
  /* above the presenter overlay (z 100) so reactions float over it */
  position: fixed; inset: 0; pointer-events: none; z-index: 150; overflow: hidden;
}
.float-emoji {
  position: absolute; bottom: 60px; font-size: 30px;
  animation: floatUp 2.6s ease-out forwards;
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(0.7) rotate(0); opacity: 0; }
  10% { opacity: 1; transform: translateY(-30px) scale(1.1); }
  100% { transform: translateY(-72vh) scale(1) rotate(14deg); opacity: 0; }
}

/* ============================================================
   Presenter overlay
   ============================================================ */

.presenter {
  position: fixed; inset: 0; z-index: 100;
  background:
    radial-gradient(800px 600px at 8% -10%, rgba(56, 225, 255, 0.12), transparent 65%),
    radial-gradient(900px 700px at 108% 25%, rgba(255, 61, 181, 0.1), transparent 65%),
    var(--bg);
  display: flex; flex-direction: column;
  padding: 4vh 5vw 0;
}
.presenter-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 1100px; margin: 0 auto; width: 100%; }
.presenter-stage .stage-question { font-size: clamp(30px, 4.6vw, 56px); margin-bottom: 4vh; }
.presenter-stage .bar .bar-track { height: 36px; border-radius: 12px; }
.presenter-stage .bar .bar-fill { border-radius: 12px; }
.presenter-stage .bar .bar-label { font-size: clamp(16px, 2vw, 22px); }
.presenter-stage .cloud span { filter: drop-shadow(0 2px 14px rgba(0,0,0,0.5)); }
.presenter-stage .scale-avg .num { font-size: clamp(64px, 10vw, 120px); }

.presenter-foot {
  display: flex; align-items: center; justify-content: center; gap: 26px;
  padding: 2.4vh 0 3vh; font-size: clamp(16px, 2vw, 22px); color: var(--muted);
}
.presenter-foot b { color: var(--text); letter-spacing: 0.1em; font-family: ui-monospace, Consolas, monospace; }
.presenter-foot img.qr { height: clamp(70px, 11vh, 120px); border-radius: 12px; background: #fff; padding: 5px; }
.presenter-foot .pres-mark { height: clamp(44px, 7vh, 72px); }

.presenter-controls {
  position: absolute; top: 16px; right: 16px;
  display: flex; gap: 8px;
}
.presenter-controls button {
  width: 42px; height: 42px; border-radius: 50%; font-size: 17px; padding: 0;
}

/* ============================================================
   Modal
   ============================================================ */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(4, 4, 10, 0.7);
  backdrop-filter: blur(5px);
  display: grid; place-items: center;
  padding: 18px;
}
.modal {
  background: var(--card-solid);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 26px;
  max-width: 460px; width: 100%;
  box-shadow: var(--shadow);
  position: relative;
  text-align: center;
}
.modal .modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border-radius: 50%; padding: 0; font-size: 15px;
}
.modal.wide {
  max-width: 760px;
  text-align: left;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}
.lib-search { width: 100%; margin: 0 0 14px; }
.lib-body { overflow-y: auto; padding-right: 4px; margin: 0 -4px 0 0; }
.lib-cat { margin-bottom: 18px; }
.lib-cat h3 {
  position: sticky; top: 0;
  background: var(--card-solid);
  margin: 0 0 10px; padding: 4px 0;
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted);
  z-index: 1;
}
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.lib-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.lib-card .lib-name { font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.lib-card .lib-meta { font-size: 12.5px; color: var(--muted); }
.lib-card .row { margin-top: auto; padding-top: 8px; }
.lib-card button { flex: 1; }

.modal .big-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: clamp(34px, 8vw, 52px); font-weight: 800; letter-spacing: 0.25em;
  margin: 6px 0 14px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.modal img.qr { border-radius: 14px; background: #fff; padding: 8px; width: 200px; height: 200px; }

/* ============================================================
   Toasts
   ============================================================ */

#toasts {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--card-solid);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 14.5px; font-weight: 600;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
  max-width: min(440px, 90vw);
}
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
@keyframes toastIn { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============================================================
   Small screens
   ============================================================ */

@media (max-width: 560px) {
  .session-main { padding: 12px; gap: 12px; }
  .card { padding: 14px; }
  .topbar { padding: 8px 10px; gap: 8px; }
  .topbar .brand .wordmark { font-size: 18px; }
  .scale-btn { width: 46px; height: 46px; }
  .type-grid { grid-template-columns: repeat(3, 1fr); }
}
