:root {
  --bg: #0c1017;
  --surface: #151c27;
  --surface-2: #1d2635;
  --cream: #f5efe4;
  --muted: #9da4b0;
  --amber: #e6a94d;
  --crimson: #c83738;
  --emerald: #2e8b66;
  --border: rgba(230, 169, 77, 0.22);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 0%, #1c2434 0%, var(--bg) 65%);
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.48;
}

.app-shell {
  max-width: 500px;
  margin: 0 auto;
  padding: 16px 16px 80px;
}

/* Header */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.logo-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  letter-spacing: 0.6px;
  font-size: 14px;
  color: var(--amber);
}
.lang-pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--cream);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

/* Hero Banner */
.hero-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 16px;
  background: var(--surface);
}
.hero-img {
  width: 100%;
  height: 175px;
  object-fit: cover;
  display: block;
  filter: brightness(0.76);
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(12,16,23,0.15) 0%, rgba(12,16,23,0.92) 95%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
}
.hero-kicker {
  font-size: 11px;
  font-family: monospace;
  letter-spacing: 1.4px;
  color: var(--amber);
  text-transform: uppercase;
}
.hero-title {
  font-family: Georgia, serif;
  font-size: 26px;
  font-weight: 700;
  margin: 2px 0;
}
.hero-sub {
  font-size: 13px;
  color: #d6d0c4;
  margin: 0;
}

/* Cards & Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
.panel-title {
  font-size: 12px;
  font-family: monospace;
  letter-spacing: 1.2px;
  color: var(--amber);
  text-transform: uppercase;
  margin-bottom: 10px;
}

/* Mode Toggle */
.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.mode-tab {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.mode-tab.active {
  background: rgba(230, 169, 77, 0.16);
  border-color: var(--amber);
  color: var(--amber);
}

/* Players */
.player-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.chip {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  line-height: 1;
}
.input-row {
  display: flex;
  gap: 8px;
}
input[type="text"], select {
  flex: 1;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.16);
  color: var(--cream);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
}

/* Category Grid */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.cat-btn {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--cream);
  padding: 10px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cat-btn.selected {
  border-color: var(--amber);
  background: rgba(230, 169, 77, 0.14);
}

/* Settings Row */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
}
.setting-row:last-child { border-bottom: none; }

/* Primary Buttons */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #d8433e 0%, #a52424 100%);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.4px;
  box-shadow: 0 6px 20px rgba(200, 55, 56, 0.35);
}
.btn-secondary {
  width: 100%;
  background: var(--surface-2);
  color: var(--cream);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Role Reveal Card */
.reveal-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--surface);
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px;
  user-select: none;
  touch-action: none;
  cursor: pointer;
}
.reveal-card.imposter-bg {
  border-color: var(--crimson);
  box-shadow: 0 0 32px rgba(200, 55, 56, 0.25);
}
.reveal-card.citizen-bg {
  border-color: var(--amber);
  box-shadow: 0 0 32px rgba(230, 169, 77, 0.18);
}
.role-art {
  width: 150px;
  height: 201px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.2);
  margin-bottom: 14px;
}
.secret-word {
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--amber);
  margin: 6px 0;
}
.imposter-word {
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  color: #ff6b6b;
  margin: 6px 0;
}

/* Timer */
.timer-display {
  font-family: monospace;
  font-size: 52px;
  font-weight: 800;
  text-align: center;
  color: var(--amber);
  margin: 12px 0;
  letter-spacing: 2px;
}
.vote-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.vote-btn {
  background: var(--surface-2);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--cream);
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.vote-btn.picked {
  border-color: var(--crimson);
  background: rgba(200, 55, 56, 0.2);
}

/* CSP-safe utility classes (replacing all inline styles) */
.text-center { text-align: center; }
.mt-14 { margin-top: 14px; }
.room-desc {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 10px 0;
}
.room-code-input {
  font-family: monospace;
  font-weight: 700;
  text-transform: uppercase;
}
.btn-auto {
  width: auto;
  padding: 0 14px;
}
.btn-auto-pad {
  width: auto;
  padding: 0 16px;
}
.btn-auto-sm {
  width: auto;
  padding: 8px 16px;
}
.slot-wrap { margin-top: 10px; }
.slot-label {
  font-size: 12px;
  color: var(--amber);
}
.slot-select {
  width: 100%;
  margin-top: 4px;
}
.select-compact { flex: 0 0 120px; }
.hint-checkbox {
  width: 18px;
  height: 18px;
  accent-color: var(--amber);
}
.reveal-name {
  margin: 4px 0 6px;
  font-family: Georgia, serif;
  font-size: 24px;
}
.reveal-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 14px;
}
.cover-icon {
  font-size: 44px;
  margin-bottom: 10px;
}
.cover-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--amber);
}
.cover-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.starter-line {
  font-size: 13px;
  color: var(--muted);
}
.timer-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}
.result-headline {
  font-family: Georgia, serif;
  margin: 6px 0;
}
.result-details {
  font-size: 14px;
  color: var(--muted);
}
.final-word-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
}
.final-word-label {
  font-size: 11px;
  color: var(--amber);
  font-family: monospace;
}
.final-word-val {
  font-size: 24px;
  font-weight: 700;
  font-family: Georgia, serif;
  margin-top: 4px;
}
.role-cat-citizen {
  font-size: 11px;
  font-family: monospace;
  color: var(--amber);
  letter-spacing: 1.2px;
}
.role-cat-imposter {
  font-size: 11px;
  font-family: monospace;
  color: #ff8080;
  letter-spacing: 1.2px;
}
.role-sub {
  font-size: 13px;
  color: #d6d0c4;
  max-width: 280px;
}
.amber-strong { color: var(--amber); }
.crimson-strong { color: #ff8080; }

.hidden { display: none !important; }
