:root {
  --ink: #12100d;
  --ink-2: #1b1815;
  --line: #322c25;
  --paper: #ece4d6;
  --muted: #9d9284;
  --gold: #c9a227;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, sans-serif;
}

* { box-sizing: border-box; }

/* Any explicit `display` beats the hidden attribute, so restate it. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 50% -12%, #241f19 0%, transparent 70%),
    var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

.screen {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4.5rem) 1.25rem 5rem;
}

/* ---------- intake ---------- */

.masthead { text-align: center; margin-bottom: clamp(2rem, 5vw, 3.5rem); }

.kicker {
  margin: 0 0 .9rem;
  font-size: .68rem;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--gold);
}

.masthead h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.8rem, 8vw, 4.6rem);
  letter-spacing: .015em;
  line-height: 1;
}

.standfirst {
  margin: 1rem auto 0;
  max-width: 34ch;
  font-family: var(--serif);
  font-size: 1.12rem;
  font-style: italic;
  color: var(--muted);
}

.preamble {
  margin: 1.4rem auto 0;
  max-width: 52ch;
  font-size: .88rem;
  line-height: 1.65;
  color: #7b7267;
}

form {
  display: grid;
  gap: 2rem;
  max-width: 780px;
  margin: 0 auto;
}

.field { display: block; position: relative; }

.label {
  display: block;
  margin-bottom: .6rem;
  font-size: .68rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
.label em { font-style: normal; text-transform: none; letter-spacing: .02em; opacity: .75; }

textarea, input[type=text] {
  width: 100%;
  padding: 1rem 1.1rem;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.5;
  resize: vertical;
}
textarea:focus, input[type=text]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, .35);
}
textarea::placeholder, input::placeholder { color: #5e564c; font-style: italic; }

.counter {
  position: absolute;
  right: .7rem;
  bottom: .5rem;
  font-size: .7rem;
  color: #5e564c;
  font-variant-numeric: tabular-nums;
}

.picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(102px, 1fr));
  gap: .85rem;
}

.pick {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: center;
  color: var(--muted);
  font: inherit;
  font-size: .74rem;
  transition: color .2s;
}

.pick figure {
  margin: 0 0 .5rem;
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--plate, var(--ink-2));
  box-shadow: 0 0 0 2px var(--plate, transparent);
  transition: box-shadow .2s, transform .2s;
}
.pick img { width: 100%; height: 100%; display: block; object-fit: cover; }
.pick figure::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(18, 16, 13, .5);
  transition: background .2s;
}

.pick:hover figure { transform: translateY(-2px); }
.pick:hover figure::after { background: rgba(18, 16, 13, .25); }
.pick[aria-pressed=true] { color: var(--paper); }
.pick[aria-pressed=true] figure {
  box-shadow: 0 0 0 2px var(--plate, transparent),
              0 0 0 4px var(--pick-accent, var(--gold));
}
.pick[aria-pressed=true] figure::after { background: transparent; }
.pick[disabled] { opacity: .38; cursor: not-allowed; }

.submit-row {
  display: flex;
  gap: 1.25rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.code-field { flex: 1 1 220px; max-width: 300px; }
.code-field input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .95rem; letter-spacing: .06em; }

button {
  font-family: var(--sans);
  cursor: pointer;
}

#convene {
  padding: 1.02rem 2.2rem;
  background: var(--gold);
  color: #1a1509;
  border: 0;
  border-radius: 3px;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  transition: background .2s, opacity .2s;
}
#convene:hover:not(:disabled) { background: #dcb43a; }
#convene:disabled { opacity: .35; cursor: not-allowed; }

.ghost {
  padding: .8rem 1.6rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  transition: color .2s, border-color .2s;
}
.ghost:hover { color: var(--paper); border-color: var(--muted); }

.error {
  margin: 0;
  padding: .85rem 1rem;
  border-left: 2px solid #b4553f;
  background: rgba(180, 85, 63, .1);
  color: #e5b3a5;
  font-size: .92rem;
}

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

.stage-belief {
  margin: 0 auto clamp(2rem, 5vw, 3rem);
  max-width: 44ch;
  text-align: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--muted);
}
.stage-belief::before { content: "\201C"; }
.stage-belief::after { content: "\201D"; }

.spotlight {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1.4rem;
  min-height: 300px;
  margin-bottom: 1.4rem;
}

.spot-portrait {
  position: relative;
  width: clamp(128px, 22vw, 168px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--plate, transparent);
  box-shadow: 0 0 0 3px var(--plate, transparent);
  opacity: 0;
  transform: scale(.9);
  transition: opacity .5s, transform .5s cubic-bezier(.2, .8, .3, 1);
}
.spotlight.live .spot-portrait { opacity: 1; transform: scale(1); }

.spot-portrait img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.spot-ring {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px solid var(--spot-accent, var(--gold));
  opacity: .55;
  animation: breathe 3.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: .5; }
  50%      { transform: scale(1.035); opacity: .22; }
}

/* Wide enough that a 400-character verdict stays inside the fold. */
.spot-copy { max-width: 60ch; text-align: center; }

.spot-name {
  margin: 0 0 .8rem;
  font-size: .68rem;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--spot-accent, var(--gold));
}

.replay {
  margin-left: .7rem;
  padding: .18rem .5rem;
  background: none;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font-size: .58rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  vertical-align: middle;
}
.replay:hover { color: var(--paper); border-color: var(--muted); }

.sound-gate {
  margin-top: 1.2rem;
  padding: .7rem 1.2rem;
  background: rgba(201, 162, 39, .12);
  border: 1px solid var(--gold);
  border-radius: 3px;
  color: var(--gold);
  font-size: .74rem;
  letter-spacing: .06em;
}
.sound-gate:hover { background: rgba(201, 162, 39, .22); }

.spot-verdict {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.1rem, 2vw, 1.34rem);
  line-height: 1.55;
  opacity: 0;
  animation: rise .6s .1s forwards;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.waiting {
  font-family: var(--serif);
  font-style: italic;
  color: #5e564c;
  text-align: center;
}

.hint {
  margin: 0 0 1.6rem;
  text-align: center;
  font-size: .74rem;
  letter-spacing: .12em;
  color: #6b6257;
  transition: opacity .4s;
}

.notice {
  margin: -.9rem 0 1.4rem;
  text-align: center;
  font-size: .74rem;
  letter-spacing: .04em;
  color: #a8865c;
}

.lineup {
  display: flex;
  justify-content: center;
  align-items: flex-start;   /* two-line names must not shove neighbours down */
  gap: clamp(.7rem, 2.4vw, 1.5rem);
  flex-wrap: wrap;
}

.seat {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  width: clamp(62px, 12vw, 88px);
  text-align: center;
  color: var(--muted);
  font: inherit;
  font-size: .68rem;
}

.seat figure {
  margin: 0 0 .5rem;
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--plate, var(--ink-2));
  box-shadow: 0 0 0 2px var(--plate, transparent);
  transition: box-shadow .3s, transform .3s, opacity .3s;
}
.seat img { width: 100%; height: 100%; object-fit: cover; display: block; }
.seat figure::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(18, 16, 13, .58);
  transition: background .3s;
}

.seat[data-state=thinking] figure { animation: pulse 2.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .5; } 50% { opacity: .9; } }

.seat[data-state=ready] figure::after,
.seat[data-state=spoken] figure::after { background: rgba(18, 16, 13, .3); }
.seat[data-state=ready], .seat[data-state=spoken] { color: var(--paper); }

.seat[data-state=speaking] figure {
  box-shadow: 0 0 0 2px var(--plate, transparent),
              0 0 0 4px var(--seat-accent, var(--gold));
  transform: translateY(-6px) scale(1.06);
}
.seat[data-state=speaking] figure::after { background: transparent; }
.seat[data-state=speaking] { color: var(--paper); }

.seat[data-state=failed] { opacity: .3; }
.seat:hover figure { transform: translateY(-3px); }
.seat:hover figure::after { background: rgba(18, 16, 13, .18); }

/* ---------- the reckoning ---------- */

.reckoning {
  max-width: 62ch;
  margin: 3.4rem auto 0;
  padding-top: 2.4rem;
  border-top: 1px solid var(--line);
}
.reckoning .kicker { text-align: center; }

.reckoning h2 {
  margin: 0 0 2rem;
  text-align: center;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.24rem, 2.3vw, 1.55rem);
  line-height: 1.5;
}

.arena-grid {
  display: grid;
  gap: .55rem;
  margin-bottom: 2.2rem;
}

.arena-row {
  display: grid;
  grid-template-columns: 30px minmax(88px, auto) minmax(112px, auto) 1fr;
  align-items: center;
  gap: .8rem;
  padding: .55rem .8rem;
  background: rgba(0, 0, 0, .22);
  border-left: 2px solid var(--row-accent, var(--gold));
  border-radius: 2px;
}
.arena-row img {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--plate, transparent);
  box-shadow: 0 0 0 2px var(--plate, transparent);
}
.arena-who { font-size: .8rem; color: var(--paper); }
.arena-level {
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--row-accent, var(--gold));
  /* On a phone this wraps and strands the separator dot on its own line. */
  white-space: nowrap;
}
.arena-note { font-size: .82rem; line-height: 1.45; color: var(--muted); }

.reckoning-body p {
  margin: 0 0 1.2rem;
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.72;
  color: #ded5c6;
}

@media (max-width: 620px) {
  .arena-row { grid-template-columns: 30px 1fr; row-gap: .3rem; }
  .arena-note { grid-column: 1 / -1; }
}

.stage-actions { margin-top: 2.2rem; text-align: center; }

/* The stage should sit inside one screen — the intake page can be tall, the
   performance should not be. */
#stage { padding-bottom: 2rem; }

/* ---------- reader ---------- */

.reader {
  position: fixed;
  top: 0; right: 0;
  width: min(560px, 100%);
  height: 100%;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--ink-2);
  border-left: 1px solid var(--line);
  padding: 2.4rem clamp(1.5rem, 4vw, 2.8rem) 1.4rem;
  animation: slide .32s cubic-bezier(.2, .8, .3, 1);
}
@keyframes slide { from { transform: translateX(100%); } to { transform: none; } }

.reader-close {
  position: absolute;
  top: 1rem; right: 1.2rem;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.9rem;
  line-height: 1;
}
.reader-close:hover { color: var(--paper); }

.reader-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.4rem;
  margin-bottom: 1.6rem;
  border-bottom: 1px solid var(--line);
}
.reader-head img {
  width: 64px; height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--plate, transparent);
  box-shadow: 0 0 0 2px var(--plate, transparent),
              0 0 0 4px var(--reader-accent, var(--gold));
}

.reader-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.5rem;
}
.reader-role {
  margin: .25rem 0 0;
  font-size: .66rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--reader-accent, var(--gold));
}

.reader-hear {
  margin-left: auto;
  width: 38px; height: 38px;
  flex: 0 0 auto;
  background: none;
  border: 1px solid var(--reader-accent, var(--gold));
  border-radius: 50%;
  color: var(--reader-accent, var(--gold));
  font-size: .8rem;
  line-height: 1;
}
.reader-hear:hover { background: rgba(201, 162, 39, .14); }

.reader-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

.reader-body p {
  margin: 0 0 1.15rem;
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.72;
  color: #ded5c6;
}
.reader-body .pending { font-style: italic; color: var(--muted); }

.you-said {
  margin: 1.6rem 0;
  padding: .75rem 0 .75rem 1.1rem;
  border-left: 2px solid var(--reader-accent, var(--gold));
  font-family: var(--sans);
  font-size: .92rem;
  line-height: 1.6;
  color: var(--muted);
}
.you-said::before {
  content: "You";
  display: block;
  margin-bottom: .35rem;
  font-size: .6rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--reader-accent, var(--gold));
}

.challenge {
  flex: 0 0 auto;
  display: block;
  margin-top: 1.2rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}
.challenge textarea { font-size: 1rem; padding: .8rem .9rem; }

.challenge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .7rem;
}
.challenge-left { font-size: .68rem; letter-spacing: .1em; color: #6b6257; }

#challenge-send {
  padding: .7rem 1.5rem;
  background: var(--gold);
  border: 0;
  border-radius: 3px;
  color: #1a1509;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
}
#challenge-send:disabled { opacity: .35; cursor: not-allowed; }
#challenge-error { margin-top: .8rem; font-size: .84rem; }

.scrim {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(9, 8, 6, .6);
}

@media (max-width: 640px) {
  .reader { width: 100%; }
  .submit-row { flex-direction: column; align-items: stretch; }
  .code-field { max-width: none; }
}
