:root {
  --bg-1: #0f1720;
  --bg-2: #111827;
  --card: #0b1220;
  --text: #e6eef8;
  --muted: #9aa6b2;
  --bg-sat: 1.15;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: radial-gradient(1200px 600px at 15% 25%, rgba(100, 200, 255, 0.08), transparent 8%),
              linear-gradient(180deg, #020508 10%, #041020 50%, #020508 100%);
  overflow: hidden;
  filter: saturate(var(--bg-sat));
}

body.animations-off * {
  animation: none !important;
  transition: none !important;
}

/* Fullscreen canvas used for stars */
#starfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
  background: transparent;
}

/* Sol centrado */
#sol {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: auto;
  z-index: 1;
  cursor: pointer;
}

#sol:hover {
  filter: brightness(1.2);
}

#sol.desintegrando {
  animation: desintegrar 1.5s ease-out forwards !important;
  pointer-events: none;
}

/* Galaxy centrado */
#galaxy {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: auto;
  z-index: 1;
  display: none;
}

/* Galaxia centrada */
#galaxia {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: auto;
  z-index: 1;
  opacity: 0;
}

#galaxia.apareciendo {
  animation: aparecer 2s ease-in forwards;
}

@keyframes desintegrar {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    filter: blur(0px) brightness(1);
  }
  30% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.1) rotate(10deg);
    filter: blur(2px) brightness(1.5);
  }
  60% {
    opacity: 0.4;
    transform: translate(-50%, -50%) scale(0.8) rotate(-20deg);
    filter: blur(8px) brightness(2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(180deg);
    filter: blur(20px) brightness(3);
  }
}

@keyframes aparecer {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(-180deg);
    filter: blur(20px);
  }
  50% {
    opacity: 0.6;
    filter: blur(8px);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    filter: blur(0px);
  }
}

/* Keep page content hidden (we only want the background) */
main, h1, p { display: none !important; }

/* Re-enable text inside interactive panels */
.galaxy-panel p,
.minigame-panel p,
.minijuegos-grid-container p,
.modo-selection p,
.settings-content p {
  display: block !important;
}

/* Panel de Configuración */
.settings-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

.settings-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(15, 23, 32, 0.4), rgba(25, 50, 90, 0.35));
  border: 2px solid;
  border-image: linear-gradient(135deg, rgba(120, 220, 255, 0.9), rgba(200, 100, 255, 0.9)) 1;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 25px rgba(120, 200, 255, 0.5), inset 0 0 20px rgba(120, 200, 255, 0.15);
  position: relative;
  overflow: hidden;
}

.settings-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: shine 2s infinite;
}

@keyframes shine {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.settings-btn:hover {
  background: linear-gradient(135deg, rgba(20, 40, 70, 0.5), rgba(40, 80, 120, 0.45));
  border-image: linear-gradient(135deg, rgba(180, 240, 255, 1), rgba(220, 120, 255, 1)) 1;
  box-shadow: 0 0 35px rgba(120, 220, 255, 0.7), inset 0 0 30px rgba(120, 220, 255, 0.2);
  transform: scale(1.15);
}

.settings-content {
  position: absolute;
  bottom: 70px;
  right: 0;
  background: linear-gradient(135deg, rgba(8, 14, 25, 0.35), rgba(12, 22, 45, 0.3));
  border: 1px solid;
  border-image: linear-gradient(135deg, rgba(120, 210, 255, 0.7), rgba(200, 120, 255, 0.7)) 1;
  border-radius: 15px;
  padding: 20px;
  width: 250px;
  color: var(--text);
  backdrop-filter: blur(15px);
  box-shadow: 0 0 50px rgba(120, 200, 255, 0.35), 
              inset 0 0 30px rgba(120, 200, 255, 0.08),
              0 20px 40px rgba(0, 0, 0, 0.8);
  animation: panelAppear 0.4s ease;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes panelAppear {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-content.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  visibility: hidden;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 5, 8, 0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 90;
}

.settings-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.settings-content h3 {
  margin: 0 0 15px 0;
  font-size: 16px;
  color: var(--text);
  border-bottom: 1px solid rgba(100, 200, 255, 0.3);
  padding-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  background: linear-gradient(90deg, rgba(100, 200, 255, 0.2), transparent);
  padding: 10px;
  margin: -20px -20px 15px -20px;
  padding-left: 10px;
}

.setting-item {
  margin-bottom: 15px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(100, 200, 255, 0.05);
  border: 1px solid rgba(100, 200, 255, 0.1);
  transition: all 0.3s ease;
}

.setting-item:hover {
  background: rgba(100, 200, 255, 0.1);
  border-color: rgba(100, 200, 255, 0.3);
}

.setting-item label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.setting-item input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(100, 200, 255, 0.2), rgba(150, 100, 255, 0.2));
  outline: none;
  -webkit-appearance: none;
  box-shadow: inset 0 0 5px rgba(100, 200, 255, 0.3);
}

.setting-item input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #64c8ff, #9664ff);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(100, 200, 255, 0.8), inset 0 0 3px rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
}

.setting-item input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 15px rgba(100, 200, 255, 1), inset 0 0 5px rgba(255, 255, 255, 0.8);
}

.setting-item input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #64c8ff, #9664ff);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 10px rgba(100, 200, 255, 0.8), inset 0 0 3px rgba(255, 255, 255, 0.5);
  transition: all 0.2s ease;
}

.setting-item input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 15px rgba(100, 200, 255, 1), inset 0 0 5px rgba(255, 255, 255, 0.8);
}

.setting-item input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #64c8ff;
}

.close-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, rgba(100, 200, 255, 0.15), rgba(150, 100, 255, 0.15));
  border: 1px solid rgba(100, 200, 255, 0.4);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(100, 200, 255, 0.2);
}

.close-btn:hover {
  background: linear-gradient(135deg, rgba(100, 200, 255, 0.3), rgba(150, 100, 255, 0.3));
  border-color: rgba(100, 200, 255, 0.8);
  box-shadow: 0 0 15px rgba(100, 200, 255, 0.5);
}

@media (prefers-color-scheme: light) {
  /* The background remains dark by design; change here to adapt */
}

/* Panel de Información Galaxy */
.galaxy-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(8, 14, 25, 0.35), rgba(12, 22, 45, 0.3));
  border: 2px solid;
  border-image: linear-gradient(135deg, rgba(120, 210, 255, 0.7), rgba(200, 120, 255, 0.7)) 1;
  border-radius: 20px;
  padding: 30px;
  width: 90%;
  max-width: 700px;
  color: var(--text);
  backdrop-filter: blur(15px);
  box-shadow: 0 0 50px rgba(120, 200, 255, 0.35), 
              inset 0 0 30px rgba(120, 200, 255, 0.08),
              0 20px 40px rgba(0, 0, 0, 0.8);
  z-index: 200;
  animation: panelSlideIn 0.5s ease;
}

@keyframes panelSlideIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.galaxy-panel.hidden {
  display: none;
}

.galaxy-close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  background: linear-gradient(135deg, rgba(120, 210, 255, 0.1), rgba(200, 120, 255, 0.1));
  border: 1px solid rgba(120, 210, 255, 0.4);
  color: var(--text);
  font-size: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(120, 200, 255, 0.2);
}

.galaxy-close-btn:hover {
  background: linear-gradient(135deg, rgba(120, 210, 255, 0.3), rgba(200, 120, 255, 0.3));
  border-color: rgba(120, 210, 255, 0.8);
  box-shadow: 0 0 20px rgba(120, 210, 255, 0.6);
}

.galaxy-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 25px;
  margin-top: 15px;
}

@media (max-width: 768px) {
  body {
    overflow-y: auto;
  }

  #sol,
  #galaxy,
  #galaxia {
    width: min(70vw, 280px);
  }

  .galaxy-panel {
    width: calc(100% - 24px);
    max-width: none;
    padding: 20px;
    border-radius: 16px;
  }

  .galaxy-content {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .modo-selection h2,
  .minigame-content h2,
  .minijuegos-grid-container h2 {
    font-size: 20px;
  }

  .modo-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .minijuegos-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .minigame-panel {
    width: calc(100% - 24px);
    max-width: none;
    padding: 18px;
  }

  .game-info {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .balloon-container {
    margin: 14px 0;
  }

  .game-controls input[type="number"] {
    width: 100%;
  }

  .settings-panel {
    right: 12px;
    bottom: 12px;
  }

  .settings-content {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    padding: 18px;
    border-radius: 18px;
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(24px);
  }

  .settings-content:not(.hidden) {
    transform: translateY(0);
  }

  .settings-btn {
    width: 56px;
    height: 56px;
    font-size: 26px;
  }

  .galaxy-close-btn {
    width: 44px;
    height: 44px;
    font-size: 26px;
  }

  .game-btn,
  .close-btn {
    padding: 12px 16px;
    font-size: 13px;
  }

  .modo-btn,
  .minijuego-card {
    padding: 14px;
  }

  .setting-item input[type="range"] {
    height: 8px;
  }

  .setting-item input[type="range"]::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
  }

  .setting-item input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
  }

  .game-controls input[type="number"] {
    font-size: 16px;
    padding: 10px 12px;
  }
}

@media (max-width: 480px) {
  #sol,
  #galaxy,
  #galaxia {
    width: min(75vw, 240px);
  }

  .galaxy-close-btn {
    width: 36px;
    height: 36px;
    font-size: 24px;
  }

  .minijuegos-grid {
    grid-template-columns: 1fr;
  }

  .game-info {
    grid-template-columns: 1fr;
  }

  .settings-content {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .settings-btn {
    width: 52px;
    height: 52px;
  }
}

.info-block {
  background: linear-gradient(135deg, rgba(20, 50, 90, 0.25), rgba(30, 70, 120, 0.2));
  border: 1px solid rgba(120, 210, 255, 0.4);
  border-radius: 15px;
  padding: 50px 30px;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: inset 0 0 20px rgba(120, 210, 255, 0.08),
              0 0 15px rgba(120, 210, 255, 0.15);
}

@media (max-width: 768px) {
  .galaxy-content {
    grid-template-columns: 1fr;
  }
}

.info-block:hover {
  background: linear-gradient(135deg, rgba(30, 70, 120, 0.4), rgba(40, 90, 140, 0.35));
  border-color: rgba(120, 210, 255, 0.8);
  box-shadow: inset 0 0 25px rgba(120, 210, 255, 0.2),
              0 0 35px rgba(120, 210, 255, 0.4);
  transform: translateY(-5px);
}

.info-block h4 {
  margin: 0;
  font-size: 20px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.info-block {
  cursor: pointer;
}

/* Mini Juego Panel */
.minigame-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(8, 14, 25, 0.35), rgba(12, 22, 45, 0.3));
  border: 2px solid;
  border-image: linear-gradient(135deg, rgba(120, 210, 255, 0.7), rgba(200, 120, 255, 0.7)) 1;
  border-radius: 20px;
  padding: 18px;
  width: 90%;
  max-width: 520px;
  max-height: 84vh;
  overflow-y: auto;
  color: var(--text);
  backdrop-filter: blur(15px);
  box-shadow: 0 0 50px rgba(120, 200, 255, 0.35), 
              inset 0 0 30px rgba(120, 200, 255, 0.08),
              0 20px 40px rgba(0, 0, 0, 0.8);
  z-index: 300;
  animation: panelSlideIn 0.5s ease;
}

.minigame-panel.hidden {
  display: none;
}

.minigame-content h2 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: var(--text);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: linear-gradient(90deg, rgba(120, 210, 255, 0.3), rgba(200, 120, 255, 0.3));
  padding: 6px;
  border-radius: 10px;
  border: 1px solid rgba(120, 210, 255, 0.4);
}

.minigame-instructions {
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.game-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.info-card {
  background: linear-gradient(135deg, rgba(20, 50, 90, 0.3), rgba(30, 70, 120, 0.25));
  border: 1px solid rgba(120, 210, 255, 0.4);
  border-radius: 10px;
  padding: 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.info-card .label {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-card .value {
  font-size: 13px;
  color: rgba(120, 210, 255, 1);
  font-weight: 600;
}

.game-controls {
  margin-bottom: 8px;
  padding: 8px;
  background: linear-gradient(135deg, rgba(20, 50, 90, 0.2), rgba(30, 70, 120, 0.15));
  border: 1px solid rgba(120, 210, 255, 0.3);
  border-radius: 10px;
}

.control-label {
  display: block;
  font-size: 10px;
  color: var(--text);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.control-label span {
  color: rgba(120, 210, 255, 1);
  font-weight: 600;
}

.game-controls input[type="range"] {
  width: 100%;
  height: 5px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(100, 200, 255, 0.2), rgba(150, 100, 255, 0.2));
  outline: none;
  -webkit-appearance: none;
  box-shadow: inset 0 0 5px rgba(100, 200, 255, 0.3);
}

.game-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #64c8ff, #9664ff);
  cursor: pointer;
  box-shadow: 0 0 15px rgba(100, 200, 255, 0.8), inset 0 0 3px rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
}

.game-controls input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 20px rgba(100, 200, 255, 1), inset 0 0 5px rgba(255, 255, 255, 0.8);
}

.game-controls input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #64c8ff, #9664ff);
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 15px rgba(100, 200, 255, 0.8), inset 0 0 3px rgba(255, 255, 255, 0.5);
  transition: all 0.2s ease;
}

.game-controls input[type="number"] {
  width: calc(100% - 60px);
  padding: 5px;
  background: rgba(20, 50, 90, 0.4);
  border: 1px solid rgba(120, 210, 255, 0.4);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: all 0.3s ease;
}

.game-controls input[type="number"]:focus {
  border-color: rgba(120, 210, 255, 0.8);
  box-shadow: 0 0 15px rgba(120, 210, 255, 0.3);
}

.game-controls .unit {
  display: inline;
  margin-left: 10px;
  color: var(--muted);
  font-size: 10px;
}

.game-btn {
  width: 100%;
  padding: 7px;
  background: linear-gradient(135deg, rgba(120, 210, 255, 0.3), rgba(200, 120, 255, 0.3));
  border: 2px solid rgba(120, 210, 255, 0.6);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  box-shadow: 0 0 20px rgba(120, 210, 255, 0.3);
}

.game-btn:hover {
  background: linear-gradient(135deg, rgba(120, 210, 255, 0.5), rgba(200, 120, 255, 0.5));
  border-color: rgba(120, 210, 255, 0.9);
  box-shadow: 0 0 30px rgba(120, 210, 255, 0.6);
  transform: translateY(-2px);
}

.game-btn.secondary {
  background: linear-gradient(135deg, rgba(50, 100, 150, 0.3), rgba(70, 120, 170, 0.3));
  border-color: rgba(100, 160, 220, 0.6);
  margin-top: 8px;
}

.game-btn.secondary:hover {
  background: linear-gradient(135deg, rgba(50, 100, 150, 0.5), rgba(70, 120, 170, 0.5));
  border-color: rgba(100, 160, 220, 0.9);
}

.resultado {
  margin-top: 8px;
  padding: 8px;
  background: linear-gradient(135deg, rgba(20, 50, 90, 0.4), rgba(30, 70, 120, 0.3));
  border: 2px solid rgba(120, 210, 255, 0.5);
  border-radius: 10px;
  text-align: center;
}

.resultado.hidden {
  display: none;
}

.resultado-texto {
  font-size: 11px;
  margin: 0 0 10px 0;
  font-weight: 600;
}

.resultado.correcto {
  border-color: rgba(100, 255, 150, 0.7);
  background: linear-gradient(135deg, rgba(20, 90, 50, 0.4), rgba(30, 120, 70, 0.3));
}

.resultado.incorrecto {
  border-color: rgba(255, 100, 100, 0.7);
  background: linear-gradient(135deg, rgba(90, 20, 20, 0.4), rgba(120, 30, 30, 0.3));
}

@media (max-width: 768px) {
  .game-info {
    grid-template-columns: 1fr;
  }
}

/* Calculadora para Modo Práctica */
.calculadora-box {
  background: linear-gradient(135deg, rgba(30, 70, 120, 0.3), rgba(40, 90, 150, 0.25));
  border: 2px solid rgba(120, 210, 255, 0.5);
  border-radius: 15px;
  padding: 14px;
  margin: 10px 0;
  box-shadow: inset 0 0 30px rgba(120, 210, 255, 0.1),
              0 0 25px rgba(120, 210, 255, 0.2);
}

.calculadora-box h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: var(--text);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.calculadora-box .formula {
  text-align: center;
  font-size: 16px;
  color: rgba(120, 210, 255, 1);
  font-weight: 600;
  margin: 8px 0 12px 0;
  font-family: 'Courier New', monospace;
  background: rgba(20, 50, 90, 0.4);
  padding: 8px;
  border-radius: 8px;
  border: 1px solid rgba(120, 210, 255, 0.3);
}

.calc-display {
  background: rgba(10, 30, 60, 0.5);
  border: 1px solid rgba(120, 210, 255, 0.4);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calc-step {
  font-size: 12px;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  padding: 6px;
  background: rgba(20, 50, 90, 0.3);
  border-radius: 6px;
  border-left: 3px solid rgba(120, 210, 255, 0.4);
}

.calc-step span {
  color: rgba(150, 220, 255, 1);
  font-weight: 600;
}

.calc-result {
  font-size: 16px;
  color: var(--text);
  font-family: 'Courier New', monospace;
  padding: 8px;
  background: linear-gradient(135deg, rgba(50, 120, 180, 0.4), rgba(70, 140, 200, 0.3));
  border-radius: 8px;
  border: 2px solid rgba(120, 210, 255, 0.6);
  text-align: center;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(120, 210, 255, 0.3);
}

.calc-result span {
  color: rgba(100, 255, 150, 1);
  font-size: 18px;
  text-shadow: 0 0 10px rgba(100, 255, 150, 0.5);
}

/* Panel de Selección de Modo */
.modo-selection {
  text-align: center;
  padding: 20px;
}

.modo-selection h2 {
  margin: 0 0 10px 0;
  font-size: 32px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 2px;
  background: linear-gradient(90deg, rgba(120, 210, 255, 0.3), rgba(200, 120, 255, 0.3));
  padding: 15px;
  border-radius: 10px;
  border: 1px solid rgba(120, 210, 255, 0.4);
}

.modo-subtitle {
  color: var(--muted);
  font-size: 16px;
  margin-bottom: 30px;
}

.modo-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 25px;
  margin-top: 20px;
}

.modo-btn {
  background: linear-gradient(135deg, rgba(20, 50, 90, 0.3), rgba(30, 70, 120, 0.25));
  border: 2px solid rgba(120, 210, 255, 0.4);
  border-radius: 15px;
  padding: 40px 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: inset 0 0 20px rgba(120, 210, 255, 0.08),
              0 0 15px rgba(120, 210, 255, 0.15);
  color: var(--text);
}

.modo-btn:hover {
  background: linear-gradient(135deg, rgba(30, 70, 120, 0.5), rgba(40, 90, 140, 0.4));
  border-color: rgba(120, 210, 255, 0.8);
  box-shadow: inset 0 0 25px rgba(120, 210, 255, 0.2),
              0 0 35px rgba(120, 210, 255, 0.4);
  transform: translateY(-5px);
}

.modo-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 15px;
}

.modo-btn h3 {
  margin: 0 0 10px 0;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modo-btn p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.4;
}

@media (max-width: 768px) {
  .modo-buttons {
    grid-template-columns: 1fr;
  }
}
/* Globo - Ley de Charles */
.balloon-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  margin: 16px 0;
  position: relative;
}

.balloon {
  width: 80px;
  height: 96px;
  background: radial-gradient(circle at 40% 40%, rgba(255, 100, 150, 0.9), rgba(200, 50, 100, 0.85));
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  position: relative;
  box-shadow: inset -10px -10px 20px rgba(0, 0, 0, 0.3),
              0 0 30px rgba(255, 100, 150, 0.5),
              0 0 50px rgba(255, 100, 150, 0.3);
  transition: transform 0.5s ease;
  animation: float 3s ease-in-out infinite;
}

.balloon::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 30px;
  background: rgba(180, 50, 100, 0.7);
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 0 0 50% 50%;
}

.balloon::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 60px;
  background: linear-gradient(180deg, rgba(150, 150, 150, 0.6), transparent);
  bottom: -80px;
  left: 50%;
  transform: translateX(-50%);
}

.balloon-volume {
  margin-top: 90px;
  font-size: 16px;
  color: rgba(120, 210, 255, 1);
  font-weight: bold;
  text-shadow: 0 0 10px rgba(120, 210, 255, 0.5);
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-15px) scale(1.02);
  }
}

/* ========== ESTILOS PARA MINIJUEGOS DE BOYLE ========== */

/* Grid de minijuegos */
.minijuegos-grid-container {
  padding: 14px;
  max-width: 1100px;
  margin: 0 auto;
}

.minijuegos-grid-container h2 {
  text-align: center;
  font-size: 32px;
  margin-bottom: 10px;
  color: #4ECDC4;
  text-shadow: 0 0 20px rgba(78, 205, 196, 0.6);
}

.minijuegos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.minijuego-card {
  background: linear-gradient(135deg, rgba(30, 40, 60, 0.9), rgba(20, 30, 50, 0.95));
  border: 2px solid rgba(78, 205, 196, 0.3);
  border-radius: 15px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.minijuego-card:hover {
  transform: translateY(-5px);
  border-color: rgba(78, 205, 196, 0.8);
  box-shadow: 0 10px 30px rgba(78, 205, 196, 0.4);
  background: linear-gradient(135deg, rgba(40, 50, 70, 0.95), rgba(30, 40, 60, 0.95));
}

.minijuego-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 6px;
}

.minijuego-card h3 {
  font-size: 14px;
  margin: 6px 0 4px 0;
  color: #fff;
}

.minijuego-card p {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

#minijuegos-boyle-panel .minijuegos-grid-container {
  max-height: 70vh;
  overflow-y: auto;
}

/* Globo para Boyle */
.balloon-boyle {
  width: 80px;
  height: 96px;
  background: radial-gradient(circle at 40% 40%, #4ECDC4, #2a9d8f);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  position: relative;
  margin: 16px auto;
  box-shadow: inset -10px -10px 20px rgba(0, 0, 0, 0.3),
              0 0 30px rgba(78, 205, 196, 0.5);
  transition: all 0.3s ease;
}

.balloon-boyle::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 30px;
  background: rgba(42, 157, 143, 0.7);
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 0 0 50% 50%;
}

.balloon-status {
  text-align: center;
  font-size: 14px;
  color: #fff;
  margin-top: 6px;
}

/* Pistón */
.piston-container {
  width: 260px;
  height: 240px;
  margin: 16px auto;
  position: relative;
}

.piston-chamber {
  width: 130px;
  height: 200px;
  background: linear-gradient(90deg, rgba(50, 60, 80, 0.8), rgba(70, 80, 100, 0.8));
  border: 3px solid rgba(78, 205, 196, 0.5);
  border-radius: 10px;
  position: relative;
  margin: 0 auto;
  overflow: hidden;
}

.piston-head {
  width: 100%;
  height: 40px;
  background: linear-gradient(180deg, #4ECDC4, #2a9d8f);
  position: absolute;
  top: 0;
  left: 0;
  border-bottom: 3px solid rgba(255, 255, 255, 0.3);
  transition: top 0.3s ease;
  z-index: 2;
}

.gas-visual {
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(100, 200, 255, 0.4), rgba(78, 205, 196, 0.2));
  position: absolute;
  bottom: 0;
  left: 0;
  transition: height 0.3s ease;
}

/* Llanta de bicicleta */
.bike-tire-container {
  width: 260px;
  height: 220px;
  margin: 16px auto;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.bike-tire {
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, #666, #333);
  border: 15px solid #222;
  border-radius: 50%;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7),
              0 0 20px rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  transform: scale(0.5);
}

.tire-status {
  margin-top: 12px;
  font-size: 14px;
  text-align: center;
  color: #fff;
}

/* Preguntas Verdadero/Falso */
.question-display {
  background: rgba(30, 40, 60, 0.8);
  padding: 14px;
  border-radius: 15px;
  margin: 12px 0;
  border: 2px solid rgba(78, 205, 196, 0.3);
}

.question-text {
  font-size: 16px;
  line-height: 1.6;
  text-align: center;
  color: #fff;
  margin: 0;
}

.answer-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}

.answer-btn {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: bold;
  border: 3px solid;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 130px;
}

.answer-btn.verdadero {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(56, 142, 60, 0.3));
  border-color: #4CAF50;
  color: #4CAF50;
}

.answer-btn.falso {
  background: linear-gradient(135deg, rgba(244, 67, 54, 0.2), rgba(211, 47, 47, 0.3));
  border-color: #f44336;
  color: #f44336;
}

.answer-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px currentColor;
}

.explicacion {
  background: rgba(20, 30, 50, 0.9);
  padding: 12px;
  border-radius: 10px;
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.6;
  border-left: 4px solid;
}

/* Tarjetas ordenables */
.sorting-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px auto;
  max-width: 500px;
}

.sort-card {
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.2), rgba(42, 157, 143, 0.3));
  border: 2px solid rgba(78, 205, 196, 0.5);
  border-radius: 12px;
  padding: 12px;
  cursor: move;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: all 0.3s ease;
}

.sort-card:hover {
  transform: translateX(10px);
  box-shadow: 0 5px 20px rgba(78, 205, 196, 0.4);
}

.card-number {
  font-size: 18px;
  font-weight: bold;
  color: #4ECDC4;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

.sort-card p {
  margin: 0;
  font-size: 14px;
  flex: 1;
}

/* Pistón interactivo */
.piston-interactive {
  width: 320px;
  height: 240px;
  margin: 16px auto;
  position: relative;
  display: flex;
  gap: 12px;
}

.cylinder {
  width: 200px;
  height: 100%;
  background: linear-gradient(90deg, rgba(50, 60, 80, 0.8), rgba(70, 80, 100, 0.8));
  border: 3px solid rgba(78, 205, 196, 0.5);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.piston-draggable {
  width: 100%;
  height: 50px;
  background: linear-gradient(180deg, #4ECDC4, #2a9d8f);
  position: absolute;
  top: 50%;
  left: 0;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  border-bottom: 3px solid rgba(255, 255, 255, 0.3);
  user-select: none;
  touch-action: none;
}

.piston-draggable:active {
  cursor: grabbing;
}

.gas-particles {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* Contenedor de fábrica */
.factory-container {
  width: 280px;
  margin: 16px auto;
}

.container-display {
  background: rgba(30, 40, 60, 0.8);
  padding: 16px;
  border-radius: 15px;
  border: 2px solid rgba(78, 205, 196, 0.3);
}

.container-limit {
  text-align: center;
  font-size: 14px;
  color: #ff9800;
  margin-bottom: 10px;
}

.container-visual {
  width: 120px;
  height: 150px;
  background: linear-gradient(180deg, transparent, rgba(78, 205, 196, 0.3));
  border: 3px solid rgba(78, 205, 196, 0.5);
  border-radius: 10px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.container-visual.seal-success {
  animation: sealPulse 0.5s ease;
  border-color: rgba(76, 175, 80, 0.8);
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

.container-visual.seal-fail {
  animation: sealShake 0.4s ease;
  border-color: rgba(255, 193, 7, 0.8);
}

.container-visual.seal-break {
  animation: sealBreak 0.6s ease;
  border-color: rgba(255, 82, 82, 0.8);
  box-shadow: 0 0 18px rgba(255, 82, 82, 0.5);
}

@keyframes sealPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes sealShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes sealBreak {
  0% { transform: scale(1); }
  40% { transform: scale(1.05); }
  70% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

/* Modo Arcade */
.arcade-question {
  background: rgba(30, 40, 60, 0.8);
  padding: 20px;
  border-radius: 15px;
  margin: 12px 0;
  text-align: center;
}

.situation {
  font-size: 20px;
  font-weight: bold;
  color: #4ECDC4;
  margin: 0;
}

.arcade-answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px auto;
  max-width: 320px;
}

.arcade-btn {
  padding: 12px;
  font-size: 14px;
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.2), rgba(42, 157, 143, 0.3));
  border: 2px solid rgba(78, 205, 196, 0.5);
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
}

.arcade-btn:hover {
  transform: translateX(10px);
  box-shadow: 0 5px 20px rgba(78, 205, 196, 0.4);
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.3), rgba(42, 157, 143, 0.4));
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ECDC4, #2a9d8f);
  transition: width 0.1s linear;
  width: 100%;
}

/* Emparejamiento */
.matching-container {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin: 16px 0;
}

.matching-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.match-card {
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.2), rgba(42, 157, 143, 0.3));
  border: 2px solid rgba(78, 205, 196, 0.5);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  min-width: 120px;
}

.match-card:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(78, 205, 196, 0.4);
}

.match-card.selected {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.3), rgba(255, 152, 0, 0.4));
  border-color: #FFC107;
}

.match-card.matched {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.28), rgba(56, 142, 60, 0.38));
  border-color: rgba(76, 175, 80, 0.8);
  cursor: default;
  opacity: 0.85;
}

/* Buceo */
.diving-scene {
  width: 280px;
  height: 300px;
  margin: 16px auto;
  position: relative;
  background: linear-gradient(180deg, 
    rgba(0, 150, 200, 0.3) 0%, 
    rgba(0, 100, 150, 0.5) 50%, 
    rgba(0, 50, 100, 0.7) 100%);
  border-radius: 15px;
  overflow: hidden;
  border: 3px solid rgba(78, 205, 196, 0.5);
}

.water-column {
  width: 100%;
  height: 100%;
  position: relative;
}

.depth-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.depth-marker {
  position: absolute;
  left: 12px;
  font-size: 10px;
  color: rgba(230, 238, 248, 0.7);
  transform: translateY(-50%);
}

.diver {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 36px;
  transition: top 0.3s ease;
  top: 20px;
  z-index: 2;
}

.air-bubble {
  position: absolute;
  left: 70%;
  width: 28px;
  height: 28px;
  background: radial-gradient(circle, rgba(200, 230, 255, 0.8), rgba(150, 200, 255, 0.4));
  border-radius: 50%;
  transition: all 0.3s ease;
  top: 20px;
}

/* Carrera */
.race-container {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 16px 0;
}

.container-race {
  background: rgba(30, 40, 60, 0.8);
  padding: 12px;
  border-radius: 15px;
  border: 2px solid rgba(78, 205, 196, 0.3);
  text-align: center;
  flex: 1;
  max-width: 220px;
}

.container-race h3 {
  color: #4ECDC4;
  margin-top: 0;
}

.visual-container {
  width: 100%;
  height: 120px;
  background: linear-gradient(180deg, rgba(78, 205, 196, 0.08), rgba(78, 205, 196, 0.35));
  border: 2px solid rgba(78, 205, 196, 0.6);
  border-radius: 10px;
  margin: 10px 0;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 18px rgba(78, 205, 196, 0.35);
}

.visual-fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 60%;
  background: linear-gradient(180deg, rgba(78, 205, 196, 0.15), rgba(78, 205, 196, 0.8));
  transition: height 0.3s ease;
}

.race-btn {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  font-size: 12px;
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.3), rgba(42, 157, 143, 0.4));
  border: 2px solid rgba(78, 205, 196, 0.5);
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
}

.race-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

/* Detecta el error */
.error-scenario {
  background: rgba(30, 40, 60, 0.8);
  padding: 16px;
  border-radius: 15px;
  margin: 12px 0;
  border: 2px solid rgba(78, 205, 196, 0.3);
}

.experiment-data {
  font-size: 14px;
  line-height: 1.6;
}

.highlight {
  padding: 2px 8px;
  border-radius: 4px;
}

.highlight.error {
  background: rgba(244, 67, 54, 0.3);
  color: #ff6b6b;
}

.error-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.error-btn {
  padding: 12px;
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.2), rgba(42, 157, 143, 0.3));
  border: 2px solid rgba(78, 205, 196, 0.5);
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 13px;
}

.error-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px rgba(78, 205, 196, 0.4);
}

.error-btn.selected {
  border-color: rgba(255, 193, 7, 0.9);
  box-shadow: 0 0 18px rgba(255, 193, 7, 0.5);
}

/* Gráfico */
.graph-container {
  width: 320px;
  height: 220px;
  margin: 16px auto;
  background: rgba(20, 30, 50, 0.8);
  border-radius: 15px;
  padding: 12px;
  border: 2px solid rgba(78, 205, 196, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dado */
.dice-game {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  margin: 16px 0;
  flex-wrap: wrap;
}

.current-state, .prediction {
  background: rgba(30, 40, 60, 0.8);
  padding: 12px;
  border-radius: 12px;
  border: 2px solid rgba(78, 205, 196, 0.3);
  min-width: 130px;
}

.dice-container {
  text-align: center;
}

.dice {
  font-size: 60px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.dice:hover {
  transform: scale(1.2);
}

.dice-result {
  margin-top: 6px;
  font-size: 18px;
  color: #4ECDC4;
  font-weight: bold;
}

.prediction-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 12px 0;
}

.pred-btn {
  padding: 10px 16px;
  font-size: 14px;
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.2), rgba(42, 157, 143, 0.3));
  border: 2px solid rgba(78, 205, 196, 0.5);
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pred-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(78, 205, 196, 0.4);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}