/* CYBERPUNK BOMB DEFUSAL GAME - OPERACIÓN EQUIPO DINAMITA */

:root {
  --primary-color: #00ff00;
  --secondary-color: #ff0055;
  --bg-dark: #0a0e27;
  --bg-darker: #020206;
  --accent-red: #ff0000;
  --accent-green: #00ff00;
  --accent-blue: #0099ff;
  --accent-yellow: #ffff00;
  --neon-purple: #ff00ff;
  --grid-color: rgba(0, 255, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Courier New', monospace;
  background: linear-gradient(135deg, #0a0e27 0%, #020206 100%);
  color: var(--primary-color);
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(0deg, transparent 24%, rgba(0, 255, 0, 0.05) 25%, rgba(0, 255, 0, 0.05) 26%, transparent 27%, transparent 74%, rgba(0, 255, 0, 0.05) 75%, rgba(0, 255, 0, 0.05) 76%, transparent 77%, transparent),
    linear-gradient(90deg, transparent 24%, rgba(0, 255, 0, 0.05) 25%, rgba(0, 255, 0, 0.05) 26%, transparent 27%, transparent 74%, rgba(0, 255, 0, 0.05) 75%, rgba(0, 255, 0, 0.05) 76%, transparent 77%, transparent);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 10;
}

.screen.active {
  display: flex;
}

/* ============ PASSWORD SCREEN ============ */

#passwordScreen {
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0e27 0%, #020206 100%);
}

.password-container {
  text-align: center;
  max-width: 500px;
  padding: 40px;
  border: 2px solid var(--primary-color);
  background: rgba(10, 14, 39, 0.95);
  box-shadow: 0 0 20px var(--primary-color), inset 0 0 10px rgba(0, 255, 0, 0.1);
  animation: pulseGlow 2s infinite;
}

.console-header {
  margin-bottom: 30px;
}

.glitch {
  position: relative;
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-color);
  text-shadow: 2px 2px 0 var(--secondary-color), -2px -2px 0 var(--accent-blue);
  animation: glitch 3s infinite;
}

@keyframes glitch {
  0% {
    text-shadow: 2px 2px 0 var(--secondary-color), -2px -2px 0 var(--accent-blue);
  }

  50% {
    text-shadow: -2px -2px 0 var(--secondary-color), 2px 2px 0 var(--accent-blue);
  }

  100% {
    text-shadow: 2px 2px 0 var(--secondary-color), -2px -2px 0 var(--accent-blue);
  }
}

.password-box {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.terminal-text {
  color: var(--primary-color);
  font-size: 16px;
  text-align: left;
}

.password-hint {
  color: var(--accent-yellow);
  font-size: 12px;
  text-align: left;
}

.password-input {
  width: 100%;
  padding: 12px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  font-family: 'Courier New', monospace;
  font-size: 18px;
  letter-spacing: 2px;
  outline: none;
  transition: all 0.3s;
}

.password-input:focus {
  box-shadow: 0 0 10px var(--primary-color), inset 0 0 5px rgba(0, 255, 0, 0.2);
}

.btn-main {
  padding: 12px;
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-blue) 100%);
  color: #000;
  border: none;
  font-weight: bold;
  cursor: pointer;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.btn-main:hover {
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
  transform: translate(0, -2px);
}

.btn-main:active {
  transform: translate(0, 0);
  box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

.error-message {
  color: var(--accent-red);
  font-size: 12px;
  text-shadow: 0 0 5px var(--accent-red);
  min-height: 15px;
}

@keyframes pulseGlow {

  0%,
  100% {
    box-shadow: 0 0 20px var(--primary-color), inset 0 0 10px rgba(0, 255, 0, 0.1);
  }

  50% {
    box-shadow: 0 0 30px var(--primary-color), inset 0 0 15px rgba(0, 255, 0, 0.2);
  }
}

/* ============ GAME SCREEN ============ */

#gameScreen {
  flex-direction: column;
  z-index: 20;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 2px solid var(--primary-color);
  background: rgba(10, 14, 39, 0.9);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

.header-section {
  flex: 1;
}

.game-header h1 {
  font-size: 28px;
  color: var(--primary-color);
  animation: glitch 3s infinite;
  margin: 0;
}

.timer-section {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 0;
}

.timer {
  font-size: 32px;
  font-weight: bold;
  color: var(--primary-color);
  text-shadow: 0 0 10px var(--primary-color);
  letter-spacing: 2px;
  min-width: 150px;
  text-align: right;
}

.timer.danger {
  color: var(--accent-red);
  text-shadow: 0 0 10px var(--accent-red);
  animation: blink 0.5s infinite;
}

@keyframes blink {

  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0.3;
  }
}

.status-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: pulse 1s infinite;
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 10px var(--accent-green);
  }

  50% {
    box-shadow: 0 0 20px var(--accent-green);
  }
}

.status-indicator.danger {
  background: var(--accent-red);
  box-shadow: 0 0 10px var(--accent-red);
}

.game-content {
  display: flex;
  flex: 1;
  gap: 20px;
  padding: 20px;
  overflow: hidden;
}

.modules-sidebar {
  width: 180px;
  background: rgba(10, 14, 39, 0.9);
  border: 1px solid var(--primary-color);
  padding: 15px;
  overflow-y: auto;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.sidebar-header {
  color: var(--primary-color);
  font-weight: bold;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--primary-color);
  padding-bottom: 10px;
}

.modules-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.module-btn {
  padding: 10px;
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  font-family: 'Courier New', monospace;
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  transition: all 0.3s;
  text-transform: uppercase;
}

.module-btn:hover {
  background: rgba(0, 255, 0, 0.1);
  box-shadow: 0 0 5px var(--primary-color);
}

.module-btn.active {
  background: rgba(0, 255, 0, 0.2);
  box-shadow: inset 0 0 5px rgba(0, 255, 0, 0.3), 0 0 10px var(--primary-color);
}

.module-btn.locked {
  color: #666;
  border-color: #666;
  cursor: not-allowed;
}

.module-btn.completed {
  color: var(--accent-yellow);
  border-color: var(--accent-yellow);
  box-shadow: 0 0 5px var(--accent-yellow);
}

.module-area {
  flex: 1;
  background: rgba(10, 14, 39, 0.9);
  border: 1px solid var(--primary-color);
  padding: 30px;
  overflow-y: auto;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.module-content {
  min-height: 100%;
}

.module {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.module h2 {
  color: var(--primary-color);
  font-size: 20px;
  border-bottom: 2px solid var(--accent-blue);
  padding-bottom: 10px;
}

.module-description {
  color: var(--accent-yellow);
  font-size: 12px;
}

.switches-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.switch-toggle {
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
}

.switch-input {
  display: none;
}

.switch-slider {
  width: 50px;
  height: 30px;
  background: #333;
  border: 1px solid var(--primary-color);
  border-radius: 15px;
  position: relative;
  transition: all 0.3s;
}

.switch-slider::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  background: var(--primary-color);
  border-radius: 50%;
  left: 2px;
  top: 2px;
  transition: all 0.3s;
}

.switch-input:checked+.switch-slider {
  background: var(--accent-green);
  box-shadow: inset 0 0 10px rgba(0, 255, 0, 0.3);
}

.switch-input:checked+.switch-slider::after {
  left: 24px;
  background: #000;
}

.switch-label {
  color: var(--primary-color);
  font-weight: bold;
  min-width: 50px;
}

/* M2: Year Wheel */
.year-wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.year-slider {
  width: 200px;
  cursor: pointer;
}

.year-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px var(--primary-color);
}

.year-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary-color);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 10px var(--primary-color);
}

.year-slider::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-blue) 100%);
  height: 3px;
  border-radius: 999px;
}

.year-display {
  font-size: 32px;
  font-weight: bold;
  color: var(--accent-yellow);
  text-shadow: 0 0 10px var(--accent-yellow);
}

/* M3: Python Questions */
.question-progress {
  text-align: center;
  color: var(--accent-yellow);
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 15px;
  padding: 8px;
  background: rgba(255, 255, 0, 0.1);
  border: 1px solid var(--accent-yellow);
  border-radius: 3px;
}

.python-question {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--primary-color);
  padding: 20px;
  margin: 20px 0;
  border-radius: 5px;
  box-shadow: inset 0 0 10px rgba(0, 255, 0, 0.1);
}

.question-text {
  color: var(--primary-color);
  font-size: 16px;
  text-align: center;
  line-height: 1.6;
  font-weight: bold;
}

.python-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 20px 0;
}

.option-btn {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  cursor: pointer;
  transition: all 0.3s;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  border-radius: 3px;
}

.option-btn:hover:not(.disabled) {
  background: rgba(0, 255, 0, 0.2);
  box-shadow: 0 0 10px var(--primary-color);
  transform: scale(1.03);
}

.option-btn.selected {
  background: rgba(255, 255, 0, 0.3);
  border-color: var(--accent-yellow);
  box-shadow: inset 0 0 10px rgba(255, 255, 0, 0.3), 0 0 15px var(--accent-yellow);
}

.option-btn.correct {
  background: rgba(0, 255, 0, 0.4);
  border-color: var(--accent-green);
  box-shadow: inset 0 0 10px rgba(0, 255, 0, 0.3), 0 0 20px var(--accent-green);
  animation: correct-answer 0.5s;
}

.option-btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@keyframes correct-answer {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

/* M4: Cables */
.cables-container {
  display: flex;
  justify-content: space-around;
  gap: 20px;
  padding: 20px 0;
}

.cable {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s;
}

.cable-visual {
  width: 20px;
  height: 80px;
  border-radius: 10px;
  box-shadow: 0 0 5px currentColor;
  transition: all 0.3s;
}

.red-cable {
  color: var(--accent-red);
}

.green-cable {
  color: var(--accent-green);
}

.blue-cable {
  color: var(--accent-blue);
}

.cable-visual {
  background: currentColor;
}

.cable.cut .cable-visual {
  opacity: 0.2;
  transform: scaleY(0.5);
}

.cable span {
  color: var(--primary-color);
  font-size: 12px;
  font-weight: bold;
}

.cable:hover:not(.cut) .cable-visual {
  box-shadow: 0 0 15px currentColor;
  transform: scaleY(1.1);
}

/* M5: Special Agents */
.special-input {
  width: 100%;
  padding: 12px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  font-family: 'Courier New', monospace;
  font-size: 18px;
  letter-spacing: 2px;
}

.symbol-keyboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.symbol-btn {
  padding: 15px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s;
}

.symbol-btn:hover {
  box-shadow: 0 0 10px var(--primary-color);
}

.symbol-btn:active {
  background: rgba(0, 255, 0, 0.2);
}

/* M6: Numpad */
.numpad-input {
  width: 100%;
  padding: 15px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  font-family: 'Courier New', monospace;
  font-size: 28px;
  letter-spacing: 3px;
  text-align: center;
  margin-bottom: 10px;
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.numpad-btn {
  padding: 20px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
}

.numpad-btn:hover {
  box-shadow: 0 0 10px var(--primary-color);
  transform: scale(1.05);
}

.numpad-btn.del {
  grid-column: 1;
}

.numpad-btn.confirm {
  grid-column: 2 / 4;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
  color: #000;
  font-weight: bold;
}

/* M7: Chronometer */
.chronometer-display {
  font-size: 48px;
  font-weight: bold;
  color: var(--accent-yellow);
  text-align: center;
  text-shadow: 0 0 15px var(--accent-yellow);
  letter-spacing: 2px;
  margin: 20px 0;
}

.stop-btn {
  width: 200px;
  margin: 20px auto;
  padding: 15px;
  background: linear-gradient(90deg, var(--accent-red), #cc0000);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
}

.stop-btn:hover {
  box-shadow: 0 0 20px var(--accent-red);
}

.chrono-hint {
  text-align: center;
  color: var(--accent-yellow);
  font-size: 12px;
}

/* M8: Mapa del Ecuador */
.ecuador-map {
  width: 100%;
  max-width: 500px;
  height: auto;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid var(--primary-color);
  margin: 20px auto;
  display: block;
  box-shadow: 0 0 25px rgba(0, 255, 0, 0.4);
  border-radius: 8px;
  padding: 10px;
}

.province {
  fill: rgba(0, 255, 0, 0.12);
  stroke: var(--primary-color);
  stroke-width: 1.2;
  cursor: pointer;
  transition: all 0.3s;
  stroke-linejoin: round;
}

.province:hover {
  fill: rgba(0, 255, 0, 0.35);
  stroke: var(--accent-yellow);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(255, 255, 0, 0.7));
}

.province.priority-selected {
  fill: rgba(255, 255, 0, 0.45);
  stroke: var(--accent-yellow);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 12px rgba(255, 255, 0, 1));
  animation: pulse-priority 1.5s infinite;
}

.province.completed {
  fill: rgba(0, 255, 0, 0.7);
  stroke: var(--accent-green);
  stroke-width: 2;
  filter: drop-shadow(0 0 15px rgba(0, 255, 0, 1));
}

.province.galapagos {
  stroke-width: 1.5;
}

.province-label {
  fill: var(--primary-color);
  font-size: 9px;
  font-weight: bold;
  pointer-events: none;
  text-anchor: middle;
  font-family: 'Courier New', monospace;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 1),
    0 0 5px rgba(0, 0, 0, 0.8),
    0 0 2px rgba(0, 255, 0, 0.3);
  letter-spacing: 0.5px;
}

#galapagos-group .province-label {
  font-size: 10px;
}

.priority-info {
  margin: 20px auto;
  max-width: 500px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--primary-color);
  border-radius: 5px;
  box-shadow: inset 0 0 10px rgba(0, 255, 0, 0.1);
}

.priority-sequence,
.priority-count {
  color: var(--primary-color);
  font-size: 13px;
  margin: 8px 0;
  text-align: center;
}

#prioritySequence {
  color: var(--accent-yellow);
  font-weight: bold;
  display: block;
  margin-top: 5px;
  font-size: 11px;
  word-wrap: break-word;
  line-height: 1.4;
}

#priorityCount {
  color: var(--accent-green);
  font-weight: bold;
  font-size: 18px;
}

.btn-reset {
  margin-top: 10px;
  padding: 10px 20px;
  background: rgba(255, 0, 85, 0.2);
  border: 2px solid var(--secondary-color);
  color: var(--secondary-color);
  font-family: 'Courier New', monospace;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  border-radius: 3px;
}

.btn-reset:hover {
  background: rgba(255, 0, 85, 0.4);
  box-shadow: 0 0 15px var(--secondary-color);
  transform: scale(1.05);
}

@keyframes pulse-priority {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.75;
  }
}

/* M9: Dial */
.dial-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
}

.dial-display {
  font-size: 64px;
  font-weight: bold;
  color: var(--accent-blue);
  text-shadow: 0 0 15px var(--accent-blue);
  min-width: 100px;
  text-align: center;
}

.dial-slider {
  width: 200px;
}

/* M10: Integrated Verification */
.verification-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 0;
}

.code-display {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--primary-color);
  padding: 20px;
  border-radius: 5px;
}

.code-label {
  color: var(--primary-color);
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 15px;
  text-align: center;
}

.code-blocks {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.code-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.block-label {
  color: var(--accent-yellow);
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
}

.code-input {
  width: 50px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  font-family: 'Courier New', monospace;
  font-size: 16px;
  text-align: center;
  letter-spacing: 1px;
  font-weight: bold;
  text-transform: uppercase;
  transition: all 0.3s;
  border-radius: 3px;
}

.code-input:focus {
  outline: none;
  border-color: var(--accent-yellow);
  box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
  background: rgba(0, 0, 0, 0.9);
}

.code-input.correct {
  border-color: var(--accent-green);
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.8);
  background: rgba(0, 255, 0, 0.1);
}

.hints-section {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--accent-blue);
  padding: 20px;
  border-radius: 5px;
}

.hints-title {
  color: var(--accent-blue);
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 15px;
  text-align: center;
}

.hints-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hint-item {
  color: var(--primary-color);
  font-size: 12px;
  padding: 8px;
  background: rgba(0, 255, 0, 0.1);
  border-left: 2px solid var(--accent-blue);
  border-radius: 2px;
}

@media (max-width: 768px) {
  .verification-container {
    grid-template-columns: 1fr;
  }

  .code-blocks {
    flex-direction: column;
    align-items: stretch;
  }

  .code-input {
    width: 100%;
  }
}

/* Validation Button */
.btn-validate {
  padding: 10px 20px;
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-blue) 100%);
  color: #000;
  border: none;
  font-weight: bold;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.3s;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.btn-validate:hover {
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
}

/* GAME FOOTER */
.game-footer {
  padding: 15px 20px;
  border-top: 2px solid var(--primary-color);
  background: rgba(10, 14, 39, 0.9);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.3);
}

#bombStatus {
  color: var(--primary-color);
  font-weight: bold;
}

.progress-indicator {
  color: var(--accent-yellow);
  font-weight: bold;
  letter-spacing: 2px;
}

/* ============ VICTORY SCREEN ============ */

#victoryScreen {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(0, 255, 0, 0.1), rgba(10, 14, 39, 0.95));
}

.victory-container {
  text-align: center;
  max-width: 600px;
  padding: 50px 40px;
  border: 3px solid var(--primary-color);
  background: rgba(10, 14, 39, 0.95);
  box-shadow: 0 0 30px var(--primary-color), inset 0 0 20px rgba(0, 255, 0, 0.1);
  animation: victoryGlow 1s infinite;
}

@keyframes victoryGlow {

  0%,
  100% {
    box-shadow: 0 0 30px var(--primary-color), inset 0 0 20px rgba(0, 255, 0, 0.1);
  }

  50% {
    box-shadow: 0 0 50px var(--primary-color), inset 0 0 30px rgba(0, 255, 0, 0.2);
  }
}

.victory-animation {
  font-size: 120px;
  margin-bottom: 20px;
  animation: victoryBounce 0.6s ease-in-out infinite;
}

@keyframes victoryBounce {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }
}

.victory-container h1 {
  font-size: 36px;
  color: var(--primary-color);
  animation: glitch 3s infinite;
  margin-bottom: 20px;
}

.victory-details {
  margin: 20px 0;
  color: var(--accent-yellow);
  font-size: 14px;
}

.victory-stat {
  color: var(--accent-green);
  font-weight: bold;
}

.victory-code {
  color: var(--accent-blue);
  font-weight: bold;
  font-size: 16px;
  letter-spacing: 2px;
}

/* ============ FAILURE SCREEN ============ */

#failureScreen {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(255, 0, 0, 0.1), rgba(10, 14, 39, 0.95));
}

.failure-container {
  text-align: center;
  max-width: 600px;
  padding: 50px 40px;
  border: 3px solid var(--accent-red);
  background: rgba(10, 14, 39, 0.95);
  box-shadow: 0 0 30px var(--accent-red), inset 0 0 20px rgba(255, 0, 0, 0.1);
  animation: failureGlow 0.5s infinite;
}

@keyframes failureGlow {

  0%,
  100% {
    box-shadow: 0 0 30px var(--accent-red), inset 0 0 20px rgba(255, 0, 0, 0.1);
  }

  50% {
    box-shadow: 0 0 50px var(--accent-red), inset 0 0 30px rgba(255, 0, 0, 0.2);
  }
}

.detonation-animation {
  font-size: 120px;
  margin-bottom: 20px;
  animation: detonate 0.8s ease-in-out infinite;
}

@keyframes detonate {

  0%,
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }

  50% {
    transform: scale(1.3) rotate(10deg);
    opacity: 0.8;
  }
}

.failure-container h1 {
  font-size: 36px;
  color: var(--accent-red);
  margin-bottom: 20px;
  text-shadow: 0 0 10px var(--accent-red);
}

.failure-details {
  margin: 20px 0;
  color: var(--accent-red);
  font-size: 14px;
}

/* ============ SCROLLBAR ============ */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  box-shadow: 0 0 5px var(--primary-color);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

body {
  background: radial-gradient(circle at top, #2f3642 0%, #0b0d12 65%);
  color: var(--text);
  min-height: 100vh;
  padding: 32px;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  padding: 20px 24px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.brand .logo {
  font-size: 32px;
  background: linear-gradient(135deg, #fcd34d, #f97316);
  padding: 10px 14px;
  border-radius: 12px;
}

h1 {
  font-size: 24px;
}

p {
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 0.95fr 1.1fr;
  gap: 24px;
}

.panel {
  background: var(--panel);
  padding: 24px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.status {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 14px;
}

.device {
  display: grid;
  gap: 20px;
}

.screen {
  background: var(--screen-bg);
  border: 1px solid rgba(124, 252, 0, 0.35);
  padding: 20px;
  border-radius: 14px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
  color: var(--screen-text);
  font-family: "Share Tech Mono", "Courier New", monospace;
}

.timer {
  font-size: 26px;
  letter-spacing: 2px;
}

.screen-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.progress {
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

#progressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #fcd34d, #22d3ee);
  transition: width 0.4s ease;
}

.strike-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.strikes {
  display: flex;
  gap: 8px;
}

.strike {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
}

.strike.active {
  background: var(--danger);
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.8);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 12px;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.controls {
  display: flex;
  gap: 12px;
}

button {
  border: none;
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.primary {
  background: linear-gradient(135deg, #fcd34d, #fb7185);
  color: #1f2937;
}

.secondary {
  background: rgba(118, 215, 234, 0.2);
  color: #7dd3fc;
  margin-top: 10px;
  width: 100%;
}

.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.modules {
  display: grid;
  gap: 16px;
}

.module {
  background: var(--module-bg);
  padding: 18px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--muted);
}

input {
  background: #0e1117;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
}

.footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
}

body.light {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-light: #e2e8f0;
  --accent: #fbbf24;
  --accent-2: #22d3ee;
  --text: #0f172a;
  --muted: #475569;
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
  --module-bg: #f1f5f9;
  --screen-bg: #d1fae5;
  --screen-text: #0f766e;
  background: radial-gradient(circle at top, #e2e8f0 0%, #f8fafc 60%);
}

.wires {
  display: grid;
  gap: 10px;
  padding: 10px 0;
}

.wire {
  height: 12px;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.wire::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 24px;
  height: 4px;
  background: rgba(0, 0, 0, 0.3);
  transform: translateY(-50%);
  border-radius: 999px;
}

.wire.red {
  background: #ef4444;
}

.wire.blue {
  background: #3b82f6;
}

.wire.yellow {
  background: #facc15;
}

.wire.white {
  background: #e5e7eb;
}

.wire.cut {
  opacity: 0.35;
  transform: scaleX(0.9);
}

.button-zone {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.big-button {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: linear-gradient(145deg, #1f2937, #0b0f14);
  color: #f8fafc;
  font-size: 18px;
  border: 6px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.big-button.blue {
  background: radial-gradient(circle at top, #60a5fa, #1e3a8a);
}

.big-button.red {
  background: radial-gradient(circle at top, #f87171, #7f1d1d);
}

.big-button.green {
  background: radial-gradient(circle at top, #4ade80, #14532d);
}

.strip {
  width: 120px;
  height: 10px;
  border-radius: 999px;
  background: #fbbf24;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

.strip.blue {
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

.strip.yellow {
  background: #facc15;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.6);
}

.strip.white {
  background: #e5e7eb;
  box-shadow: 0 0 8px rgba(229, 231, 235, 0.6);
}

.button-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.symbol {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-size: 24px;
  color: #facc15;
  padding: 16px 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.symbol.active {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* ============ INTRO SCREEN ============ */

#introScreen {
  align-items: flex-start;
  justify-content: flex-start;
  background: linear-gradient(135deg, #0a0e27 0%, #020206 100%);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
}

.intro-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
  animation: fadeIn 1s ease-in;
  min-height: min-content;
}

.intro-header {
  text-align: center;
  margin-bottom: 20px;
}

.intro-title {
  font-size: 36px;
  margin-bottom: 10px;
  color: var(--accent-red);
  text-shadow:
    2px 2px 0 var(--primary-color),
    -2px -2px 0 var(--accent-blue),
    0 0 20px var(--accent-red);
}

.intro-subtitle {
  font-size: 16px;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 3px;
  text-shadow: 0 0 10px var(--primary-color);
}

.intro-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  align-items: start;
}

.briefing-box {
  background: rgba(10, 14, 39, 0.95);
  border: 2px solid var(--primary-color);
  padding: 30px;
  box-shadow:
    0 0 30px rgba(0, 255, 0, 0.3),
    inset 0 0 20px rgba(0, 255, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.briefing-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
      transparent,
      var(--primary-color),
      transparent);
  animation: scanline 3s linear infinite;
}

@keyframes scanline {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(500px);
  }
}

.briefing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--primary-color);
  flex-wrap: wrap;
  gap: 10px;
}

.classified-tag {
  color: var(--accent-yellow);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
  padding: 5px 10px;
  border: 1px solid var(--accent-yellow);
  background: rgba(255, 255, 0, 0.1);
}

.status-tag {
  color: var(--accent-red);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
  padding: 5px 10px;
  border: 1px solid var(--accent-red);
  background: rgba(255, 0, 0, 0.1);
  text-shadow: 0 0 5px var(--accent-red);
}

.narrative-container {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.narrative-block {
  color: var(--primary-color);
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-wrap;
  font-family: 'Courier New', monospace;
  min-height: 200px;
  animation: fadeIn 0.5s ease-in;
}

.narrative-block .block-title {
  color: var(--accent-red);
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
  text-shadow: 0 0 10px var(--accent-red);
  display: block;
}

.narrative-block .block-content {
  color: var(--primary-color);
  margin-bottom: 10px;
  display: block;
}

.narrative-block .highlight {
  color: var(--accent-yellow);
  font-weight: bold;
}

.narrative-block .warning-text {
  color: var(--accent-red);
  font-weight: bold;
  text-shadow: 0 0 5px var(--accent-red);
}

.narrative-block .divider {
  color: var(--primary-color);
  opacity: 0.5;
  margin: 15px 0;
  display: block;
}

.narrative-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}

.btn-next {
  padding: 14px 35px;
  background: linear-gradient(90deg, var(--primary-color), #00cc00);
  color: #000;
  border: 2px solid var(--primary-color);
  font-weight: bold;
  cursor: pointer;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.3s;
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
  font-family: 'Courier New', monospace;
}

.btn-next:hover {
  box-shadow: 0 0 30px rgba(0, 255, 0, 0.8);
  transform: scale(1.05);
  background: linear-gradient(90deg, #00ff00, var(--primary-color));
}

.btn-next:active {
  transform: scale(0.98);
}

.btn-start {
  padding: 18px 40px;
  background: linear-gradient(90deg, var(--accent-red), #cc0000);
  color: #fff;
  border: 2px solid var(--accent-red);
  font-weight: bold;
  cursor: pointer;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 2px;
  transition: all 0.3s;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
  font-family: 'Courier New', monospace;
}

.btn-start:hover {
  box-shadow: 0 0 40px rgba(255, 0, 0, 0.8);
  transform: scale(1.05);
  background: linear-gradient(90deg, #ff0000, var(--accent-red));
}

.btn-start:active {
  transform: scale(0.98);
}

.bomb-visual {
  background-image: url('bomb_silhouette.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  min-height: 400px;
  opacity: 0.6;
  filter: drop-shadow(0 0 20px var(--primary-color));
  animation: pulse-bomb 3s infinite;
}

@keyframes pulse-bomb {

  0%,
  100% {
    opacity: 0.4;
    filter: drop-shadow(0 0 15px var(--primary-color));
  }

  50% {
    opacity: 0.7;
    filter: drop-shadow(0 0 30px var(--primary-color));
  }
}

.team-logo {
  position: fixed;
  bottom: 20px;
  z-index: 100;
  opacity: 0.6;
}

.team-logo-left {
  left: 20px;
}

.team-logo-right {
  right: 20px;
}

.team-logo img {
  max-width: 120px;
  height: auto;
  filter: brightness(0.9);
  transition: all 0.3s;
}

.team-logo img:hover {
  opacity: 1;
  filter: brightness(1.1);
  transform: scale(1.05);
}

/* Responsive for intro screen */
@media (max-width: 900px) {
  .intro-content {
    grid-template-columns: 1fr;
  }

  .bomb-visual {
    min-height: 250px;
    order: -1;
  }

  .intro-title {
    font-size: 24px;
  }

  .briefing-box {
    padding: 20px;
  }


  .briefing-text {
    font-size: 12px;
  }

  .team-logo {
    bottom: 10px;
    right: 10px;
  }

  .team-logo img {
    max-width: 80px;
  }
}

/* ============ MEMORY GAME (M11) ============ */
.memory-stats {
  display: flex;
  justify-content: space-around;
  margin: 20px 0;
  padding: 15px;
  background: rgba(0, 255, 0, 0.1);
  border: 1px solid var(--primary-color);
  border-radius: 8px;
}

.memory-stats .stat {
  color: var(--primary-color);
  font-size: 16px;
  font-weight: bold;
  text-shadow: 0 0 5px var(--primary-color);
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin: 15px auto;
  padding: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  max-width: 95%;
  width: 100%;
}

.memory-card {
  aspect-ratio: 3/2;
  min-height: 90px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: bold;
  text-align: center;
  padding: 8px;
  transition: all 0.3s;
  position: relative;
  transform-style: preserve-3d;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
  overflow: hidden;
  word-wrap: break-word;
  line-height: 1.3;
}

.memory-card:hover:not(.flipped):not(.matched) {
  /* Eliminado transform scale para evitar zoom */
  box-shadow: 0 0 15px rgba(0, 255, 0, 0.6);
  border-color: #fff;
}

.memory-card.flipped,
.memory-card.matched {
  background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
  border-color: var(--accent-yellow);
  color: var(--accent-yellow);
  cursor: default;
}

.memory-card.matched {
  border-color: var(--primary-color);
  color: var(--primary-color);
  opacity: 0.8;
  /* Eliminado scale animation */
  animation: matchGlow 0.5s ease-in-out;
}

.memory-card.bomb {
  background: linear-gradient(135deg, #8b0000 0%, #ff0000 100%);
  border-color: var(--accent-red);
  color: #fff;
  font-size: 30px;
  animation: bombPulse 0.5s infinite;
  /* Este ya no se usa pero no estorba */
}

.memory-card .card-back {
  color: var(--primary-color);
  font-size: 28px;
}

.memory-card .card-front {
  display: none;
  color: var(--accent-yellow);
  line-height: 1.3;
  font-size: 15px;
}

.memory-card.flipped .card-back {
  display: none;
}

.memory-card.flipped .card-front {
  display: block;
}

.memory-card.matched .card-front {
  display: block;
  color: var(--primary-color);
}

@keyframes matchGlow {

  0%,
  100% {
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
  }

  50% {
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.8);
  }
}

@keyframes bombPulse {

  0%,
  100% {
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
  }

  50% {
    box-shadow: 0 0 40px rgba(255, 0, 0, 1);
  }
}

/* Responsive for memory game */
@media (max-width: 1200px) {
  .memory-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    padding: 15px;
  }

  .memory-card {
    font-size: 14px;
    min-height: 80px;
    padding: 6px;
  }

  .memory-card .card-back {
    font-size: 24px;
  }
  
  .memory-card .card-front {
    font-size: 14px;
  }
}

@media (max-width: 900px) {
  .memory-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .memory-card {
    font-size: 12px;
    min-height: 75px;
    aspect-ratio: 3/2;
    padding: 5px;
  }

  .memory-card .card-back {
    font-size: 20px;
  }
  
  .memory-card .card-front {
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .memory-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 10px;
  }

  .memory-card {
    font-size: 11px;
    min-height: 70px;
    padding: 4px;
  }

  .memory-card .card-back {
    font-size: 18px;
  }
  
  .memory-card .card-front {
    font-size: 11px;
  }
}

/* Memory Card Types */
.memory-card.concept {
  border-color: #00ffff;
}

.memory-card.def {
  border-color: #ff00ff;
}

.memory-card.concept .card-front {
  color: #00ffff;
}

.memory-card.def .card-front {
  color: #ff00ff;
}