/* Friday Night Chaos - Mobile First Dark Theme */

:root {
  --bg-color: #0c0e14;
  --surface-color: #161a24;
  --surface-hover: #1f2533;
  --border-color: #272d3d;
  --border-subtle: #1c212c;
  
  --accent-color: #ff3e6c;
  --accent-glow: rgba(255, 62, 108, 0.25);
  --accent-hover: #e0325d;

  --text-main: #f0f3f8;
  --text-muted: #8e99aa;
  --text-dim: #5a6475;

  --winner-color: #ffd166;
  --winner-glow: rgba(255, 209, 102, 0.25);
  --success-color: #06d6a0;
  --danger-color: #ef476f;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 220ms cubic-bezier(0.4, 0, 0.2, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  user-select: none;
  -webkit-user-select: none;
}

/* Editable text areas allow user text selection */
input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

.hidden {
  display: none !important;
}

/* App layout */
.app-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  position: relative;
}

/* Header */
.app-header {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background-color: var(--bg-color);
  z-index: 50;
  padding: 0 4px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-color);
}

.room-code-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

/* Reconnecting Pill */
.reconnect-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: rgba(239, 71, 111, 0.15);
  color: #ff7597;
  border: 1px solid rgba(239, 71, 111, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.pulsing-dot {
  width: 6px;
  height: 6px;
  background-color: #ff3e6c;
  border-radius: 50%;
  animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.5; }
}

/* Error Banners */
.error-banner {
  background-color: rgba(239, 71, 111, 0.15);
  border: 1px solid var(--danger-color);
  color: #ffb3c1;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-top: 10px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.inline-error {
  background-color: rgba(239, 71, 111, 0.12);
  color: #ff7b95;
  border-left: 3px solid var(--danger-color);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  margin: 8px 0;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 0 24px;
}

.view-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn var(--transition-normal);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards & Surfaces */
.card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.hero-card {
  text-align: center;
  padding: 24px 12px 12px;
}

.hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 40%, var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Form inputs & buttons */
.form-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.optional-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-dim);
}

input[type="text"], textarea {
  width: 100%;
  background-color: #0f121a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 12px 14px;
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition-fast);
  font-family: inherit;
}

input[type="text"]:focus, textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Buttons (min 44px height for mobile touch targets) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
  text-decoration: none;
  text-align: center;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--accent-color);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:active:not(:disabled) {
  background-color: var(--accent-hover);
}

.btn-secondary {
  background-color: var(--surface-hover);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-sm {
  min-height: 38px;
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* LOBBY VIEW */
.lobby-code-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
}

.label-heading {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--text-muted);
}

.big-code-btn {
  background: rgba(255, 62, 108, 0.08);
  border: 2px dashed var(--accent-color);
  border-radius: var(--radius-lg);
  padding: 12px 24px;
  cursor: pointer;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 280px;
  transition: background-color var(--transition-fast);
}

.big-code-btn:active {
  background: rgba(255, 62, 108, 0.16);
}

#lobby-room-code {
  font-family: monospace, monospace;
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: #ffffff;
}

.tap-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.copy-toast {
  font-size: 0.8rem;
  color: var(--success-color);
  font-weight: 600;
}

.lobby-share {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
  word-break: break-all;
}

.share-url-text {
  color: var(--text-muted);
  user-select: all;
  -webkit-user-select: all;
}

.card-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.badge {
  font-size: 0.75rem;
  background-color: var(--border-color);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.player-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background-color: #0f121a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}

.player-name-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-dim);
}

.player-status-dot.connected {
  background-color: var(--success-color);
}

.tag-host {
  font-size: 0.7rem;
  background: rgba(255, 209, 102, 0.15);
  color: var(--winner-color);
  border: 1px solid rgba(255, 209, 102, 0.3);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.tag-you {
  font-size: 0.7rem;
  background: rgba(255, 62, 108, 0.15);
  color: var(--accent-color);
  border: 1px solid rgba(255, 62, 108, 0.3);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.setting-item {
  background-color: #0f121a;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
}

.setting-k {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.setting-v {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Category picker: full row, description under it, 18+ tag for adult packs. */
.setting-item-wide { grid-column: 1 / -1; }
.setting-desc {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.3;
}
.tag-adult {
  font-size: 0.65rem;
  background: rgba(255, 62, 108, 0.18);
  color: var(--accent-color);
  border: 1px solid rgba(255, 62, 108, 0.4);
  padding: 0 5px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  margin-left: 4px;
}

.action-footer {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-hint {
  font-size: 0.8rem;
  text-align: center;
  color: var(--text-muted);
}

/* TIMER DISPLAY */
.timer-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
}

.timer-ring-wrap {
  position: relative;
  width: 58px;
  height: 58px;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-circle-bg {
  fill: none;
  stroke: var(--surface-color);
  stroke-width: 7;
}

.timer-circle-fg {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 7;
  stroke-dasharray: 263.89; /* 2 * PI * 42 */
  stroke-dashoffset: 0;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear, stroke var(--transition-fast);
}

.timer-seconds {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: monospace;
}

.round-counter-pill {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

/* PROMPT CARD */
.prompt-card {
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(180deg, var(--surface-color) 0%, #1a1f2c 100%);
  border: 1px solid var(--border-color);
}

.twist-chip {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.4);
  color: #ffe08a;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
}

.twist-tag {
  background-color: var(--winner-color);
  color: #1a1805;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.prompt-text {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.4;
  color: #ffffff;
}

.prompt-mini-card {
  padding: 12px 14px;
}

.prompt-text-small {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 4px;
}

.ai-inspired-note {
  font-size: 0.85rem;
  color: #ff94b0;
  background-color: rgba(255, 62, 108, 0.08);
  border-left: 3px solid var(--accent-color);
  padding: 6px 10px;
  border-radius: 4px;
}

.inspired-tag {
  font-weight: 700;
}

/* ANSWER INPUT */
.answer-input-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-assist-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-assist-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.textarea-wrap {
  position: relative;
}

.textarea-wrap textarea {
  resize: none;
  font-size: 1.05rem;
  line-height: 1.4;
}

.char-count-wrap {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
  font-family: monospace;
}

.locked-banner {
  background-color: rgba(6, 214, 160, 0.12);
  border: 1px solid var(--success-color);
  color: #55f3cb;
  padding: 12px;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
}

/* VOTING PHASE */
.votes-quota-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.quota-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.vote-dots {
  display: flex;
  gap: 8px;
}

.vote-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--accent-color);
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.vote-dot.filled {
  background-color: var(--accent-color);
  transform: scale(1.1);
}

.voting-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vote-card {
  min-height: 64px;
  padding: 14px 16px;
  background-color: var(--surface-color);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
}

.vote-card:active:not(.disabled) {
  transform: scale(0.99);
}

.vote-card.selected {
  border-color: var(--accent-color);
  background-color: rgba(255, 62, 108, 0.08);
}

.vote-card.is-yours {
  opacity: 0.6;
  cursor: not-allowed;
  border-style: dashed;
}

.vote-card-text {
  font-size: 1rem;
  line-height: 1.4;
  flex: 1;
  word-break: break-word;
}

.vote-indicator-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: transparent;
  flex-shrink: 0;
}

.vote-card.selected .vote-indicator-check {
  border-color: var(--accent-color);
  background-color: var(--accent-color);
  color: #fff;
}

/* REVEAL & GM BUBBLE */
.gm-bubble {
  background: linear-gradient(145deg, #181d2a 0%, #111520 100%);
  border: 1px solid rgba(255, 62, 108, 0.3);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.gm-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.gm-badge {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background-color: var(--accent-color);
  color: #fff;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.gm-typing-indicator {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
  animation: pulse 1s infinite;
}

.gm-content {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-main);
  white-space: pre-wrap;
  min-height: 1.5em;
}

.reveal-section-title {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 4px;
}

.reveal-answers-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reveal-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform var(--transition-normal), border-color var(--transition-normal);
  animation: slideInUp var(--transition-normal);
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal-card.is-winner {
  border-color: var(--winner-color);
  background: linear-gradient(135deg, var(--surface-color) 0%, rgba(255, 209, 102, 0.08) 100%);
  box-shadow: 0 4px 16px var(--winner-glow);
}

.reveal-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.reveal-winner-badge {
  font-size: 0.75rem;
  font-weight: 800;
  background-color: var(--winner-color);
  color: #121004;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.reveal-vote-count {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}

.reveal-vote-count.high-votes {
  color: var(--winner-color);
}

.reveal-text {
  font-size: 1.05rem;
  line-height: 1.4;
  word-break: break-word;
}

.courtroom-action {
  align-self: flex-start;
}

/* LEADERBOARD & SCORES */
.scores-card, .podium-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scores-list, .standings-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.score-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background-color: #0f121a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.score-item.is-top {
  border-color: rgba(255, 209, 102, 0.4);
}

.score-rank {
  font-weight: 800;
  width: 24px;
  font-size: 1rem;
}

.score-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-points {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--accent-color);
}

/* Footer */
.app-footer {
  padding: 12px 4px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
}

.footer-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-divider {
  color: var(--border-color);
}

/* ── P0 UI pass: prompt beat, live progress, resume toast ── */

/* Prompt-beat card: bigger type, centered, unmissable for the 3s window. */
.prompt-beat-card {
  min-height: 220px;
  text-align: center;
  align-items: center;
  border-color: var(--accent-color);
  box-shadow: 0 0 32px var(--accent-glow);
}

.prompt-beat-card .prompt-text {
  font-size: 1.5rem;
}

.prompt-countdown-hint {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-color);
  margin-top: 12px;
}

/* Live "3/6 locked in" line under the prompt / quota bars. */
.progress-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  margin-bottom: 12px;
}

.progress-count {
  font-size: 0.9rem;
  font-weight: 800;
  font-family: monospace;
  color: var(--text-main);
}

/* "You're back as X" toast after an auto-resumed session. */
.resume-toast {
  position: sticky;
  top: 8px;
  z-index: 50;
  margin: 8px 16px 0;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background-color: rgba(6, 214, 160, 0.14);
  border: 1px solid var(--success-color);
  color: #55f3cb;
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
}

/* Finale pills: the last round gets a gold treatment everywhere. */
.round-counter-pill.is-finale {
  color: #1a1805;
  background-color: var(--winner-color);
  border-color: var(--winner-color);
  box-shadow: 0 0 16px var(--winner-glow);
}

/* ── Game Master picker (lobby) ── */
.model-current {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 8px 0 4px;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 10px 0 6px;
}

.model-select {
  width: 100%;
  background-color: #0f121a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 12px 14px;
  font-size: 1rem;
  outline: none;
  font-family: inherit;
  min-height: 44px;
}

.model-select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.model-select:disabled {
  opacity: 0.6;
}


/* ── Additions: leave, host skip, reveal authors ─────────────────────────── */
.header-leave {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}
.header-leave:hover { color: inherit; }

.btn-ghost {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  color: var(--text-muted);
  margin-top: 12px;
}

.reveal-author {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.reveal-author.is-you { font-weight: 600; }

.vote-card.is-yours::after {
  content: "your answer";
  display: block;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.answer-timer-warning .timer-seconds { animation: fnc-pulse 0.8s ease-in-out infinite; }
@keyframes fnc-pulse { 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  .answer-timer-warning .timer-seconds { animation: none; }
}

.setting-select {
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font: inherit;
}

/* ── Header actions: mute toggle ─────────────────────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-icon-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  width: 34px;
  height: 30px;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  color: inherit;
}
.header-icon-btn[aria-pressed="true"] { opacity: 0.7; }

/* ── Lobby: TV view link ─────────────────────────────────────────────────── */
.tv-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px dashed currentColor;
}
.tv-link:hover { color: var(--text-main); }

/* ── Host kick button ────────────────────────────────────────────────────── */
.player-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.kick-btn {
  background: transparent;
  border: 1px solid rgba(239, 71, 111, 0.35);
  color: var(--danger-color);
  border-radius: 999px;
  width: 26px;
  height: 26px;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.kick-btn:hover { background: rgba(239, 71, 111, 0.12); }
.kick-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Staged reveal ───────────────────────────────────────────────────────── */
.reveal-progress {
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.reveal-card { position: relative; }
.reveal-card.reveal-settled { animation: none; }
.reveal-card.reveal-enter {
  animation: fnc-reveal-in 420ms cubic-bezier(0.2, 0.8, 0.2, 1.2) both;
}
.reveal-enter .reveal-vote-count {
  display: inline-block;
  animation: fnc-count-pop 500ms 150ms cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
/* The author lands a beat after the answer. */
.reveal-enter .reveal-author {
  animation: fnc-author-in 360ms 650ms ease-out both;
}
.reveal-card.is-winner.reveal-enter {
  animation: fnc-winner-in 700ms cubic-bezier(0.2, 0.8, 0.2, 1.2) both;
}
.reveal-enter .reveal-winner-badge {
  animation: fnc-badge-in 500ms 250ms cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
@keyframes fnc-reveal-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes fnc-count-pop {
  from { opacity: 0; transform: scale(0.3); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes fnc-author-in {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: none; }
}
@keyframes fnc-winner-in {
  0% { opacity: 0; transform: scale(0.85); box-shadow: 0 0 0 var(--winner-glow); }
  60% { opacity: 1; transform: scale(1.04); box-shadow: 0 0 32px var(--winner-glow); }
  100% { transform: scale(1); }
}
@keyframes fnc-badge-in {
  from { opacity: 0; transform: scale(0.2) rotate(-12deg); }
  to { opacity: 1; transform: none; }
}

/* CSS-only confetti burst on the winning card. */
.confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.confetti-bit {
  position: absolute;
  top: 40%;
  left: var(--x);
  width: 7px;
  height: 11px;
  border-radius: 2px;
  opacity: 0;
  background: var(--winner-color);
  animation: fnc-confetti 1100ms var(--d) ease-out both;
}
.confetti-bit.c1 { background: var(--accent-color); }
.confetti-bit.c2 { background: var(--success-color); }
.confetti-bit.c3 { background: #7aa2ff; }
@keyframes fnc-confetti {
  0% { opacity: 1; transform: translateY(0) rotate(0); }
  100% { opacity: 0; transform: translateY(-70px) rotate(var(--r)); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-card,
  .reveal-card.reveal-enter,
  .reveal-card.is-winner.reveal-enter,
  .reveal-enter .reveal-vote-count,
  .reveal-enter .reveal-author,
  .reveal-enter .reveal-winner-badge { animation: none; }
  .confetti { display: none; }
}

/* Keep the header on one line with the extra mute button. */
.header-brand { min-width: 0; }
.brand-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-actions { flex: none; }
@media (max-width: 420px) {
  .brand-title { font-size: 0.82rem; letter-spacing: 0.05em; }
  .header-brand { gap: 6px; }
  .header-actions { gap: 6px; }
  .header-icon-btn { width: 30px; }
}

.score-gain {
  font-size: 0.8rem;
  font-weight: 700;
  color: #34d399;
  margin-right: 8px;
}

/* ── Home page: modes + how to play ─────────────────────────────────────── */
.hero-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
}
.hero-pills li {
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
}

.mode-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0 14px;
}
.mode-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  padding: 16px 14px;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.mode-tile:active { transform: scale(0.98); }
.mode-tile[aria-selected="true"] {
  border-color: var(--accent-color);
  background: rgba(255, 62, 108, 0.1);
}
.mode-icon { font-size: 1.6rem; }
.mode-title { font-weight: 700; font-size: 1.02rem; }
.mode-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.3; }

.field-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.mode-footnote { text-align: center; margin-top: 10px; }

.how-to { margin-top: 18px; }
.how-to h2 { margin: 0 0 12px; font-size: 1.2rem; }
.how-to h3 { margin: 18px 0 8px; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.how-steps { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.how-steps li { line-height: 1.45; font-size: 0.93rem; }
.how-steps strong { display: block; }
.score-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.score-table td { padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.score-table td.pts { text-align: right; font-weight: 700; color: #34d399; white-space: nowrap; padding-left: 12px; }
.how-tips { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 0.9rem; line-height: 1.4; }

@media (max-width: 360px) {
  .mode-picker { grid-template-columns: 1fr; }
}

.ai-key { margin-top: 10px; font-size: 0.88rem; }
.ai-key summary { cursor: pointer; color: var(--text-muted); }
.ai-key-row { display: flex; gap: 8px; margin-top: 6px; }
.ai-key-row input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font: inherit;
}

.ai-input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font: inherit;
}
#ai-provider-wrap .ai-key-row { align-items: center; }

/* FAQ (home page) and footer links */
.faq-item { border-top: 1px solid var(--border-subtle); padding: 12px 0; }
.faq-item:first-of-type { border-top: 0; }
.faq-item summary { cursor: pointer; font-weight: 600; }
.faq-item p { margin: 8px 0 0; color: var(--text-muted); line-height: 1.5; }
.footer-link { color: var(--text-muted); text-decoration: none; }
.footer-link:hover { color: var(--text-main); text-decoration: underline; }

/* ── Join QR + share (lobby) ─────────────────────────────────────────────── */
.lobby-qr-wrap { display: flex; flex-direction: column; align-items: center; margin: 14px 0 6px; }
.lobby-qr-btn { background: #fff; border: 0; border-radius: var(--radius-md); padding: 0; cursor: pointer; line-height: 0; }
.lobby-qr, .lobby-qr svg { display: block; width: 164px; height: 164px; border-radius: var(--radius-md); }
.lobby-qr-caption { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; font-weight: 600; letter-spacing: 0.04em; }
.share-actions { display: flex; gap: 8px; justify-content: center; margin: 10px 0 4px; flex-wrap: wrap; }
.share-actions .btn { flex: 1 1 120px; }
.share-actions .hidden { display: none; }
.share-url-text { cursor: copy; }
.qr-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.86); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; }
.qr-modal.hidden { display: none; }
.qr-modal-body { width: min(88vw, 70vh); aspect-ratio: 1; line-height: 0; }
.qr-modal-body svg { width: 100%; height: 100%; border-radius: var(--radius-md); }
.qr-modal-caption { color: var(--text-muted); font-size: 0.95rem; }

/* Home page: links to the question-pack pages */
.pack-links { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pack-links a { display: inline-block; padding: 8px 12px; border-radius: var(--radius-full); background: var(--surface-hover);
  border: 1px solid var(--border-color); color: var(--text-main); text-decoration: none; font-size: 0.9rem; }
.pack-links a:hover { border-color: var(--accent-color); }

/* Simple AI setup: two big choices + Advanced disclosure */
.ai-simple { display: grid; gap: 8px; margin: 6px 0; }
.ai-choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--border, rgba(255,255,255,.18)); border-radius: 10px; cursor: pointer; }
.ai-choice input { margin-top: 4px; }
.ai-choice small { color: var(--text-muted); }
.ai-advanced { margin: 8px 0; }
.ai-advanced summary { cursor: pointer; color: var(--text-muted); }
.ai-advanced .model-select { width: 100%; margin-top: 6px; }

/* ── Game types (modes.js) ─────────────────────────────────────────────── */
/* Badge + one-line rule above the prompt in every in-round view. */
.mode-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--mode-color, var(--accent-color));
}
.mode-badge {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mode-color, var(--accent-color));
  white-space: nowrap;
}
.mode-rule { font-size: 0.85rem; color: var(--text-muted); line-height: 1.3; }
[data-mode="quip"] { --mode-color: var(--accent-color); }
[data-mode="bluff"] { --mode-color: #9b8cff; }
[data-mode="likely"] { --mode-color: var(--success-color); }
[data-mode="wyr"] { --mode-color: #4cc9f0; }

/* Lobby: the game-type cheat sheet under the picker. */
.mode-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.mode-list-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--text-dim);
  border: 1px solid transparent;
}
.mode-list-item strong { color: var(--text-muted); }
.mode-list-item.is-on { color: var(--text-muted); background: rgba(255, 255, 255, 0.03); border-color: var(--border-subtle); }
.mode-list-item.is-on strong { color: var(--text-main); }
.mode-list-item.is-tappable { cursor: pointer; }
.mode-list-item.is-tappable:active { transform: scale(0.99); }
.mode-list-emoji { flex: none; width: 1.4em; text-align: center; }
.setting-scope { color: var(--text-dim); font-style: italic; }

/* Voting: a bluff ballot is a list; a friend ballot is a grid of names;
   This or That is two big buttons. */
.vote-card.is-yours[data-kind="fake"]::after { content: "your fake"; }
#voting-cards-container[data-mode="likely"] {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
#voting-cards-container[data-mode="likely"] .vote-card {
  min-height: 56px;
  padding: 10px 12px;
}
#voting-cards-container[data-mode="likely"] .vote-card-text { font-weight: 700; overflow-wrap: anywhere; }
#voting-cards-container[data-mode="wyr"] { gap: 14px; }
#voting-cards-container[data-mode="wyr"] .vote-card {
  min-height: 120px;
  padding: 18px 16px;
  border-width: 3px;
  justify-content: flex-start;
}
#voting-cards-container[data-mode="wyr"] .vote-card-text { font-size: 1.2rem; font-weight: 700; line-height: 1.3; }
#voting-cards-container[data-mode="wyr"] .vote-card[data-kind="b"] { border-color: rgba(76, 201, 240, 0.35); }
#voting-cards-container[data-mode="wyr"] .vote-card[data-kind="a"] { border-color: rgba(255, 62, 108, 0.35); }
#voting-cards-container[data-mode="wyr"] .vote-card.selected[data-kind="a"] { border-color: var(--accent-color); }
#voting-cards-container[data-mode="wyr"] .vote-card.selected[data-kind="b"] { border-color: #4cc9f0; background-color: rgba(76, 201, 240, 0.1); }
.wyr-side {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.3rem;
  color: #fff;
  background: var(--accent-color);
}
[data-kind="b"] .wyr-side { background: #4cc9f0; color: #0c0e14; }
.wyr-side-sm { display: inline-flex; width: 24px; height: 24px; font-size: 0.8rem; margin-right: 8px; vertical-align: 2px; }

/* Reveal extras: the truth card, fakes, who picked what, the A/B split. */
.reveal-card[data-kind="truth"] {
  border-color: var(--success-color);
  background: linear-gradient(135deg, var(--surface-color) 0%, rgba(6, 214, 160, 0.1) 100%);
  box-shadow: 0 4px 16px rgba(6, 214, 160, 0.2);
}
.reveal-card[data-kind="truth"] .reveal-winner-badge { background: var(--success-color); }
.reveal-card[data-kind="truth"] .reveal-text { font-size: 1.25rem; font-weight: 800; }
.reveal-fake-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: #9b8cff;
  border: 1px solid rgba(155, 140, 255, 0.4);
  padding: 1px 7px;
  border-radius: var(--radius-sm);
}
.reveal-voters { font-size: 0.82rem; color: var(--text-muted); line-height: 1.35; }
.split-bar { height: 8px; border-radius: var(--radius-full); background: var(--border-subtle); overflow: hidden; }
.split-bar span { display: block; height: 100%; background: var(--mode-color, var(--accent-color)); border-radius: inherit; transition: width 600ms ease-out; }
.reveal-card.is-winner .split-bar span { background: var(--winner-color); }
#reveal-prompt-card { padding: 10px 14px; }

.setting-sub { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
