/* =====================================================================
   SurveyAll — instructor surfaces (dashboard, editor, results).
   These are tools, not documents: scan first, read second.
   ===================================================================== */

.section-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.section-head h2 { font-size: 1.3rem; }

/* ---------------------------------------------------------- deck list */

.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--sp-4);
}

.deck-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  transition: border-color .15s ease, transform .1s ease;
}
.deck-card:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--edge)); }

.deck-swatch {
  height: 4.5rem;
  border-radius: 8px;
  border: 1px solid var(--edge);
  position: relative;
  overflow: hidden;
}
.deck-swatch::after {
  content: attr(data-theme-name);
  position: absolute;
  left: .5rem; bottom: .4rem;
  font-size: .68rem;
  font-weight: 600;
  padding: .12rem .4rem;
  border-radius: 999px;
  background: rgba(255,255,255,.82);
  color: #222;
}

.deck-title { font-family: var(--display); font-size: 1.05rem; font-weight: 650; line-height: 1.2; }
.deck-meta { font-size: .78rem; color: var(--ink-soft); }
.deck-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: auto; }

/* =====================================================================
   The deck editor — three panes.

   Slides on the left, the open slide in the middle, the deck's look on
   the right. Each pane owns its own scrollbar so the rail never scrolls
   away from you while you work down a long question, which is the whole
   reason a slide overview earns its width.
   ===================================================================== */

.edit-body { overflow: hidden; }

.editor-shell {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr) 21rem;
  height: calc(100vh - 3.6rem);   /* below the sticky appbar */
  height: calc(100dvh - 3.6rem);
  min-height: 0;
}
.editor-shell.design-hidden { grid-template-columns: 15rem minmax(0, 1fr); }
.editor-shell.design-hidden > .side { display: none; }

/* ------------------------------------------------------- the slide rail */

.slide-rail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--edge);
  background: color-mix(in srgb, var(--ink) 3%, var(--surface));
}

.rail-head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
}
.rail-count { font-size: .72rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.rail-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  list-style: none;
  margin: 0;
  padding: 0 var(--sp-2) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.rail-empty {
  padding: var(--sp-4) var(--sp-3);
  font-size: .82rem;
  color: var(--ink-soft);
}

.rail-item {
  position: relative;
  display: grid;
  grid-template-columns: 1.1rem minmax(0, 1fr);
  gap: var(--sp-2);
  align-items: start;
  padding: .2rem .15rem;
  border-radius: 8px;
}
.rail-item.is-dragging { opacity: .4; }
/* a drop line, in the direction the slide is travelling */
.rail-item.is-drop-before::before,
.rail-item.is-drop-after::after {
  content: '';
  position: absolute;
  left: 1.6rem; right: .2rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.rail-item.is-drop-before::before { top: -.3rem; }
.rail-item.is-drop-after::after { bottom: -.3rem; }

.rail-num {
  padding-top: .15rem;
  font-size: .7rem;
  font-weight: 600;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  text-align: right;
  cursor: grab;
}

.rail-col { min-width: 0; display: flex; flex-direction: column; gap: .15rem; }

.rail-thumb {
  display: block;
  width: 100%;
  padding: 0;
  border: 2px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
  background: none;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.rail-thumb:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--edge)); }
.rail-item.is-selected .rail-thumb {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.rail-type {
  font-size: .68rem;
  color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Row actions stay out of the way until you want them, so the rail reads
   as a strip of slides rather than a strip of buttons. */
.rail-actions {
  position: absolute;
  top: .3rem; right: .3rem;
  display: flex;
  gap: .1rem;
  padding: .1rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity .15s ease;
}
.rail-item:hover .rail-actions,
.rail-item:focus-within .rail-actions { opacity: 1; }

.rail-act {
  width: 1.15rem; height: 1.15rem;
  display: grid; place-items: center;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--ink-soft);
  font-size: .7rem;
  line-height: 1;
  cursor: pointer;
}
.rail-act:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 10%, transparent); color: var(--ink); }
.rail-act:disabled { opacity: .3; cursor: default; }
.rail-act.is-danger:hover { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }

.rail-foot {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-top: 1px solid var(--edge);
  background: var(--surface);
}
.rail-foot .btn { width: 100%; }

/* --------------------------------------------------------- slide stage */

.slide-stage {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.stage-canvas-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: center;
}
.stage-canvas {
  width: 100%;
  max-width: 44rem;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.canvas-note { font-size: .74rem; text-align: center; }

.slide-form {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-5);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
}
.form-head { display: flex; align-items: center; gap: var(--sp-2); }
.form-head h2 { font-size: 1.05rem; }

.step-num {
  width: 1.3rem;
  flex-shrink: 0;
  font-size: .74rem;
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------- new-slide gallery */

.gallery-backdrop { position: fixed; inset: 0; z-index: 190; }

.slide-gallery {
  position: fixed;
  z-index: 200;
  width: min(38rem, calc(100vw - 2rem));
  max-height: min(30rem, 70vh);
  overflow-y: auto;
  padding: var(--sp-4);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.gallery-head h3 { font-size: 1rem; margin-bottom: var(--sp-3); }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: var(--sp-3);
}

.gallery-tile {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .4rem;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.gallery-tile:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.gallery-thumb {
  display: block;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--edge);
}
.gallery-name { font-size: .84rem; font-weight: 650; }
.gallery-blurb { font-size: .7rem; color: var(--ink-soft); line-height: 1.35; }

/* ------------------------------------------------------ narrow screens */

@media (max-width: 1080px) {
  .editor-shell { grid-template-columns: 12rem minmax(0, 1fr); }
  .editor-shell > .side { display: none; }
  .editor-shell:not(.design-hidden) > .side {
    display: flex;
    position: fixed;
    top: 3.6rem; right: 0; bottom: 0;
    width: min(21rem, 92vw);
    z-index: 60;
    box-shadow: var(--shadow);
  }
}
@media (max-width: 720px) {
  .edit-body { overflow: auto; }
  .editor-shell { grid-template-columns: minmax(0, 1fr); height: auto; }
  .slide-rail { border-right: none; border-bottom: 1px solid var(--edge); }
  .rail-list { flex-direction: row; overflow-x: auto; }
  .rail-item { min-width: 8.5rem; }
  .slide-stage { padding: var(--sp-4); overflow: visible; }
}

.opt-editor { display: flex; flex-direction: column; gap: var(--sp-2); }
.opt-line { display: flex; align-items: center; gap: var(--sp-2); }
.opt-line input[type="text"] { flex: 1; }
.opt-correct {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .76rem; color: var(--ink-soft);
  white-space: nowrap;
}
.opt-remove {
  border: none; background: none; cursor: pointer;
  color: var(--ink-soft); font-size: 1.1rem; line-height: 1;
  padding: .2rem .35rem; border-radius: 5px;
}
.opt-remove:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: var(--sp-3);
}

/* ------------------------------------------------------------- panels */

.side {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-height: 0;
  overflow-y: auto;
  padding: var(--sp-4);
  border-left: 1px solid var(--edge);
  background: color-mix(in srgb, var(--ink) 2%, var(--surface));
}

.panel {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.panel h3 { font-size: .95rem; }

/* --------------------------------------------------------- theme grid */

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
}

.theme-tile {
  border: 2px solid var(--edge);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: none;
  text-align: left;
  transition: border-color .15s ease, transform .08s ease, box-shadow .15s ease;
}
.theme-tile:hover { transform: translateY(-1px); }
.theme-tile.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* a miniature slide: tokens are scoped onto .theme-slide by applyTheme,
   so every var() below resolves to THAT theme, not the page's */
.theme-slide {
  aspect-ratio: 16 / 10;
  position: relative;
  background-color: var(--ground);
  display: flex;
  align-items: flex-end;
  padding: .5rem .55rem;
}
.theme-slide-name {
  position: absolute;
  top: .45rem; left: .55rem; right: .5rem;
  font-family: var(--display);
  color: var(--ink);
  font-size: .84rem;
  font-weight: 650;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-slide-bars {
  display: flex;
  align-items: flex-end;
  gap: .3rem;
  width: 100%;
  height: 46%;
}
.theme-slide-bars span {
  flex: 1;
  border-radius: min(var(--bar-radius), 4px) min(var(--bar-radius), 4px) 0 0;
}
.theme-slide-bars span:nth-child(1) { height: 55%; background: var(--accent); }
.theme-slide-bars span:nth-child(2) { height: 90%; background: var(--accent-2); }
.theme-slide-bars span:nth-child(3) { height: 70%; background: var(--accent); }
.theme-slide-bars span:nth-child(4) { height: 38%; background: var(--accent); }

/* --------------------------------------- pedagogy: editor additions */

.anchor-name {
  flex: 1;
  font-size: .8rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.anchor-input { width: 4.5rem; }

.passage-input {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
  font-size: .85rem;
  resize: vertical;
}
.seg-preview {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .4rem;
}
.seg-preview-chip {
  padding: .2rem .5rem;
  border: 1px solid var(--edge);
  border-radius: 999px;
  font-size: .7rem;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--ink) 3%, transparent);
}
.seg-preview-warn {
  font-size: .7rem;
  font-weight: 700;
  color: var(--bad);
}

.template-modal { max-width: 34rem; }
.template-list {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  max-height: 55vh;
  overflow-y: auto;
  margin: 1rem 0;
}
.template-card {
  padding: .8rem .9rem;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--surface);
}
.template-card p { margin: .25rem 0; font-size: .8rem; color: var(--ink-soft); }
.template-card .template-source {
  font-size: .7rem;
  font-style: italic;
}
.template-card .btn { margin-top: .35rem; }

/* --------------------------------------------------------- my themes */

.mythemes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-3);
}
.mythemes-head h4 { font-size: .85rem; }
.mythemes-empty {
  font-size: .74rem;
  color: var(--ink-soft);
  margin: .35rem 0 0;
}

/* small pencil chip on a custom tile */
.theme-edit {
  position: absolute;
  top: .35rem; right: .35rem;
  width: 1.5rem; height: 1.5rem;
  display: grid; place-items: center;
  border: none;
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  color: var(--ink);
  font-size: .8rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease;
}
.theme-tile:hover .theme-edit,
.theme-edit:focus-visible { opacity: 1; }

.theme-builder {
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 3%, var(--surface));
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.ct-colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}
.ct-colors input[type="color"] {
  width: 100%;
  height: 2.2rem;
  padding: .15rem;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.ct-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}
.ct-warn {
  font-size: .74rem;
  font-weight: 600;
  color: var(--bad);
  margin: 0;
}
.ct-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ---------------------------------------------------- background grid */

.bg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
}

.bg-tile {
  aspect-ratio: 4 / 3;
  border: 2px solid var(--edge);
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  background-color: var(--ground);
  background-size: cover;
  background-position: center;
  padding: 0;
}
.bg-tile.is-active { border-color: var(--accent); }
.bg-tile-label {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: .15rem .3rem;
  font-size: .6rem;
  font-weight: 600;
  background: rgba(255,255,255,.85);
  color: #222;
  text-align: center;
}

.bg-controls { display: flex; flex-direction: column; gap: var(--sp-2); }
.bg-controls input[type="range"] { width: 100%; }

.upload-drop {
  border: 2px dashed var(--edge);
  border-radius: 10px;
  padding: var(--sp-4);
  text-align: center;
  font-size: .82rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.upload-drop:hover, .upload-drop.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* -------------------------------------------------------- text import */

.text-editor {
  width: 100%;
  min-height: 24rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .84rem;
  line-height: 1.6;
  tab-size: 2;
}

.parse-errors { display: flex; flex-direction: column; gap: var(--sp-1); }

/* ------------------------------------------------------------ session */

.session-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--surface);
}

.session-code {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .1em;
}

.session-meta { font-size: .78rem; color: var(--ink-soft); }

/* ------------------------------------------------------------ results */

.result-block {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-4);
}
.result-block .chart { font-size: .95rem; }
.result-block [data-chart="cloud"] { min-height: 16rem; }

.stat-row {
  display: flex;
  gap: var(--sp-5);
  flex-wrap: wrap;
}
.stat { display: flex; flex-direction: column; gap: .1rem; }
.stat-value {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-label { font-size: .72rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; }

.empty-state {
  padding: var(--sp-7) var(--sp-5);
  text-align: center;
  border: 1px dashed var(--edge);
  border-radius: var(--radius);
  display: flex; flex-direction: column; gap: var(--sp-3);
  align-items: center;
}
.empty-state h3 { font-size: 1.1rem; }
.empty-state p { color: var(--ink-soft); font-size: .9rem; max-width: 26rem; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: grid; place-items: center;
  padding: var(--sp-4);
  z-index: 200;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--sp-5);
  max-width: 44rem;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--sp-4);
  box-shadow: var(--shadow);
}

/* =====================================================================
   Miniature slides (app/slide-preview.js).

   One set of rules for three sizes: the rail thumbnail, the editor
   canvas, and the new-slide gallery. The slide's own font-size is a
   percentage of its width (cqw), and everything inside is in em, so the
   whole composition scales without a single media query — the same trick
   present.css uses to fill a projector.
   ===================================================================== */

.sp-frame {
  container-type: inline-size;
  width: 100%;
  display: block;
}

.sp-slide {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  isolation: isolate;
  color: var(--ink);
  font-family: var(--body);
  font-size: 12px;        /* fallback where container units are missing */
  font-size: 5.6cqw;
  line-height: 1.3;
}

.sp-backdrop { position: absolute; inset: 0; background-repeat: no-repeat; background-position: center; }
.sp-scrim { position: absolute; inset: 0; }

.sp-content {
  position: relative;
  z-index: 2;
  height: 100%;
  padding: 6% 6.5%;
  display: flex;
  flex-direction: column;
  gap: .45em;
}

.sp-kicker {
  font-size: .4em;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.sp-prompt {
  font-family: var(--display);
  font-size: calc(1.05em * var(--prompt-scale, 1));
  font-weight: 650;
  line-height: 1.14;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sp-prompt.is-empty { opacity: .45; font-style: italic; }

.sp-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sp-blank { opacity: .4; font-size: .5em; }

/* ---------------------------------------------------------- bars/donut */

.sp-bars { display: flex; flex-direction: column; gap: .34em; width: 100%; }
.sp-bar-row { display: flex; align-items: center; gap: .4em; }
.sp-bar-track {
  flex: 1;
  height: .42em;
  border-radius: var(--bar-radius);
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  overflow: hidden;
}
.sp-bar-fill { height: 100%; border-radius: inherit; background: var(--accent); }
.sp-bar-fill.is-alt { background: var(--accent-2); opacity: .85; }
.sp-bar-fill.is-key { background: var(--good); }
.sp-bar-label {
  flex: 0 0 auto;
  max-width: 42%;
  font-size: .38em;
  color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sp-donut-wrap { display: grid; place-items: center; height: 100%; }
.sp-donut {
  width: 3.2em; height: 3.2em;
  border-radius: 50%;
  -webkit-mask: radial-gradient(circle, transparent 46%, #000 47%);
  mask: radial-gradient(circle, transparent 46%, #000 47%);
}

/* ---------------------------------------------------------------- cloud */

.sp-cloud {
  display: flex; flex-wrap: wrap;
  align-items: baseline; justify-content: center;
  gap: .1em .35em;
  font-family: var(--display);
  font-weight: 650;
  line-height: 1;
}
.sp-cloud-word { color: var(--accent); }
.sp-cloud-word.is-alt { color: var(--accent-2); }

/* --------------------------------------------------------- text cards */

.sp-cards { display: flex; gap: .35em; width: 100%; }
.sp-card {
  flex: 1;
  display: flex; flex-direction: column; gap: .2em;
  padding: .35em;
  border-radius: .3em;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
}
.sp-line {
  height: .16em;
  width: 90%;
  border-radius: 99px;
  background: color-mix(in srgb, var(--ink) 26%, transparent);
}

/* --------------------------------------------------------------- scales */

.sp-scales { display: flex; flex-direction: column; gap: .32em; width: 100%; }
.sp-scale-row { display: flex; align-items: center; gap: .4em; }
.sp-scale-label {
  flex: 0 0 34%;
  font-size: .38em;
  color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sp-scale-track {
  position: relative;
  flex: 1;
  height: .12em;
  border-radius: 99px;
  background: color-mix(in srgb, var(--ink) 15%, transparent);
}
.sp-scale-dot {
  position: absolute;
  top: 50%;
  width: .42em; height: .42em;
  margin: -.21em 0 0 -.21em;
  border-radius: 50%;
  background: var(--accent);
}

/* -------------------------------------------------------------- ranking */

.sp-rank { display: flex; flex-direction: column; gap: .3em; width: 100%; }
.sp-rank-row { display: flex; align-items: center; gap: .35em; }
.sp-rank-num {
  width: .9em; height: .9em;
  flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
  font-size: .38em;
  font-weight: 700;
}
.sp-rank-bar { height: .34em; border-radius: var(--bar-radius); background: var(--accent); }

/* ------------------------------------------------------------- spectrum */

.sp-spectrum { display: flex; flex-direction: column; gap: .25em; width: 100%; }
.sp-spectrum-ends {
  display: flex; justify-content: space-between;
  font-size: .36em; color: var(--ink-soft);
}
.sp-spectrum-axis {
  position: relative;
  height: 2.1em;
  border-radius: .25em;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 14%, transparent),
    color-mix(in srgb, var(--accent-2) 14%, transparent));
}
.sp-spectrum-dot {
  position: absolute;
  width: .28em; height: .28em;
  margin: -.14em 0 0 -.14em;
  border-radius: 50%;
  background: var(--accent);
}

/* ------------------------------------------------------------- showdown */

.sp-showdown { display: flex; gap: .4em; width: 100%; }
.sp-sample {
  flex: 1;
  display: flex; flex-direction: column; gap: .2em;
  padding: .35em;
  border-radius: .3em;
  border: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
}
.sp-sample-text {
  font-size: .36em;
  line-height: 1.3;
  color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}
.sp-sample-bar {
  margin-top: auto;
  height: .28em;
  border-radius: var(--bar-radius);
  background: var(--accent);
}

/* -------------------------------------------------------------- heatmap */

.sp-heat { display: flex; flex-wrap: wrap; gap: .18em; font-size: .38em; line-height: 1.45; }
.sp-heat-seg {
  padding: .05em .3em;
  border-radius: .2em;
  background: color-mix(in srgb, var(--accent) calc(var(--heat, .3) * 55%), transparent);
}
.sp-heat-seg.is-blank { height: 1.15em; }

/* ------------------------------------------------------------------ Q&A */

.sp-qa { display: flex; flex-direction: column; gap: .3em; width: 100%; }
.sp-bubble {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: .85em;
  padding-right: .25em;
  border-radius: .3em .3em .3em .1em;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}
.sp-bubble.is-alt {
  background: color-mix(in srgb, var(--accent-2) 22%, transparent);
  align-self: flex-end;
  border-radius: .3em .3em .1em .3em;
}
.sp-bubble-vote { font-size: .34em; color: var(--ink-soft); line-height: 1; }

/* -------------------------------------------------------- instructions */

.sp-instructions {
  display: flex;
  align-items: center;
  gap: .8em;
  width: 100%;
}
.sp-steps {
  flex: 1;
  min-width: 0;
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: .28em;
}
.sp-step { display: flex; align-items: flex-start; gap: .35em; }
.sp-step-num {
  flex-shrink: 0;
  width: .95em; height: .95em;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--ground);
  font-size: .4em;
  font-weight: 700;
  line-height: 1;
}
.sp-step-text {
  font-size: .4em;
  line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.sp-joincard {
  flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: .25em;
  padding: .4em;
  border-radius: .35em;
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
}
/* The QR is a picture of a code that doesn't exist until a session
   starts, so the editor draws its silhouette rather than inventing one.
   Three finder squares are what make it read as a QR at 2em across. */
.sp-qr {
  width: 2.4em; height: 2.4em;
  display: grid;
  grid-template: repeat(7, 1fr) / repeat(7, 1fr);
  gap: 6%;
  padding: 6%;
  border-radius: .15em;
  background: #fff;
}
.sp-qr > span { border-radius: .5px; }
.sp-qr > .sp-qr-on { background: color-mix(in srgb, #111 78%, transparent); }
.sp-join-meta { display: flex; flex-direction: column; align-items: center; }
.sp-join-label {
  font-size: .3em; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-soft);
}
.sp-join-code {
  font-family: var(--display);
  font-size: .55em; font-weight: 700; letter-spacing: .12em;
}

/* The editor's instructions slide carries a real, scannable QR — same
   encoded image the projector shows — so it needs the white plate and
   square aspect the generated SVG expects, not the fake grid's layout. */
.sp-qr.sp-qr-real {
  display: block;
  padding: 0;
  background: #fff;
  overflow: hidden;
}
.sp-qr.sp-qr-real svg { display: block; width: 100%; height: 100%; }

/* The deck's join code in the appbar. It reads as a label, not a button,
   until you hover — rotating a code is deliberate, not something to be
   invited into by a control that looks eager to be pressed. */
.code-chip {
  display: inline-flex;
  align-items: baseline;
  gap: .4rem;
  padding: .25rem .6rem;
  border: 1px dashed var(--edge);
  border-radius: 999px;
  background: none;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.code-chip:hover {
  border-style: solid;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--edge));
  background: var(--accent-soft);
}
.code-label {
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.code-value {
  font-family: var(--display);
  font-size: .95rem;
  font-weight: 700;
  letter-spacing: .1em;
}


/* The canvas is the one place a prompt is not clamped to two lines — you
   are editing it, so you need to see all of it. */
.stage-canvas .sp-prompt {
  display: block;
  -webkit-line-clamp: none;
  overflow: visible;
}
