* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0a0a12; font-family: 'Press Start 2P', monospace; }
#game-wrapper { position: relative; width: 100vw; height: calc(100vh - 28px); }
#canvas { display: block; width: 100%; height: 100%; }
#ui-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
#ui-overlay > * { pointer-events: auto; }
#footer-bar { height: 28px; background: #111; display: flex; align-items: center; justify-content: center; }
#footer-bar a { color: #666; font-size: 10px; text-decoration: none; font-family: monospace; }
#footer-bar a:hover { color: #c44; }

.start-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; background: radial-gradient(ellipse at center, #0d1030 0%, #050510 70%); z-index: 100; overflow-y: auto; padding: 20px 10px 40px; }
.start-title { font-family: 'Bungee Shade', cursive; font-size: clamp(24px, 5vw, 56px); color: #fff; text-shadow: 3px 3px 0 #c0392b, 6px 6px 0 #2c0a08; transform: rotate(-2deg); margin-bottom: 10px; text-align: center; line-height: 1.2; }
.start-subtitle { font-family: 'Bungee', cursive; font-size: clamp(10px, 2vw, 18px); color: #c0392b; margin-bottom: 20px; letter-spacing: 4px; }
.color-picker { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; max-width: 300px; }
.color-swatch { width: 36px; height: 36px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: all 0.2s; }
.color-swatch:hover, .color-swatch.selected { border-color: #fff; transform: scale(1.2); box-shadow: 0 0 12px rgba(255,255,255,0.4); }
.name-input { background: #1a1a2e; border: 2px solid #333; color: #fff; padding: 10px 16px; font-family: 'Press Start 2P', monospace; font-size: 12px; border-radius: 6px; width: 220px; text-align: center; margin: 10px 0; outline: none; }
.name-input:focus { border-color: #c0392b; }
.difficulty-row { display: flex; gap: 8px; margin: 10px 0; }
.diff-btn { background: #1a1a2e; border: 2px solid #333; color: #888; padding: 8px 14px; font-family: 'Press Start 2P', monospace; font-size: 9px; border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.diff-btn:hover { border-color: #666; color: #ccc; }
.diff-btn.selected { border-color: #c0392b; color: #fff; background: #2a1020; }
.start-btn { background: #c0392b; color: #fff; border: none; padding: 16px 40px; font-family: 'Bungee', cursive; font-size: clamp(14px, 2.5vw, 22px); border-radius: 8px; cursor: pointer; margin-top: 15px; transition: all 0.15s; box-shadow: 0 4px 0 #7b241c, 0 6px 20px rgba(192,57,43,0.3); }
.start-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #7b241c, 0 8px 24px rgba(192,57,43,0.4); }
.start-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #7b241c; }
.start-hint { color: #555; font-size: 8px; margin-top: 10px; }

.section-label { color: #888; font-size: 9px; margin: 12px 0 6px; letter-spacing: 3px; text-align: center; }

/* Map Selector */
.map-selector { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; max-width: 600px; }
.map-card { background: #1a1a2e; border: 2px solid #333; border-radius: 8px; padding: 10px 16px; cursor: pointer; transition: all 0.2s; text-align: center; min-width: 120px; }
.map-card:hover { border-color: #666; }
.map-card.selected { border-color: #c0392b; background: #2a1020; }
.map-card-name { font-family: 'Bungee', cursive; color: #fff; font-size: 11px; margin-bottom: 4px; }
.map-card-desc { color: #666; font-size: 7px; }

/* Role Selector */
.role-selector { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 650px; }
.role-card { background: #1a1a2e; border: 2px solid #333; border-radius: 8px; padding: 8px 12px; cursor: pointer; transition: all 0.2s; text-align: center; min-width: 100px; max-width: 130px; }
.role-card:hover { border-color: #666; }
.role-card.selected { background: #1a1520; }
.role-card-icon { font-size: 20px; margin-bottom: 4px; }
.role-card-name { font-family: 'Bungee', cursive; font-size: 9px; margin-bottom: 3px; }
.role-card-desc { color: #666; font-size: 6px; line-height: 1.4; }

/* Role Badge */
.role-badge { position: absolute; top: 36px; right: 10px; background: rgba(0,0,0,0.7); border: 2px solid #555; border-radius: 6px; padding: 4px 10px; font-size: 8px; }

/* Map Badge */
.map-badge { position: absolute; top: 36px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.5); color: #666; font-size: 7px; padding: 3px 8px; border-radius: 3px; }

/* Role Reveal */
.role-reveal { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.85); z-index: 90; animation: fadeIn 0.5s; }
.role-reveal-text { text-align: center; }
.role-icon { font-size: 48px; margin-bottom: 10px; }
.role-name { font-family: 'Bungee Shade', cursive; font-size: clamp(20px, 4vw, 40px); margin-bottom: 10px; }
.role-desc { font-size: 10px; color: #888; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Music Controls */
.music-controls { position: absolute; top: 8px; right: 10px; background: rgba(0,0,0,0.5); border-radius: 4px; padding: 4px 6px; cursor: pointer; }
.music-icon { font-size: 16px; }

/* Kill and ability buttons */
.action-btn.kill-btn { background: rgba(192,57,43,0.8); border-color: #c0392b; color: #fff; }
.action-btn.kill-btn.active { background: rgba(231,76,60,0.9); animation: pulse-red 1s infinite; }
.action-btn.sab-btn { background: rgba(60,30,30,0.8); border-color: #833; color: #c88; }
.action-btn.sab-btn.active { background: rgba(180,60,60,0.8); border-color: #c44; color: #fff; }
.action-btn.vent-btn { background: rgba(30,60,30,0.8); border-color: #363; color: #8c8; }
.action-btn.vent-btn.active { background: rgba(60,180,60,0.8); border-color: #4e4; color: #fff; animation: pulse-green 1s infinite; }

.hud-tasks { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,0.7); border: 1px solid #333; border-radius: 6px; padding: 8px 12px; color: #ccc; font-size: 8px; max-width: 220px; }
.hud-tasks h3 { color: #fff; font-size: 9px; margin-bottom: 6px; }
.task-item { padding: 2px 0; color: #888; }
.task-item.completed { color: #2ecc71; text-decoration: line-through; }
.task-item.active { color: #f1c40f; }

.taskbar-container { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 300px; max-width: 60%; }
.taskbar-bg { background: rgba(0,0,0,0.6); border-radius: 0 0 8px 8px; padding: 6px 10px; }
.taskbar-fill { height: 8px; background: #333; border-radius: 4px; overflow: hidden; }
.taskbar-fill-inner { height: 100%; background: linear-gradient(90deg, #27ae60, #2ecc71); transition: width 0.5s; border-radius: 4px; }
.taskbar-label { color: #888; font-size: 7px; text-align: center; margin-top: 2px; }

.action-buttons { position: absolute; bottom: 20px; right: 20px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; max-width: 320px; }
.action-btn { width: 60px; height: 60px; border-radius: 50%; border: 3px solid #333; font-family: 'Press Start 2P', monospace; font-size: 7px; cursor: pointer; display: flex; align-items: center; justify-content: center; text-align: center; color: #888; transition: all 0.2s; }
.action-btn.use-btn { background: rgba(30,60,30,0.8); }
.action-btn.use-btn.active { background: rgba(46,204,113,0.8); border-color: #2ecc71; color: #fff; animation: pulse-green 1s infinite; }
.action-btn.report-btn { background: rgba(60,20,20,0.8); }
.action-btn.report-btn.active { background: rgba(231,76,60,0.8); border-color: #e74c3c; color: #fff; animation: pulse-red 1s infinite; }
.action-btn.meeting-btn { background: rgba(60,60,20,0.8); }
.action-btn.meeting-btn.active { background: rgba(241,196,15,0.8); border-color: #f1c40f; color: #fff; }

@keyframes pulse-green { 0%,100% { box-shadow: 0 0 10px rgba(46,204,113,0.3); } 50% { box-shadow: 0 0 20px rgba(46,204,113,0.6); } }
@keyframes pulse-red { 0%,100% { box-shadow: 0 0 10px rgba(231,76,60,0.3); } 50% { box-shadow: 0 0 20px rgba(231,76,60,0.6); } }

.minimap-container { position: absolute; bottom: 20px; left: 10px; background: rgba(0,0,0,0.7); border: 1px solid #333; border-radius: 6px; overflow: hidden; }

.meeting-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; z-index: 50; overflow-y: auto; padding: 20px; }
.meeting-title { font-family: 'Bungee', cursive; color: #fff; font-size: clamp(16px, 3vw, 28px); margin: 10px 0; }
.meeting-who { color: #f1c40f; font-size: 10px; margin-bottom: 10px; }
.meeting-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 600px; margin: 10px 0; }
.meeting-player { background: #1a1a2e; border: 2px solid #333; border-radius: 8px; padding: 10px; text-align: center; width: 110px; cursor: pointer; transition: all 0.2s; }
.meeting-player:hover { border-color: #c0392b; }
.meeting-player.dead { opacity: 0.4; pointer-events: none; }
.meeting-player.voted { border-color: #f1c40f; }
.meeting-player .mp-name { color: #ccc; font-size: 7px; margin-top: 4px; }
.meeting-player .mp-bean { width: 40px; height: 50px; margin: 0 auto; }
.chat-log { background: #111; border: 1px solid #333; border-radius: 6px; max-width: 500px; width: 90%; max-height: 150px; overflow-y: auto; padding: 8px; margin: 10px 0; }
.chat-msg { color: #aaa; font-size: 8px; padding: 3px 0; border-bottom: 1px solid #1a1a2e; }
.chat-msg .chat-name { font-weight: bold; }
.skip-btn { background: #333; color: #aaa; border: 2px solid #555; padding: 10px 24px; font-family: 'Press Start 2P', monospace; font-size: 9px; border-radius: 6px; cursor: pointer; margin-top: 10px; }
.skip-btn:hover { background: #444; color: #fff; }
.vote-timer { color: #e74c3c; font-size: 10px; margin: 8px 0; }

.eject-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 60; }
.eject-text { font-family: 'Bungee', cursive; color: #fff; font-size: clamp(14px, 3vw, 24px); text-align: center; margin: 10px 0; opacity: 0; animation: fadeInUp 1s forwards; }
.eject-text.line2 { animation-delay: 2s; color: #c0392b; }
.eject-text.not-imp { color: #e74c3c; }
.eject-text.was-imp { color: #2ecc71; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.task-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); background: #1a1a2e; border: 2px solid #555; border-radius: 12px; padding: 20px; z-index: 40; min-width: 280px; max-width: 90vw; }
.task-overlay h3 { font-family: 'Bungee', cursive; color: #fff; font-size: 14px; text-align: center; margin-bottom: 12px; }
.task-close { position: absolute; top: 8px; right: 12px; color: #888; font-size: 16px; cursor: pointer; background: none; border: none; font-family: monospace; }
.task-close:hover { color: #fff; }

.wire-panel { display: flex; justify-content: space-between; gap: 20px; }
.wire-col { display: flex; flex-direction: column; gap: 12px; }
.wire-end { width: 40px; height: 20px; border-radius: 4px; cursor: pointer; border: 2px solid transparent; transition: all 0.15s; }
.wire-end:hover, .wire-end.selected { border-color: #fff; transform: scale(1.1); }
.wire-end.connected { opacity: 0.5; }

.swipe-area { height: 60px; background: #333; border-radius: 8px; position: relative; overflow: hidden; margin: 10px 0; }
.swipe-card { position: absolute; top: 5px; left: 10px; width: 60px; height: 50px; background: #3498db; border-radius: 4px; cursor: grab; display: flex; align-items: center; justify-content: center; font-size: 7px; color: #fff; }
.swipe-slot { position: absolute; right: 10px; top: 10px; width: 8px; height: 40px; background: #555; border-radius: 2px; }
.swipe-status { text-align: center; color: #888; font-size: 8px; margin-top: 6px; }

.asteroids-area { width: 250px; height: 180px; background: #111; border-radius: 8px; position: relative; overflow: hidden; margin: 0 auto; cursor: crosshair; }
.asteroid { position: absolute; width: 20px; height: 20px; background: #888; border-radius: 50%; }

.progress-task { text-align: center; }
.progress-bar { width: 200px; height: 20px; background: #333; border-radius: 10px; overflow: hidden; margin: 10px auto; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #3498db, #2ecc71); transition: width 0.1s; }
.progress-label { color: #888; font-size: 8px; }

.simon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 180px; margin: 0 auto; }
.simon-btn { height: 60px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; opacity: 0.6; transition: all 0.15s; }
.simon-btn.lit { opacity: 1; border-color: #fff; transform: scale(1.05); }

.sabotage-banner { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); background: rgba(192,57,43,0.9); color: #fff; font-family: 'Bungee', cursive; font-size: clamp(10px, 2vw, 16px); padding: 8px 24px; border-radius: 6px; z-index: 30; animation: flash-banner 0.5s infinite alternate; white-space: nowrap; }
@keyframes flash-banner { from { opacity: 0.7; } to { opacity: 1; } }
.sabotage-timer { font-size: clamp(14px, 3vw, 24px); }

.death-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 70; }
.death-title { font-family: 'Bungee Shade', cursive; color: #c0392b; font-size: clamp(20px, 5vw, 48px); margin-bottom: 20px; }
.death-sub { color: #888; font-size: 10px; margin-bottom: 20px; }
.ghost-btn, .restart-btn { background: #1a1a2e; color: #ccc; border: 2px solid #444; padding: 12px 24px; font-family: 'Press Start 2P', monospace; font-size: 10px; border-radius: 6px; cursor: pointer; margin: 5px; }
.ghost-btn:hover, .restart-btn:hover { border-color: #888; color: #fff; }

.victory-screen, .defeat-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 80; }
.victory-screen { background: radial-gradient(ellipse, #0a2040, #050510); }
.defeat-screen { background: radial-gradient(ellipse, #200a0a, #050510); }
.end-title { font-family: 'Bungee Shade', cursive; font-size: clamp(28px, 6vw, 64px); margin-bottom: 10px; }
.victory-screen .end-title { color: #3498db; text-shadow: 0 0 30px rgba(52,152,219,0.5); }
.defeat-screen .end-title { color: #c0392b; text-shadow: 0 0 30px rgba(192,57,43,0.5); }
.end-sub { color: #888; font-size: 10px; margin-bottom: 15px; }
.end-stats { color: #888; font-size: 9px; text-align: center; line-height: 2; margin-bottom: 20px; }
.play-again-btn { background: #c0392b; color: #fff; border: none; padding: 14px 32px; font-family: 'Bungee', cursive; font-size: 16px; border-radius: 8px; cursor: pointer; box-shadow: 0 4px 0 #7b241c; }
.play-again-btn:hover { transform: translateY(-2px); }

.mobile-joystick { position: absolute; bottom: 100px; left: 30px; width: 100px; height: 100px; border-radius: 50%; background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.15); display: none; z-index: 20; }
.joystick-knob { position: absolute; top: 50%; left: 50%; width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.25); transform: translate(-50%,-50%); }

@media (max-width: 768px) {
  .mobile-joystick { display: block; }
  .hud-tasks { font-size: 7px; max-width: 160px; padding: 6px 8px; }
  .action-btn { width: 50px; height: 50px; font-size: 6px; }
  .minimap-container { width: 80px !important; height: 60px !important; }
  .map-selector { gap: 6px; }
  .map-card { min-width: 90px; padding: 6px 10px; }
  .role-selector { gap: 5px; }
  .role-card { min-width: 80px; padding: 5px 8px; }
}