:root {
  --bg: #0f1117;
  --bg-card: #1a1d29;
  --bg-card-2: #23273a;
  --accent: #e63946;
  --accent-2: #457b9d;
  --text: #f1f1f4;
  --text-muted: #9a9db0;
  --border: #2e3244;
  --success: #2ecc71;
  --danger: #e63946;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1b1f2e 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

.wrapper {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 80px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1.logo {
  text-align: center;
  font-size: 2.4rem;
  letter-spacing: 2px;
  margin: 16px 0 4px;
  color: var(--accent);
  text-shadow: 0 0 24px rgba(230, 57, 70, 0.45);
}

.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 0.95rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.card h2 {
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--text);
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 12px;
}

input[type="text"], select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card-2);
  color: var(--text);
  font-size: 1rem;
}

input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--accent-2);
}

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 13px 18px;
  font-size: 1rem;
  font-weight: 600;
  width: 100%;
  margin-top: 16px;
  transition: transform 0.05s ease, opacity 0.15s ease;
}

button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: white; }
.btn-secondary { background: var(--accent-2); color: white; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }

.error-box {
  background: rgba(230, 57, 70, 0.15);
  border: 1px solid var(--accent);
  color: #ffb3b8;
  padding: 10px 14px;
  border-radius: 10px;
  margin-top: 12px;
  font-size: 0.9rem;
  display: none;
}
.error-box.visible { display: block; }

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

.room-code {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--accent);
}

.room-code-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.player-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

.player-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-card-2);
  border-radius: 10px;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.dot.offline { background: #555a6e; }

.crown { color: #f4b400; }

.badge {
  font-size: 0.7rem;
  background: var(--accent-2);
  color: white;
  border-radius: 6px;
  padding: 2px 6px;
  margin-left: auto;
}

.role-card {
  text-align: center;
  padding: 36px 20px;
}

.role-card.impostor {
  background: linear-gradient(160deg, #3a0d12, var(--bg-card));
  border-color: var(--accent);
}

.role-card.crew {
  background: linear-gradient(160deg, #0d2f3a, var(--bg-card));
  border-color: var(--accent-2);
}

.role-label {
  font-size: 0.9rem;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.role-word {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 14px 0;
  word-break: break-word;
}

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

.vote-list button {
  text-align: left;
  background: var(--bg-card-2);
  color: var(--text);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}

.vote-list button.selected {
  border-color: var(--accent);
  background: rgba(230, 57, 70, 0.15);
}

.progress {
  height: 8px;
  border-radius: 6px;
  background: var(--bg-card-2);
  overflow: hidden;
  margin-top: 10px;
}
.progress-bar {
  height: 100%;
  background: var(--accent-2);
  transition: width 0.3s ease;
}

.tally-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.tally-name {
  width: 90px;
  font-size: 0.85rem;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tally-bar-bg {
  flex: 1;
  background: var(--bg-card-2);
  border-radius: 6px;
  height: 18px;
  overflow: hidden;
}
.tally-bar {
  height: 100%;
  background: var(--accent-2);
}
.tally-count {
  width: 20px;
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.result-banner {
  text-align: center;
  padding: 18px;
  border-radius: 14px;
  margin-bottom: 16px;
  font-weight: 700;
  font-size: 1.1rem;
}
.result-banner.caught { background: rgba(46, 204, 113, 0.15); color: #6ee89a; border: 1px solid var(--success); }
.result-banner.escaped { background: rgba(230, 57, 70, 0.15); color: #ff8b93; border: 1px solid var(--accent); }

.muted { color: var(--text-muted); font-size: 0.88rem; }
.center { text-align: center; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

#share-link {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-card-2);
}

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

.qr-wrap img {
  border-radius: 10px;
  background: white;
  padding: 8px;
}

.footer-link {
  display: block;
  text-align: center;
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
}

.hidden { display: none !important; }
