* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #121225;
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  overflow: hidden;
  user-select: none;
}
h1 { font-size: 1.4rem; margin-bottom: 24px; color: #aaa; letter-spacing: 2px; text-transform: uppercase; }
.card-flip {
  width: 320px;
  max-width: 90vw;
  height: 220px;
  cursor: pointer;
  margin-bottom: 20px;
}
.card-flip:not(.flipping):active { transform: scale(0.97); }
.card {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.card-hidden {
  background: linear-gradient(135deg, #1e1e3a, #2a2a50);
  border: 2px solid #3a3a6a;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.card-crewmate {
  background: linear-gradient(135deg, #0a4a2e, #0d6b3e);
  border: 2px solid #1a8a50;
  box-shadow: 0 4px 30px rgba(13, 107, 62, 0.4);
}
.card-impostor {
  background: linear-gradient(135deg, #5a0a0a, #8b1a1a);
  border: 2px solid #c0392b;
  box-shadow: 0 4px 30px rgba(192, 57, 43, 0.5);
  animation: pulse-red 1.5s ease-in-out infinite;
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 4px 30px rgba(192, 57, 43, 0.4); }
  50% { box-shadow: 0 4px 50px rgba(192, 57, 43, 0.7); }
}
.player-label { font-size: 1.1rem; color: #ccc; margin-bottom: 8px; }
.role-text { font-size: 2.2rem; font-weight: 800; letter-spacing: 1px; }
.tap-hint { font-size: 0.85rem; color: #666; margin-top: 8px; }
.emoji { font-size: 3rem; margin-bottom: 8px; }
.progress { font-size: 0.9rem; color: #555; margin-bottom: 16px; }
.btn {
  margin-top: 10px;
  padding: 14px 36px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
  letter-spacing: 1px;
}
.btn:active { transform: scale(0.95); }
.btn-next { background: #3a3a6a; color: #fff; position: relative; z-index: 1; }
.btn-next:hover { background: #4a4a8a; }
.btn-reset { background: #c0392b; color: #fff; margin-top: 20px; }
.btn-reset:hover { background: #e74c3c; }
.done-msg { font-size: 1.2rem; color: #aaa; margin-top: 20px; text-align: center; line-height: 1.6; }
.setup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 320px;
  max-width: 90vw;
}
.setup label { font-size: 1rem; color: #aaa; align-self: flex-start; margin-bottom: 4px; }
.setup-group { display: flex; flex-direction: column; width: 100%; }
.setup input[type=number] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid #3a3a6a;
  background: #1e1e3a;
  color: #fff;
  font-size: 1.2rem;
  text-align: center;
  outline: none;
}
.setup input[type=number]:focus { border-color: #6a6aaa; }
.error-msg { color: #e74c3c; font-size: 0.85rem; margin-top: 6px; min-height: 1em; }
.btn-start { background: #2ecc71; color: #121225; width: 100%; }
.btn-start:hover { background: #27ae60; }
.names-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #aaa;
  font-size: 0.95rem;
  cursor: pointer;
  align-self: flex-start;
}
.names-toggle input[type=checkbox] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2ecc71;
}
.names-group { gap: 8px; }
.name-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid #3a3a6a;
  background: #1e1e3a;
  color: #fff;
  font-size: 1rem;
  outline: none;
}
.name-input:focus { border-color: #6a6aaa; }
.btn-reset-names {
  background: transparent;
  border: 1px solid #444;
  color: #666;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.5px;
  align-self: flex-start;
}
.btn-reset-names:hover { color: #aaa; border-color: #666; }
.btn-reset-corner {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 10;
  background: transparent;
  border: 1px solid #444;
  color: #888;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: color 0.15s, border-color 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-reset-corner:hover { color: #fff; border-color: #888; }
.btn-reset-corner:active { transform: scale(0.95); }
.nav-buttons {
  display: flex;
  gap: 12px;
  width: 320px;
  max-width: 90vw;
  margin-top: 10px;
}
.nav-buttons .btn { flex: 1; margin-top: 0; }
.btn-prev { background: #2a2a50; color: #aaa; }
.btn-prev:hover { background: #3a3a6a; color: #fff; }
.btn-prev:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-prev:disabled:active { transform: none; }
