/* ===========================================================
   Quiet Town — design tokens
   Different world from the blackjack felt: this is an
   interrogation-room-at-night feel, not a casino.
   --ink-950  #14110f   near-black warm charcoal
   --ink-800  #1f1a16   panel
   --ink-700  #2a2320   raised panel / hover
   --lamp     #e8a33d   single warm desk-lamp amber (the ONE light source)
   --paper    #ece4d6   card/text
   --danger   #b6503f   elimination, mafia team color
   --safe     #7fa8c9   detective/investigate color
   --heal     #8fbf8a   doctor/protect color
   Type: Fraunces (headers) + IBM Plex Mono (everything functional)
   =========================================================== */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; min-height: 100vh;
  background: #14110f;
  color: #ece4d6;
  font-family: 'IBM Plex Mono', monospace;
}
h1, h2, h3 { font-family: 'Fraunces', serif; margin: 0; }
.hidden { display: none !important; }

.screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, rgba(232,163,61,0.05), transparent 60%), #14110f;
}

.lobby-card {
  width: 100%; max-width: 440px;
  background: #1f1a16;
  border: 1px solid rgba(232,163,61,0.2);
  border-radius: 4px;
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.brand-lamp { font-size: 28px; color: #e8a33d; }
.brand-lamp.small { font-size: 18px; }
.brand h1 { font-size: 28px; font-weight: 600; letter-spacing: 0.01em; }

.tagline {
  font-size: 13px; line-height: 1.6; color: rgba(236,228,214,0.6);
  margin: 0 0 28px;
}

.lobby-actions { display: flex; flex-direction: column; gap: 20px; }
.action-block h2 { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.hint { font-size: 12px; color: rgba(236,228,214,0.5); line-height: 1.5; margin: 0 0 14px; }

.field { display: block; margin-bottom: 10px; }
.field span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(236,228,214,0.5); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 10px 12px;
  background: #14110f; border: 1px solid rgba(232,163,61,0.25);
  border-radius: 3px; color: #ece4d6;
  font-family: 'IBM Plex Mono', monospace; font-size: 14px;
}
.field input:focus, .field select:focus { outline: 2px solid #e8a33d; outline-offset: 1px; border-color: transparent; }

.divider { display: flex; align-items: center; text-align: center; color: rgba(236,228,214,0.3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: rgba(232,163,61,0.15); }
.divider span { padding: 0 12px; }

.btn {
  display: inline-block; width: 100%; padding: 12px 18px;
  border-radius: 3px; border: 1px solid transparent;
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600; letter-spacing: 0.03em;
  cursor: pointer; transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid #e8a33d; outline-offset: 2px; }
.btn-primary { background: #e8a33d; color: #14110f; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-secondary { background: transparent; color: #ece4d6; border-color: rgba(232,163,61,0.35); }
.btn-secondary:hover:not(:disabled) { border-color: #e8a33d; }
.btn-ghost { background: transparent; color: rgba(236,228,214,0.55); border-color: rgba(236,228,214,0.18); }
.btn-small { width: auto; padding: 9px 16px; font-size: 12px; }
.btn-tiny { width: auto; padding: 6px 10px; font-size: 11px; }

.lobby-status { margin: 16px 0 0; font-size: 12px; color: #e8a33d; min-height: 16px; }

.table-code {
  font-size: 32px; font-weight: 600; letter-spacing: 0.14em; color: #e8a33d;
  background: #14110f; border: 1px dashed rgba(232,163,61,0.35);
  border-radius: 4px; padding: 16px; text-align: center; margin: 16px 0 10px;
}

.seated-list { margin: 22px 0; }
.seated-list h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(236,228,214,0.5); margin-bottom: 10px; font-family: 'IBM Plex Mono', monospace; font-weight: 600; }
.seated-list ul { list-style: none; margin: 0; padding: 0; }
.seated-list li { padding: 8px 12px; background: rgba(232,163,61,0.05); border-radius: 3px; margin-bottom: 6px; font-size: 13px; }

.role-config { margin: 22px 0; border-top: 1px solid rgba(232,163,61,0.15); padding-top: 18px; }
.role-config h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(236,228,214,0.5); margin-bottom: 12px; font-weight: 600; }
.role-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; }
.stepper { display: flex; align-items: center; gap: 12px; }
.step-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid rgba(232,163,61,0.4); background: transparent; color: #e8a33d;
  font-size: 15px; cursor: pointer; line-height: 1;
}
.step-btn:hover { background: rgba(232,163,61,0.1); }
.stepper span { min-width: 16px; text-align: center; font-weight: 600; }

/* ---------- Game screen (night room) ---------- */
.night-room {
  min-height: 100vh; width: 100%;
  display: flex; flex-direction: column; align-items: center;
  background: radial-gradient(ellipse 700px 400px at 50% 15%, rgba(232,163,61,0.06), transparent 65%), #14110f;
  padding-bottom: 24px;
}

.game-header {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 16px 24px; position: relative;
}
.phase-badge {
  font-size: 13px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: #e8a33d; border: 1px solid rgba(232,163,61,0.3); padding: 4px 12px; border-radius: 20px;
}
.conn-indicator { position: absolute; right: 20px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-live { background: #8fbf8a; box-shadow: 0 0 6px #8fbf8a; }
.dot-down { background: #b6503f; }

.announcement {
  text-align: center; font-size: 13px; color: rgba(236,228,214,0.75);
  max-width: 420px; padding: 0 24px 8px; min-height: 20px; line-height: 1.5;
}

.timer-display {
  font-family: 'Fraunces', serif; font-size: 40px; font-weight: 600;
  color: #e8a33d; margin: 4px 0 8px;
}

.role-card-area { display: flex; flex-direction: column; align-items: center; margin: 20px 0; }

.role-card {
  width: 220px; height: 300px; border-radius: 12px;
  position: relative; cursor: pointer;
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
}
.role-card-face {
  position: absolute; inset: 0; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 20px; text-align: center;
}
.role-hidden {
  background: repeating-linear-gradient(45deg, #1f1a16, #1f1a16 8px, #2a2320 8px, #2a2320 16px);
  border: 2px solid rgba(232,163,61,0.4);
}
.hidden-icon { font-size: 48px; color: rgba(232,163,61,0.5); }
.hidden-label { font-size: 12px; color: rgba(236,228,214,0.5); max-width: 140px; line-height: 1.4; }

.role-revealed {
  background: #ece4d6;
  color: #14110f;
  border: 2px solid #e8a33d;
}
.role-name { font-family: 'Fraunces', serif; font-size: 28px; font-weight: 700; }
.role-blurb { font-size: 12px; line-height: 1.5; color: #3a332c; }

.peek-hint { font-size: 11px; color: rgba(236,228,214,0.4); margin-top: 12px; }

.action-panel {
  width: 100%; max-width: 460px;
  background: rgba(232,163,61,0.05); border: 1px solid rgba(232,163,61,0.25);
  border-radius: 8px; padding: 16px 18px; margin: 14px 0;
  display: flex; flex-direction: column; align-items: center;
}
.action-panel h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; color: #e8a33d; }
.target-grid {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%;
}
.target-btn {
  padding: 9px 16px; border-radius: 20px; font-size: 12px;
  background: transparent; border: 1px solid rgba(232,163,61,0.3); color: #ece4d6;
  font-family: 'IBM Plex Mono', monospace; cursor: pointer;
}
.target-btn:hover { border-color: #e8a33d; background: rgba(232,163,61,0.08); }
.target-btn.selected { background: #e8a33d; color: #14110f; border-color: #e8a33d; font-weight: 600; }
.action-confirm { margin: 10px 0 0; color: #8fbf8a; }

.detective-result {
  width: 100%; max-width: 460px;
  background: rgba(127,168,201,0.08); border: 1px solid rgba(127,168,201,0.3);
  border-radius: 8px; padding: 12px 16px; margin: 0 0 14px;
  font-size: 13px; text-align: center; color: #a8c9e0;
}

.host-controls-label { text-align: center; margin-bottom: 4px; }

.players-list {
  width: 100%; max-width: 460px;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  padding: 12px 20px;
}
.player-chip {
  padding: 7px 14px; border-radius: 20px; font-size: 12px;
  background: rgba(232,163,61,0.06); border: 1px solid rgba(232,163,61,0.15);
}
.player-chip.dead {
  opacity: 0.4; text-decoration: line-through;
  border-color: rgba(182,80,63,0.4);
}

.chat-panel {
  width: 100%; max-width: 460px;
  display: flex; flex-direction: column;
  border-top: 1px solid rgba(232,163,61,0.15);
  margin-top: 8px; padding: 14px 20px 0;
}
.chat-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.chat-tab {
  background: transparent; border: 1px solid rgba(232,163,61,0.2);
  color: rgba(236,228,214,0.55); font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; padding: 6px 12px; border-radius: 20px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.chat-tab.active { border-color: #e8a33d; color: #e8a33d; background: rgba(232,163,61,0.08); }
.night-only-badge {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.05em;
  background: rgba(182,80,63,0.25); color: #d98a7a; padding: 2px 6px; border-radius: 10px;
}

.chat-log {
  height: 160px; overflow-y: auto;
  background: rgba(0,0,0,0.2); border: 1px solid rgba(232,163,61,0.1);
  border-radius: 6px; padding: 10px 12px; margin-bottom: 8px;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px;
}
.chat-msg { line-height: 1.4; }
.chat-msg .who { color: #e8a33d; font-weight: 600; }
.chat-msg.dead-sender .who { color: rgba(182,80,63,0.7); }
.chat-msg.dead-sender { opacity: 0.6; }
.chat-msg .who::after { content: attr(data-dead); font-size: 9px; color: rgba(182,80,63,0.8); margin-left: 4px; }
.chat-empty { opacity: 0.35; font-size: 11px; text-align: center; margin-top: auto; margin-bottom: auto; }

.chat-input-row { display: flex; gap: 8px; margin-bottom: 10px; }
.chat-input-row input {
  flex: 1; padding: 9px 12px; background: #14110f;
  border: 1px solid rgba(232,163,61,0.25); border-radius: 3px;
  color: #ece4d6; font-family: 'IBM Plex Mono', monospace; font-size: 13px;
}
.chat-input-row input:focus { outline: 2px solid #e8a33d; outline-offset: 1px; border-color: transparent; }
.chat-hint { text-align: center; margin-bottom: 10px; }

.host-controls {
  width: 100%; max-width: 460px;
  border-top: 1px solid rgba(232,163,61,0.15);
  margin-top: 12px; padding: 18px 20px 0;
  display: flex; flex-direction: column; gap: 12px;
}
.control-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.elim-field { flex: 1; margin-bottom: 0; min-width: 160px; }

@media (max-width: 480px) {
  .role-card { width: 180px; height: 250px; }
  .role-name { font-size: 22px; }
}
