/* LibrePoll — clean, minimal, responsive design system. */

:root {
  --bg: #ffffff;
  --bg-subtle: #f6f7f9;
  --bg-raised: #ffffff;
  --border: #c7cdd6;
  --text: #16181d;
  --text-muted: #656d76;
  --brand: #4f46e5;
  --brand-dark: #3f37c9;
  --brand-contrast: #ffffff;
  --success: #12875a;
  --success-bg: #e7f7ef;
  --danger: #d1263f;
  --danger-bg: #fdecee;
  --warn: #b7791f;
  --warn-bg: #fdf3e0;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --max-width: 960px;
  font-size: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --bg-subtle: #17191f;
    --bg-raised: #1b1e25;
    --border: #2b2f38;
    --text: #eef0f3;
    --text-muted: #9aa2ad;
    --brand: #8b81f7;
    --brand-dark: #a89dfc;
    --brand-contrast: #10121a;
    --success: #3ecf8e;
    --success-bg: #0f2a20;
    --danger: #ff6b81;
    --danger-bg: #2c1216;
    --warn: #f0b94d;
    --warn-bg: #2c2210;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--text-muted); }
.small { font-size: 0.85rem; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.container--wide { max-width: 1200px; }
.container--narrow { max-width: 440px; }
@media (min-width: 641px) {
  .container--narrow { max-width: 800px; }
}

/* --- Nav --- */
.nav {
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.85rem 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}
.nav-brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.nav-links { display: flex; gap: 1rem; flex: 1; flex-wrap: wrap; }
.nav-links a { color: var(--text-muted); font-size: 0.92rem; }
.nav-links a.active, .nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-right { display: flex; align-items: center; gap: 0.9rem; }

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  border: 1.5px solid var(--text-muted);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}
.badge-count.has-pending {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
  animation: shake 3.2s ease-in-out infinite;
}
@keyframes shake {
  0%, 92%, 100% { transform: translateX(0) rotate(0); }
  93% { transform: translateX(-2px) rotate(-8deg); }
  94% { transform: translateX(2px) rotate(8deg); }
  95% { transform: translateX(-2px) rotate(-6deg); }
  96% { transform: translateX(2px) rotate(6deg); }
  97% { transform: translateX(0) rotate(0); }
}

main { padding: 2rem 0 4rem; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text);
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}
.btn:hover { border-color: var(--text-muted); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.82rem; }
.btn-lg { padding: 0.85rem 1.4rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 0.45rem; width: 2.1rem; height: 2.1rem; }
.btn-icon.is-copied { color: var(--success); }

/* --- Forms --- */
label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 0.3rem; }
.field { margin-bottom: 1.1rem; }
.field-hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 0.3rem; }
input[type="text"], input[type="email"], input[type="number"], input[type="password"],
input[type="search"], textarea, select {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}
textarea { min-height: 6rem; resize: vertical; }
input[type="color"] {
  width: 100%;
  height: 2.6rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}
input:focus, textarea:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
.checkbox-row label { font-weight: 400; margin: 0; }

.advanced { margin-bottom: 1.5rem; }
.advanced > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  list-style: none;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before { content: "▸ "; color: var(--text-muted); }
.advanced[open] > summary::before { content: "▾ "; }
.advanced[open] > summary { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.advanced-body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 1.1rem 0.9rem 0.1rem;
}

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute; inset: 0; background: var(--border); border-radius: 999px; transition: background 0.15s;
}
.switch-track::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform 0.15s; box-shadow: var(--shadow);
}
.switch input:checked + .switch-track { background: var(--success); }
.switch input:checked + .switch-track::before { transform: translateX(18px); }

/* --- Cards / tiles --- */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.poll-tile {
  display: block;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  color: var(--text);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.poll-tile:hover { box-shadow: var(--shadow); border-color: var(--brand); text-decoration: none; }
.poll-tile-type {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}
.poll-tile-name { font-weight: 600; margin-bottom: 0.3rem; }
.poll-tile-meta { color: var(--text-muted); font-size: 0.82rem; }

.poll-respond-qr { width: 100px; height: 100px; margin: 0 auto; }
.poll-respond-qr svg { width: 100%; height: 100%; display: block; }

.type-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.4rem; height: 1.4rem; border-radius: 5px;
  background: var(--bg-subtle); font-size: 0.8rem;
}

.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-closed { background: var(--danger-bg); color: var(--danger); }
.badge-open { background: var(--success-bg); color: var(--success); }
.badge-pending { background: var(--warn-bg); color: var(--warn); }

/* --- Display tiles on the poll page --- */
.display-tile {
  position: relative;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  padding-bottom: 2.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.display-tile-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.display-tile-name { font-weight: 600; }
.display-url-row {
  display: flex; gap: 0.4rem; align-items: center;
  background: var(--bg-subtle); border-radius: var(--radius-sm); padding: 0.4rem 0.5rem;
}
.display-url-row input {
  border: none; background: transparent; font-size: 0.8rem; color: var(--text-muted); padding: 0.1rem;
  flex: 1; min-width: 0;
}
.display-tile-delete {
  position: absolute;
  bottom: 0.7rem;
  right: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--danger);
  cursor: pointer;
}
.display-tile-delete:hover { background: var(--danger-bg); }
.display-tile.is-revoked { opacity: 0.55; }

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10, 12, 16, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--bg-raised); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  padding: 1.5rem;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }

/* --- Tables --- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; }
tr:last-child td { border-bottom: none; }

/* --- Flash / alerts --- */
.alert { border-radius: var(--radius-sm); padding: 0.75rem 1rem; margin-bottom: 1rem; font-size: 0.9rem; }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }

/* --- Utility --- */
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.row { display: flex; align-items: center; gap: 0.75rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.wrap { flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* --- Responsive --- */
@media (max-width: 640px) {
  .nav-inner { flex-wrap: wrap; gap: 0.6rem; }
  .nav-links { order: 3; width: 100%; gap: 0.75rem; }
  main { padding: 1.25rem 0 3rem; }
  h1 { font-size: 1.35rem; }
}

/* =========================================================================
   Display renderer (served standalone or embedded in PowerPoint). Must
   scale typography/layout to its container at any size — thumbnail up to
   full-slide — so units below lean on cqw/vw rather than fixed px.
   ========================================================================= */
.lp-display {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Fallback only — display.js's applyColors() always sets background-color
     and color inline, from the display's `background`/`text_color`
     parameters (auto-computed contrast, or an explicit override). True
     transparency ("blend with whatever's behind it") is gone: it's
     incompatible with the anti-ghosting fix below, which needs an
     always-opaque, nudgeable background to work. */
  background-color: #ffffff;
  color: #1c1e24;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  position: relative;
  /* Promotes this to its own GPU compositing layer. Content add-in webview
     hosts (PowerPoint on Mac, worse in slideshow mode) have a documented
     tendency not to repaint a same-size content update, leaving stale
     pixels ("ghosting") on screen — an already-isolated layer is less
     likely to get skipped. Paired with the per-render and heartbeat
     background-color nudges in display.js (forceRepaint()), which are the
     change actually confirmed to fix it. */
  transform: translateZ(0);
}

.lp-display-inner { flex: 1; display: flex; flex-direction: column; padding: 4%; min-height: 0; }
.lp-prompt { margin: auto; text-align: center; max-width: 90%; }
.lp-prompt-text { font-size: clamp(1.1rem, 4vw, 2.6rem); font-weight: 700; margin-bottom: 1em; }
.lp-prompt-qr { display: flex; flex-direction: column; align-items: center; gap: 0.6em; }
.lp-prompt-qr canvas, .lp-prompt-qr svg { width: min(40vh, 40vw, 260px); height: auto; background: #fff; padding: 6px; border-radius: 8px; }
.lp-prompt-link { font-size: clamp(0.9rem, 2vw, 1.3rem); font-weight: 600; letter-spacing: 0.02em; }
.lp-prompt-code { font-family: ui-monospace, SFMono-Regular, monospace; font-size: clamp(1rem, 2.4vw, 1.6rem); }
.lp-prompt-response-count { font-size: clamp(0.65rem, 1.4vw, 0.95rem); opacity: 0.55; margin-top: 1.2em; }

.lp-reconnecting {
  position: absolute; bottom: 3%; right: 3%;
  font-size: 0.72rem; padding: 0.3em 0.7em; border-radius: 999px;
  background: rgba(120, 90, 0, 0.85); color: #fff; opacity: 0.9;
}
.lp-blank { position: absolute; inset: 0; background: #000; z-index: 40; }
.lp-blank[hidden] { display: none; }

.lp-toggle-hint { position: absolute; top: 3%; right: 3%; font-size: 0.7rem; opacity: 0.5; }

.lp-moderation-note { position: absolute; bottom: 3%; left: 3%; font-size: 0.72rem; opacity: 0.6; }
.lp-moderation-note[hidden] { display: none; }

/* Bar graph — Chart.js canvas (current). .lp-bars* below is the original
   hand-rolled div/CSS implementation, kept intact as a rollback path (see
   BAR_GRAPH_ENGINE in display.js) rather than deleted. */
.lp-bars-chart-wrap { position: relative; flex: 1; width: 100%; min-height: 0; }

.lp-bars { display: flex; flex-direction: column; gap: 0.6em; flex: 1; justify-content: center; }
.lp-bars.horizontal .lp-bar-row { display: flex; align-items: center; gap: 0.6em; }
.lp-bar-label { flex: 0 0 28%; font-size: clamp(0.75rem, 1.6vw, 1.1rem); text-align: right; }
.lp-bar-track { flex: 1; background: rgba(120,120,130,0.18); border-radius: 6px; height: clamp(1em, 4vw, 2em); overflow: hidden; }
.lp-bar-fill { height: 100%; background: var(--lp-accent, var(--brand)); border-radius: 6px; transition: width 0.4s ease; }
.lp-bar-fill.correct { background: var(--success); }
.lp-bar-value { flex: 0 0 auto; font-size: clamp(0.7rem, 1.4vw, 1rem); min-width: 2.5em; }

/* Tables */
.lp-table { width: 100%; border-collapse: collapse; font-size: clamp(0.75rem, 2vw, 1.2rem); }
.lp-table td, .lp-table th { padding: 0.4em 0.6em; border-bottom: 1px solid rgba(120,120,130,0.25); }

/* Summary table (number poll type) — a row of stat cards rather than a
   plain table, so it reads at a glance from across a room. */
.lp-summary-stats {
  flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.8em; align-content: center;
}
.lp-summary-stat {
  background: rgba(120,120,130,0.1); border-radius: 10px; padding: 1em 0.6em;
  text-align: center; display: flex; flex-direction: column; justify-content: center; gap: 0.35em;
}
.lp-summary-stat-label { font-size: clamp(0.65rem, 1.4vw, 1rem); opacity: 0.65; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.lp-summary-stat-value { font-size: clamp(1.4rem, 5vw, 3rem); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--lp-accent, var(--brand)); }

/* Word cloud (Chart.js-style canvas via wordcloud2.js) / note grid */
.lp-cloud { position: relative; flex: 1; }
.lp-cloud canvas { display: block; width: 100%; height: 100%; }
.lp-notegrid { position: relative; flex: 1; }
.lp-note {
  position: absolute; color: #1c1e24; border-radius: 8px;
  padding: 0.5em 0.7em; font-size: clamp(0.55rem, 1.4vw, 0.95rem); box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  max-width: 14em; min-height: 150px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  transition: left 0.6s ease, top 0.6s ease;
}

/* Movie credits */
.lp-credits { flex: 1; overflow: hidden; position: relative; }
.lp-credits-track { position: absolute; left: 0; right: 0; display: flex; flex-direction: column; gap: 1.2em; text-align: center; }
.lp-credits-track div { font-size: clamp(0.9rem, 2.6vw, 1.6rem); }

/* Upvote list */
.lp-upvote-list { display: flex; flex-direction: column; gap: 0.5em; flex: 1; overflow: hidden; }
.lp-upvote-row { display: flex; justify-content: space-between; gap: 0.6em; background: rgba(120,120,130,0.1); border-radius: 8px; padding: 0.5em 0.8em; }
.lp-upvote-text { font-size: clamp(0.75rem, 2vw, 1.15rem); }
.lp-upvote-count { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Continuum / scatter — endpoint labels sit inline with the track, at the
   same height as the points themselves (not floating above it), so the
   whole thing reads left-label / points / right-label in one row. There
   is deliberately no visible line under the points any more: individual
   points get a little vertical jitter (seededJitter — deterministic per
   response so it doesn't reshuffle on re-render) so they read as a
   scattered set of responses rather than values plotted on a ruler; the
   mean marker (.lp-dot.mean) stays exactly on the centerline as the one
   fixed reference point. */
.lp-continuum { flex: 1; display: flex; align-items: center; gap: 0.75em; }
.lp-continuum-track { position: relative; flex: 1; min-width: 0; height: clamp(3rem, 14vw, 6rem); }
.lp-continuum-label { flex: 0 0 auto; max-width: 32%; font-size: clamp(0.7rem, 1.6vw, 1.05rem); font-weight: 600; }
.lp-continuum-label.right { text-align: right; }
.lp-dot { position: absolute; top: 50%; width: 0.9em; height: 0.9em; border-radius: 50%; background: var(--lp-accent, var(--brand)); opacity: 0.55; transform: translate(-50%, -50%); }
.lp-dot.mean { width: 1.6em; height: 1.6em; opacity: 1; background: var(--danger); z-index: 2; }
.lp-marker { position: absolute; font-size: clamp(1em, 2.4vw, 1.8em); transform: translate(-50%, -50%); }

.lp-scatter { flex: 1; position: relative; border: 1px solid rgba(120,120,130,0.3); }
.lp-scatter-crosshair { position: absolute; background: rgba(120,120,130,0.25); }
.lp-scatter-axis-label { position: absolute; font-size: clamp(0.65rem, 1.4vw, 1rem); font-weight: 600; white-space: nowrap; }

/* Leaderboard */
.lp-leaderboard { flex: 1; display: flex; flex-direction: column; gap: 0.45em; justify-content: center; }
.lp-leaderboard-row { display: flex; align-items: center; gap: 0.7em; font-size: clamp(0.75rem, 2vw, 1.2rem); }
.lp-leaderboard-rank { font-weight: 800; opacity: 0.6; width: 1.6em; }
.lp-leaderboard-name { flex: 1; }
.lp-leaderboard-score { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Carousel — .lp-carousel-item needs a *definite* width/height (100% of
   .lp-carousel, which itself gets a real size from flex:1 in the column
   layout above it), not max-width/max-height alone. A percentage
   max-width/max-height can only resolve against a definite containing
   block; with no explicit size here, the item's own size was determined
   by its content (the img), while the img's size depended on the item's
   size via that same percentage — a circular dependency that collapsed
   both to 0×0, hiding every whiteboard/photo carousel behind a blank
   frame regardless of image content. */
.lp-carousel { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; min-height: 0; }
.lp-carousel-item { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.lp-carousel-item img, .lp-carousel-item svg { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }

/* Masonry */
/* Masonry Grid (flow engine) — plain flexbox, no layout library and no
   dependency on CSS `aspect-ratio`. `min-height: 0` because this is a
   flex:1 item inside a column flex container (.lp-display-inner), and
   without it some browsers refuse to let a flex item shrink below its
   content's natural height, defeating overflow-y's scrollbar. Every tile
   gets an explicit pixel width/height inline (display.js's
   renderMasonryGridFlow, computed from the response's own stored image
   dimensions), so plain flex-wrap reads left-to-right and wraps down —
   "like text" — with no CSS feature more exotic than flexbox involved, on
   the theory (see spec) that whatever's failing to render this correctly
   inside PowerPoint doesn't support `aspect-ratio` but clearly does
   support flexbox, since every other display already depends on it. */
.lp-masonry { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-wrap: wrap; align-content: flex-start; }
/* Margin, not `gap` — `gap` on a flex container is itself a somewhat
   newer addition than flexbox proper, and this component now exists
   specifically to avoid depending on anything not maximally safe. */
.lp-masonry-item { margin: 0 8px 8px 0; border-radius: 8px; overflow: hidden; background: rgba(120,120,130,0.08); }
.lp-masonry-item img, .lp-masonry-item svg { display: block; }
.lp-masonry-item.text-tile { width: 220px; padding: 0.6em 0.8em; font-size: clamp(0.7rem, 1.6vw, 1rem); }
.lp-masonry-item.fade-in { animation: fadein 0.4s ease; }

/* Masonry Grid (CSS engine) — the original `columns:` layout, kept intact
   as a rollback path behind MASONRY_GRID_ENGINE in display.js, since this
   project isn't kept under source control. Its actual bug (documented in
   display.js): given more content than fits the container's height,
   `columns` doesn't scroll vertically — it adds more columns, extending
   the grid sideways indefinitely. */
.lp-masonry-css { columns: 3 160px; column-gap: 0.6em; flex: 1; overflow: auto; }
.lp-masonry-css .lp-masonry-item { width: 100%; break-inside: avoid; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --- Present view: large touch targets, high contrast --- */
.present-poll-select { font-size: 1.1rem; padding: 0.8rem; }
.present-display {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem;
  background: var(--bg-raised);
}
.present-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 0.6rem; margin-top: 0.75rem; }
.present-controls .btn { padding: 1.1rem 0.5rem; font-size: 1rem; }
.present-panic {
  width: 100%; padding: 1.4rem; font-size: 1.2rem; font-weight: 800; letter-spacing: 0.02em;
  background: var(--danger); color: #fff; border: none; border-radius: var(--radius);
  margin: 1.5rem 0;
}
.present-panic.is-active { background: #7a0f22; }

/* --- Moderation queue --- */
.moderate-card { max-width: 520px; margin: 0 auto; text-align: center; }
.moderate-media { max-width: 100%; max-height: 50vh; border-radius: var(--radius); margin-bottom: 1rem; }
.moderate-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; }
.moderate-actions .btn { width: 5.5rem; height: 5.5rem; border-radius: 50%; font-size: 1.8rem; }

/* --- Respond forms --- */
.respond-container { max-width: 480px; margin: 0 auto; }
.option-list { display: flex; flex-direction: column; gap: 0.5rem; }
.option-item {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; font-weight: 500;
}
.option-item:hover { border-color: var(--brand); }
.option-item.selected { border-color: var(--brand); background: rgba(79, 70, 229, 0.08); }
/* A slider/place_yourself response is a *position* on a continuum, not a
   quantity — the browser's default filled track (0 up to the thumb, in
   the accent color) reads as "this much of a bar", which is the wrong
   metaphor. -webkit-appearance/appearance: none clears the native
   rendering entirely, so the track and thumb are rebuilt as plain,
   unfilled elements below: same neutral color the whole way across,
   with only the thumb marking the chosen position. */
.slider-input {
  width: 100%; margin: 1.5rem 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: transparent;
}
.slider-input::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--border); }
.slider-input::-moz-range-track { height: 6px; border-radius: 3px; background: var(--border); }
/* Firefox doesn't fill the track by default (only -webkit- does), but
   pin -moz-range-progress to the same neutral color anyway in case a
   future engine change adds one. */
.slider-input::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--border); }
.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none; margin-top: -9px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand); border: 3px solid var(--bg-raised); box-shadow: var(--shadow);
}
.slider-input::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--bg-raised);
  background: var(--brand); box-shadow: var(--shadow);
}
.slider-input:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--brand); outline-offset: 2px; }
.slider-input:focus-visible::-moz-range-thumb { outline: 2px solid var(--brand); outline-offset: 2px; }
/* slider/place_yourself response forms: endpoint labels flank the input
   in one row, reusing display.js's .lp-continuum-label. Previously these
   labels were position:absolute with no positioned ancestor, which put
   them off-screen above the page — not just a display-side issue. */
.slider-row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.slider-row .slider-input { flex: 1 1 140px; margin: 0; }
.marker-palette { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.marker-choice { font-size: 1.6rem; padding: 0.3rem 0.5rem; border-radius: var(--radius-sm); border: 2px solid transparent; cursor: pointer; }
.marker-choice.selected { border-color: var(--brand); background: rgba(79, 70, 229, 0.08); }
.whiteboard-canvas { width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--border); border-radius: var(--radius); touch-action: none; background: #fff; }
.whiteboard-toolbar { display: flex; gap: 0.5rem; margin: 0.6rem 0; flex-wrap: wrap; }
/* .wb-text-input (the whiteboard Text tool's in-place editor) is styled
   entirely inline by respond.js, not here — the app-wide
   `input[type="text"] { width:100%; ... }` rule above has higher
   specificity (tag+attribute beats a single class) and would otherwise
   win, stretching it to full viewport width with a bordered input box
   instead of the small in-place caret it's meant to be. Only the class
   name exists for JS to select it by. */
.point2d-plane { width: 100%; aspect-ratio: 1 / 1; border: 1px solid var(--border); border-radius: var(--radius); position: relative; touch-action: none; }
