/* ── Games Room — Shared Styles ──────────────────────────────────────── */
/* Navy/gold design system matching the existing apps.                    */

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1a1a2e;
  color: #eee;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────────────────── */

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.container.wide { max-width: 600px; }

/* ── Typography ──────────────────────────────────────────────────────── */

h1 {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  color: #ccc;
}

.subtitle {
  text-align: center;
  color: #888;
  font-size: 14px;
  margin-bottom: 32px;
}

.label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
  margin-bottom: 6px;
}

/* ── Cards / Panels ──────────────────────────────────────────────────── */

.card {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.card-flat {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */

button, .btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 0.15s;
  text-align: center;
  text-decoration: none;
}

button:active, .btn:active { opacity: 0.7; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: #c9a84c;
  color: #1a1a2e;
}

.btn-secondary {
  background: #0f3460;
  color: #eee;
}

.btn-danger {
  background: #c0392b;
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 2px solid #0f3460;
  color: #aaa;
}

.btn-small {
  padding: 8px 14px;
  font-size: 13px;
  width: auto;
  display: inline-block;
  border-radius: 8px;
}

/* ── Inputs ──────────────────────────────────────────────────────────── */

input[type="text"], input[type="number"] {
  width: 100%;
  padding: 12px 16px;
  background: #0d1b3e;
  border: 1px solid #0f3460;
  border-radius: 10px;
  color: #eee;
  font-size: 16px;
  outline: none;
  touch-action: manipulation;
}

input:focus {
  border-color: #c9a84c;
}

input::placeholder {
  color: #555;
}

/* ── PIN Input ───────────────────────────────────────────────────────── */

.pin-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.pin-box {
  width: 56px;
  height: 64px;
  background: #0d1b3e;
  border: 2px solid #0f3460;
  border-radius: 12px;
  color: #eee;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  caret-color: #c9a84c;
  touch-action: manipulation;
}

.pin-box:focus {
  border-color: #c9a84c;
}

/* ── PIN Display (in lobby) ──────────────────────────────────────────── */

.pin-display {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}

.pin-digit {
  width: 48px;
  height: 56px;
  background: #0d1b3e;
  border: 2px solid #c9a84c;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #c9a84c;
}

/* ── Player Roster ───────────────────────────────────────────────────── */

.player-list {
  list-style: none;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 10px;
  margin-bottom: 8px;
}

.player-name {
  font-size: 16px;
  font-weight: 600;
}

.player-badges {
  display: flex;
  gap: 6px;
}

.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-gm {
  background: #c9a84c;
  color: #1a1a2e;
}

.badge-spectator {
  background: #0f3460;
  color: #aaa;
}

.badge-you {
  background: #27ae60;
  color: #fff;
}

/* ── Role Toggle ─────────────────────────────────────────────────────── */

.role-toggle {
  display: flex;
  background: #0d1b3e;
  border: 1px solid #0f3460;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}

.role-toggle button {
  flex: 1;
  padding: 10px;
  background: transparent;
  color: #888;
  border: none;
  border-radius: 0;
  font-size: 14px;
  font-weight: 600;
}

.role-toggle button.active {
  background: #0f3460;
  color: #eee;
}

/* ── QR Code ─────────────────────────────────────────────────────────── */

.qr-container {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.qr-container canvas {
  border-radius: 8px;
}

/* ── Game Cards ──────────────────────────────────────────────────────── */

.game-card {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s;
}

.game-card:active { border-color: #c9a84c; }

.game-card h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.game-card p {
  font-size: 13px;
  color: #888;
}

.game-card .player-range {
  font-size: 12px;
  color: #c9a84c;
  margin-top: 6px;
}

/* ── Divider ─────────────────────────────────────────────────────────── */

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0;
  color: #555;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #0f3460;
}

/* ── Status / Feedback ───────────────────────────────────────────────── */

.error {
  background: #3d1515;
  border: 1px solid #c0392b;
  color: #f5a5a5;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}

.error.show { display: block; }

.empty-state {
  text-align: center;
  color: #555;
  padding: 32px 0;
  font-size: 14px;
}

/* ── Spacing helpers ─────────────────────────────────────────────────── */

.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-center { text-align: center; }

/* ── Animations ──────────────────────────────────────────────────────── */

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

.fade-in { animation: fadeIn 0.3s ease; }

/* ── Screen sections (show/hide) ─────────────────────────────────────── */

.screen { display: none; }
.screen.active { display: block; }
