body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}

#app {
  width: 100%;
  max-width: 720px;
}

/* Start screen: join form, lobby, unavailable state — all share the same
   dark card shell so the brand reads consistently before playback starts.
   The player itself (below) stays deliberately unbranded/cinema-neutral. */

.start-screen {
  text-align: center;
}

/* The join page is the one surface where branding leads — the logo gets a
   full header presence here, well above the admin header's small mark. */
.start-screen .brand {
  margin: 2rem 0 2.5rem;
}

.start-screen .brand-logo {
  height: 84px;
}

.start-card {
  padding: 2.25rem 2rem;
}

.tagline {
  color: var(--text-muted);
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
}

#lobby-join {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  max-width: 22rem;
  margin: 1.5rem auto 0;
}

#lobby-join .field-input {
  width: 100%;
}

.host-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0.2rem;
  margin-top: -0.25rem;
}

.host-toggle:hover {
  color: var(--text);
}

#pin-field-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#pin-field-wrap .hint {
  font-size: 0.78rem;
  color: var(--text-faint);
}

#join-btn {
  width: 100%;
  margin-top: 0.5rem;
}

.pin-error {
  color: var(--danger-text);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

/* Unavailable / invalid-link state: same shell, deliberately inert — no
   accent color, nothing actionable (R3.7). */

#event-unavailable p,
#invalid-link p {
  color: var(--text-muted);
  line-height: 1.5;
}

/* Lobby room */

#lobby-room p {
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

#participant-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
}

#participant-list li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
}

.host-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent-hover);
}

.waiting-indicator {
  font-size: 1rem;
  color: var(--text-muted);
}

/* Connection error / host-offer banners */

.connection-error,
.host-offer-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.connection-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  color: var(--danger-text);
}

.host-offer-banner {
  background: var(--warning-bg);
  border: 1px solid #6b4e00;
  color: var(--warning);
}

/* Player: cinema-neutral. Pure near-black letterbox, no accent color inside
   the video frame itself — only the overlay's one actionable button gets
   the accent treatment, so it draws the eye without competing with content. */

.player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 60vh;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

#player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  background: rgba(0, 0, 0, 0.68);
  padding: 1rem;
}

.overlay-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.choice-btn {
  position: relative;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.85rem 1.6rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: rgba(28, 29, 33, 0.9);
  color: var(--text);
  cursor: pointer;
}

.choice-btn:hover {
  border-color: var(--accent);
}

.choice-btn.continue-btn,
.choice-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.choice-btn.continue-btn:hover,
.choice-btn.primary:hover {
  background: var(--accent-hover);
}

/* Show-of-hands (R2.3, host-only visibility): a small live tally badge on
   each choice option. Non-hosts get the same buttons but as an informal
   vote — clicking never advances the session, only signals a preference. */

.hand-tally {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.choice-btn.my-vote {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.vote-hint {
  font-size: 0.8rem;
  color: var(--text-faint);
}

.ending-message {
  font-size: 1.6rem;
  font-weight: 600;
}

/* Local, per-viewer AV controls (mute/fullscreen/captions) — never synced,
   R2.13 — sit over the bottom-right corner of the video itself. */

.av-controls {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  display: flex;
  gap: 0.4rem;
}

.av-controls button {
  font-size: 0.8rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
}

.av-controls button:hover {
  background: rgba(0, 0, 0, 0.75);
}

.av-controls button.active {
  border-color: var(--accent);
  color: var(--accent-hover);
}

/* Story-so-far rail (R4.4) — collapsible breadcrumb of nodes visited.
   Replay (clicking an earlier step) is host-only and only enabled once the
   session has reached an ending, per R4.4's "after completion" wording. */

.path-history {
  margin-top: 0.85rem;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
}

.path-history summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  list-style: none;
}

.path-history summary::-webkit-details-marker {
  display: none;
}

.path-history summary::before {
  content: '▸ ';
}

.path-history[open] summary::before {
  content: '▾ ';
}

.path-history-trail {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.path-history-trail .sep {
  color: var(--text-faint);
}

.path-history-step {
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font: inherit;
  cursor: default;
}

.path-history-step.replayable {
  cursor: pointer;
  color: var(--text);
}

.path-history-step.replayable:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.path-history-step.current {
  border-color: var(--accent);
  color: var(--accent-hover);
}

/* Host controls: a minimal bottom bar, visibly distinct from the read-only
   attendee view (which never renders this element at all — R2.13). */

.host-controls {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
}

.host-controls-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.host-controls-row:last-child {
  margin-bottom: 0;
}

.host-controls select {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  font: inherit;
}

#seek-slider {
  flex: 1;
  accent-color: var(--accent);
}
