/* Everyone's Watching.
 *
 * The stylesheet carries half the experiment. Round 1 has to look like a dull
 * form: flat panels, generous spacing, nothing moving. Round 2 has to feel
 * like a room - warmer edge light, tighter rhythm, a clock, faces. Same
 * layout underneath, so the player reads it as "same job, different room"
 * rather than "the game changed the rules on me".
 *
 * The switch is one class on <body>.
 */

.screen {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  margin: 0 auto;
  padding: max(64px, calc(env(safe-area-inset-top) + 56px)) 20px max(20px, env(safe-area-inset-bottom));
}

.screen[hidden] { display: none; }

/* The reveal takes focus when it opens so a screen reader announces the
   verdict instead of sitting in silence. It is a scroll container, not a
   control, so it must never draw the gold ring - the player did not tab to
   it and has nothing to do with it. Keyboard focus inside it is unaffected. */
#reveal:focus,
#reveal:focus-visible { outline: none; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- intro ---------- */

#intro { justify-content: center; }

.kicker {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--dim);
}

.title {
  margin: 0;
  font-size: clamp(46px, 14vw, 78px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.045em;
}

.title .tl-2 {
  display: block;
  color: #7c5cff;
}

.pitch {
  margin: 26px 0 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--dim);
  max-width: 34ch;
}

.pitch.small { margin-top: 12px; font-size: 14px; }

.big-btn {
  margin-top: 32px;
  padding: 18px 26px;
  border-radius: 16px;
  background: var(--paper);
  color: var(--void);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform 0.14s var(--ease-snap);
}

.big-btn:active { transform: scale(0.97); }

.text-link {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--dim);
  text-decoration: none;
}

.text-link:hover { color: var(--paper); }

/* ---------- hud ---------- */

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.hud-left { display: flex; align-items: baseline; gap: 10px; }

.round-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.hud-count { font-size: 13px; color: var(--dim); }

.dots { display: flex; gap: 5px; }

.dots i {
  width: 6px; height: 6px;
  border-radius: 99px;
  background: var(--panel-lift);
}

.dots i.on { background: var(--dim); }

body.watched .dots i.on { background: #7c5cff; }

/* ---------- the room (round 2) ---------- */

.room { margin-bottom: 12px; }
.room[hidden] { display: none; }

.watchers {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.watcher {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.pfp {
  width: 38px; height: 38px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--void);
  background: var(--tint);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.06);
}

.wname {
  font-size: 10px;
  color: var(--dim);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Reactions surface above a head and go. Nothing here is a message to the
   player - presence is the whole instrument.
   They rise INTO the avatar rather than above it, so a reaction can never
   collide with the header sitting directly above the room. */
.react {
  position: absolute;
  top: 2px;
  left: 50%;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  white-space: nowrap;
  text-shadow: 0 1px 3px var(--void), 0 0 8px var(--void);
}

.react.show { animation: react-pop 1.5s var(--ease-out) forwards; }

@keyframes react-pop {
  0%   { opacity: 0; transform: translate(-50%, 10px) scale(0.7); }
  18%  { opacity: 1; transform: translate(-50%, 0) scale(1); }
  70%  { opacity: 1; transform: translate(-50%, -3px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(0.95); }
}

.room-status {
  margin: 12px 0 0;
  min-height: 15px;
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 0.02em;
}

/* ---------- clock (round 2) ---------- */

/* Thicker than a hairline on purpose. This bar is the only thing on screen
   that says "decide now", and at 4px a player watching the faces never
   registers it draining. */
.clock {
  height: 7px;
  border-radius: 99px;
  background: var(--panel-lift);
  overflow: hidden;
  margin-bottom: 16px;
}

.clock[hidden] { display: none; }

.clock i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 99px;
  background: #7c5cff;
  transform-origin: left;
}

.clock i.warn { background: var(--gold); }
.clock i.panic { background: var(--hot); }

/* ---------- the question ---------- */

/* The play screen must never scroll. In round 2 there is a seven second clock
   running, and an option that sits below the fold is an option that does not
   exist - the player cannot weigh what she cannot see, and the riskiest rung
   is always the last one. So the screen is capped to the viewport and the
   stage is the part that gives: it shrinks and, if a long question plus a
   full feed still will not fit, the feed scrolls inside itself rather than
   pushing the buttons off the bottom. */
#play {
  max-height: 100dvh;
  overflow: hidden;
}

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 0 18px;
}

.q-text {
  margin: 0;
  font-size: clamp(19px, 5.2vw, 25px);
  font-weight: 500;
  line-height: 1.38;
  letter-spacing: -0.02em;
}

body.watched .q-text { font-weight: 600; }

/* What the room went with. Reads as a feed, not as advice. */
.others {
  margin-top: 18px;
  display: grid;
  gap: 7px;
  /* Atmosphere yields to interaction: the feed is allowed to shrink and
     scroll so that the four options always stay on screen. */
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.others::-webkit-scrollbar { display: none; }

.others[hidden] { display: none; }

.other {
  margin: 0;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--panel);
  border-left: 2px solid var(--tint);
  font-size: 13px;
  line-height: 1.35;
  color: var(--dim);
  animation: slide-in 0.28s var(--ease-out);
}

.other b {
  color: var(--tint);
  font-weight: 600;
  margin-right: 5px;
}

.other span { color: var(--paper); }

@keyframes slide-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

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

.opts {
  display: grid;
  gap: 9px;
  padding-bottom: 4px;
}

.opt {
  display: flex;
  align-items: center;
  min-height: 54px;
  padding: 13px 16px;
  border-radius: 14px;
  text-align: left;
  background: var(--panel);
  border: 1.5px solid var(--line);
  font-size: 15px;
  line-height: 1.35;
  font-weight: 500;
  transition: transform 0.12s var(--ease-snap), background 0.15s, border-color 0.15s, opacity 0.25s;
}

/* The three-second nudge. A single slow breath on the border, offset down the
   list so it reads as one gesture rather than four blinking buttons. It is not
   an alarm - it only has to answer "what am I supposed to press". */
.opts.nudge .opt {
  animation: opt-breathe 2.1s var(--ease-out) infinite;
}

.opts.nudge .opt:nth-child(2) { animation-delay: 0.1s; }
.opts.nudge .opt:nth-child(3) { animation-delay: 0.2s; }
.opts.nudge .opt:nth-child(4) { animation-delay: 0.3s; }

@keyframes opt-breathe {
  0%, 100% { border-color: var(--line); }
  50%      { border-color: color-mix(in srgb, #7c5cff 60%, var(--line)); }
}

@media (prefers-reduced-motion: reduce) {
  .opts.nudge .opt { animation: none; }
}

.opt:active { transform: scale(0.98); }
.opt:hover:not(:disabled) { background: var(--panel-lift); }
.opt:disabled { cursor: default; }

/* Round 2 tightens the frame: brighter edges, a shade more contrast. The
   options themselves are never coloured by risk - colouring them would tell
   the player what is being measured. */
body.watched .opt {
  border-color: rgba(124, 92, 255, 0.35);
  background: linear-gradient(170deg, var(--panel-lift), var(--panel));
}

.opt.picked {
  border-color: var(--paper);
  background: var(--panel-lift);
}

.opt.faded { opacity: 0.32; }

/* ---------- between rounds ---------- */

#between { justify-content: center; }

.mid-title {
  margin: 0 0 20px;
  font-size: clamp(28px, 8vw, 40px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.mid-line {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--paper);
  max-width: 36ch;
}

.mid-line.dimmer { color: var(--dim); font-size: 14.5px; }

/* ---------- reveal ---------- */

#reveal { justify-content: center; padding-top: max(84px, calc(env(safe-area-inset-top) + 72px)); }

.rv-title {
  margin: 0 0 10px;
  font-size: clamp(28px, 8vw, 42px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.035em;
}

.rv-sub {
  margin: 0 0 26px;
  font-size: 15px;
  color: var(--dim);
  line-height: 1.45;
}

/* The chart. One shared 0-3 scale, both bars drawn from the real means, no
   axis tricks. If the two bars look the same it is because they are. */
.chart {
  margin: 0 0 26px;
  padding: 18px 16px 14px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.chart-row {
  display: grid;
  grid-template-columns: 62px 1fr 42px;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
}

.chart-label { font-size: 12px; color: var(--dim); letter-spacing: 0.04em; }

.chart-track {
  height: 16px;
  border-radius: 99px;
  background: var(--void);
  overflow: hidden;
}

.chart-bar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--dim);
}

.chart-bar.b2 { background: #7c5cff; }
.chart-bar.b2.up { background: var(--hot); }

.chart-num { font-size: 14px; font-weight: 700; text-align: right; }

.chart-cap {
  margin: 4px 0 0;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--dim);
}

.rv-body { margin-bottom: 24px; }

.rv-body p {
  margin: 0 0 14px;
  font-size: 15.5px;
  line-height: 1.58;
  color: var(--paper);
}

/* The method, the caveats, and the reasoning behind the takeaway. All true,
   none of it the first thing she needs. Same fold as .pairs below, but inline
   rather than panelled, so it sits inside whatever block it is folding. */
.rv-more summary {
  display: inline-flex;
  align-items: center;
  /* 44px: the documented minimum tap target. Not the full --thumb height,
     which is sized for primary buttons and would leave a crater in prose. */
  min-height: 44px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--dim);
  cursor: pointer;
  list-style: none;
}

.rv-more summary::-webkit-details-marker { display: none; }
.rv-more summary::after { content: " \25BE"; }
.rv-more[open] summary::after { content: " \25B4"; }
.rv-more summary:hover { color: var(--paper); }

.rv-body .rv-more p { margin: 2px 0 0; color: var(--dim); }

/* ---------- the per-pair table ---------- */

.pairs {
  margin-bottom: 26px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
}

.pairs summary {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--dim);
  cursor: pointer;
  list-style: none;
}

.pairs summary::-webkit-details-marker { display: none; }
.pairs summary::after { content: " ↓"; }
.pairs[open] summary::after { content: " ↑"; }
.pairs summary:hover { color: var(--paper); }

.pairs-note {
  margin: 0;
  padding: 0 16px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--dim);
}

.pair-list { padding: 0 12px 12px; display: grid; gap: 8px; }

.pair {
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--void);
  border: 1px solid var(--line);
}

.pair-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.pair-dom {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

.pair-delta {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pair-delta.up { color: var(--hot); }
.pair-delta.down { color: var(--volt); }
.pair-delta.same { color: var(--dim); }

.pair-side {
  display: grid;
  grid-template-columns: 58px 1fr 16px;
  gap: 8px;
  align-items: baseline;
  padding: 3px 0;
}

.ps-tag { font-size: 10.5px; color: var(--dim); letter-spacing: 0.06em; }
.ps-pick { font-size: 13px; line-height: 1.35; color: var(--paper); }
.ps-risk { font-size: 12px; color: var(--dim); text-align: right; }

/* ---------- takeaway ---------- */

.takeaway {
  padding: 18px 16px;
  border-radius: 16px;
  background: linear-gradient(165deg, var(--panel-lift), var(--panel));
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

.ta-tag {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.ta-line {
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.42;
  color: var(--paper);
}

.ta-line b { color: var(--gold); font-weight: 700; }

.ta-why {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--dim);
}

/* Short screens. The options must stay reachable without scrolling, so the
   room and the feed give up their space first - they are atmosphere, the
   options are the interaction. */
@media (max-height: 820px) {
  .screen { padding-top: max(52px, calc(env(safe-area-inset-top) + 44px)); }

  .pfp { width: 30px; height: 30px; font-size: 13px; }
  .wname { font-size: 9px; }
  .room-status { margin-top: 8px; font-size: 11px; }
  .clock { margin-bottom: 11px; }

  .stage { padding: 4px 0 12px; }
  .q-text { font-size: clamp(17px, 4.6vw, 21px); }

  /* only the two most recent answers stay on screen */
  .others { margin-top: 12px; gap: 5px; }
  .other { padding: 7px 10px; font-size: 12px; }
  .other:nth-last-child(n+3) { display: none; }

  .opt { min-height: 48px; padding: 11px 14px; font-size: 14px; }
  .opts { gap: 7px; }
}

/* Very short screens (an old small phone, or a browser with a big toolbar).
   The room shrinks to a single strip of faces and the feed to one line. */
@media (max-height: 620px) {
  .screen { padding-top: max(46px, calc(env(safe-area-inset-top) + 38px)); }
  .hud { margin-bottom: 8px; }
  .room { margin-bottom: 8px; }
  .wname { display: none; }
  .pfp { width: 26px; height: 26px; font-size: 12px; }
  .room-status { margin-top: 6px; }
  .stage { padding: 2px 0 8px; }
  .q-text { font-size: 16px; line-height: 1.32; }
  .others { margin-top: 9px; }
  .other:nth-last-child(n+2) { display: none; }
  .opt { min-height: 42px; padding: 9px 13px; font-size: 13.5px; }
  .opts { gap: 6px; }
}
