* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: #000;
  color: #fff;
  font-family: "Arial Hebrew", "Heebo", "Trebuchet MS", "Arial Black", sans-serif;
  overflow: hidden;
  height: 100%;
  user-select: none;
}

#game-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #0a0e2a 0%, #000 80%);
}

#game {
  background: #08081a;
  max-width: 100%;
  max-height: 100%;
  image-rendering: pixelated;
  border: 2px solid #1a1f3a;
  box-shadow: 0 0 60px rgba(80, 120, 255, 0.15);
}

/* HUD */
#hud {
  position: absolute;
  top: 14px;
  left: 14px;
  pointer-events: none;
}
#task-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
#task-bar-label {
  font-size: 14px;
  letter-spacing: 2px;
  color: #cfd8ff;
  text-shadow: 0 0 5px #2233aa;
}
#task-bar {
  width: 240px;
  height: 18px;
  background: #1a1f3a;
  border: 2px solid #4a5a90;
  border-radius: 3px;
  overflow: hidden;
}
#task-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #44ff88, #88ffaa);
  transition: width 250ms ease;
}
#task-list {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #b0c0ff;
  text-shadow: 1px 1px 0 #000;
  max-width: 280px;
}
#task-list .done {
  color: #66ff99;
  text-decoration: line-through;
  opacity: 0.7;
}

/* Interact prompt */
#interact-prompt {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #ffd34a;
  color: #ffe680;
  padding: 8px 18px;
  font-size: 18px;
  letter-spacing: 1.5px;
  border-radius: 6px;
  box-shadow: 0 0 18px rgba(255, 211, 74, 0.6);
}
#interact-prompt .key {
  display: inline-block;
  background: #ffd34a;
  color: #221100;
  padding: 2px 9px;
  border-radius: 4px;
  margin-right: 6px;
  font-weight: bold;
}

.hidden { display: none !important; }

/* Top-right buttons */
#map-btn, #install-btn {
  position: absolute;
  top: 14px;
  background: #1a1f3a;
  color: #cfd8ff;
  border: 2px solid #4a5a90;
  padding: 8px 16px;
  font-size: 14px;
  letter-spacing: 2px;
  cursor: pointer;
  font-family: inherit;
  border-radius: 4px;
}
#map-btn { right: 14px; }
#install-btn { right: 100px; background: #1c3b2c; border-color: #4a9a6a; color: #aaffcc; }
#map-btn:hover     { background: #2a3050; }
#install-btn:hover { background: #2c5b3c; }
[dir="rtl"] #map-btn     { right: auto; left: 14px; }
[dir="rtl"] #install-btn { right: auto; left: 100px; }

/* Map overlay */
#map-overlay, #task-overlay, #title-screen, #win-screen, #lang-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  z-index: 30;
}
#lang-screen { z-index: 40; }
#lang-inner {
  background: #0e1230;
  border: 3px solid #4a5a90;
  border-radius: 12px;
  padding: 36px 60px;
  text-align: center;
  box-shadow: 0 0 50px rgba(80, 120, 255, 0.3);
}
.lang-title {
  font-size: 22px;
  letter-spacing: 2px;
  color: #cfd8ff;
  margin: 0 0 26px;
  text-shadow: 0 0 8px #2233aa;
}
.lang-buttons {
  display: flex;
  gap: 18px;
  justify-content: center;
}
.lang-btn {
  background: #ffd34a;
  color: #221100;
  border: none;
  padding: 14px 36px;
  font-size: 22px;
  letter-spacing: 2px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  border-radius: 8px;
  box-shadow: 0 5px 0 #b08020;
  min-width: 160px;
}
.lang-btn:hover { background: #ffe680; transform: translateY(-2px); }

.change-lang {
  display: block;
  margin: 14px auto 0;
  background: transparent;
  border: 1px solid #4a5a90;
  color: #8090c0;
  padding: 4px 14px;
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  border-radius: 4px;
}
.change-lang:hover { background: #1a1f3a; color: #cfd8ff; }
#map-panel, #task-panel, #title-inner, #win-inner {
  background: #0e1230;
  border: 3px solid #4a5a90;
  border-radius: 10px;
  padding: 20px 26px;
  box-shadow: 0 0 40px rgba(80, 120, 255, 0.25);
  text-align: center;
}
.panel-title {
  font-size: 22px;
  letter-spacing: 4px;
  color: #cfd8ff;
  margin-bottom: 12px;
  text-shadow: 0 0 8px #2233aa;
}
#minimap {
  display: block;
  background: #000;
  border: 2px solid #2a3050;
  border-radius: 6px;
}
#map-close, #task-close, #start-btn, #win-restart {
  margin-top: 14px;
  background: #ffd34a;
  color: #221100;
  border: none;
  padding: 10px 28px;
  font-size: 16px;
  letter-spacing: 2px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  border-radius: 6px;
  box-shadow: 0 4px 0 #b08020;
}
#map-close:hover, #task-close:hover, #start-btn:hover, #win-restart:hover {
  background: #ffe680;
}

/* Title */
#title-inner {
  padding: 40px 60px;
  min-width: 460px;
}
.logo {
  font-size: 78px;
  margin: 0;
  letter-spacing: 6px;
  color: #ff3d3d;
  text-shadow:
    -3px -3px 0 #5a0000,
    3px  3px 0 #5a0000,
    0 0 30px #ff3d3d;
}
.logo .us { color: #ffd34a; text-shadow:
    -3px -3px 0 #5a3a00,
    3px  3px 0 #5a3a00,
    0 0 30px #ffd34a;
}
.tagline {
  font-size: 16px;
  letter-spacing: 8px;
  color: #cfd8ff;
  margin-bottom: 24px;
}
#color-pick { margin: 14px 0; }
.color-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; max-width: 360px; margin: 0 auto; }
.color-swatch {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid #2a3050;
  cursor: pointer;
  transition: transform 100ms;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { border-color: #fff; box-shadow: 0 0 12px #fff; }
.hint, .controls-hint {
  font-size: 12px;
  color: #8090c0;
  letter-spacing: 1px;
  margin-top: 8px;
}
.controls-hint { margin-top: 18px; }
.namefield {
  display: block;
  font-size: 12px;
  letter-spacing: 2px;
  color: #cfd8ff;
  margin: 18px 0 8px;
}
.namefield input {
  display: block;
  margin: 6px auto 0;
  background: #1a1f3a;
  color: #fff;
  border: 2px solid #4a5a90;
  padding: 8px 12px;
  font-size: 18px;
  font-family: inherit;
  text-align: center;
  border-radius: 4px;
  width: 200px;
  letter-spacing: 2px;
}

/* Task panel */
#task-panel { min-width: 480px; min-height: 320px; }
#task-content {
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Task: wires */
.wires {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  width: 460px;
  height: 280px;
  position: relative;
  background: #0a0e22;
  border: 3px solid #2a3050;
  border-radius: 6px;
  padding: 18px 24px;
  overflow: hidden;
}
.wires .wires-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.wires .wire-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
.wires .wpreview { visibility: hidden; }
.wire-col {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  z-index: 2;
  width: 44px;
}
.wire-node {
  width: 44px; height: 44px;
  border: 3px solid #2a3050;
  background: #1a1f3a;
  cursor: pointer;
  position: relative;
  border-radius: 4px;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.5);
}
.wire-node.left::after {
  content: "";
  position: absolute;
  right: -22px;
  top: 50%;
  width: 22px;
  height: 8px;
  transform: translateY(-50%);
  background: var(--c);
  border-radius: 2px;
}
.wire-node.right::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 50%;
  width: 22px;
  height: 8px;
  transform: translateY(-50%);
  background: var(--c);
  border-radius: 2px;
}

/* Task: swipe card */
.swipe-wrap { width: 420px; height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.swipe-slot {
  width: 360px; height: 70px;
  background: #1a1f3a;
  border: 3px solid #4a5a90;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}
.swipe-card {
  position: absolute;
  left: 10px; top: 8px;
  width: 90px; height: 54px;
  background: linear-gradient(135deg, #ffd34a, #ffaa22);
  border-radius: 4px;
  cursor: grab;
  box-shadow: 0 2px 6px #000, inset 0 0 0 2px rgba(255,255,255,0.3);
}
.swipe-card::after {
  content: "";
  position: absolute;
  left: 8px; top: 16px;
  width: 30px; height: 4px;
  background: rgba(255,255,255,0.5);
  border-radius: 2px;
  box-shadow: 0 8px 0 rgba(255,255,255,0.4);
}
.swipe-msg { margin-top: 16px; font-size: 14px; color: #cfd8ff; letter-spacing: 1px; }

/* Task: download */
.download-wrap { width: 420px; height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.download-bar { width: 360px; height: 26px; background: #1a1f3a; border: 2px solid #4a5a90; border-radius: 3px; overflow: hidden; }
.download-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #44aaff, #88ddff); transition: width 100ms linear; }
.download-text { margin-top: 14px; color: #cfd8ff; font-size: 14px; letter-spacing: 2px; }

/* Task: asteroids */
.asteroids-wrap { width: 460px; height: 280px; background: #000; border: 2px solid #4a5a90; position: relative; overflow: hidden; cursor: crosshair; }
.asteroid { position: absolute; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #888, #333); }
.asteroids-count { position: absolute; top: 6px; left: 8px; color: #ffd34a; font-size: 14px; letter-spacing: 1px; }

/* Task: numbers */
.numbers-wrap { width: 320px; height: 320px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 8px; }
.num-cell {
  background: #1a1f3a;
  border: 3px solid #4a5a90;
  color: #cfd8ff;
  font-size: 32px;
  font-family: inherit;
  cursor: pointer;
  border-radius: 4px;
}
.num-cell:hover { background: #2a3050; }
.num-cell.done { background: #1a3a1a; border-color: #4a9a4a; color: #88ff88; cursor: default; }

/* Win screen */
#win-inner { padding: 40px 60px; }
#win-text {
  font-size: 56px;
  letter-spacing: 6px;
  margin: 0 0 12px;
  color: #66ff99;
  text-shadow: 0 0 24px #66ff99;
}
#win-text.lose { color: #ff5555; text-shadow: 0 0 24px #ff5555; }
#win-sub {
  font-size: 16px;
  color: #cfd8ff;
  letter-spacing: 2px;
  margin: 0 0 16px;
  min-height: 20px;
}

/* Lobby screen */
#lobby-screen {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}
#lobby-settings {
  position: absolute;
  top: 50%;
  right: 24px;
  transform: translateY(-50%);
  width: 260px;
  background: rgba(14, 18, 48, 0.92);
  border: 3px solid #4a5a90;
  border-radius: 12px;
  padding: 22px 20px;
  box-shadow: 0 0 40px rgba(80, 120, 255, 0.3);
  pointer-events: auto;
  z-index: 26;
}
[dir="rtl"] #lobby-settings {
  right: auto;
  left: 24px;
}
.lobby-settings-title {
  font-size: 20px;
  letter-spacing: 4px;
  color: #cfd8ff;
  text-align: center;
  margin: 0 0 18px;
  text-shadow: 0 0 8px #2233aa;
}
.lobby-field {
  margin-bottom: 16px;
}
.lobby-field > label {
  display: block;
  font-size: 12px;
  letter-spacing: 2px;
  color: #8090c0;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.lobby-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lobby-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: #1a1f3a;
  border: 1px solid #4a5a90;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.lobby-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: #ffd34a;
  border-radius: 50%;
  border: 2px solid #b08020;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.lobby-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #ffd34a;
  border-radius: 50%;
  border: 2px solid #b08020;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.lobby-val {
  font-size: 14px;
  color: #ffd34a;
  font-weight: bold;
  min-width: 40px;
  text-align: center;
  letter-spacing: 1px;
}
.lobby-radios {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.lobby-radios label {
  font-size: 13px;
  color: #cfd8ff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 1px;
}
.lobby-radios input[type="radio"] {
  accent-color: #ffd34a;
  cursor: pointer;
}
#lobby-start-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  background: #ffd34a;
  color: #221100;
  border: none;
  padding: 12px 0;
  font-size: 18px;
  letter-spacing: 3px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  border-radius: 6px;
  box-shadow: 0 5px 0 #b08020;
}
#lobby-start-btn:hover {
  background: #ffe680;
  transform: translateY(-2px);
}

/* Role reveal screen */
#role-screen {
  background: rgba(0,0,0,0.92);
}
#role-inner {
  background: #0e1230;
  border: 3px solid #4a5a90;
  border-radius: 12px;
  padding: 50px 80px;
  text-align: center;
  box-shadow: 0 0 60px rgba(80, 120, 255, 0.3);
}
#role-label {
  font-size: 72px;
  letter-spacing: 8px;
  margin: 0 0 18px;
  font-weight: bold;
}
#role-label.crewmate {
  color: #66ddff;
  text-shadow: 0 0 30px #66ddff, 0 0 12px #fff;
}
#role-label.impostor {
  color: #ff3333;
  text-shadow: 0 0 30px #ff3333, 0 0 12px #ff8888;
  animation: imp-pulse 1.2s infinite ease-in-out;
}
@keyframes imp-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
#role-desc {
  font-size: 18px;
  color: #cfd8ff;
  letter-spacing: 2px;
  margin: 0 0 26px;
  max-width: 460px;
}
#role-continue {
  background: #ffd34a;
  color: #221100;
  border: none;
  padding: 12px 36px;
  font-size: 18px;
  letter-spacing: 2px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  border-radius: 6px;
  box-shadow: 0 5px 0 #b08020;
}
#role-continue:hover { background: #ffe680; }

/* Impostor HUD */
#impostor-hud {
  position: absolute;
  bottom: 14px;
  left: 14px;
  background: rgba(20, 0, 0, 0.7);
  border: 2px solid #ff3333;
  border-radius: 8px;
  padding: 10px 18px;
  color: #ffaaaa;
  font-size: 13px;
  letter-spacing: 1px;
  box-shadow: 0 0 20px rgba(255, 51, 51, 0.3);
  pointer-events: none;
}
[dir="rtl"] #impostor-hud { left: auto; right: 14px; }
.imp-title {
  font-size: 18px;
  font-weight: bold;
  color: #ff3333;
  letter-spacing: 3px;
  text-shadow: 0 0 8px #ff3333;
}
.imp-mission {
  font-size: 12px;
  color: #cfd8ff;
  margin: 4px 0 6px;
}
.imp-cooldown { font-size: 13px; color: #ffd34a; }
.imp-cooldown #imp-cd-val { color: #fff; font-weight: bold; }
.imp-sab-cooldown { font-size: 12px; color: #ff8844; margin-top: 4px; }
.imp-sab-cooldown #sab-cd-val { color: #fff; font-weight: bold; }

/* Sabotage button & menu */
#sabotage-wrap {
  position: absolute;
  bottom: 14px;
  right: 14px;
  z-index: 20;
}
[dir="rtl"] #sabotage-wrap { right: auto; left: 14px; }
#sabotage-btn {
  background: #8b0000;
  color: #ffaaaa;
  border: 2px solid #ff3333;
  padding: 10px 22px;
  font-size: 15px;
  letter-spacing: 2px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  border-radius: 6px;
  box-shadow: 0 0 16px rgba(255, 51, 51, 0.4);
}
#sabotage-btn:hover { background: #aa1111; }
#sabotage-btn.on-cooldown {
  background: #3a1a1a;
  color: #886666;
  border-color: #663333;
  cursor: not-allowed;
  box-shadow: none;
}
#sabotage-menu {
  position: absolute;
  bottom: 50px;
  right: 0;
  background: rgba(14, 18, 48, 0.95);
  border: 2px solid #ff3333;
  border-radius: 8px;
  padding: 6px;
  min-width: 180px;
}
[dir="rtl"] #sabotage-menu { right: auto; left: 0; }
.sab-option {
  display: block;
  width: 100%;
  background: transparent;
  color: #ffaaaa;
  border: none;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  letter-spacing: 1px;
  border-radius: 4px;
}
[dir="rtl"] .sab-option { text-align: right; }
.sab-option:hover { background: rgba(255, 51, 51, 0.2); }

/* Reactor meltdown HUD */
#reactor-hud {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(120, 0, 0, 0.85);
  border: 3px solid #ff2222;
  border-radius: 8px;
  padding: 10px 30px;
  text-align: center;
  z-index: 20;
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
  animation: reactor-flash 1s infinite;
}
@keyframes reactor-flash {
  0%, 100% { border-color: #ff2222; box-shadow: 0 0 30px rgba(255, 0, 0, 0.5); }
  50% { border-color: #ff6666; box-shadow: 0 0 50px rgba(255, 0, 0, 0.8); }
}
#reactor-warning {
  font-size: 20px;
  font-weight: bold;
  color: #ff4444;
  letter-spacing: 3px;
  text-shadow: 0 0 10px #ff0000;
}
#reactor-timer {
  font-size: 36px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 12px #ff0000;
  margin-top: 4px;
}

/* Lights sabotage HUD */
#lights-hud {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(80, 60, 0, 0.85);
  border: 3px solid #ffa500;
  border-radius: 8px;
  padding: 10px 30px;
  text-align: center;
  z-index: 20;
  box-shadow: 0 0 20px rgba(255, 165, 0, 0.4);
}
#lights-warning {
  font-size: 18px;
  font-weight: bold;
  color: #ffa500;
  letter-spacing: 3px;
  text-shadow: 0 0 8px #ff8800;
}

/* Vent selection overlay */
#vent-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  z-index: 30;
}
#vent-panel {
  background: #0e1230;
  border: 3px solid #4a5a90;
  border-radius: 10px;
  padding: 20px 26px;
  box-shadow: 0 0 40px rgba(80, 120, 255, 0.25);
  text-align: center;
  min-width: 280px;
  max-height: 70vh;
  overflow-y: auto;
}
#vent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}
.vent-item {
  background: #1a1f3a;
  border: 2px solid #4a5a90;
  color: #cfd8ff;
  padding: 10px 18px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  border-radius: 6px;
  letter-spacing: 1px;
  text-align: center;
}
.vent-item:hover { background: #2a3060; border-color: #88aaff; }
.vent-item.current { border-color: #ffd34a; color: #ffd34a; }
#vent-close {
  margin-top: 10px;
  background: #ffd34a;
  color: #221100;
  border: none;
  padding: 8px 22px;
  font-size: 14px;
  letter-spacing: 2px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  border-radius: 6px;
  box-shadow: 0 3px 0 #b08020;
}
#vent-close:hover { background: #ffe680; }

/* Switches minigame */
.switches-wrap {
  width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.switches-hint {
  font-size: 14px;
  color: #cfd8ff;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.switches-row {
  display: flex;
  gap: 16px;
  justify-content: center;
}
.switch-item {
  width: 50px;
  height: 80px;
  background: #1a1f3a;
  border: 3px solid #4a5a90;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.switch-item::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 30px;
  background: #555;
  border-radius: 4px;
  bottom: 10px;
  transition: bottom 200ms, background 200ms;
}
.switch-item.on::after {
  bottom: auto;
  top: 10px;
  background: #88ff88;
}
.switch-item.on {
  border-color: #44aa44;
  background: #1a3a1a;
}

/* Quickfix minigame */
.quickfix-wrap {
  width: 420px;
  height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
