/* ═══════════════════════════════════════════
   IHMERT SUS - Among Us in Ihmert
   ═══════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
input, textarea, select {
  -webkit-user-select: text;
  user-select: text;
}

html, body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: #0a0a1a;
  color: #e8ecf4;
  overflow: hidden;
  overscroll-behavior: none;
  width: 100%;
  height: 100%;
  height: 100dvh;
  position: fixed;
  touch-action: none;
}

/* Orientation warning overlay */
#rotate-device {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0a0a15;
  z-index: 99999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: white;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ─── Screens ─── */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1;
}
.screen.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Lobby Overlay (game canvas visible behind) ─── */
.lobby-overlay.active {
  background: transparent;
  z-index: 150;
  pointer-events: none;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 20px;
}
.lobby-panel {
  pointer-events: all;
  background: rgba(10, 15, 35, 0.92);
  border: 1px solid rgba(100, 120, 180, 0.3);
  border-radius: 16px;
  padding: 20px;
  max-width: 380px;
  max-height: 85vh;
  overflow-y: auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  margin-top: 10px;
}
.lobby-hint {
  text-align: center;
  color: #5a6a8a;
  font-size: 11px;
  margin-top: 12px;
  letter-spacing: 1px;
}

/* Hide HUD game elements when lobby overlay is active */
body.in-lobby #hud-top,
body.in-lobby #hud-taskbar,
body.in-lobby #hud-actions,
body.in-lobby .tasks-toggle,
body.in-lobby .mute-toggle,
body.in-lobby .camera-toggle,
body.in-lobby .admin-map-toggle,
body.in-lobby #hud-weather,
body.in-lobby #hud-round-score,
body.in-lobby #ghost-chat-panel {
  display: none !important;
}

/* ─── Stars Background ─── */
.stars-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at 30% 20%, #0d1127 0%, #0a0a1a 100%);
}
.stars-bg::before, .stars-bg::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: white;
  box-shadow:
    30px 80px 0 #fff3, 120px 40px 0 #fff5, 250px 120px 0 #fff2,
    400px 30px 0 #fff4, 80px 200px 0 #fff3, 300px 180px 0 #fff5,
    500px 80px 0 #fff2, 180px 300px 0 #fff4, 600px 200px 0 #fff3,
    50px 400px 0 #fff2, 350px 350px 0 #fff4, 700px 100px 0 #fff3,
    150px 500px 0 #fff2, 450px 400px 0 #fff5, 650px 300px 0 #fff3,
    100px 600px 0 #fff4, 550px 500px 0 #fff2, 750px 400px 0 #fff3,
    200px 650px 0 #fff5, 500px 600px 0 #fff2, 800px 500px 0 #fff4;
  animation: twinkle 3s ease-in-out infinite alternate;
}
.stars-bg::after {
  animation-delay: 1.5s;
  transform: translate(50px, -30px);
}

@keyframes twinkle {
  0% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* ─── Menu ─── */
.menu-container {
  position: relative;
  z-index: 1;
  max-width: 420px;
  width: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  text-align: center;
  margin-bottom: 32px;
}
.logo-text {
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 6px;
  background: linear-gradient(135deg, #ff4757, #ff6b81, #ffa502);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: none;
}
.logo-sub {
  font-size: 80px;
  font-weight: 900;
  letter-spacing: 16px;
  color: #ff4757;
  text-shadow: 0 0 40px rgba(255, 71, 87, 0.5);
  margin-top: -10px;
}
.logo-tagline {
  font-size: 13px;
  color: #5a6a8a;
  letter-spacing: 2px;
  margin-top: 8px;
}

.menu-card {
  background: rgba(20, 25, 50, 0.85);
  border: 1px solid rgba(100, 120, 180, 0.2);
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%;
  backdrop-filter: blur(10px);
}

.input {
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid rgba(100, 120, 180, 0.3);
  background: rgba(10, 15, 35, 0.8);
  color: #e8ecf4;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.input:focus {
  border-color: rgba(255, 71, 87, 0.5);
}
.input::placeholder {
  color: #4a5a7a;
}

.btn {
  padding: 14px 28px;
  border-radius: 12px;
  border: none;
  font-weight: 700;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
  width: 100%;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, #ff4757, #c0392b);
  color: #fff;
  box-shadow: 0 4px 20px rgba(255, 71, 87, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 6px 30px rgba(255, 71, 87, 0.5);
}

.btn-secondary {
  background: rgba(100, 120, 180, 0.2);
  color: #8a9cc5;
  border: 1px solid rgba(100, 120, 180, 0.3);
}

.btn-small {
  padding: 10px 16px;
  font-size: 13px;
  width: auto;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); }

.divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: #3a4a6a;
  font-size: 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(100, 120, 180, 0.2);
}
.divider span { padding: 0 12px; }

.join-row {
  display: flex;
  gap: 8px;
}
.join-row .input { flex: 1; }
.join-row .btn { width: auto; padding: 14px 24px; }

.error-msg {
  color: #ff4757;
  font-size: 13px;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
}

.menu-footer {
  text-align: center;
  color: #3a4a6a;
  font-size: 12px;
  margin-top: 20px;
}

/* ─── Lobby ─── */
.lobby-container {
  position: relative;
  z-index: 1;
  max-width: 480px;
  width: 100%;
  padding: 20px;
}

.lobby-header {
  text-align: center;
  margin-bottom: 20px;
}
.lobby-label {
  font-size: 12px;
  color: #5a6a8a;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.game-code-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px;
  background: rgba(20, 25, 50, 0.85);
  border: 1px solid rgba(100, 120, 180, 0.2);
  border-radius: 12px;
}
.code-label { color: #5a6a8a; font-size: 13px; }
.code-value {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 6px;
  color: #ffa502;
  font-family: monospace;
}

.players-list {
  background: rgba(20, 25, 50, 0.85);
  border: 1px solid rgba(100, 120, 180, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(30, 40, 70, 0.6);
  margin-bottom: 6px;
}
.player-chip:last-child { margin-bottom: 0; }

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.2);
}

.player-name { flex: 1; font-size: 14px; }

.badge {
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.badge-host { background: #ffa502; color: #000; }
.badge-you { background: #3498db; color: #fff; }
.badge-impostor { background: #ff4757; color: #fff; }
.badge-crewmate { background: #2ecc71; color: #fff; }
.badge-dead { background: #555; color: #fff; }

.settings-panel {
  background: rgba(20, 25, 50, 0.85);
  border: 1px solid rgba(100, 120, 180, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.settings-title {
  font-size: 12px;
  color: #5a6a8a;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 12px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.setting-row label { font-size: 14px; color: #8a9cc5; }
.setting-row select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(100, 120, 180, 0.3);
  background: rgba(10, 15, 35, 0.8);
  color: #e8ecf4;
  font-family: inherit;
  font-size: 14px;
}

.wait-msg {
  text-align: center;
  color: #5a6a8a;
  font-size: 14px;
  padding: 14px;
}

/* ─── Game Screen ─── */
#game-screen {
  display: none;
  flex-direction: column;
}
#game-screen.active {
  display: flex;
}

#game-canvas-container {
  position: fixed;
  inset: 0;
  z-index: 0;
}
#game-canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ─── HUD ─── */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
#hud > * { pointer-events: auto; }

#hud-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-badge {
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.hud-badge.crewmate { background: rgba(46, 204, 113, 0.3); color: #2ecc71; border: 1px solid #2ecc71; }
.hud-badge.impostor { background: rgba(255, 71, 87, 0.3); color: #ff4757; border: 1px solid #ff4757; }

.hud-location {
  font-size: 13px;
  color: #8a9cc5;
  padding: 6px 12px;
  background: rgba(10, 15, 35, 0.7);
  border-radius: 8px;
}

.sabotage-alert {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 71, 87, 0.9);
  color: #fff;
  padding: 10px 24px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  animation: pulse-alert 1s infinite;
  text-align: center;
}
@keyframes pulse-alert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

#hud-taskbar {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 15, 35, 0.8);
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(100, 120, 180, 0.2);
}
.taskbar-label { font-size: 11px; color: #5a6a8a; text-transform: uppercase; letter-spacing: 1px; }
.taskbar-bg {
  width: 100px;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}
.taskbar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2ecc71, #27ae60);
  border-radius: 4px;
  transition: width 0.5s;
  width: 0%;
}
#taskbar-pct { font-size: 12px; color: #2ecc71; font-weight: 700; min-width: 32px; }

/* ─── Action Buttons ─── */
#hud-actions {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 14px;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(20, 25, 50, 0.9);
  color: #e8ecf4;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(10px);
}
.action-btn:hover { transform: scale(1.05); }
.action-btn:active { transform: scale(0.95); }
.action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.action-icon { font-size: 20px; }

.btn-kill { border-color: #ff4757; background: rgba(255, 71, 87, 0.2); }
.btn-kill:hover { background: rgba(255, 71, 87, 0.4); }
.btn-report { border-color: #f39c12; background: rgba(243, 156, 18, 0.2); }
.btn-report:hover { background: rgba(243, 156, 18, 0.4); }
.btn-vent { border-color: #9b59b6; background: rgba(155, 89, 182, 0.2); }
.btn-vent:hover { background: rgba(155, 89, 182, 0.4); }
.btn-sabotage { border-color: #e74c3c; background: rgba(231, 76, 60, 0.2); }
.btn-sabotage:hover { background: rgba(231, 76, 60, 0.4); }

/* ─── Mobile Joystick ─── */
#joystick-zone {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 50%;
  height: 100%;
  z-index: 5;
  touch-action: none;
}

/* ─── Tasks ─── */
.tasks-toggle {
  position: absolute;
  top: 50px;
  right: 12px;
  background: rgba(10, 15, 35, 0.8);
  border: 1px solid rgba(100, 120, 180, 0.3);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  color: #e8ecf4;
}

.task-list {
  position: absolute;
  top: 90px;
  right: 12px;
  width: 260px;
  max-height: 300px;
  overflow-y: auto;
  background: rgba(10, 15, 35, 0.92);
  border: 1px solid rgba(100, 120, 180, 0.2);
  border-radius: 12px;
  padding: 14px;
}
.task-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  color: #8a9cc5;
}
.task-item.completed {
  color: #2ecc71;
  text-decoration: line-through;
}
.task-check {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid rgba(100, 120, 180, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}
.task-item.completed .task-check {
  background: #2ecc71;
  border-color: #2ecc71;
  color: #fff;
}
.task-location {
  font-size: 10px;
  color: #4a5a7a;
  margin-left: auto;
}

/* ─── Minimap ─── */
#minimap {
  position: absolute;
  bottom: 20px;
  left: 20px;
  border-radius: 10px;
  border: 2px solid rgba(100, 120, 180, 0.3);
  background: rgba(10, 15, 35, 0.8);
  opacity: 0.85;
}

/* ─── Overlays ─── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 15, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

/* Role Reveal */
.role-reveal-content {
  text-align: center;
  animation: fadeIn 0.5s;
}
.role-icon {
  font-size: 80px;
  margin-bottom: 20px;
}
.role-text {
  font-size: 48px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 4px;
  animation: pulse 1.5s infinite;
}
.role-text.crewmate { color: #2ecc71; }
.role-text.impostor { color: #ff4757; }
.role-subtitle {
  font-size: 16px;
  color: #5a6a8a;
  margin-top: 12px;
}
.role-partners {
  font-size: 14px;
  color: #ff6b81;
  margin-top: 16px;
}

@keyframes fadeIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* Meeting */
.meeting-container {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}
.meeting-header {
  text-align: center;
  margin-bottom: 16px;
}
.meeting-title {
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.meeting-timer {
  font-size: 36px;
  font-weight: 900;
  color: #ffa502;
  margin-top: 8px;
}

.meeting-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.meeting-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(30, 40, 70, 0.6);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}
.meeting-player:hover:not(.dead):not(.voted):not(.is-self) {
  border-color: rgba(255, 71, 87, 0.5);
  background: rgba(255, 71, 87, 0.1);
}
.meeting-player.selected {
  border-color: #ff4757;
  background: rgba(255, 71, 87, 0.2);
}
.meeting-player.dead {
  opacity: 0.3;
  cursor: not-allowed;
}
.meeting-player.voted {
  opacity: 0.6;
  cursor: default;
}
.meeting-player .vote-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ff4757;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  margin-left: auto;
}

.skip-vote {
  grid-column: 1 / -1;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  background: rgba(90, 106, 138, 0.2);
  border: 2px solid transparent;
  cursor: pointer;
  color: #5a6a8a;
  font-weight: 600;
  transition: all 0.2s;
}
.skip-vote:hover { border-color: rgba(90, 106, 138, 0.5); }
.skip-vote.selected { border-color: #5a6a8a; background: rgba(90, 106, 138, 0.3); }

/* Chat */
.chat-container {
  background: rgba(20, 25, 50, 0.85);
  border: 1px solid rgba(100, 120, 180, 0.2);
  border-radius: 12px;
  overflow: hidden;
}
.chat-messages {
  max-height: 180px;
  overflow-y: auto;
  padding: 12px;
}
.chat-msg {
  margin-bottom: 6px;
  font-size: 13px;
}
.chat-msg-name {
  font-weight: 700;
  margin-right: 6px;
}
.chat-input-row {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid rgba(100, 120, 180, 0.1);
}
.chat-input {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 8px;
  margin-bottom: 0;
}

/* Vote Result */
.vote-result-content {
  text-align: center;
  animation: fadeIn 0.5s;
}
.vote-result-text {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 12px;
}
.vote-result-role {
  font-size: 16px;
  font-weight: 700;
}

/* Game Over */
.gameover-content {
  text-align: center;
  width: 100%;
  max-width: 480px;
  padding: 20px;
  animation: fadeIn 0.5s;
}
.gameover-title {
  font-size: 40px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 4px;
  animation: glow 2s infinite;
}
@keyframes glow {
  0%, 100% { text-shadow: 0 0 20px currentColor; }
  50% { text-shadow: 0 0 40px currentColor, 0 0 80px currentColor; }
}
.gameover-subtitle {
  font-size: 18px;
  font-weight: 700;
  margin-top: 12px;
  margin-bottom: 24px;
}
.gameover-players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
}

/* Task Modal */
.task-modal-content {
  background: rgba(20, 25, 50, 0.95);
  border: 1px solid rgba(100, 120, 180, 0.3);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.task-modal-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #3498db;
}
.task-modal-desc {
  font-size: 13px;
  color: #5a6a8a;
  margin-bottom: 20px;
}
.task-modal-body {
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

/* Task interactions */
.task-sequence-btn {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  border: 2px solid rgba(100, 120, 180, 0.3);
  background: rgba(30, 40, 70, 0.6);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}
.task-sequence-btn.done {
  background: rgba(46, 204, 113, 0.3);
  border-color: #2ecc71;
}
.task-sequence-btn:hover:not(.done) {
  background: rgba(52, 152, 219, 0.3);
  border-color: #3498db;
}

.task-hold-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid #3498db;
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-hold-btn:active {
  background: rgba(52, 152, 219, 0.5);
  border-color: #2ecc71;
  color: #2ecc71;
}
.task-hold-progress {
  width: 200px;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
}
.task-hold-fill {
  height: 100%;
  background: #3498db;
  border-radius: 4px;
  transition: width 0.1s;
}

/* Sabotage Menu */
.sabotage-menu-content {
  background: rgba(20, 25, 50, 0.95);
  border: 1px solid rgba(255, 71, 87, 0.3);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 400px;
}
.sabotage-menu-title {
  font-size: 20px;
  font-weight: 800;
  color: #ff4757;
  text-align: center;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 2px;
}
.sabotage-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.sabotage-option {
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 71, 87, 0.3);
  background: rgba(255, 71, 87, 0.1);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}
.sabotage-option:hover {
  background: rgba(255, 71, 87, 0.2);
  border-color: rgba(255, 71, 87, 0.5);
}
.sabotage-option-name {
  font-weight: 700;
  font-size: 15px;
  color: #ff6b81;
}
.sabotage-option-desc {
  font-size: 12px;
  color: #5a6a8a;
  margin-top: 4px;
}

/* Kill Animation */
.kill-text {
  font-size: 60px;
  font-weight: 900;
  color: #ff4757;
  text-transform: uppercase;
  letter-spacing: 8px;
  animation: killFlash 0.5s;
  text-shadow: 0 0 40px rgba(255, 71, 87, 0.8);
}
@keyframes killFlash {
  0% { opacity: 0; transform: scale(3); }
  50% { opacity: 1; }
  100% { transform: scale(1); }
}

/* ─── Hat Selector ─── */
.hat-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.hat-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid rgba(100, 120, 180, 0.3);
  background: rgba(20, 25, 50, 0.8);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hat-btn:hover { border-color: rgba(255, 165, 2, 0.5); background: rgba(255, 165, 2, 0.1); }
.hat-btn.selected { border-color: #ffa502; background: rgba(255, 165, 2, 0.2); box-shadow: 0 0 10px rgba(255,165,2,0.3); }

/* ─── Mute Button ─── */
.mute-toggle {
  position: fixed;
  bottom: 15px;
  left: 15px;
  background: rgba(10, 15, 35, 0.8);
  border: 1px solid rgba(100, 120, 180, 0.3);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  color: #e8ecf4;
  z-index: 90;
}
.mute-toggle:hover { background: rgba(20, 30, 60, 0.9); }

/* ─── Camera Toggle ─── */
.camera-toggle {
  position: fixed;
  bottom: 15px;
  left: 60px;
  background: rgba(10, 15, 35, 0.8);
  border: 1px solid rgba(100, 120, 180, 0.3);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  color: #e8ecf4;
  z-index: 90;
}
.camera-toggle:hover { background: rgba(20, 30, 60, 0.9); }

/* ─── Camera Overlay ─── */
.camera-container {
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}
.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.camera-title {
  font-size: 18px;
  font-weight: 800;
  color: #ff4757;
  text-transform: uppercase;
  letter-spacing: 2px;
  animation: pulse-alert 1.5s infinite;
}
.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.camera-feed {
  position: relative;
  background: #111;
  border: 2px solid rgba(100, 120, 180, 0.3);
  border-radius: 8px;
  overflow: hidden;
}
.camera-feed canvas {
  width: 100%;
  height: auto;
  display: block;
}
.cam-label {
  position: absolute;
  bottom: 4px;
  left: 6px;
  font-size: 11px;
  color: #0f0;
  font-family: monospace;
  text-shadow: 0 0 4px #0f0;
}
.cam-static {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255,255,255,0.03) 2px,
    rgba(255,255,255,0.03) 4px
  );
  pointer-events: none;
  animation: cam-noise 0.1s infinite;
}
@keyframes cam-noise {
  0% { opacity: 0.5; }
  50% { opacity: 0.3; }
  100% { opacity: 0.5; }
}

/* ─── Task Modal Large ─── */
.task-modal-large {
  max-width: 70vw !important;
  min-height: 50vh;
  padding: 32px;
}
.task-modal-large .task-modal-body {
  min-height: 200px;
}
.task-modal-status {
  font-size: 14px;
  font-weight: 700;
  min-height: 24px;
  margin-bottom: 12px;
  text-align: center;
}
.task-modal-status.error { color: #ff4757; animation: shake 0.3s; }
.task-modal-status.success { color: #2ecc71; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.shake-anim { animation: shake 0.3s ease-in-out; }

/* Wire task canvas */
#task-canvas {
  border: 2px solid rgba(100, 120, 180, 0.3);
  border-radius: 12px;
  background: rgba(10, 15, 30, 0.9);
  margin-bottom: 12px;
  max-width: 100%;
}

/* Card swipe minigame */
.card-reader {
  width: 100%;
  max-width: 400px;
  height: 160px;
  background: linear-gradient(180deg, #2a2a3a, #1a1a2a);
  border: 2px solid rgba(100, 120, 180, 0.4);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  margin: 16px auto;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.5);
}
.card-slot {
  position: absolute;
  top: 50%;
  left: 10px;
  right: 10px;
  height: 8px;
  background: #333;
  transform: translateY(-50%);
  border-radius: 4px;
}
.card-swipe-card {
  position: absolute;
  width: 60px;
  height: 90px;
  background: linear-gradient(135deg, #4a90d9, #357abd);
  border: 2px solid #fff;
  border-radius: 8px;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  font-weight: 700;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.card-swipe-card:active { cursor: grabbing; }
.card-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  position: absolute;
  top: 10px;
  right: 10px;
  background: #555;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
}
.card-indicator.green { background: #2ecc71; box-shadow: 0 0 12px #2ecc71; }
.card-indicator.red { background: #ff4757; box-shadow: 0 0 12px #ff4757; }

/* Simon says grid */
.simon-grid {
  display: grid;
  grid-template-columns: repeat(3, 70px);
  gap: 8px;
  justify-content: center;
  margin: 16px auto;
}
.simon-btn {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.2);
  cursor: pointer;
  transition: all 0.15s;
  opacity: 0.5;
}
.simon-btn.lit { opacity: 1; box-shadow: 0 0 20px currentColor; transform: scale(1.08); }
.simon-btn:active { transform: scale(0.95); }

/* Download progress */
.download-bar {
  width: 100%;
  max-width: 350px;
  height: 24px;
  background: rgba(255,255,255,0.1);
  border-radius: 12px;
  overflow: hidden;
  margin: 16px auto;
  border: 1px solid rgba(100,120,180,0.3);
}
.download-fill {
  height: 100%;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  border-radius: 12px;
  transition: width 0.1s linear;
}
.download-text {
  font-size: 16px;
  font-weight: 700;
  color: #3498db;
  margin-top: 8px;
  font-family: monospace;
}

/* ─── Camera shake ─── */
@keyframes camera-shake {
  0%, 100% { transform: translate(0,0) rotate(0); }
  10% { transform: translate(-8px, 4px) rotate(-1deg); }
  20% { transform: translate(6px, -6px) rotate(1deg); }
  30% { transform: translate(-4px, 8px) rotate(0deg); }
  40% { transform: translate(8px, -4px) rotate(-1deg); }
  50% { transform: translate(-6px, 2px) rotate(1deg); }
  60% { transform: translate(4px, -8px) rotate(0deg); }
  70% { transform: translate(-8px, 6px) rotate(-1deg); }
  80% { transform: translate(6px, -2px) rotate(1deg); }
  90% { transform: translate(-2px, 4px) rotate(0deg); }
}
.camera-shaking {
  animation: camera-shake 0.5s ease-in-out;
}

/* ─── Feature 1: Admin Map ─── */
.admin-map-toggle {
  position: fixed;
  bottom: 15px;
  left: 105px;
  background: rgba(10, 15, 35, 0.8);
  border: 1px solid rgba(100, 120, 180, 0.3);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  color: #e8ecf4;
  z-index: 90;
}
.admin-map-toggle:hover { background: rgba(20, 30, 60, 0.9); }
.admin-map-container {
  width: 90%;
  max-width: 700px;
  padding: 20px;
}
.admin-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.admin-map-title {
  font-size: 18px;
  font-weight: 800;
  color: #3498db;
  text-transform: uppercase;
  letter-spacing: 2px;
}
#admin-map-canvas {
  width: 100%;
  max-height: 70vh;
  border: 2px solid rgba(100, 120, 180, 0.3);
  border-radius: 12px;
  background: rgba(10, 15, 30, 0.95);
}

/* ─── Feature 2: Ghost Chat ─── */
.ghost-chat-panel {
  position: absolute;
  bottom: 180px;
  left: 20px;
  width: 260px;
  background: rgba(10, 15, 35, 0.92);
  border: 1px solid rgba(155, 89, 182, 0.4);
  border-radius: 12px;
  overflow: hidden;
  z-index: 15;
}
.ghost-chat-header {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  color: #9b59b6;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(155, 89, 182, 0.2);
}
.ghost-chat-messages {
  max-height: 120px;
  overflow-y: auto;
  padding: 8px 12px;
}
.ghost-chat-msg {
  margin-bottom: 4px;
  font-size: 12px;
  color: #b794d0;
}
.ghost-chat-msg .chat-msg-name { color: #9b59b6; }
.ghost-chat-input-row {
  display: flex;
  gap: 4px;
  padding: 6px;
  border-top: 1px solid rgba(155, 89, 182, 0.1);
}
.ghost-chat-input {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
}

/* ─── Feature 4: Quick Reactions ─── */
.chat-quick-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(100, 120, 180, 0.1);
}
.quick-reaction-btn {
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(100, 120, 180, 0.3);
  background: rgba(30, 40, 70, 0.6);
  color: #8a9cc5;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.quick-reaction-btn:hover {
  background: rgba(52, 152, 219, 0.3);
  border-color: #3498db;
  color: #e8ecf4;
}
.quick-reaction-btn:active { transform: scale(0.95); }

/* ─── Feature 5: Emotes ─── */
.player-emote {
  position: absolute;
  font-size: 28px;
  pointer-events: none;
  z-index: 20;
  text-align: center;
  transform: translate(-50%, -100%);
  animation: emote-float 3s ease-out forwards;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
@keyframes emote-float {
  0% { opacity: 1; transform: translate(-50%, -100%) scale(0.5); }
  15% { opacity: 1; transform: translate(-50%, -100%) scale(1.2); }
  25% { opacity: 1; transform: translate(-50%, -100%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(0.8); }
}

/* ─── Feature 6: Weather HUD ─── */
.hud-weather {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  background: rgba(10, 15, 35, 0.8);
  border-radius: 8px;
  border: 1px solid rgba(100, 120, 180, 0.2);
  font-size: 14px;
  color: #8a9cc5;
  pointer-events: auto;
}

/* ─── Feature 8: Ihmert Facts ─── */
.role-ihmert-fact {
  font-size: 13px;
  color: #5a6a8a;
  margin-top: 24px;
  max-width: 400px;
  font-style: italic;
  min-height: 20px;
}

/* ─── Feature 9: Statistics ─── */
.stats-panel {
  background: rgba(20, 25, 50, 0.85);
  border: 1px solid rgba(100, 120, 180, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
  width: 100%;
}
.stats-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #8a9cc5;
  padding: 4px 0;
}
.stat-value {
  font-weight: 700;
  color: #e8ecf4;
}

/* ─── Feature 10: Round Score ─── */
.hud-round-score {
  position: absolute;
  top: 48px;
  left: 12px;
  padding: 6px 14px;
  background: rgba(10, 15, 35, 0.8);
  border-radius: 8px;
  border: 1px solid rgba(100, 120, 180, 0.2);
  font-size: 12px;
  color: #8a9cc5;
}
.gameover-round-info {
  font-size: 16px;
  font-weight: 700;
  color: #ffa502;
  margin-bottom: 12px;
  letter-spacing: 2px;
}
.gameover-match-result {
  font-size: 22px;
  font-weight: 900;
  margin-top: 16px;
  margin-bottom: 16px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ─── Feature 3: Emergency Cooldown styling ─── */
.emergency-cooldown-label {
  font-size: 10px;
  color: #ff4757;
  text-align: center;
  margin-top: 2px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100, 120, 180, 0.3); border-radius: 3px; }

/* ─── Responsive: Mobile ─── */
@media (max-width: 768px) {
  /* Menu screen */
  .menu-container { padding: 15px; width: 95%; }
  .logo-text { font-size: 36px !important; }
  .logo-sub { font-size: 48px !important; }
  .logo-tagline { font-size: 11px; }
  .input { font-size: 16px !important; } /* Prevents iOS zoom on focus */
  .btn { font-size: 14px; padding: 12px 20px; }
  .menu-card { padding: 20px 16px; }

  /* Lobby */
  .lobby-container { padding: 10px; width: 95%; }
  .lobby-panel { max-width: 320px; max-height: 70vh; padding: 12px; }
  .lobby-overlay.active { padding: 10px; }
  .settings-panel { font-size: 13px; }
  .hat-options { flex-wrap: wrap; }
  .hat-btn { width: 40px; height: 40px; font-size: 20px; }
  .code-value { font-size: 22px; letter-spacing: 4px; }
  .players-list { max-height: 200px; }

  /* HUD */
  #hud-top { flex-wrap: wrap; gap: 4px; }
  .hud-badge { font-size: 10px; padding: 3px 8px; }
  .hud-location { font-size: 11px; padding: 4px 8px; }
  #hud-taskbar { max-width: 200px; padding: 6px 10px; }
  .taskbar-label { font-size: 10px; }
  .taskbar-bg { width: 70px; }
  #taskbar-pct { font-size: 10px; }
  .hud-round-score { font-size: 10px; top: 42px; }

  /* Action buttons - make them bigger for touch */
  #hud-actions {
    flex-direction: column;
    gap: 8px;
    bottom: 20px;
    right: 10px;
  }
  .action-btn {
    min-width: 70px;
    min-height: 50px;
    font-size: 12px;
    padding: 8px 12px;
    touch-action: manipulation;
  }
  .action-icon { font-size: 18px; }
  .action-label { font-size: 10px; }

  /* Voice controls */
  #voice-controls {
    bottom: 20px;
    left: 10px;
    flex-direction: column;
  }

  /* Joystick zone - cover left half of screen */
  #joystick-zone {
    width: 50%;
    height: 100%;
    top: 0;
  }

  /* Task modal */
  .task-modal-content {
    width: 90vw !important;
    max-width: 90vw !important;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
  }
  .task-modal-large {
    max-width: 95vw !important;
    min-height: auto;
    padding: 20px;
  }
  #task-canvas { max-width: 100%; height: auto; }
  .simon-grid { grid-template-columns: repeat(3, 60px); gap: 6px; }
  .simon-btn { width: 60px; height: 60px; }
  .card-reader { height: 130px; }

  /* Meeting overlay */
  .meeting-container {
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 12px;
  }
  .meeting-players { grid-template-columns: 1fr; gap: 6px; }
  .meeting-player {
    padding: 12px 14px;
    font-size: 14px;
    min-height: 48px;
  }
  .meeting-title { font-size: 16px; }
  .meeting-timer { font-size: 28px; }
  .skip-vote {
    padding: 14px;
    font-size: 15px;
    min-height: 48px;
  }
  .chat-input {
    font-size: 16px !important; /* Prevent iOS zoom */
    padding: 10px 12px;
  }
  .chat-messages { max-height: 120px; }

  /* Quick reactions - scrollable */
  .chat-quick-reactions {
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
  }
  .quick-reaction-btn {
    font-size: 11px;
    padding: 6px 10px;
    touch-action: manipulation;
  }

  /* Minimap - smaller on mobile (rendered on canvas) */

  /* Stats panel */
  .stats-panel { font-size: 12px; padding: 12px; }
  .stats-content { gap: 4px; }
  .stat-item { font-size: 11px; }

  /* Game over */
  .gameover-content { width: 90%; max-height: 85vh; overflow-y: auto; padding: 16px; }
  .gameover-title { font-size: 28px; letter-spacing: 2px; }
  .gameover-subtitle { font-size: 14px; }
  .gameover-players { grid-template-columns: 1fr; gap: 6px; }

  /* Sabotage menu */
  .sabotage-menu-content { width: 90%; padding: 20px; }
  .sabotage-option { padding: 12px; font-size: 13px; touch-action: manipulation; }
  .sabotage-menu-title { font-size: 16px; }

  /* Camera overlay */
  .camera-container { width: 95%; padding: 12px; }
  .camera-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .camera-title { font-size: 14px; }

  /* Admin map */
  .admin-map-container { width: 95%; padding: 12px; }
  #admin-map-canvas { max-height: 60vh; }

  /* Utility buttons */
  .mute-toggle { left: 10px; bottom: auto; top: auto; }
  .camera-toggle { left: 10px; }
  .admin-map-toggle { left: 10px; }
  .tasks-toggle { top: 46px; right: 8px; padding: 6px 10px; font-size: 16px; }
  .task-list { width: 200px; right: 8px; top: 80px; }
  .task-item { font-size: 12px; }

  /* Ghost chat panel */
  .ghost-chat-panel { width: 200px; bottom: 140px; left: 10px; }
  .ghost-chat-input { font-size: 16px !important; } /* Prevent iOS zoom */

  /* Weather HUD */
  .hud-weather { font-size: 12px; padding: 4px 10px; }

  /* Role reveal */
  .role-text { font-size: 32px; letter-spacing: 2px; }
  .role-icon { font-size: 60px; }
  .role-subtitle { font-size: 14px; }
  .role-ihmert-fact { font-size: 11px; max-width: 300px; }

  /* Vote result */
  .vote-result-text { font-size: 18px; }
  .vote-result-role { font-size: 14px; }

  /* Kill animation */
  .kill-text { font-size: 40px; letter-spacing: 4px; }

  /* Sabotage alert */
  .sabotage-alert { font-size: 13px; padding: 8px 16px; top: 44px; }

  /* All interactive elements - prevent double-tap zoom */
  button, .action-btn, .meeting-player, .skip-vote, .sabotage-option, .hat-btn, .quick-reaction-btn {
    touch-action: manipulation;
  }
}

/* Extra small screens */
@media (max-width: 400px) {
  .logo-text { font-size: 28px !important; }
  .logo-sub { font-size: 40px !important; }
  .action-btn { min-width: 60px; min-height: 45px; }
  .task-modal-content { width: 95vw !important; }
  .meeting-player { padding: 10px 12px; font-size: 13px; }
  .meeting-container { padding: 8px; }
  .chat-quick-reactions { gap: 3px; }
  .quick-reaction-btn { font-size: 10px; padding: 4px 8px; }
}
