/* ==========================================================================
   ISLA MATEMÁTICA - DIGITAL KIDS ACADEMY (ESTILOS MEJORADOS)
   ========================================================================== */

:root {
  --bg-dark: #070f26;
  --panel-bg: rgba(9, 18, 44, 0.9);
  --card-bg: rgba(20, 33, 66, 0.93);
  --primary: #f97316;
  --gold: #ffd60a;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #38bdf8;
  --text-light: #f8fafc;
  --text-muted: #cbd5e1;
  --font-title: 'Fredoka', sans-serif;
  --font-body: 'Nunito', sans-serif;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--text-light);
  background: var(--bg-dark);
  user-select: none;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  display: block;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   BARRA SUPERIOR GLOBAL
   ========================================================================== */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  z-index: 40;
  background: linear-gradient(90deg, rgba(6, 13, 33, 0.96), rgba(15, 29, 64, 0.95));
  border-bottom: 3px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  backdrop-filter: blur(10px);
  flex-wrap: nowrap;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.brand-logo-img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid var(--gold);
  object-fit: cover;
  flex-shrink: 0;
}

.brand-logo h1 {
  font-family: var(--font-title);
  font-size: 1.18rem;
  color: var(--gold);
  letter-spacing: 0.5px;
  line-height: 1.1;
  white-space: nowrap;
}

.brand-logo small {
  display: block;
  font-size: 0.73rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.status-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
  flex-shrink: 0;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.2);
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.84rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
}

.stat-pill strong {
  color: var(--gold);
  font-size: 0.94rem;
}

.lives-pill {
  border-color: #f87171;
  background: rgba(239, 68, 68, 0.22);
}

.gold-pill {
  border-color: var(--gold);
  background: rgba(255, 214, 10, 0.18);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-top {
  font-family: var(--font-title);
  font-size: 0.83rem;
  padding: 7px 11px;
  border-radius: 11px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.15s, background 0.15s;
}

.btn-top:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.22);
}

.btn-training {
  background: linear-gradient(135deg, #2563eb, #0284c7);
  border-color: #7dd3fc;
}

.btn-shop {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  border-color: var(--gold);
}

.btn-danger-outline {
  border-color: rgba(239, 68, 68, 0.55);
  color: #fca5a5;
}

/* ==========================================================================
   PANTALLA 0: PUNTO DE ENTRENAMIENTO INTERACTIVO CON EL LOGO ANIMADO
   ========================================================================== */
.screen-overlay {
  position: fixed;
  top: 68px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  background: radial-gradient(circle at top, rgba(9, 20, 48, 0.9), rgba(5, 11, 28, 0.97));
  overflow-y: auto;
  padding: 22px;
}

.training-screen {
  position: fixed;
}

.training-backdrop-art {
  position: fixed;
  top: 68px;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('../Gemini_Generated_Image_rxoo9xrxoo9xrxoo.jpe');
  background-size: cover;
  background-position: center;
  opacity: 0.18;
  pointer-events: none;
  z-index: -1;
}

.training-container {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: stretch;
}

.mascot-column {
  background: rgba(6, 13, 33, 0.94);
  border: 3px solid var(--gold);
  border-radius: 24px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}

.mascot-stage {
  position: relative;
  width: 240px;
  height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mascot-glow {
  position: absolute;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 214, 10, 0.35), transparent 70%);
  border-radius: 50%;
  animation: pulseGlow 2.2s infinite alternate;
}

.dk-mascot-svg {
  width: 215px;
  height: 195px;
  z-index: 2;
  animation: mascotFloat 2.6s ease-in-out infinite;
  transition: transform 0.25s;
}

.mascot-stage:hover .dk-mascot-svg {
  transform: scale(1.06) rotate(-3deg);
}

.mascot-stage.mascot-excited .dk-mascot-svg {
  animation: mascotJumpSpin 0.65s ease-out;
}

.mascot-cap {
  transform-origin: 155px 80px;
  animation: capTilt 3.2s ease-in-out infinite;
}

.mascot-sparks {
  animation: sparksBlink 1.4s ease-in-out infinite alternate;
}

.mascot-eyes {
  transform-origin: 160px 124px;
  animation: eyeBlink 4s infinite;
}

@keyframes mascotFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes mascotJumpSpin {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-22px) scale(1.12) rotate(8deg); }
  70% { transform: translateY(-8px) scale(1.05) rotate(-6deg); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes capTilt {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-4deg) translateY(-3px); }
}

@keyframes sparksBlink {
  0% { opacity: 0.4; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1.06); }
}

@keyframes eyeBlink {
  0%, 92%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.15); }
}

.mascot-click-hint {
  font-size: 0.78rem;
  color: var(--gold);
  background: rgba(255, 214, 10, 0.14);
  padding: 4px 12px;
  border-radius: 999px;
  margin-top: -6px;
  z-index: 3;
}

.mascot-speech-bubble {
  background: rgba(20, 35, 74, 0.95);
  border: 2px solid rgba(56, 189, 248, 0.5);
  border-radius: 18px;
  padding: 16px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mascot-speech-bubble h3 {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 1.12rem;
}

.mascot-speech-bubble p {
  font-size: 0.9rem;
  line-height: 1.42;
  color: #e2e8f0;
}

.mascot-Trick-box {
  background: rgba(6, 13, 33, 0.8);
  border-left: 4px solid var(--green);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.86rem;
  color: #bbf7d0;
  line-height: 1.4;
}

.training-board-column {
  display: flex;
  flex-direction: column;
}

.training-card {
  background: rgba(15, 26, 56, 0.94);
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

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

.training-header-row h2 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  color: var(--gold);
}

.training-pill {
  background: rgba(34, 197, 94, 0.22);
  border: 1px solid #4ade80;
  color: #86efac;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

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

.train-op-btn {
  font-family: var(--font-title);
  font-size: 0.95rem;
  padding: 11px 12px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  background: rgba(30, 41, 59, 0.85);
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
}

.train-op-btn.active {
  background: linear-gradient(135deg, #ffd60a, #f59e0b);
  color: #060d21;
  border-color: #fff;
  font-weight: 700;
}

.table-number-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: rgba(6, 13, 33, 0.65);
  padding: 10px 16px;
  border-radius: 14px;
}

.number-btns-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.num-select-btn {
  font-family: var(--font-title);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: #1e293b;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
}

.num-select-btn.active {
  background: #38bdf8;
  color: #060d21;
  border-color: #fff;
  font-weight: 800;
}

.training-content-split {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
}

.table-display-panel, .practice-mini-panel {
  background: rgba(6, 13, 33, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 16px;
}

.table-display-panel h4, .practice-mini-panel h4 {
  font-family: var(--font-title);
  color: var(--gold);
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.interactive-table-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.table-cell-item {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}

.table-cell-item:hover {
  background: rgba(56, 189, 248, 0.25);
  transform: scale(1.02);
}

.table-cell-item.active-row {
  background: rgba(255, 214, 10, 0.22);
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 214, 10, 0.25);
}

.table-cell-item strong {
  color: var(--gold);
}

.practice-sub {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.training-sample-problem {
  font-family: var(--font-title);
  font-size: 2rem;
  color: #fff;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 8px;
}

.training-sample-hint {
  font-size: 0.85rem;
  color: #7dd3fc;
  text-align: center;
  margin-bottom: 12px;
}

.training-sample-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.training-sample-feedback {
  margin-top: 10px;
  text-align: center;
  font-weight: 800;
  font-size: 0.92rem;
  min-height: 22px;
}

.ready-start-footer {
  margin-top: auto;
  background: linear-gradient(90deg, rgba(22, 163, 74, 0.25), rgba(234, 179, 8, 0.25));
  border: 2px solid #4ade80;
  border-radius: 18px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ready-question {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ready-question strong {
  font-family: var(--font-title);
  font-size: 1.15rem;
  color: #fff;
}

.ready-question span {
  font-size: 0.84rem;
  color: #bbf7d0;
}

.btn-start-mega {
  font-family: var(--font-title);
  font-size: 1.25rem;
  padding: 14px 30px;
  border-radius: 16px;
  border: 3px solid #fff;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.5);
  transition: transform 0.15s;
}

.btn-start-mega:hover {
  transform: scale(1.05);
}

/* ==========================================================================
   PANTALLA 1: LA GRAN ISLA UNIFICADA (LOS 28 NIVELES EN UNA SOLA ISLA)
   ========================================================================== */
.island-unified-wrapper {
  max-width: 1320px;
  margin: 0 auto;
  padding-bottom: 50px;
}

.island-hero-header {
  background: var(--card-bg);
  border: 2px solid rgba(255, 214, 10, 0.45);
  border-radius: 22px;
  padding: 18px 22px;
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-explorer-preview {
  display: flex;
  align-items: center;
  gap: 18px;
}

.explorer-ref-thumb {
  width: 135px;
  height: 86px;
  object-fit: cover;
  border-radius: 14px;
  border: 3px solid var(--gold);
}

.hero-explorer-preview h2 {
  font-family: var(--font-title);
  font-size: 1.55rem;
  color: var(--gold);
  margin-bottom: 4px;
}

.hero-explorer-preview p {
  font-size: 0.92rem;
  color: #e2e8f0;
  line-height: 1.4;
}

.island-quick-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.filter-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.world-tab-btn {
  font-family: var(--font-title);
  font-size: 0.9rem;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  cursor: pointer;
}

.world-tab-btn.active {
  background: var(--gold);
  color: #060d21;
  border-color: #fff;
  font-weight: 700;
}

.unified-island-regions {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.island-region-block {
  background: rgba(14, 25, 54, 0.88);
  border: 3px solid var(--region-color, #22c55e);
  border-radius: 24px;
  padding: 20px;
}

.region-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px dashed rgba(255, 255, 255, 0.15);
}

.region-block-header h3 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--gold);
}

.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(275px, 1fr));
  gap: 16px;
}

.level-card {
  background: var(--card-bg);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: transform 0.18s, border-color 0.18s;
}

.level-card.unlocked:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
}

.level-card.completed {
  border-color: #22c55e;
}

.level-card.locked {
  opacity: 0.55;
}

.level-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.level-badge {
  background: var(--world-color, #22c55e);
  color: #fff;
  padding: 3px 10px;
  border-radius: 999px;
}

.biome-mini-tag {
  font-size: 0.76rem;
  color: #7dd3fc;
  font-weight: 800;
}

.level-name {
  font-family: var(--font-title);
  font-size: 1.15rem;
  color: #fff;
}

.level-desc {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.level-boss-meta, .level-reward-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  background: rgba(6, 13, 33, 0.65);
  padding: 7px 10px;
  border-radius: 10px;
}

.btn-play-level, .btn-primary, .btn-secondary, .btn-buy, .btn-ghost {
  font-family: var(--font-title);
  font-size: 0.96rem;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: transform 0.12s;
}

.btn-play-level, .btn-primary {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
}

.btn-play-level:disabled, .btn-buy:disabled, .btn-primary:disabled {
  background: #475569;
  color: #94a3b8;
  cursor: not-allowed;
}

.btn-secondary {
  background: #334155;
  color: #f8fafc;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-ghost {
  background: transparent;
  color: #cbd5e1;
  border: 1px dashed rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   TIENDA Y PERSONALIZACIÓN
   ========================================================================== */
.shop-container {
  max-width: 1240px;
  margin: 0 auto;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  background: var(--card-bg);
  padding: 20px;
  border-radius: 18px;
  border: 2px solid var(--gold);
}

.shop-section-title {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: var(--gold);
  margin: 18px 0 12px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.shop-card {
  background: var(--card-bg);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.shop-card.equipped-card {
  border-color: #22c55e;
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.28);
}

.shop-cat-tag {
  font-size: 0.74rem;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.1);
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--gold);
}

.shop-owned-pill {
  font-size: 0.85rem;
  font-weight: 800;
  color: #38bdf8;
}

.btn-buy {
  width: 100%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
}

.btn-buy.btn-equipped {
  background: #16a34a;
}

/* ==========================================================================
   HUD DE JUEGO 3D + RETOS DE CAMINO + ARENA DE JEFE
   ========================================================================== */
.hud-layer {
  position: fixed;
  top: 68px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  pointer-events: none;
}

.hud-top-panel {
  pointer-events: auto;
  margin: 12px 20px;
  background: rgba(6, 13, 33, 0.86);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  backdrop-filter: blur(8px);
}

.biome-tag {
  font-size: 0.76rem;
  font-weight: 900;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.camera-badge {
  display: inline-block;
  margin-top: 3px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.camera-badge.normal-vertical {
  background: rgba(56, 189, 248, 0.22);
  color: #bae6fd;
}

.camera-badge.secret-horizontal {
  background: linear-gradient(90deg, #a855f7, #ec4899);
  color: #fff;
}

.hud-progress-wrapper {
  flex: 1;
  max-width: 520px;
}

.checkpoints-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.76rem;
  font-weight: 800;
}

.cp-pill {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #94a3b8;
}

.cp-pill.active {
  background: rgba(34, 197, 94, 0.3);
  color: #86efac;
  border: 1px solid #22c55e;
}

.level-progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  overflow: hidden;
}

.level-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #ffd60a);
  transition: width 0.15s;
}

.hud-quick-actions {
  display: flex;
  gap: 8px;
}

.btn-hud-camp, .btn-hud-exit {
  font-family: var(--font-title);
  padding: 9px 14px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 0.86rem;
}

.btn-hud-camp { background: #0d9488; color: #fff; }
.btn-hud-exit { background: #475569; color: #fff; }

.boss-crate-prompt {
  pointer-events: auto;
  position: fixed;
  top: 162px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(88, 28, 135, 0.95);
  border: 3px solid #e879f9;
  border-radius: 18px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
}

/* Modal de Operación Matemática en el Camino */
.path-math-overlay {
  pointer-events: auto;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 35;
  width: min(520px, 92vw);
}

.path-math-card {
  background: rgba(6, 13, 33, 0.96);
  border: 3px solid #38bdf8;
  border-radius: 24px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75);
}

.path-gate-badge {
  display: inline-block;
  background: rgba(56, 189, 248, 0.22);
  color: #7dd3fc;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.path-math-card h3 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--gold);
  margin-bottom: 6px;
}

.path-math-card p {
  font-size: 0.9rem;
  color: #cbd5e1;
  margin-bottom: 12px;
}

/* Combate contra el Jefe Final (Compacto abajo para ver bien al Jefe 3D) */
.boss-battle-overlay {
  pointer-events: auto;
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(510px, 92vw);
  z-index: 30;
}

.boss-card {
  background: rgba(6, 13, 33, 0.84);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 10px 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
}

.boss-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.boss-header-row h2 {
  font-size: 1.05rem;
  line-height: 1.1;
}

.question-source-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(56, 189, 248, 0.22);
  color: #7dd3fc;
  padding: 2px 8px;
  border-radius: 999px;
}

.boss-hp-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 175px;
  font-size: 0.8rem;
}

.boss-hp-bar {
  flex: 1;
  height: 12px;
  background: #334155;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.boss-hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ef4444, #f97316);
  transition: width 0.25s;
}

.boss-timer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.78rem;
}

.boss-timer-bar {
  flex: 1;
  height: 8px;
  background: #1e293b;
  border-radius: 999px;
  overflow: hidden;
}

.boss-timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #38bdf8, #22c55e);
  transition: width 0.1s linear;
}

.boss-timer-fill.urgent {
  background: #ef4444;
}

.math-arena-box {
  background: rgba(20, 33, 66, 0.78);
  border-radius: 14px;
  padding: 8px 10px;
  text-align: center;
}

.math-operation-big {
  font-family: var(--font-title);
  font-size: 1.45rem;
  color: var(--gold);
  margin-bottom: 6px;
}

.math-input-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 6px;
}

#boss-answer-input {
  width: 145px;
  font-family: var(--font-title);
  font-size: 1.05rem;
  padding: 5px 10px;
  border-radius: 10px;
  border: 2px solid #94a3b8;
  background: #060d21;
  color: #fff;
  text-align: center;
}

.btn-shoot-power {
  font-family: var(--font-title);
  font-size: 0.92rem;
  padding: 5px 14px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  color: #fff;
  cursor: pointer;
}

.quick-options-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.boss-options-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.btn-math-option {
  font-family: var(--font-title);
  font-size: 0.98rem;
  padding: 6px 8px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: #1e293b;
  color: #fff;
  cursor: pointer;
}

.btn-math-option:hover {
  background: #2563eb;
}

/* Controles inferiores */
.controls-helper {
  position: fixed;
  bottom: 14px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}

.keyboard-hints {
  background: rgba(6, 13, 33, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 14px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.8rem;
}

.touch-controls {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.dpad-mid {
  display: flex;
  gap: 4px;
}

.touch-btn {
  font-family: var(--font-title);
  min-width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(6, 13, 33, 0.85);
  color: #fff;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 0 12px;
}

.action-pad { display: flex; gap: 8px; }
.action-jump { background: rgba(34, 197, 94, 0.85); }
.action-spin { background: rgba(249, 115, 22, 0.88); }
.action-sprint { background: rgba(59, 130, 246, 0.85); }

/* Modales y Toasts */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(6, 13, 33, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
}

.modal-box {
  background: #142142;
  border: 3px solid var(--gold);
  border-radius: 24px;
  max-width: 500px;
  width: 100%;
  padding: 26px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-actions-col { display: flex; flex-direction: column; gap: 10px; }
.modal-actions-row { display: flex; justify-content: center; gap: 12px; }

.loot-box {
  background: rgba(6, 13, 33, 0.75);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loot-item { font-family: var(--font-title); font-size: 1.3rem; }
.loot-item.gold { color: var(--gold); }
.loot-item.lives { color: #4ade80; }

#toast-container {
  position: fixed;
  top: 78px;
  right: 20px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.game-toast {
  background: rgba(6, 13, 33, 0.95);
  border-left: 5px solid var(--gold);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  transition: opacity 0.3s, transform 0.3s;
}

.game-toast.fade-out {
  opacity: 0;
  transform: translateX(20px);
}

@media (max-width: 980px) {
  .training-container {
    grid-template-columns: 1fr;
  }
  .training-content-split {
    grid-template-columns: 1fr;
  }
}
