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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #090b12;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #f8fafc;
}

#viewport-3d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

#world-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Barras flotantes 3D sobre cada personaje (Vida, Maná, Stamina) */
.overhead-unit-bars {
  position: absolute;
  transform: translate(-50%, -100%);
  width: 148px;
  background: rgba(9, 13, 24, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 6px;
  padding: 4px 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  transition: opacity 0.12s;
}

.unit-status-pill {
  display: none;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 99px;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pill-stun {
  background: #facc15;
  color: #0f172a;
}

.pill-channel {
  background: #ef4444;
  color: #ffffff;
}

.pill-ignite {
  background: #f97316;
  color: #ffffff;
}

.pill-shield,
.pill-charge {
  background: #0284c7;
  color: #ffffff;
  border: 1px solid #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.7);
}

.unit-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 3px;
  color: #e2e8f0;
}

.unit-hp-text {
  font-size: 10px;
  color: #cbd5e1;
}

.bar-track {
  width: 100%;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 2px;
}

.hp-track { height: 7px; }
.mana-track { height: 6px; }
.stamina-track { display: none !important; }

.bar-fill {
  height: 100%;
  transition: width 0.08s linear;
}

.ally-hp { background: linear-gradient(90deg, #16a34a, #22c55e); }
.enemy-hp { background: linear-gradient(90deg, #dc2626, #ef4444); }
.mana-fill { background: linear-gradient(90deg, #2563eb, #38bdf8); }
.stamina-fill { background: linear-gradient(90deg, #d97706, #fbbf24); }

/* Textos de daño flotantes 3D */
.floating-combat-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 15px;
  font-weight: 800;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.95);
  white-space: nowrap;
  pointer-events: none;
}

.floating-combat-text.big-crit {
  font-size: 20px;
  letter-spacing: 0.5px;
}

/* Barra superior in-game limpia: Menú izquierda, Jefe/Rival centro, Cripta derecha */
#top-bar {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  pointer-events: none;
  z-index: 100;
}

.ingame-top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.btn-menu-pill {
  background: rgba(15, 23, 42, 0.85);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  transition: all 0.15s;
}

.btn-menu-pill:hover {
  background: #1e293b;
  border-color: #38bdf8;
  color: #38bdf8;
  transform: translateY(-1px);
}

.ingame-mode-badge {
  background: rgba(30, 41, 59, 0.7);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
}

.panel-glass {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 8px 12px;
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.btn-ui {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ui:hover {
  background: #334155;
  border-color: #94a3b8;
}

.btn-ui.active-mode {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}

.select-ui, .input-ui {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}

.input-ui {
  width: 105px;
}

#room-code-input, #dm-code {
  text-transform: uppercase;
}

/* Panel central superior: Barras del Rival */
.enemy-boss-frame {
  min-width: 310px;
  text-align: center;
}

#enemy-name-label {
  font-size: 13px;
  font-weight: 800;
  color: #fca5a5;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.enemy-bar-big {
  position: relative;
  height: 16px;
  background: #1e293b;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 3px;
}

#enemy-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #b91c1c, #ef4444);
  transition: width 0.1s;
}

#enemy-hp-text {
  position: absolute;
  inset: 0;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  text-shadow: 0 1px 3px #000;
}

.enemy-subbars {
  display: block;
}

.enemy-subtrack {
  height: 6px;
  background: #0f172a;
  border-radius: 3px;
  overflow: hidden;
}

/* Registro matemático de daño (arriba a la derecha) */
.combat-log-panel {
  width: 340px;
  max-height: 175px;
  display: flex;
  flex-direction: column;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 5px;
  text-transform: uppercase;
}

#combat-log-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  max-height: 130px;
}

.log-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(30, 41, 59, 0.55);
}

.log-ally { border-left: 3px solid #38bdf8; }
.log-enemy { border-left: 3px solid #f87171; }
.log-math strong { color: #fde047; }

/* HUD Inferior: WASD Doble Tecla + Barras de Recursos + Habilidades Q, E, R, F */
#bottom-hud {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 14px;
  pointer-events: none;
}

/* Widget visual WASD Doble Tecla */
.wasd-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.wasd-title {
  font-size: 10px;
  font-weight: 700;
  color: #fbbf24;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.wasd-row {
  display: flex;
  gap: 4px;
}

.keycap {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #1e293b;
  border: 1px solid #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #cbd5e1;
  transition: all 0.08s;
}

.keycap.pressed {
  background: #0284c7;
  border-color: #38bdf8;
  color: #fff;
  transform: translateY(1px);
}

.keycap.dashed {
  background: #f59e0b;
  border-color: #fef08a;
  color: #0f172a;
  box-shadow: 0 0 14px #f59e0b;
  transform: scale(1.12);
}

/* Centro del HUD: Canalización, Barras (Vida, Maná, Stamina) y Hotbar (Q, E, R, F) */
.center-action-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 650px;
}

#castbar-wrapper {
  width: 100%;
  height: 22px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid #f97316;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

#castbar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.04s linear;
}

#castbar-label {
  position: absolute;
  inset: 0;
  text-align: center;
  line-height: 20px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px #000;
}

.player-bars-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hud-bar-row {
  position: relative;
  height: 18px;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 5px;
  overflow: hidden;
}

.hud-bar-fill {
  height: 100%;
  transition: width 0.08s linear;
}

#hud-hp-fill { background: linear-gradient(90deg, #15803d, #22c55e); }
#hud-mp-fill { background: linear-gradient(90deg, #1d4ed8, #38bdf8); }
#hud-sta-fill { background: linear-gradient(90deg, #b45309, #fbbf24); }

.hud-bar-text {
  position: absolute;
  inset: 0;
  text-align: center;
  line-height: 16px;
  font-size: 11px;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

/* Barra de habilidades: LMB, Q, E, R, F, 1 (Heal), ESPACIO, 2x WASD */
.skills-hotbar {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: nowrap;
}

.skill-slot {
  position: relative;
  width: 74px;
  height: 82px;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border: 2px solid #475569;
  border-radius: 10px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.1s, border-color 0.15s;
}

.skill-slot:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
}

.skill-slot.no-resource {
  border-color: #ef4444;
  opacity: 0.65;
}

.skill-slot.charge-active-slot,
.skill-slot.shield-active-slot {
  border-color: #38bdf8;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.85), inset 0 0 12px rgba(56, 189, 248, 0.45);
  background: linear-gradient(180deg, #0369a1, #0f172a);
  transform: translateY(-2px);
}

.keycap-space {
  width: 104px;
  height: 26px;
  font-size: 10px;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.skill-key-badge {
  display: inline-block;
  background: #0f172a;
  border: 1px solid #64748b;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
  align-self: flex-start;
  z-index: 2;
}

.skill-icon {
  font-size: 22px;
  text-align: center;
  z-index: 2;
}

.skill-name {
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  color: #e2e8f0;
  line-height: 1.1;
  z-index: 2;
}

.skill-cost {
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  color: #38bdf8;
  z-index: 2;
}

.skill-cost.sta-cost {
  color: #fbbf24;
}

.cd-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: rgba(2, 6, 23, 0.82);
  z-index: 3;
  transition: height 0.05s linear;
}

.cd-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  color: #fde047;
  z-index: 4;
  text-shadow: 0 2px 5px #000;
}

/* Modales (Victoria, Selección de Modos, Cuentas y Fórmulas) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000; /* Siempre al frente de todas las capas */
}

.hidden {
  display: none !important;
}

.modal-card {
  background: #0f172a;
  border: 1px solid #38bdf8;
  border-radius: 14px;
  padding: 22px 26px;
  max-width: 680px;
  width: 92%;
  max-height: 92vh;
  overflow-y: auto;
  animation: flIn .18s ease-out;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

/* Menú de pausa AAA (PC y Móvil) */
.pause-card {
  max-width: 430px !important;
  width: min(430px, 94vw) !important;
  padding: 20px 22px 16px !important;
  border: 0 !important;
  border-radius: 0 !important;
  --c: 16px;
  --edge: rgba(230, 180, 80, .55);
  --fill: rgba(11, 9, 22, .96);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}
.pause-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  text-align: left;
  gap: 10px;
}
.pause-title {
  margin: 0 !important;
  font-family: var(--fl-display, Georgia, serif);
  font-size: 20px !important;
  letter-spacing: 2.5px;
  color: #ffe3a0;
}
.pause-tag {
  display: inline-block;
  margin-top: 2px;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #38bdf8;
  font-weight: 700;
}
.pause-x {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  flex: none;
}
.pause-x:hover { background: rgba(239, 68, 68, .3); border-color: #ef4444; }
.pause-resume { width: 100%; padding: 12px 18px !important; font-size: 14px !important; }
.pause-audio {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .1);
}
.pa-row {
  display: grid;
  grid-template-columns: 64px 1fr 40px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #e2e8f0;
}
.pa-row input[type="range"] { width: 100%; accent-color: #e6b450; cursor: pointer; }
.pa-mute {
  padding: 4px 6px;
  border: 1px solid rgba(230, 180, 80, .35);
  background: rgba(230, 180, 80, .12);
  color: #fde68a;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 4px;
}
.pa-mute.off { opacity: .5; border-color: rgba(255, 255, 255, .2); color: #94a3b8; background: transparent; }
.pause-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pause-grid .fl-btn { width: 100%; padding: 10px 8px !important; font-size: 11.5px !important; letter-spacing: 1.2px !important; }
.pause-quit { width: 100%; padding: 11px 16px !important; font-size: 12.5px !important; }
.pause-foot { font-size: 11px; color: #8f8ba8; }
body.touch-mode #btn-pause-keys { display: none !important; }
body.touch-mode .pause-card { padding: 12px 16px !important; gap: 8px; max-width: 480px !important; }
body.touch-mode .pause-audio { grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 7px 10px; }
body.touch-mode .pa-row { grid-template-columns: 54px 1fr 34px; gap: 6px; }
body.touch-mode .pause-resume, body.touch-mode .pause-quit { padding: 9px 12px !important; }
body.touch-mode .pause-grid .fl-btn { padding: 8px 6px !important; }
body.touch-mode .pause-foot { display: none; }
@media (max-height: 520px) {
  .pause-card { padding: 12px 16px !important; gap: 8px; max-width: 480px !important; }
  .pause-audio { grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 7px 10px; }
  .pa-row { grid-template-columns: 54px 1fr 34px; gap: 6px; }
  .pause-resume, .pause-quit { padding: 9px 12px !important; }
  .pause-grid .fl-btn { padding: 8px 6px !important; }
  .pause-foot { display: none; }
}

.modal-card h2 {
  margin-bottom: 12px;
  font-size: 22px;
}

.victory-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 14px 0 18px;
}

.stat-col {
  background: #1e293b;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.65;
}

.stat-col h4 {
  color: #38bdf8;
  margin-bottom: 6px;
}

.formula-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 10px 0;
}

.formula-table th, .formula-table td {
  border: 1px solid #334155;
  padding: 6px 8px;
  text-align: left;
}

.formula-table th {
  background: #1e293b;
  color: #38bdf8;
}

.formula-box {
  background: #1e293b;
  border-left: 4px solid #f59e0b;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  margin: 8px 0;
  line-height: 1.5;
}

/* ================= ESTILOS MAZMORRA DE EXTRACCIÓN Y CUENTAS ================= */
.char-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.char-card:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
  background: rgba(30, 41, 59, 0.95);
}

.char-card.selected {
  border-color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
  background: rgba(38, 28, 15, 0.7);
}

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

.char-card-name {
  font-weight: 700;
  font-size: 14px;
  color: #f8fafc;
}

.char-card-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.char-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #94a3b8;
}

/* Minimapa 3x3 */
.mini-cell {
  background: #1e1e24;
  color: #64748b;
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  padding: 6px 2px;
  border-radius: 3px;
  border: 1px solid #334155;
  transition: background 0.15s;
}

.mini-cell.mini-boss {
  border-color: #dc2626;
  color: #f87171;
  background: rgba(153, 27, 27, 0.2);
}

.mini-cell.active-room {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.7);
}

/* Botones de navegación de pestañas */
.tab-active {
  background: #2563eb !important;
  color: #ffffff !important;
}

/* Notificación flotante de botín recogido */
.loot-notification {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid #eab308;
  color: #fde047;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  z-index: 999;
  animation: fadeUp 1.4s forwards;
}

@keyframes fadeUp {
  0% { opacity: 0; transform: translate(-50%, 10px); }
  20% { opacity: 1; transform: translate(-50%, 0); }
  80% { opacity: 1; transform: translate(-50%, -5px); }
  100% { opacity: 0; transform: translate(-50%, -20px); }
}

/* ================= PANTALLA DE TÍTULO Y MENÚ PRINCIPAL ================= */
.game-menu-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(15, 23, 42, 0.78) 0%, rgba(2, 6, 23, 0.95) 100%);
  backdrop-filter: blur(14px);
  animation: fadeInMenu 0.4s ease-out;
}

@keyframes fadeInMenu {
  from { opacity: 0; transform: scale(1.02); }
  to { opacity: 1; transform: scale(1); }
}

.main-menu-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 90%;
  max-width: 520px;
  text-align: center;
  z-index: 10;
}

.game-branding {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.game-emblem {
  font-size: 38px;
  filter: drop-shadow(0 0 16px rgba(234, 179, 8, 0.6));
}

.game-title {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 3px;
  margin: 0;
  background: linear-gradient(180deg, #fef08a 0%, #eab308 50%, #ca8a04 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 14px rgba(202, 138, 4, 0.4));
  text-transform: uppercase;
}

.game-subtitle {
  font-size: 13px;
  color: #cbd5e1;
  letter-spacing: 1px;
  margin: 0;
  font-weight: 500;
}

.menu-hero-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 41, 59, 0.75);
  border: 1px solid rgba(234, 179, 8, 0.35);
  padding: 8px 16px;
  border-radius: 30px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 440px;
  box-sizing: border-box;
}

.hero-badge-avatar {
  font-size: 26px;
}

.hero-badge-info {
  flex: 1;
  text-align: left;
}

.hero-name-label {
  font-weight: 800;
  font-size: 14px;
  color: #f8fafc;
}

.hero-sub-label {
  font-size: 11px;
  color: #38bdf8;
}

.hero-stash-pill {
  font-size: 11px;
  font-weight: 700;
  color: #facc15;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid rgba(250, 204, 21, 0.25);
}

.main-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 380px;
}

.btn-menu-primary {
  background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
  color: #0f172a;
  border: 2px solid #fef08a;
  border-radius: 10px;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(234, 179, 8, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.5);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-transform: uppercase;
}

.btn-menu-primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 32px rgba(234, 179, 8, 0.75), inset 0 2px 6px rgba(255, 255, 255, 0.7);
  border-color: #ffffff;
}

.btn-menu-secondary {
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
}

.btn-menu-secondary:hover {
  background: rgba(51, 65, 85, 0.95);
  border-color: #38bdf8;
  color: #38bdf8;
  transform: translateY(-1px);
}

.game-version-tag {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 6px;
}

/* ================= MODAL DE SELECCIÓN DE MODO ================= */
.mode-select-card {
  max-width: 860px !important;
  background: rgba(13, 17, 28, 0.97) !important;
  border: 1px solid rgba(234, 179, 8, 0.3) !important;
}

.mode-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

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

.mode-choice-card {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s;
}

.mode-choice-card.arena-theme {
  border-color: rgba(56, 189, 248, 0.35);
}

.mode-choice-card.arena-theme:hover {
  border-color: #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.25);
  background: rgba(22, 33, 56, 0.95);
}

.mode-choice-card.dungeon-theme {
  border-color: rgba(168, 85, 247, 0.35);
}

.mode-choice-card.dungeon-theme:hover {
  border-color: #a855f7;
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.25);
  background: rgba(33, 18, 54, 0.95);
}

.mode-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mode-icon {
  font-size: 32px;
}

.mode-card-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #f8fafc;
}

.mode-tagline {
  font-size: 11px;
  color: #94a3b8;
}

.mode-desc {
  font-size: 12px;
  line-height: 1.45;
  color: #cbd5e1;
  margin: 0;
}

.mode-config-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  padding: 10px;
  border-radius: 8px;
}

.config-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  gap: 8px;
}

.config-line label {
  font-weight: 700;
  color: #cbd5e1;
  white-space: nowrap;
}

.btn-launch-mode {
  padding: 12px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
}

.btn-arena {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-arena:hover {
  background: linear-gradient(135deg, #0369a1, #1d4ed8);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.6);
  transform: translateY(-1px);
}

.btn-dungeon {
  background: linear-gradient(135deg, #7e22ce, #9333ea);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(147, 51, 234, 0.4);
}

.btn-dungeon:hover {
  background: linear-gradient(135deg, #6b21a8, #7e22ce);
  box-shadow: 0 0 20px rgba(168, 85, 247, 0.6);
  transform: translateY(-1px);
}



/* ── Números de daño: legibles y con "pop" ── */
.fct { font-size: var(--fs, 16px); font-weight: 900; -webkit-text-stroke: 0.6px rgba(0,0,0,.85); paint-order: stroke fill;
  text-shadow: 0 0 6px rgba(0,0,0,.95), 0 2px 0 rgba(0,0,0,.9), 1px 1px 0 #000, -1px 1px 0 #000, 1px -1px 0 #000, -1px -1px 0 #000;
  animation: fct-pop .22s cubic-bezier(.2,1.6,.4,1) both; text-align: center; line-height: 1; }
.fct small { display: block; font-size: 10px; font-weight: 800; letter-spacing: .5px; color: #fde68a; margin-top: 2px; -webkit-text-stroke: 0; }
.fct.mine { color: #ffffff; } .fct.other { color: #cbd5e1; opacity: .8; }
.fct.taken { color: #ff5a5a; } .fct.crit { color: #facc15; letter-spacing: .5px; } .fct.combo { color: #fcd34d; }
.fct.dot { color: #fb923c; font-weight: 800; }
@keyframes fct-pop { 0% { transform: translate(-50%,-50%) scale(1.9); } 100% { transform: translate(-50%,-50%) scale(1); } }
/* ── Iconos de estado sobre los enemigos ── */
.status-icons-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.status-icons { position: absolute; transform: translate(-50%,-100%); display: none; gap: 2px; pointer-events: none; }
.status-icons i { font-style: normal; font-size: 15px; line-height: 1; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(8,8,16,.78); border: 1.5px solid var(--c, #fff); box-shadow: 0 0 8px var(--c, #fff); animation: st-pulse 1s ease-in-out infinite alternate; }
@keyframes st-pulse { from { transform: scale(1); } to { transform: scale(1.12); } }

/* ===== Cripta: alertas de tensión ===== */
#crypt-alerts{position:fixed;inset:0;pointer-events:none;z-index:40}
#crypt-alerts .ca-edge{position:absolute;transform:translate(-50%,-50%);width:30px;height:30px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:16px;background:rgba(15,10,30,.75);border:2px solid #fb923c;box-shadow:0 0 10px #fb923c;animation:caPulse .7s infinite alternate}
#crypt-alerts .ca-edge.hot{border-color:#ef4444;box-shadow:0 0 14px #ef4444;animation-duration:.35s}
#crypt-alerts .ca-edge.chest{border-color:#fbbf24;box-shadow:0 0 10px #fbbf24}
#crypt-alerts .ca-edge.curse{border-color:#dc2626;box-shadow:0 0 16px #dc2626;animation-duration:.3s}
@keyframes caPulse{from{scale:.88}to{scale:1.15}}
#crypt-alerts .ca-banner{display:none;position:absolute;top:14%;left:50%;transform:translateX(-50%);padding:6px 14px;border-radius:8px;background:rgba(127,29,29,.85);color:#fff;font-weight:700;font-size:14px;border:1px solid #f87171;text-align:center;max-width:90vw}
#crypt-alerts .ca-vig{position:absolute;inset:0;opacity:0;box-shadow:inset 0 0 120px 30px rgba(220,38,38,.65)}
