/* game.css - Estilos del Entorno de Programación (Juego, Bloques y Python) */
.game-view-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: #f1f5f9;
  overflow: hidden;
}

/* TOP BAR DEL NIVEL */
.level-top-bar {
  background-color: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  gap: 12px;
  min-height: 52px;
  position: relative;
  z-index: 20;
}

.level-nav-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.mission-nav-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-level-nav-arrow {
  padding: 4px 8px !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 5px !important;
  cursor: pointer !important;
  line-height: 1 !important;
}

.btn-level-nav-arrow:hover {
  background: #e2e8f0 !important;
  color: #0284c7 !important;
}

.btn-back-courses {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-back-courses:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.level-title-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  max-width: 360px;
}

.level-title-box h3 {
  font-size: 15px;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-title-box span {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.level-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Selector de modo: Bloques vs Python */
.mode-switch-group {
  display: flex;
  background: #f1f5f9;
  padding: 2px;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
}

.mode-btn {
  padding: 5px 11px;
  border: none;
  background: transparent;
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn.active {
  background: #ffffff;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-hint {
  background: #fef08a;
  border: 1px solid #facc15;
  color: #854d0e;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  position: static;
  box-shadow: 0 1px 2px rgba(250, 204, 21, 0.2);
}

.btn-hint:hover {
  background: #fde047;
}

/* ÁREA DE TRABAJO SPLIT: CANVAS (IZQ) + EDITOR (DER) */
.workspace-split {
  flex: 1;
  display: flex;
  overflow: hidden;
  transition: all 0.25s ease;
}

/* MODO PANTALLA COMPLETA JUNIOR (PREDETERMINADO PARA CURSOS JR) */
.workspace-split.junior-fullscreen .canvas-panel {
  width: 100% !important;
  border-right: none;
}

.workspace-split.junior-fullscreen .editor-panel {
  display: none !important;
}

.workspace-split.junior-fullscreen #gameCanvas {
  max-height: calc(100% - 10px);
}

.workspace-split.junior-fullscreen .cm-tray-container {
  max-width: 820px;
}

/* PANEL IZQUIERDO: CANVAS DEL JUEGO */
.canvas-panel {
  width: 50%;
  min-width: 440px;
  background: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: relative;
  border-right: 2px solid #cbd5e1;
  transition: width 0.25s ease;
}

.canvas-header-tools {
  background: #ffffff;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
}

.tool-badge-ruler {
  font-size: 12px;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  padding: 4px 10px;
  border-radius: 20px;
}

.canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
  position: relative;
}

#gameCanvas {
  background: #b7e493;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  cursor: default;
  max-width: 100%;
  max-height: 100%;
}

#gameCanvas.ruler-mode {
  cursor: crosshair;
}

/* Barra inferior del canvas */
.canvas-bottom-bar {
  background: #ffffff;
  padding: 10px 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.canvas-controls-left,
.canvas-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-canvas-tool {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-canvas-tool:hover {
  background: #f1f5f9;
}

.btn-canvas-tool.active {
  background: #fab538;
  color: #451a03;
  border-color: #d97706;
}

/* PANEL DERECHO: EDITOR (BLOQUES O PYTHON) */
.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  overflow: hidden;
}

.editor-instructions {
  background: #f0fdf4;
  border-bottom: 1px solid #bbf7d0;
  padding: 12px 20px;
  color: #166534;
  font-size: 13px;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* BARRA DE ESTADO DE ROL PROFESOR VS ALUMNO */
.editor-role-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12px;
  gap: 12px;
}

.role-status-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.status-badge-teacher {
  background: #ecfccb;
  color: #3f6212;
  border: 1px solid #d9f99d;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
}

.status-badge-student {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
}

.role-status-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-role-action {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-role-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

/* CONTENEDOR DE BLOQUES */
.blocks-environment {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.blocks-palette {
  width: 180px;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.palette-category-title {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  margin-top: 6px;
}

.palette-block-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.1s, opacity 0.1s;
  text-align: left;
}

.palette-block-btn:hover {
  transform: translateX(3px);
  opacity: 0.92;
}

.btn-palette-step { background: #38bdf8; }
.btn-palette-jump { background: #f97316; }
.btn-palette-turn { background: #818cf8; }
.btn-palette-repeat { background: #10b981; }
.btn-palette-say { background: #f59e0b; }

.blocks-workspace {
  flex: 1;
  background: #fafaf9;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty-blocks-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #94a3b8;
  text-align: center;
  gap: 8px;
}

.empty-blocks-notice .empty-icon {
  font-size: 40px;
}

/* ESTILOS DE LOS BLOQUES DE CÓDIGO (BLOCKS) */
.blocks-sequence {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.code-block {
  border-radius: 8px;
  color: #ffffff;
  background-color: #0284c7;
  box-shadow: 0 2px 5px rgba(0,0,0,0.12);
  position: relative;
  overflow: hidden;
}

.block-step { background-color: #0284c7; }
.block-jump { background-color: #ea580c; }
.block-step_back { background-color: #0369a1; }
.block-turn_left { background-color: #6366f1; }
.block-turn_right { background-color: #4f46e5; }
.block-say { background-color: #d97706; }
.block-repeat { background-color: #059669; }

.block-content {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 10px;
}

.block-icon {
  font-size: 16px;
}

.block-label {
  font-size: 13px;
  font-weight: 700;
}

.block-input,
.block-input-text,
.block-select {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.9);
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  outline: none;
}

.block-input {
  width: 58px;
  text-align: center;
}

.block-unit {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
}

.block-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-block-action,
.btn-block-delete {
  background: rgba(0,0,0,0.15);
  border: none;
  color: #ffffff;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-block-delete:hover {
  background: rgba(239, 68, 68, 0.8);
}

.block-nested-body {
  background: rgba(0, 0, 0, 0.12);
  margin: 0 8px 8px 18px;
  padding: 8px;
  border-radius: 6px;
  border-left: 4px solid #34d399;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nested-placeholder {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  font-style: italic;
  padding: 6px;
}

.nested-add-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.85);
}

.btn-sub-add {
  background: rgba(255,255,255,0.25);
  border: none;
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.btn-sub-add:hover {
  background: rgba(255,255,255,0.4);
}

.block-repeat-footer {
  background: rgba(0,0,0,0.18);
  padding: 3px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}

/* ============================================================
   EDITOR PYTHON
   ============================================================ */
.python-environment {
  flex: 1;
  display: none;
  flex-direction: column;
  background: #1e1e1e;
  color: #d4d4d4;
  position: relative;
}

.python-environment.active {
  display: flex;
}

.python-quick-chips {
  background: #252526;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #333333;
  overflow-x: auto;
}

.chip-label {
  font-size: 11px;
  color: #858585;
  font-weight: 700;
}

.quick-chip-btn {
  background: #333333;
  color: #9cdcfe;
  border: 1px solid #444444;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 11px;
  cursor: pointer;
}

.quick-chip-btn:hover {
  background: #3e3e42;
  color: #ffffff;
}

.python-code-box {
  flex: 1;
  display: flex;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  position: relative;
}

.line-numbers {
  width: 40px;
  background: #1e1e1e;
  color: #858585;
  text-align: right;
  padding: 12px 8px;
  user-select: none;
  border-right: 1px solid #2d2d2d;
}

#pythonEditorTextarea {
  flex: 1;
  background: #1e1e1e;
  color: #d4d4d4;
  border: none;
  resize: none;
  padding: 12px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  outline: none;
  white-space: pre;
  tab-size: 4;
}

/* CONSOLA DE SALIDA Y ERRORES DIDÁCTICOS */
.console-drawer {
  height: 100px;
  background: #18181b;
  border-top: 1px solid #27272a;
  display: flex;
  flex-direction: column;
}

.console-title {
  background: #27272a;
  color: #a1a1aa;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  text-transform: uppercase;
}

.console-content {
  flex: 1;
  padding: 8px 12px;
  font-family: monospace;
  font-size: 12px;
  color: #e4e4e7;
  overflow-y: auto;
}

.console-line-error {
  color: #f87171;
}

.console-line-success {
  color: #4ade80;
}

/* BARRA DE EJECUCIÓN INFERIOR Y BANDEJA CODEMONKEY */
.execution-action-bar {
  background: #ffffff;
  border-top: 2px solid #e2e8f0;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.cm-action-tray-container {
  background: #fdfbf7;
  border-top: 3px solid #e2d9cc;
  padding: 10px 16px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.05);
}

.cosmic-theme .cm-action-tray-container {
  background: #0f172a;
  border-top: 2px solid #1e293b;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
}

.cm-action-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cm-controls-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cm-controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Botón RUN! icónico estilo CodeMonkey */
.cm-btn-run, .btn-run-code {
  background: linear-gradient(180deg, #99d63f 0%, #76b82a 100%) !important;
  color: #1a2e05 !important;
  border: 3px solid #284407 !important;
  border-radius: 9999px !important;
  padding: 7px 28px !important;
  font-family: 'Fredoka', 'Quicksand', 'Arial Black', sans-serif !important;
  font-size: 19px !important;
  font-weight: 900 !important;
  letter-spacing: 0.5px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  box-shadow: 0 4px 0 #284407, 0 6px 12px rgba(0,0,0,0.15) !important;
  transition: all 0.12s ease !important;
  user-select: none !important;
}

.cm-btn-run:hover, .btn-run-code:hover {
  background: linear-gradient(180deg, #a6e545 0%, #85cb2f 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 0 #284407, 0 8px 16px rgba(0,0,0,0.2) !important;
}

.cm-btn-run:active, .btn-run-code:active {
  transform: translateY(3px) !important;
  box-shadow: 0 1px 0 #284407, 0 2px 4px rgba(0,0,0,0.2) !important;
}

.cm-run-icon {
  font-size: 15px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  background: #284407;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 2px;
}

.cm-run-text {
  font-weight: 900;
  color: #1b3503;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Botón Circular Reset estilo CodeMonkey */
.cm-btn-reset {
  background: linear-gradient(180deg, #7dd3fc 0%, #38bdf8 100%) !important;
  color: #0369a1 !important;
  border: 3px solid #0369a1 !important;
  width: 44px !important;
  height: 44px !important;
  border-radius: 50% !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  box-shadow: 0 4px 0 #075985, 0 4px 10px rgba(0,0,0,0.15) !important;
  transition: all 0.12s ease !important;
  font-size: 22px !important;
  font-weight: 900 !important;
}

.cm-btn-reset:hover {
  background: linear-gradient(180deg, #bae6fd 0%, #60a5fa 100%) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 0 #075985, 0 6px 14px rgba(0,0,0,0.2) !important;
}

.cm-btn-reset:active {
  transform: translateY(3px) !important;
  box-shadow: 0 1px 0 #075985 !important;
}

.cm-reset-arrow {
  display: inline-block;
  color: #ea580c;
  font-size: 24px;
  font-weight: 900;
  text-shadow: 0 1px 0 #ffffff;
  line-height: 1;
}

/* Botones secundarios de herramientas (regla, mapa) */
.cm-btn-tool {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  box-shadow: 0 2px 0 #cbd5e1;
  transition: all 0.12s ease;
}

.cosmic-theme .cm-btn-tool {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
  box-shadow: 0 2px 0 #0f172a;
}

.cm-btn-tool:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.cm-btn-tool:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* BANDEJA DE TECLAS / COMANDOS CODEMONKEY */
.cm-quick-tray {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.cm-tray-btn {
  background: #ffffff;
  border: 2px solid #334155;
  border-radius: 8px;
  padding: 5px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 58px;
  cursor: pointer;
  box-shadow: 0 3px 0 #334155;
  transition: all 0.1s ease;
  user-select: none;
  flex-shrink: 0;
}

.cosmic-theme .cm-tray-btn {
  background: #1e293b;
  border-color: #475569;
  box-shadow: 0 3px 0 #0f172a;
}

.cm-tray-btn:hover {
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #334155;
  border-color: #0284c7;
}

.cosmic-theme .cm-tray-btn:hover {
  background: #334155;
  border-color: #38bdf8;
  box-shadow: 0 5px 0 #0f172a;
}

.cm-tray-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #334155;
}

.cm-tray-icon {
  font-size: 16px;
  line-height: 1.1;
}

.cm-tray-label {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.3px;
}

.cosmic-theme .cm-tray-label {
  color: #f1f5f9;
}

.btn-run-code {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  padding: 10px 28px;
  border-radius: 9999px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.38);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.2px;
}

.btn-run-code:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.48);
  filter: brightness(1.05);
}

.btn-run-code:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.btn-reset-code {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #475569;
  padding: 9px 20px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-reset-code:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   MODAL DE VICTORIA CON ESTRELLAS (IDÉNTICO A CODEMONKEY)
   ============================================================ */
.win-modal-dialog {
  text-align: center;
  max-width: 440px;
}

.stars-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
}

.star-icon {
  font-size: 52px;
  color: #cbd5e1;
  transition: transform 0.3s, color 0.3s;
}

.star-icon.earned {
  color: #facc15;
  transform: scale(1.15);
  filter: drop-shadow(0 4px 8px rgba(250, 204, 21, 0.5));
}

.win-feedback-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 12px;
  color: #166534;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ============================================================
   VISTA ASTRO RUNNER (MODO DE SALTOS Y OBSTÁCULOS ANIMADOS)
   ============================================================ */
.runner-view-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: calc(100vh - 100px);
  padding: 20px 24px;
  background: #090d16;
  color: #f8fafc;
  border-radius: 12px;
  box-sizing: border-box;
}

.runner-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid #334155;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.runner-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.runner-title-icon {
  font-size: 34px;
  background: rgba(249, 115, 22, 0.2);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(249, 115, 22, 0.4);
}

.runner-header-left h2 {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.runner-header-left p {
  margin: 0;
  font-size: 13px;
  color: #94a3b8;
}

.runner-header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.runner-biome-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #334155;
}

.runner-biome-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  margin-right: 4px;
}

.runner-biome-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #cbd5e1;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.runner-biome-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.runner-biome-btn.active {
  background: #f97316;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.4);
}

.runner-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 10px 16px;
}

.runner-hud-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.runner-hud-icon {
  font-size: 18px;
}

.runner-hud-label {
  color: #9ca3af;
  font-size: 12px;
  text-transform: uppercase;
}

.runner-hud-value {
  font-size: 16px;
  font-weight: 800;
  font-family: 'Consolas', monospace;
  color: #ffffff;
}

.runner-canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border: 2px solid #334155;
  background: #020617;
}

#runnerCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 960 / 420;
  cursor: pointer;
}

.runner-gameover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out;
}

.runner-gameover-box {
  background: #1e293b;
  border: 2px solid #ef4444;
  border-radius: 14px;
  padding: 24px 32px;
  text-align: center;
  max-width: 440px;
  box-shadow: 0 12px 36px rgba(239, 68, 68, 0.3);
}

.runner-gameover-box h3 {
  margin: 0 0 8px 0;
  color: #f87171;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.5px;
}

.runner-gameover-box p {
  color: #cbd5e1;
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.4;
}

.runner-gameover-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.runner-bottom-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  gap: 16px;
}

.runner-keys-tip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #94a3b8;
}

.runner-action-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.runner-jump-button {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%) !important;
  color: white !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  padding: 14px 28px !important;
  border-radius: 12px !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.45) !important;
  transition: transform 0.1s, box-shadow 0.1s !important;
  letter-spacing: 0.5px;
}

.runner-jump-button:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.6) !important;
}

/* ========================================================
   BANDEJA DE PROGRAMACIÓN VISUAL CODEMONKEY JR (FILAS 2 Y 3)
   ======================================================== */
.cm-tray-container {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 95%;
  max-width: 660px;
  background: rgba(147, 197, 253, 0.95);
  backdrop-filter: blur(8px);
  border: 3px solid #60a5fa;
  border-radius: 18px;
  padding: 8px 14px;
  box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
  transition: all 0.25s ease;
}

.cm-tray-slots-row {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

.cm-slots-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  overflow-x: auto;
  padding: 4px 2px;
  min-height: 48px;
}

.cm-slot-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px dashed #2563eb;
  background: rgba(239, 246, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  position: relative;
}

.cm-slot-box:hover {
  background: rgba(219, 234, 254, 0.95);
  border-color: #1d4ed8;
}

.cm-slot-box.active-executing {
  border-color: #10b981 !important;
  background: #d1fae5 !important;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.85);
  transform: scale(1.12);
  z-index: 10;
}

.cm-card-token {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 3px 6px rgba(2, 132, 199, 0.35);
  user-select: none;
  animation: popIn 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.cm-play-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 3px solid #ffffff;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cm-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.6);
  filter: brightness(1.08);
}

.cm-play-btn:active {
  transform: scale(0.95);
}

.cm-actions-palette {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.cm-act-btn {
  width: 50px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
  border: 2px solid #ffffff;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cm-act-btn:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 6px 14px rgba(2, 132, 199, 0.45);
  filter: brightness(1.1);
}

.cm-act-btn:active {
  transform: translateY(1px) scale(0.96);
}

.cm-divider {
  width: 2px;
  height: 30px;
  background: rgba(255, 255, 255, 0.6);
  margin: 0 4px;
}

.cm-tool-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cm-tool-btn:hover {
  background: #eff6ff;
  border-color: #60a5fa;
  transform: scale(1.05);
}

