/* =====================================================================
   SurveyAll — participant view. Mobile first, thumb first.
   Targets are >=48px, the submit button sits inside thumb reach, and
   nothing here ever asks who you are.
   ===================================================================== */

.join-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  overscroll-behavior-y: contain;
}

.join-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem 0;
}

/* ---------------------------------------------------------------- head */

.join-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem 0 1rem;
  font-size: .78rem;
  color: var(--ink-soft);
}

.join-pseudonym {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent) 80%, var(--ink));
  font-weight: 600;
  font-size: .74rem;
}

.join-progress { margin-left: auto; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- prompt */

.q-prompt {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.18;
  margin-bottom: .35rem;
  text-wrap: balance;
}

.q-hint {
  font-size: .82rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
}

.q-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  padding-bottom: 1rem;
}

/* ------------------------------------------------------------- options */

.opt {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 3.4rem;
  padding: .85rem 1rem;
  border: 2px solid var(--edge);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  font-size: 1rem;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .08s ease;
  -webkit-tap-highlight-color: transparent;
}

.opt:active { transform: scale(.985); }

.opt.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.opt-marker {
  width: 1.5rem; height: 1.5rem;
  border-radius: 50%;
  border: 2px solid var(--edge);
  flex-shrink: 0;
  display: grid; place-items: center;
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  transition: background .15s ease, border-color .15s ease;
}
.opt.is-selected .opt-marker {
  background: var(--accent);
  border-color: var(--accent);
}
.opt-marker.is-square { border-radius: 6px; }

.opt-text { flex: 1; overflow-wrap: anywhere; }

/* --------------------------------------------------------- word inputs */

.word-input {
  min-height: 3.4rem;
  font-size: 1.1rem;
  text-align: center;
  border-width: 2px;
  border-radius: 14px;
}

.text-input {
  min-height: 8rem;
  font-size: 1.02rem;
  border-width: 2px;
  border-radius: 14px;
  line-height: 1.45;
}

.char-count {
  align-self: flex-end;
  font-size: .74rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.char-count.is-near { color: var(--accent-2); }

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

.scale-item {
  padding: .9rem 1rem;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: var(--surface);
  display: flex; flex-direction: column; gap: .7rem;
}

.scale-statement { font-size: .96rem; line-height: 1.3; }

.scale-buttons {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: .35rem;
}

.scale-btn {
  min-height: 2.9rem;
  border: 2px solid var(--edge);
  border-radius: 10px;
  background: var(--surface);
  font-size: .95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.scale-btn.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.scale-ends {
  display: flex; justify-content: space-between;
  font-size: .72rem; color: var(--ink-soft);
}

.scale-skip {
  align-self: flex-start;
  font-size: .78rem;
  background: none; border: none;
  color: var(--ink-soft);
  text-decoration: underline;
  cursor: pointer;
  padding: .2rem 0;
}

/* ------------------------------------------- pedagogy: new controls */

.conf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding-bottom: .5rem;
}
.conf-label { font-size: .78rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.conf-btns { display: flex; gap: .35rem; }
.conf-btn {
  padding: .4rem .6rem;
  border: 2px solid var(--edge);
  border-radius: 999px;
  background: var(--surface);
  font-size: .74rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.conf-btn.is-selected {
  border-color: var(--accent);
  color: color-mix(in srgb, var(--accent) 80%, var(--ink));
  background: var(--accent-soft);
}

.hand-btn {
  margin-top: .5rem;
  width: 100%;
  padding: .6rem;
  border: 2px dashed var(--edge);
  border-radius: 12px;
  background: transparent;
  color: var(--ink-soft);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.hand-btn.is-raised {
  border-style: solid;
  border-color: var(--good);
  color: var(--good);
}

.spectrum-control { padding: 1rem 0; }
.spectrum-control-ends {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  font-weight: 650;
  color: var(--ink-soft);
  margin-bottom: .8rem;
}
.spectrum-slider {
  width: 100%;
  height: 2.6rem;
  accent-color: var(--accent);
  touch-action: pan-y;
}

.sample-pick {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: .8rem .9rem;
  border: 2px solid var(--edge);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.sample-pick.is-selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}
.sample-pick-tag {
  flex-shrink: 0;
  width: 1.6rem; height: 1.6rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  font-weight: 700;
  font-size: .8rem;
}
.sample-pick.is-selected .sample-pick-tag { background: var(--accent); color: #fff; }
.sample-pick-text {
  font-family: var(--display);
  font-size: .92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.rationale-input {
  width: 100%;
  padding: .7rem .8rem;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--surface);
  font-size: .9rem;
}

.heatmap-control .seg-row {
  border-radius: 12px;
  overflow: hidden;
}
.seg-body {
  display: block;
  width: 100%;
  text-align: left;
  padding: .7rem .85rem;
  border: 2px solid var(--edge);
  border-radius: 12px;
  background: var(--surface);
  font-family: var(--display);
  font-size: .92rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
button.seg-body { cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.seg-row.is-picked > .seg-body {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
.seg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .4rem .2rem 0;
}
.seg-chip {
  padding: .32rem .6rem;
  border: 1.5px solid var(--edge);
  border-radius: 999px;
  background: var(--surface);
  font-size: .74rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.seg-chip.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent) 80%, var(--ink));
}

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

.rank-item {
  display: flex; align-items: center; gap: .7rem;
  min-height: 3.4rem;
  padding: .7rem .8rem;
  border: 2px solid var(--edge);
  border-radius: 14px;
  background: var(--surface);
  /* movement is FLIP-animated in join-page.js (the list is rebuilt on
     every change, so a transform transition here never fired) */
  transition: border-color .15s ease;
}
.rank-item.is-ranked { border-color: var(--accent); }

.rank-badge {
  width: 2rem; height: 2rem;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  font-weight: 700;
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
}
.rank-item.is-ranked .rank-badge { background: var(--accent); color: #fff; }

.rank-text { flex: 1; font-size: .96rem; overflow-wrap: anywhere; }

.rank-moves { display: flex; flex-direction: column; gap: .15rem; }
.rank-move {
  width: 2.2rem; height: 1.6rem;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
  font-size: .7rem;
  line-height: 1;
  display: grid; place-items: center;
}
.rank-move:disabled { opacity: .3; cursor: not-allowed; }

/* ------------------------------------------------------------- actions */

.join-actions {
  position: sticky;
  bottom: 0;
  padding: .8rem 0 max(.8rem, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--ground) 72%, transparent);
  display: flex; flex-direction: column; gap: .5rem;
}

.submit-btn {
  width: 100%;
  min-height: 3.4rem;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 650;
  cursor: pointer;
  transition: filter .15s ease, transform .08s ease;
}
.submit-btn:disabled { opacity: .4; cursor: not-allowed; }
.submit-btn:active:not(:disabled) { transform: translateY(1px); }
.submit-btn.is-sent { background: var(--good); }

.field-error {
  font-size: .84rem;
  color: var(--bad);
  text-align: center;
  min-height: 1.2rem;
}

/* --------------------------------------------------------------- state */

.join-state {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 1rem;
  text-align: center;
  padding: 2rem 1rem;
}

.state-icon { font-size: 2.6rem; line-height: 1; }
.state-title { font-family: var(--display); font-size: 1.35rem; font-weight: 600; }
.state-text { font-size: .92rem; color: var(--ink-soft); max-width: 24rem; line-height: 1.5; }

.pulse-wait {
  display: flex; gap: .35rem;
}
.pulse-wait span {
  width: .55rem; height: .55rem; border-radius: 50%;
  background: var(--accent);
  animation: wait-bounce 1.3s ease-in-out infinite;
}
.pulse-wait span:nth-child(2) { animation-delay: .18s; }
.pulse-wait span:nth-child(3) { animation-delay: .36s; }
@keyframes wait-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-.45rem); opacity: 1; }
}

/* --------------------------------------------------------- code screen */

.code-form { display: flex; flex-direction: column; gap: .8rem; width: 100%; max-width: 20rem; }

.code-input {
  text-align: center;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: .28em;
  text-transform: uppercase;
  padding: .8rem .5rem;
  border-width: 2px;
  border-radius: 14px;
}
.code-input::placeholder { letter-spacing: .18em; opacity: .35; }

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

.qa-panel { display: flex; flex-direction: column; gap: .7rem; }

.qa-compose { display: flex; flex-direction: column; gap: .5rem; }

.qa-list { display: flex; flex-direction: column; gap: .5rem; }

.qa-card {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .8rem .9rem;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--surface);
}
.qa-card-text { flex: 1; font-size: .92rem; line-height: 1.4; overflow-wrap: anywhere; }

.qa-vote {
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  min-width: 2.6rem;
  padding: .35rem .4rem;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-size: .72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.qa-vote.is-voted { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.qa-vote:disabled { cursor: default; }

/* ------------------------------------------------------- shared result */

.shared-result {
  border-top: 1px solid var(--edge);
  padding-top: 1rem;
  margin-top: .5rem;
}
.shared-result .chart { font-size: .82rem; }
.shared-result [data-chart="cloud"] { min-height: 11rem; }

/* -------------------------------------------------------------- footer */


@media (min-width: 640px) {
  .q-prompt { font-size: 1.7rem; }
  .join-shell { padding-top: 1.5rem; }
}

/* -------------------------------------------------- instructions slide
   The projector's instructions slide, mirrored onto the phone of someone
   who has already followed it. Confirmation first, then the same words
   for anyone who can't read the screen from the back row. */

.instr-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);
}

.instr-badge {
  align-self: flex-start;
  padding: .2rem .6rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--good) 16%, transparent);
  color: var(--good);
  font-size: .78rem;
  font-weight: 650;
}

.instr-list {
  margin: 0;
  padding-left: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  font-size: .94rem;
  line-height: 1.45;
}

.instr-smallprint { font-size: .8rem; color: var(--ink-soft); }
