/*
 * Polls: dashboard and the responsive "Calm" editor.
 *
 * Builds on sketch-ui's sketch.css (tokens, .btn, .link, .sk, .grip, animations).
 *
 * The editor layout depends only on the width of .ed (container queries):
 *   wide   (>= 1100px)   questions | question | sessions
 *   medium (700-1099px)  questions | question, sessions underneath
 *   narrow (< 700px)     one pane at a time, chosen by data-view on .ed
 *                        (list -> question -> sessions)
 */

:root {
  --correct: #2f7d3b;
  --tick: #a9a196;
  --line: #ddd6ca;
  --strip: #eeeae2;
}

/* ------------------------------------------------------------------------------
 * Shared bits
 * ------------------------------------------------------------------------------ */

.clamp2 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.hint {
  color: var(--muted);
  font-size: 15px;
}

.muted-link {
  color: var(--muted);
}

.btn-sm {
  min-height: 44px;
  padding: 0 16px;
  font-size: 18px;
}

input::placeholder,
textarea::placeholder {
  color: #a9a196;
}

/* ------------------------------------------------------------------------------
 * Dashboard
 * ------------------------------------------------------------------------------ */

.dash {
  display: flex;
  flex-direction: column;
  gap: 36px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 32px 72px;
}

.dash-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 700;
  text-decoration: none;
}

.brand path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  --d: 700ms;
}

.dash-intro {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-h1 {
  font-size: 52px;
  line-height: 1.1;
  font-weight: 700;
}

.dash-lead {
  color: var(--ink-soft);
  font-size: 21px;
}

.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 32px;
  padding: 24px 28px;
}

.notice .sk .outline {
  stroke: var(--link);
  stroke-width: 2;
}

.notice .sk .fill {
  fill: #eef1f8;
}

.notice-icon {
  position: relative;
  flex-shrink: 0;
}

.notice-icon path {
  fill: none;
  stroke: var(--link);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notice-icon .dot {
  fill: var(--link);
  stroke: none;
}

.notice-text {
  position: relative;
  display: flex;
  flex: 1 1 420px;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.notice-h {
  font-size: 23px;
}

.notice-text p {
  color: #3d3a35;
  font-size: 19px;
  line-height: 1.35;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 28px;
}

.poll-card {
  min-height: 236px;
  padding: 24px 26px 20px;
  gap: 10px;
}

.poll-card > *:not(.sk) {
  position: relative;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 17px;
}

.badge {
  padding: 0 10px;
  border: 1.6px solid var(--correct);
  border-radius: 255px 12px 225px 12px / 12px 225px 12px 255px;
  color: var(--correct);
}

.card-title {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.card-title.is-empty {
  color: var(--muted);
}

.card-status {
  color: var(--ink-soft);
  font-size: 18px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
}

.copy-link {
  margin-left: auto;
  font-size: 17px;
}

.copy-link svg,
.q-meta svg,
.opt-icon,
.rm svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.new-card {
  display: contents;
}

.new-card-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 236px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  cursor: pointer;
}

.new-card-btn .sk .outline {
  stroke: var(--muted);
  stroke-width: 2;
}

.new-card-btn:hover {
  color: var(--ink);
}

.new-card-btn > span {
  position: relative;
}

.plus {
  font-size: 44px;
  line-height: 1;
}

.new-card-label {
  font-size: 22px;
}

.paste-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 760px;
  font-size: 20px;
}

.paste-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.paste-field {
  flex: 1 1 360px;
}

.paste-field .sk .outline {
  stroke-width: 2;
}

.paste-input {
  position: relative;
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 19px;
}

.paste-error {
  color: #8f1d1d;
  font-size: 17px;
}

.dev-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  color: var(--muted);
  font-size: 16px;
}

@media (max-width: 699px) {
  .dash {
    gap: 28px;
    padding: 20px 20px 48px;
  }

  .dash-h1 {
    font-size: 40px;
  }

  .dash-lead,
  .notice-text p {
    font-size: 18px;
  }
}

/* ------------------------------------------------------------------------------
 * Editor: frame and header
 * ------------------------------------------------------------------------------ */

.ed {
  container-type: inline-size;
  container-name: ed;
  min-height: 100vh;
}

.wrap {
  display: flex;
  flex-direction: column;
  gap: 40px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 40px 64px;
}

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
}

.title-wrap {
  flex: 1 1 320px;
  min-width: 0;
  max-width: 620px;
}

.title-input {
  width: 100%;
  height: 52px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 30px;
  font-weight: 700;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin-left: auto;
}

/* Save indicator. polls.js sets data-saving on .ed as soon as a save starts and keeps
 * it for at least 600 ms, so "Saving…" never blinks for just a frame. "✓ Saved" and
 * "Saving…" share one grid cell and cross-fade, so the swap never moves anything. */
.save-state {
  display: inline-grid;
  color: var(--muted);
  font-size: 15px;
}

.save-state > span {
  display: inline-flex;
  grid-area: 1 / 1;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: opacity 180ms ease;
}

.when-saved {
  opacity: 0.75;
}

.when-saving {
  opacity: 0;
}

.ed[data-saving] .when-saved {
  opacity: 0;
}

.ed[data-saving] .when-saving {
  opacity: 0.75;
}

/* ------------------------------------------------------------------------------
 * Editor: three-column layout
 * ------------------------------------------------------------------------------ */

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 280px;
  align-items: start;
  gap: 40px 56px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
  max-width: 760px;
}

.aside {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
}

/* Elements that only exist on narrow screens (or only on wider ones). */
.ed .m-only,
.ed .m-line {
  display: none;
}

/* ------------------------------------------------------------------------------
 * Editor: question list
 * ------------------------------------------------------------------------------ */

.q-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qrow {
  display: flex;
  align-items: center;
}

.q-item {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 14px;
  color: var(--ink);
  text-decoration: none;
}

.q-item .sel-fill {
  fill: var(--accent-tint);
}

.q-num {
  position: relative;
  flex-shrink: 0;
  width: 22px;
  color: var(--muted);
  font-size: 19px;
  font-weight: 700;
}

.q-item[aria-current="true"] .q-num {
  color: var(--accent);
}

.q-body {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.q-label {
  font-size: 18px;
  line-height: 1.25;
}

.q-label.is-empty {
  color: var(--muted);
}

.q-meta {
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 14px;
}

.chev {
  position: relative;
  color: #a9a196;
  font-size: 22px;
}

.m-line {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 6px;
  overflow: visible;
}

.m-line path,
.step-line path {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.add-question {
  align-self: flex-start;
  margin-top: 6px;
  padding-left: 14px;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------------------------
 * Editor: the question
 * ------------------------------------------------------------------------------ */

.q-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.q-of {
  color: var(--accent);
  font-size: 19px;
}

.q-text-wrap {
  position: relative;
  margin-top: -16px;
}

.q-text {
  display: block;
  width: 100%;
  padding: 6px 2px 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 34px;
  line-height: 1.2;
  font-weight: 700;
  resize: none;
  field-sizing: content;
  min-height: 2.6em;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.a-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.arow {
  display: flex;
  align-items: center;
  gap: 6px;
}

.arow .grip {
  margin-left: -28px;
}

.tick {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.tick svg {
  overflow: visible;
}

.tick-fill {
  fill: none;
}

.tick-shape {
  fill: none;
  stroke: var(--tick);
  stroke-width: 2;
  stroke-linecap: round;
}

.tick:hover .tick-shape {
  stroke: var(--ink-soft);
}

.is-correct .tick-fill {
  fill: var(--correct);
}

.is-correct .tick-shape {
  stroke: var(--correct);
}

.tick-check {
  --d: 300ms;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ans-field {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
}

.ans-input {
  position: relative;
  width: 100%;
  height: 50px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 22px;
}

.ans-line {
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 100%;
  height: 6px;
  overflow: visible;
  pointer-events: none;
}

.ans-line path {
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.is-correct .ans-line path {
  stroke: var(--correct);
}

.rm:disabled {
  opacity: 0.3;
  cursor: default;
}

.ans-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  padding-left: 50px;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 48px;
  padding-top: 4px;
}

.opt-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.opt-label {
  color: var(--muted);
  font-size: 15px;
}

.opts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-left: -14px;
}

.opt {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 19px;
  cursor: pointer;
}

.opt > *:not(.sk) {
  position: relative;
}

.opt.is-on {
  color: var(--ink);
}

.opt:hover {
  color: var(--ink);
}

/* Previous / next, on phones */
.step-nav {
  position: relative;
  gap: 12px;
  margin-top: 8px;
  padding-top: 10px;
}

.step-line {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 6px;
  overflow: visible;
}

.step {
  position: relative;
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 52px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 19px;
  text-decoration: none;
  cursor: pointer;
}

.step.is-off {
  color: #b9b2a5;
  cursor: default;
}

.step-next {
  font-weight: 700;
}

.step-next > span {
  position: relative;
}

.step .outline {
  stroke-width: 2;
}

/* ------------------------------------------------------------------------------
 * Editor: sessions and "keep this poll"
 * ------------------------------------------------------------------------------ */

.aside-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aside-h {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
}

.aside-sub {
  margin-top: -8px;
  color: var(--ink-soft);
  font-size: 16px;
}

.aside-text {
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.35;
}

.start-link {
  align-self: flex-start;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
}

.start-link:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.keep {
  gap: 2px;
}

.keep-h {
  font-size: 17px;
  font-weight: 700;
}

.keep-text {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.35;
}

.keep-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  margin-left: -4px;
}

.keep-actions .link {
  font-size: 16px;
}

/* ------------------------------------------------------------------------------
 * Editor: medium width, sessions move underneath
 * ------------------------------------------------------------------------------ */

@container ed (max-width: 1099px) {
  .layout {
    grid-template-columns: 240px minmax(0, 1fr);
    column-gap: 40px;
  }

  .aside {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 48px;
    padding-top: 8px;
  }
}

/* ------------------------------------------------------------------------------
 * Editor: narrow, one pane at a time
 * ------------------------------------------------------------------------------ */

@container ed (max-width: 699px) {
  .wrap {
    gap: 10px;
    padding: 16px 24px 24px;
  }

  .ed .d-only {
    display: none !important;
  }

  .ed .m-only {
    display: flex;
  }

  .ed .m-line {
    display: block;
  }

  .top {
    justify-content: space-between;
    gap: 0 12px;
  }

  .title-wrap {
    flex: 1 1 100%;
    order: 3;
    max-width: none;
  }

  .title-input {
    height: 48px;
  }

  .top-actions {
    margin-left: 0;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .aside {
    display: flex;
    flex-direction: column;
    gap: 28px;
  }

  .aside-h {
    color: var(--ink);
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
  }

  .main {
    gap: 18px;
    max-width: none;
  }

  .q-item {
    min-height: 72px;
    padding: 10px 4px;
  }

  .q-label {
    font-size: 19px;
  }

  .q-text {
    padding: 4px 2px 8px;
    font-size: 26px;
  }

  .ans-input {
    height: 48px;
    font-size: 20px;
  }

  .qrow .grip {
    width: 32px;
    margin-left: -8px;
    color: #b9b2a5;
  }

  .arow {
    gap: 2px;
  }

  .arow .grip {
    width: 28px;
    margin-left: -10px;
    color: #b9b2a5;
  }

  .ans-tools {
    padding-left: 62px;
  }

  .strip {
    position: relative;
    align-items: center;
    gap: 12px;
    margin: 8px 0 18px;
    padding: 12px 16px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
  }

  .strip-fill {
    fill: var(--strip);
  }

  .strip-text {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    line-height: 1.2;
  }

  .strip-title {
    font-size: 17px;
  }

  .strip-sub {
    color: var(--ink-soft);
    font-size: 15px;
  }

  .q-count {
    align-items: center;
    min-height: 32px;
    color: var(--muted);
    font-size: 15px;
  }

  .big-start {
    width: 100%;
    margin-top: 24px;
    font-size: 21px;
  }

  /* Which pane shows */
  .ed[data-view="list"] :is(.main, .aside, .back-view) {
    display: none;
  }

  .ed[data-view="question"] :is(.nav, .aside, .title-wrap, .back-polls, .back-from-sessions) {
    display: none;
  }

  .ed[data-view="sessions"] :is(.nav, .main, .title-wrap, .back-polls, .back-from-question) {
    display: none;
  }
}

/* ------------------------------------------------------------------------------
 * Sessions in the editor and on the dashboard
 * ------------------------------------------------------------------------------ */

.live-btn .live-dot,
.btn .live-dot {
  position: relative;
}

.live-session {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.live-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--live);
  font-size: 17px;
}

.live-code {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 1px;
}

.live-url {
  color: var(--ink-soft);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.live-actions {
  display: flex;
  gap: 12px;
}

.live-open {
  font-weight: 700;
}

.past {
  display: flex;
  flex-direction: column;
}

.past-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
}

.past-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.past-when {
  align-self: flex-start;
  color: var(--ink);
  font-size: 18px;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 4px;
}

.past-when:hover {
  color: var(--link-hover);
  text-decoration-color: currentColor;
}

.past-meta {
  color: var(--muted);
  font-size: 14px;
}

.past-csv {
  font-size: 16px;
}

.past-csv svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.strip.is-live .strip-fill {
  fill: color-mix(in srgb, var(--accent) 15%, transparent);
}

.strip .live-dot {
  position: relative;
}

.big-start-form {
  display: block;
}

.card-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.card-status.is-live {
  color: var(--live);
}

.card-actions form {
  display: contents;
}

/* ------------------------------------------------------------------------------
 * Result bars (presenter and phones)
 * ------------------------------------------------------------------------------ */

.bar-fill {
  fill: #c9d3ec;
}

.is-lead .bar-fill {
  fill: var(--accent);
}

.is-correct .bar-fill {
  fill: var(--correct);
}

@keyframes bar-grow {
  from {
    height: 10px;
  }
}

/* ------------------------------------------------------------------------------
 * Presenter (projector)
 *
 * Sized from the viewport so it fills any screen; designed at 1920 × 1080.
 * ------------------------------------------------------------------------------ */

body.presenting {
  overflow: hidden;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  padding: 3vh 5vw 2.5vh;
  font-size: clamp(14px, 1.35vw, 28px);
}

.p-top {
  display: flex;
  align-self: stretch;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 1.3em;
}

.p-joined {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

.p-question,
.p-lobby,
.p-ended {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 0;
}

.p-num {
  margin-top: 2vh;
  color: var(--accent);
  font-size: 1.4em;
}

.p-text {
  max-width: 80vw;
  margin: 0.25em 0 0.8em;
  font-size: clamp(28px, 3.3vw, 72px);
  line-height: 1.1;
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
}

.p-chart {
  display: flex;
  flex-direction: column;
  width: min(84vw, 1520px);
  margin-top: auto;
}

.p-bars,
.p-labels {
  display: flex;
  justify-content: center;
  gap: 4vw;
}

.p-bars {
  align-items: flex-end;
}

.p-col,
.p-label {
  flex: 1 1 0;
  max-width: 300px;
  min-width: 0;
}

.p-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.3em;
}

.p-pct {
  min-height: 1.1em;
  font-size: 2.3em;
  line-height: 1.1;
  font-weight: 700;
  text-align: center;
}

.p-bar {
  height: max(10px, calc(var(--h, 0) * 0.36vh));
  transition: height 700ms cubic-bezier(0.5, 0, 0.2, 1);
  animation: bar-grow 900ms cubic-bezier(0.5, 0, 0.2, 1) backwards;
}

.p-baseline {
  width: 100%;
  height: 6px;
  overflow: visible;
}

.p-baseline path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.p-labels {
  margin-top: 1.2vh;
}

.p-label {
  font-size: 1.5em;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}

.p-letter {
  color: var(--muted);
  font-size: 0.75em;
}

.p-label.is-correct {
  color: var(--correct);
  font-weight: 700;
}

.p-label-text {
  position: relative;
}

.p-check {
  position: absolute;
  right: 100%;
  padding-right: 0.25em;
}

.p-replay-chip {
  padding: 0 0.5em;
  border: 1.6px solid var(--ink-soft);
  border-radius: 255px 12px 225px 12px / 12px 225px 12px 255px;
  font-size: 0.8em;
}

.p-lobby {
  justify-content: center;
  gap: 1.2vh;
}

.p-kicker {
  color: var(--ink-soft);
  font-size: 1.6em;
}

.p-qr-big {
  width: min(42vh, 32vw);
  padding: 1.4vh;
}

.p-qr-big .qr,
.p-qr .qr {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
}

.qr-bg {
  fill: #fff;
}

.qr-dots {
  fill: var(--ink);
}

.p-url {
  font-size: 2.4em;
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
}

.p-code {
  font-size: 1.6em;
}

.p-code b {
  color: var(--accent);
  letter-spacing: 0.06em;
}

.p-waiting {
  color: var(--ink-soft);
  font-size: 1.3em;
}

.p-ended {
  justify-content: center;
  gap: 1vh;
}

.p-ended-sub {
  color: var(--ink-soft);
  font-size: 1.5em;
}

.p-ended-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
  margin-top: 2vh;
}

.p-foot {
  display: flex;
  align-self: stretch;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2vw;
  margin-top: 2vh;
}

.p-join {
  display: flex;
  align-items: center;
  gap: 1.4vw;
}

.p-qr {
  flex-shrink: 0;
  width: clamp(96px, 7.5vw, 160px);
  padding: 10px;
}

.p-join-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.p-small {
  color: var(--ink-soft);
  font-size: 1.1em;
}

.p-small b {
  color: var(--ink);
}

.p-join-url {
  font-size: 1.9em;
  font-weight: 700;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.p-controls {
  display: flex;
  align-items: center;
  gap: 0.6em;
  transition: opacity 300ms ease;
}

.s-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 1.2em;
  white-space: nowrap;
  cursor: pointer;
}

.s-btn:hover {
  color: var(--ink);
}

.s-btn > span {
  position: relative;
}

.s-round {
  width: 64px;
  padding: 0;
  font-size: 1.7em;
}

.s-round .arrow {
  position: relative;
  width: 30px;
  height: 30px;
}

.s-next .arrow path {
  stroke-width: 2.6;
}

.step .arrow,
.step-next .arrow {
  position: relative;
}

.s-round .outline {
  stroke: currentColor;
}

.s-next {
  color: var(--ink);
}

.s-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.s-end {
  color: var(--muted);
}

/* The reveal toggle: filled and bold while there is something to reveal. */
.s-reveal {
  gap: 10px;
  padding: 0 24px;
  color: var(--ink);
}

.s-reveal.is-primary {
  font-weight: 700;
}

.s-reveal .outline {
  stroke-width: 2.4;
}

/* Same look as the primary buttons (e.g. "Start session"): accent tint, ink text. */
.s-reveal.is-primary .fill {
  fill: var(--accent-tint);
}

.s-icon {
  position: relative;
  flex-shrink: 0;
  overflow: visible;
}

.s-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

a.s-btn {
  text-decoration: none;
}

/* Controls fade out while the pointer rests (polls.js sets .idle). */
.presenting.idle .p-controls {
  opacity: 0;
}

.presenting.idle {
  cursor: none;
}

/* ------------------------------------------------------------------------------
 * Phones (voters)
 * ------------------------------------------------------------------------------ */

.phone {
  display: flex;
  flex-direction: column;
  max-width: 440px;
  min-height: 100svh;
  margin: 0 auto;
  padding: 24px 24px 28px;
}

.v-screen,
.v-state {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.v-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 18px;
}

.v-live {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.v-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 56px;
  text-align: center;
}

.v-hero-tight {
  margin-top: 28px;
}

.v-kicker {
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 22px;
}

.v-h1 {
  font-size: 38px;
  line-height: 1.1;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.v-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 6px 16px;
  font-size: 20px;
}

.v-chip > span,
.v-chip > b {
  position: relative;
}

.v-chip b {
  color: var(--accent);
  letter-spacing: 1px;
}

.v-chip .sk .outline {
  stroke: var(--ink-soft);
  stroke-width: 1.8;
}

.v-hand path,
.v-cup path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v-cup .steam {
  stroke: var(--muted);
  stroke-width: 2.4;
  stroke-dasharray: 0.35 0.65;
  animation: v-steam 2.6s linear var(--t, 0ms) infinite;
}

@keyframes v-steam {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

.v-bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: auto;
  padding-top: 24px;
}

.v-note {
  color: var(--ink-soft);
  font-size: 17px;
  text-align: center;
}

.v-wide {
  width: 100%;
  min-height: 64px;
  font-size: 24px;
}

.v-num {
  margin-top: 24px;
  color: var(--accent);
  font-size: 20px;
}

.v-question {
  margin: 4px 0 20px;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.v-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.v-choices {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.v-choice {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 10px 16px;
  font-size: 22px;
  line-height: 1.15;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.v-choice > *:not(.sk) {
  position: relative;
}

/* The real radio/checkbox stays focusable but out of sight. */
.v-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.v-choice:has(input:focus-visible) {
  outline: 3px dashed var(--focus);
  outline-offset: 3px;
}

.v-letter {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 2px solid var(--ink);
  border-radius: 52% 46% 50% 48% / 48% 52% 46% 50%;
  font-size: 20px;
  font-weight: 700;
}

.v-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.v-tick {
  flex-shrink: 0;
  opacity: 0;
  overflow: visible;
}

.v-tick path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v-choice:has(input:checked) .sk .outline {
  stroke: var(--accent);
  stroke-width: 3;
}

.v-choice:has(input:checked) {
  background: var(--accent-tint);
  border-radius: 6px 10px 5px 9px;
}

.v-choice:has(input:checked) .v-letter {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.v-choice:has(input:checked) .v-tick {
  opacity: 1;
}

.v-done {
  overflow: visible;
}

.v-done path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v-done .v-done-check {
  stroke-width: 5;
}

.v-picked {
  color: var(--ink-soft);
  font-size: 20px;
}

.v-picked b {
  color: var(--ink);
}

.v-results {
  margin-top: 28px;
  padding: 18px 22px 16px;
}

.v-results > *:not(.sk) {
  position: relative;
}

.v-tally-h {
  color: var(--ink-soft);
  font-size: 18px;
}

.v-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 18px;
  height: 170px;
  margin-top: 10px;
}

.v-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: 56px;
  height: 100%;
}

.v-pct {
  font-size: 18px;
  font-weight: 700;
}

.v-pct.is-lead {
  color: var(--accent);
}

.v-bar {
  width: 100%;
  height: max(6px, calc(var(--h, 0) * 1.1px));
  transition: height 600ms cubic-bezier(0.5, 0, 0.2, 1);
  animation: bar-grow 900ms cubic-bezier(0.5, 0, 0.2, 1) backwards;
}

.v-col-letter {
  color: var(--ink-soft);
  font-size: 17px;
}

.v-col-letter.is-correct {
  color: var(--correct);
  font-weight: 700;
}

.v-history {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 32px;
  padding: 18px 22px 20px;
}

.v-history > *:not(.sk) {
  position: relative;
}

.v-history-h {
  color: var(--ink-soft);
  font-size: 18px;
}

.v-history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  line-height: 1.2;
}

.v-history-row svg {
  flex-shrink: 0;
  overflow: visible;
}

.v-history-row path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.v-code-field {
  height: 72px;
}

.v-code-input {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
}
