/* ============================================================================
   SKILL TREE V2 — diseño rediseñado
   2026-05-14
   ============================================================================ */

/* ─── Page header con badge BETA ─── */
.st2-page-header .page-title { display: flex; align-items: center; gap: 10px; }
.st2-beta-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 3px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ffc857, #e9a82b);
  color: #1f1206;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(255,200,87,0.45);
  vertical-align: middle;
}

/* ─── Shell ─── */
.st2-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ─── Topbar: puntos + acciones ─── */
.st2-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(28,19,52,0.85), rgba(10,5,24,0.85));
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.st2-points {
  display: flex;
  align-items: center;
  gap: 12px;
}
.st2-points-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(255,200,87,0.22), rgba(255,200,87,0.06));
  border: 1px solid rgba(255,200,87,0.4);
  color: #ffc857;
  font-size: 22px;
  box-shadow: 0 0 18px rgba(255,200,87,0.32);
}
.st2-points-label {
  font-family: var(--font-title);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 2px;
}
.st2-points-val {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 800;
  color: #ffc857;
  line-height: 1;
}
.st2-actions {
  display: flex;
  gap: 8px;
}

/* ─── Tabs de rama ─── */
.st2-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.st2-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(28,19,52,0.55);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.st2-tab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, color-mix(in srgb, var(--st2-color) 12%, transparent), transparent 65%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.st2-tab:hover::before,
.st2-tab.active::before { opacity: 1; }
.st2-tab:hover {
  border-color: color-mix(in srgb, var(--st2-color) 50%, transparent);
  transform: translateY(-1px);
}
.st2-tab.active {
  background: linear-gradient(180deg, color-mix(in srgb, var(--st2-color) 18%, transparent), rgba(0,0,0,0.4));
  border-color: var(--st2-color);
  color: #fff;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--st2-color) 28%, transparent);
}
.st2-tab-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--st2-color) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--st2-color) 38%, transparent);
  color: var(--st2-color);
  font-size: 22px;
  flex: 0 0 auto;
}
.st2-tab-body { flex: 1; min-width: 0; }
.st2-tab-name {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.st2-tab-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.st2-tab-bar {
  flex: 1;
  height: 5px;
  background: rgba(0,0,0,0.4);
  border-radius: 999px;
  overflow: hidden;
}
.st2-tab-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--st2-color), color-mix(in srgb, var(--st2-color) 60%, white));
  border-radius: inherit;
  transition: width 0.4s ease;
}
.st2-tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  white-space: nowrap;
}

/* ─── Main layout: canvas full-width + bonuses panel flotante (overlay) ─── */
/* 2026-05-14 v2: el panel de bonuses ahora se superpone al canvas (position:absolute)
   en lugar de reducir su ancho. El canvas siempre usa el 100%. */
.st2-main {
  position: relative;
  display: block;
  width: 100%;
}

/* ─── Canvas con nodos ─── */
.st2-canvas-wrap {
  position: relative;
  background: linear-gradient(180deg, rgba(28,19,52,0.65), rgba(10,5,24,0.85));
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  overflow: hidden;
  min-height: 540px;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.4);
}
/* 2026-05-14: background image por rama — pintado de /assets/skill-tree/{branch}.webp */
.st2-canvas-wrap[data-branch="warrior"] .st2-canvas-bg-img {
  background-image: url('/assets/skill-tree/warrior.webp');
}
.st2-canvas-wrap[data-branch="merchant"] .st2-canvas-bg-img {
  background-image: url('/assets/skill-tree/merchant.webp');
}
.st2-canvas-wrap[data-branch="explorer"] .st2-canvas-bg-img {
  background-image: url('/assets/skill-tree/explorer.webp');
}
.st2-canvas-bg-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.32;
  filter: saturate(0.85) contrast(1.05);
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 100%);
}
.st2-canvas-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 50%, transparent 100%);
  opacity: 0.5;
}
/* Vignette para oscurecer bordes y centrar mirada */
.st2-canvas-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(10,5,24,0.85) 100%);
  pointer-events: none;
}
.st2-canvas {
  position: relative;
  padding: 16px;
  z-index: 1;
}

/* ─── Líneas conectoras ─── */
.st2-line {
  transition: stroke 0.25s ease, opacity 0.25s ease, stroke-width 0.25s ease;
}
.st2-line-active {
  stroke-dasharray: 6 4;
  animation: st2-line-flow 1.6s linear infinite;
}
@keyframes st2-line-flow {
  to { stroke-dashoffset: -20; }
}

/* ─── Nodos SVG ─── */
/* IMPORTANTE: NO usar `transform` CSS en `.st2-node` porque el `<g>` ya tiene
   `transform="translate(x,y)"` SVG attr — el CSS lo reemplazaría y el nodo
   saltaría al origen. En vez de eso, aplicamos los efectos en los circles internos. */
.st2-node { cursor: pointer; }
.st2-node .st2-node-bg {
  fill: rgba(20,12,40,0.85);
  stroke: rgba(255,255,255,0.15);
  stroke-width: 2;
  transition: fill 0.2s ease, stroke 0.2s ease, stroke-width 0.2s ease, r 0.18s ease;
}
.st2-node .st2-node-ring {
  stroke: transparent;
  stroke-width: 2;
  transition: stroke 0.2s ease, stroke-opacity 0.2s ease, stroke-width 0.2s ease, r 0.18s ease;
}
.st2-node .st2-node-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.45);
  transition: color 0.2s ease, transform 0.18s ease;
  line-height: 1;
}
.st2-node .st2-node-icon iconify-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  color: inherit;
}
/* También en cards mobile + tooltip + modal */
.st2-card-iconbox iconify-icon { width: 0.95em; height: 0.95em; color: inherit; }
.st2-tt-icon iconify-icon { width: 0.95em; height: 0.95em; color: inherit; }
.st2n-icon iconify-icon { width: 1em; height: 1em; color: inherit; }
.st2-tab-icon iconify-icon { width: 1em; height: 1em; color: inherit; }
/* Hover: efectos solo en los elementos internos, NUNCA en el <g> outer */
.st2-node:hover .st2-node-ring { stroke-opacity: 0.85; stroke-width: 3; }
.st2-node:hover .st2-node-icon { transform: scale(1.12); }
.st2-node:hover .st2-node-bg { filter: drop-shadow(0 0 10px color-mix(in srgb, var(--branch-color, #fff) 70%, transparent)); }
.st2-node-level {
  fill: rgba(255,255,255,0.55);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  pointer-events: none;
}

/* Estados de nodo */
.st2-node-locked .st2-node-bg { fill: rgba(15,10,30,0.95); stroke: rgba(255,255,255,0.08); }
.st2-node-locked .st2-node-icon { color: rgba(255,255,255,0.22); }
.st2-node-locked .st2-node-level { fill: rgba(255,255,255,0.28); }

.st2-node-available .st2-node-bg {
  fill: rgba(20,12,40,0.9);
  stroke: var(--branch-color);
  stroke-opacity: 0.6;
}
.st2-node-available .st2-node-icon { color: var(--branch-color); opacity: 0.85; }
.st2-node-available .st2-node-ring {
  stroke: var(--branch-color);
  stroke-opacity: 0.18;
}
.st2-node-available:hover .st2-node-ring { stroke-opacity: 0.5; }

.st2-node-allocated .st2-node-bg {
  fill: color-mix(in srgb, var(--branch-color) 18%, rgba(20,12,40,0.92));
  stroke: var(--branch-color);
  stroke-width: 2.5;
}
.st2-node-allocated .st2-node-icon { color: var(--branch-color); }
.st2-node-allocated .st2-node-level { fill: #fff; }
.st2-node-allocated .st2-node-ring {
  stroke: var(--branch-color);
  stroke-opacity: 0.35;
}

.st2-node-maxed .st2-node-bg {
  fill: color-mix(in srgb, var(--branch-color) 28%, rgba(20,12,40,0.92));
  stroke: var(--branch-color);
  stroke-width: 3;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--branch-color) 50%, transparent));
}
.st2-node-maxed .st2-node-icon { color: #fff; }
.st2-node-maxed .st2-node-level { fill: #fff; font-weight: 800; }
.st2-node-maxed .st2-node-ring {
  stroke: var(--branch-color);
  stroke-opacity: 0.65;
  stroke-dasharray: 3 2;
}

/* Pips (mini circles arriba del nodo) */
.st2-pip { transition: fill 0.2s ease; }
.st2-pip.is-on { filter: drop-shadow(0 0 3px currentColor); }

/* ─── Tooltip flotante ─── */
.st2-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 50;
  min-width: 240px;
  max-width: 320px;
  background: linear-gradient(180deg, rgba(28,19,52,0.97), rgba(10,5,24,0.97));
  border: 1px solid color-mix(in srgb, var(--st2-color, #fff) 45%, transparent);
  border-radius: 12px;
  box-shadow:
    0 14px 40px rgba(0,0,0,0.6),
    0 0 24px color-mix(in srgb, var(--st2-color, #fff) 25%, transparent);
  padding: 0;
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  transition: opacity 0.14s ease, transform 0.14s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.st2-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.st2-tt-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: color-mix(in srgb, var(--st2-color) 10%, transparent);
}
.st2-tt-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--st2-color) 22%, rgba(0,0,0,0.4));
  border: 1px solid color-mix(in srgb, var(--st2-color) 45%, transparent);
  color: var(--st2-color);
  font-size: 20px;
  flex: 0 0 auto;
}
.st2-tt-titlewrap { flex: 1; min-width: 0; }
.st2-tt-name {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 2px;
}
.st2-tt-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.05em;
}
.st2-tt-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.st2-tt-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: rgba(255,255,255,0.85);
}
.st2-tt-row b { color: #fff; }
.st2-tt-tag {
  flex: 0 0 auto;
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.st2-tt-tag.tag-cur {
  background: rgba(95,214,132,0.18);
  border: 1px solid rgba(95,214,132,0.4);
  color: #5fd684;
}
.st2-tt-tag.tag-next {
  background: rgba(78,195,247,0.18);
  border: 1px solid rgba(78,195,247,0.4);
  color: #4ec3f7;
}
.st2-tt-row.st2-tt-maxed {
  align-items: center;
  color: #ffc857;
  font-weight: 700;
  font-family: var(--font-title);
  letter-spacing: 0.04em;
}
.st2-tt-prereq {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin-top: 4px;
  border-radius: 8px;
  background: rgba(232,90,106,0.10);
  border: 1px solid rgba(232,90,106,0.35);
  color: #ffaeb6;
  font-size: 11px;
}
.st2-tt-prereq i { color: #e85a6a; }
.st2-tt-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(0,0,0,0.25);
  border-radius: 0 0 12px 12px;
  font-family: var(--font-title);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}

/* ─── Bonuses sidebar panel (overlay flotante sobre el canvas, 2026-05-14 v2) ─── */
.st2-bonuses-panel {
  background: linear-gradient(180deg, rgba(28,19,52,0.92), rgba(10,5,24,0.96));
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  overflow: hidden;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 280px;
  z-index: 20;
  transition: width 0.3s ease, transform 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 14px 40px rgba(0,0,0,0.55);
}
/* Toggle del panel — header clickeable */
.st2-bonuses-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent);
  border: none;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}
.st2-bonuses-toggle:hover {
  background: linear-gradient(180deg, rgba(255,200,87,0.10), rgba(255,200,87,0.02));
  color: #fff;
}
.st2-bonuses-toggle > i:first-child { color: #ffc857; font-size: 18px; flex: 0 0 auto; }
.st2-bonuses-toggle-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st2-bonuses-toggle-caret {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  flex: 0 0 auto;
  transition: transform 0.25s ease;
}
.st2-bonuses-toggle:hover .st2-bonuses-toggle-caret { color: #ffc857; }

/* Estado colapsado: pestaña vertical pegada al borde, solo icono + caret */
.st2-bonuses-panel.is-collapsed {
  width: 44px;
  background: linear-gradient(180deg, rgba(28,19,52,0.92), rgba(10,5,24,0.96));
}
.st2-bonuses-panel.is-collapsed .st2-bonuses-toggle {
  padding: 14px 6px;
  flex-direction: column;
  gap: 10px;
  border-bottom: none;
  text-align: center;
  min-height: 180px;
  justify-content: flex-start;
}
.st2-bonuses-panel.is-collapsed .st2-bonuses-toggle-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-align: center;
  white-space: nowrap;
  margin: 4px 0;
  flex: 1;
}
.st2-bonuses-panel.is-collapsed .st2-bonuses-body {
  display: none;
}
.st2-bonuses-panel.is-collapsed .st2-bonuses-toggle-caret {
  transform: rotate(0deg);
}

/* Head estático (usado solo por la sección de bonus de mobile, que no es colapsable) */
.st2-bonuses-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent);
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.85);
}
.st2-bonuses-head > i { color: #ffc857; font-size: 18px; }
.st2-bonuses-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 480px;
  overflow-y: auto;
}
.st2-bonus-empty {
  padding: 16px;
  text-align: center;
  color: rgba(255,255,255,0.5);
  font-size: 12px;
}
.st2-bonus-empty i { font-size: 24px; color: rgba(255,255,255,0.3); display: block; margin-bottom: 8px; }
.st2-bonus-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  transition: background 0.15s ease;
}
.st2-bonus-row:hover { background: rgba(255,255,255,0.04); }
.st2-bonus-icon {
  width: 22px; height: 22px;
  border-radius: 6px;
  display: grid; place-items: center;
  background: rgba(95,214,132,0.18);
  color: #5fd684;
  font-size: 11px;
  flex: 0 0 auto;
}
.st2-bonus-key {
  flex: 1;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}
.st2-bonus-val {
  font-family: var(--font-mono);
  font-weight: 800;
  color: #5fd684;
  font-size: 12.5px;
}

/* ─── Mobile vs desktop canvas visibility ─── */
.st2-canvas-wrap-mobile,
.st2-mobile-bonuses { display: none; }
.st2-canvas-wrap-desktop { display: block; }

.st2-mtier {
  margin-bottom: 16px;
}
.st2-mtier-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--st2-color) 18%, rgba(0,0,0,0.5)), rgba(0,0,0,0.5));
  border-left: 4px solid var(--st2-color);
  border-radius: 10px;
  margin-bottom: 8px;
}
.st2-mtier-num {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #fff;
  flex: 0 0 auto;
}
.st2-mtier-bar {
  flex: 1;
  height: 5px;
  background: rgba(0,0,0,0.5);
  border-radius: 999px;
  overflow: hidden;
}
.st2-mtier-bar-fill {
  height: 100%;
  background: var(--st2-color);
  transition: width 0.4s ease;
}
.st2-mtier-progress {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
  flex: 0 0 auto;
}
.st2-mtier-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.st2-card {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 11px 12px;
  background: rgba(20,14,40,0.7);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}
.st2-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0; width: 3px;
  border-radius: 12px 0 0 12px;
  background: var(--st2-color);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.st2-card:hover { border-color: color-mix(in srgb, var(--st2-color) 50%, transparent); transform: translateY(-1px); }
.st2-card-allocated::before,
.st2-card-maxed::before { opacity: 0.8; }
.st2-card-locked { opacity: 0.55; }

.st2-card-iconbox {
  width: 46px; height: 46px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--st2-color) 16%, rgba(0,0,0,0.4));
  border: 1px solid color-mix(in srgb, var(--st2-color) 35%, transparent);
  color: var(--st2-color);
  font-size: 22px;
  flex: 0 0 auto;
}
.st2-card-allocated .st2-card-iconbox,
.st2-card-maxed .st2-card-iconbox {
  background: color-mix(in srgb, var(--st2-color) 30%, rgba(0,0,0,0.4));
  color: #fff;
}
.st2-card-body { flex: 1; min-width: 0; }
.st2-card-name {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 13.5px;
  color: #fff;
  margin-bottom: 2px;
}
.st2-card-desc {
  font-size: 11.5px;
  color: rgba(255,255,255,0.65);
  line-height: 1.35;
}
.st2-card-prereq {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(232,90,106,0.1);
  border: 1px solid rgba(232,90,106,0.3);
  color: #ffaeb6;
  font-size: 10.5px;
}
.st2-card-prereq i { color: #e85a6a; font-size: 11px; }
.st2-card-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
  flex: 0 0 auto;
}
.st2-card-lv {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 14px;
  color: var(--st2-color);
  letter-spacing: 0.04em;
}
.st2-card-locked .st2-card-lv { color: rgba(255,255,255,0.4); }
.st2-card-side > i { font-size: 22px; color: var(--st2-color); }
.st2-card-locked .st2-card-side > i { color: rgba(255,255,255,0.4); }
.st2-card-maxed .st2-card-side > i { color: #5fd684; }

/* ─── Node modal v2 ─── */
.st2-node-modal {
  max-width: 440px;
  background: linear-gradient(180deg, #1c1334 0%, #0a0518 100%);
  padding: 0;
  overflow: hidden;
  position: relative;
}
.st2n-header {
  padding: 24px 22px 18px;
  text-align: center;
  background:
    radial-gradient(circle at center top, color-mix(in srgb, var(--st2-color) 30%, transparent), transparent 70%),
    transparent;
  border-bottom: 1px solid color-mix(in srgb, var(--st2-color) 25%, transparent);
}
.st2n-icon {
  width: 76px; height: 76px;
  border-radius: 18px;
  display: grid; place-items: center;
  margin: 0 auto 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--st2-color) 35%, transparent), color-mix(in srgb, var(--st2-color) 15%, transparent));
  border: 1px solid color-mix(in srgb, var(--st2-color) 55%, transparent);
  color: #fff;
  font-size: 38px;
  box-shadow: 0 0 28px color-mix(in srgb, var(--st2-color) 45%, transparent);
}
.st2n-name {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 22px;
  color: #fff;
  letter-spacing: 0.02em;
}
.st2n-branch {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--st2-color) 80%, white);
  margin-top: 4px;
}
.st2n-pips {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 14px 16px 6px;
}
.st2n-pip {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.18);
  transition: all 0.2s ease;
}
.st2n-pip.is-on {
  background: var(--st2-color);
  border-color: var(--st2-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--st2-color) 60%, transparent);
}
.st2n-stats {
  padding: 8px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.st2n-stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  font-size: 13px;
  color: rgba(255,255,255,0.85);
}
.st2n-stat-row b { color: #fff; }
.st2n-tag {
  flex: 0 0 auto;
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: var(--font-title);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.st2n-tag.tag-cur {
  background: rgba(95,214,132,0.18);
  border: 1px solid rgba(95,214,132,0.4);
  color: #5fd684;
}
.st2n-tag.tag-next {
  background: rgba(78,195,247,0.18);
  border: 1px solid rgba(78,195,247,0.4);
  color: #4ec3f7;
}
.st2n-stat-max {
  background: linear-gradient(135deg, rgba(255,200,87,0.15), rgba(255,200,87,0.05));
  border-color: rgba(255,200,87,0.4);
  color: #ffc857;
  font-family: var(--font-title);
  font-weight: 800;
  letter-spacing: 0.06em;
  justify-content: center;
}
.st2n-prereq {
  margin: 0 18px 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(232,90,106,0.10);
  border: 1px solid rgba(232,90,106,0.35);
  color: #ffaeb6;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.st2n-prereq.is-met {
  background: rgba(95,214,132,0.10);
  border-color: rgba(95,214,132,0.35);
  color: #b6f0ce;
}
.st2n-prereq.is-met i { color: #5fd684; }
.st2n-prereq i { color: #e85a6a; font-size: 16px; }
.st2n-allocate {
  display: block;
  width: calc(100% - 36px);
  margin: 8px 18px 22px;
  padding: 13px;
  font-family: var(--font-title);
  letter-spacing: 0.05em;
}

/* ─── RESPONSIVE: Mobile (≤900px) ─── */
@media (max-width: 900px) {
  /* 2026-05-19: aprovechar más ancho en mobile — negative margin para escapar
     del padding del main-area (16px lateral) y ganar ~16px por lado. */
  .st2-shell {
    margin-left: -8px;
    margin-right: -8px;
  }
  .st2-canvas-wrap {
    border-radius: 14px;
  }
  .st2-main { display: none; }
  .st2-canvas-wrap-mobile { display: block; min-height: 480px; }
  .st2-mobile-bonuses {
    display: block;
    margin-top: 14px;
    background: linear-gradient(180deg, rgba(28,19,52,0.75), rgba(10,5,24,0.85));
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    overflow: hidden;
  }
  /* 2026-05-19: 2 columnas (2×2) en mobile, icono AL LADO del nombre (horizontal)
     para ocupar menos altura vertical y dejar más espacio al árbol abajo. */
  .st2-tabs { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .st2-tab {
    padding: 8px 9px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    text-align: left;
  }
  .st2-tab-body { flex: 1; min-width: 0; text-align: left; }
  .st2-tab-name {
    font-size: 11.5px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.03em;
  }
  .st2-tab-icon {
    width: 32px;
    height: 32px;
    font-size: 17px;
    border-radius: 9px;
    flex: 0 0 32px;
  }
  .st2-tab-progress-wrap { justify-content: flex-start; gap: 6px; }
  .st2-tab-bar { height: 4px; }
  .st2-tab-count { font-size: 10px; flex: 0 0 auto; }
  /* Canvas mobile específico: scroll vertical fluido */
  .st2-canvas-wrap-mobile .st2-canvas { padding: 8px; }

  /* 2026-05-19: Topbar compacto en mobile.
     Layout: fila 1 = caja enmarcada [✨ ico] "PUNTOS DISPONIBLES" XX,
             fila 2 = botones Reset 1 / Respec. */
  .st2-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .st2-points {
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 200, 87, 0.35);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 200, 87, 0.08), rgba(0, 0, 0, 0.35));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  }
  .st2-points-icon {
    width: 36px;
    height: 36px;
    font-size: 17px;
    border-radius: 10px;
    flex: 0 0 36px;
  }
  /* Label y número AL LADO (no apilados) */
  .st2-points-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
  }
  .st2-points-label {
    font-size: 10px;
    letter-spacing: 0.1em;
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .st2-points-val {
    font-size: 22px;
    line-height: 1;
    flex: 0 0 auto;
  }
  /* Botones abajo en grid 2-cols (o 3 si está el +10 admin) */
  .st2-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  /* Admin tiene 3 botones (+10, Reset 1, Respec) → 3 cols */
  .st2-actions:has(.btn:nth-child(3)) {
    grid-template-columns: repeat(3, 1fr);
  }
  .st2-actions .btn {
    padding: 9px 8px;
    font-size: 12px;
    min-height: 38px;
    border-radius: 9px;
    width: 100%;
    justify-content: center;
  }
  .st2-actions .btn i { font-size: 13px; }

  /* 2026-05-19: subir visibilidad de iconos en estado locked/available
     — antes el locked era 0.22 (apenas visible en pantallas brillantes mobile). */
  .st2-node-locked .st2-node-icon { color: rgba(255,255,255,0.5); }
  .st2-node-available .st2-node-icon { color: var(--branch-color); opacity: 1; }
}
@media (min-width: 901px) {
  .st2-canvas-wrap-mobile,
  .st2-mobile-bonuses { display: none; }
}

/* ─── Mobile modal adjustments ─── */
@media (max-width: 480px) {
  .st2-node-modal { max-width: calc(100vw - 32px); }
  .st2n-icon { width: 64px; height: 64px; font-size: 30px; }
  .st2n-name { font-size: 18px; }
}

/* ============================================================================
   RESPEC 1 PUNTO MODAL (2026-05-14) — selector de nodo a resetear con 50 gemas
   ============================================================================ */
/* 2026-05-19: el overlay NO debe scrollearse (eso causaba que iOS Safari
   propague el touch al body de fondo). El scroll vive dentro de .st2-r1-content.
   El bloqueo de body scroll se hace en JS al abrir/cerrar el modal. */
#st2r1-overlay {
  align-items: flex-start;
  padding: 16px;
  overflow: hidden;
  overscroll-behavior: contain;
}
.st2-r1-modal {
  max-width: 540px;
  background: linear-gradient(180deg, #1c1334 0%, #0a0518 100%);
  padding: 0;
  overflow: hidden;
  position: relative;
  /* 2026-05-19 v2: vh simple — máxima compatibilidad iOS. */
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.st2-r1-header {
  padding: 22px 22px 16px;
  text-align: center;
  background: radial-gradient(circle at center top, rgba(232,90,106,0.28), transparent 70%);
  border-bottom: 1px solid rgba(232,90,106,0.25);
}
.st2-r1-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  display: grid; place-items: center;
  margin: 0 auto 10px;
  background: linear-gradient(135deg, rgba(232,90,106,0.32), rgba(232,90,106,0.12));
  border: 1px solid rgba(232,90,106,0.55);
  color: #ffaeb6;
  font-size: 30px;
  box-shadow: 0 0 24px rgba(232,90,106,0.45);
}
.st2-r1-title {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 19px;
  color: #fff;
  margin-bottom: 4px;
}
.st2-r1-sub {
  font-size: 12.5px;
  color: rgba(255,255,255,0.65);
  line-height: 1.4;
  max-width: 420px;
  margin: 0 auto;
}
.st2-r1-sub b { color: #ffc857; }

/* Cost / gems status card */
.st2-r1-cost-row {
  padding: 12px 16px 0;
}
.st2-r1-cost-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-soft);
}
.st2-r1-cost-card > i {
  font-size: 24px;
  flex: 0 0 auto;
}
.st2-r1-cost-card.is-ok {
  background: rgba(78,195,247,0.10);
  border-color: rgba(78,195,247,0.4);
}
.st2-r1-cost-card.is-ok > i { color: #4ec3f7; }
.st2-r1-cost-card.is-missing {
  background: rgba(232,90,106,0.10);
  border-color: rgba(232,90,106,0.4);
}
.st2-r1-cost-card.is-missing > i { color: #ff8898; }
.st2-r1-cost-card.is-creator {
  background: rgba(255,210,74,0.12);
  border-color: rgba(255,210,74,0.45);
}
.st2-r1-cost-card.is-creator > i { color: #ffd24a; font-size: 22px; }
.st2-r1-cost-label {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 2px;
}
.st2-r1-cost-val {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  letter-spacing: 0.02em;
}
.st2-r1-cost-small {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  font-weight: 600;
  margin-left: 8px;
}

/* Lista scrolleable de nodos */
.st2-r1-content {
  flex: 1 1 auto;
  min-height: 0;                 /* CRITICO: permite que el flex item achique y haga scroll */
  /* 2026-05-19 v2: max-height fijo en vh — más simple, evita issues con dvh/svh
     en safari viejo. Lo importante es que tenga un cap explícito para que el
     flex container lo respete. */
  max-height: 55vh;
  overflow-y: auto;
  overscroll-behavior: contain;  /* evita que el scroll se "escape" al body */
  -webkit-overflow-scrolling: touch;  /* scroll suave en iOS */
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  touch-action: pan-y;           /* solo permite gesto vertical, evita conflictos con horizontal */
}
.st2-r1-branch {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow: hidden;
}
.st2-r1-branch-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--st2-color) 22%, rgba(0,0,0,0.4)), rgba(0,0,0,0.4));
  border-bottom: 1px solid color-mix(in srgb, var(--st2-color) 30%, transparent);
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
}
.st2-r1-branch-head i { color: var(--st2-color); font-size: 16px; }
.st2-r1-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.st2-r1-node {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #fff;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s ease;
}
.st2-r1-node:last-child { border-bottom: none; }
.st2-r1-node:hover {
  background: color-mix(in srgb, var(--st2-color) 12%, transparent);
}
.st2-r1-node:disabled, .st2-r1-node.is-loading {
  opacity: 0.5;
  cursor: not-allowed;
}
.st2-r1-node-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--st2-color) 18%, rgba(0,0,0,0.5));
  border: 1px solid color-mix(in srgb, var(--st2-color) 38%, transparent);
  color: var(--st2-color);
  font-size: 18px;
  flex: 0 0 auto;
}
.st2-r1-node-icon iconify-icon { width: 0.95em; height: 0.95em; color: inherit; }
.st2-r1-node-body { flex: 1; min-width: 0; }
.st2-r1-node-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 13.5px;
  color: #fff;
  margin-bottom: 1px;
}
.st2-r1-node-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.03em;
}
.st2-r1-node-cta {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(232,90,106,0.12);
  border: 1px solid rgba(232,90,106,0.32);
  color: #ff8898;
  flex: 0 0 auto;
  transition: all 0.15s ease;
}
.st2-r1-node:hover .st2-r1-node-cta {
  background: rgba(232,90,106,0.25);
  border-color: rgba(232,90,106,0.55);
  color: #ffaeb6;
}

.st2-r1-empty {
  text-align: center;
  padding: 32px 16px;
  color: rgba(255,255,255,0.5);
  font-size: 13px;
}
.st2-r1-empty i { font-size: 36px; display: block; margin-bottom: 10px; color: rgba(255,255,255,0.25); }
.st2-r1-empty p { margin: 0; }

.st2-r1-actions {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-soft);
  background: rgba(0,0,0,0.25);
}

@media (max-width: 480px) {
  .st2-r1-modal { max-width: calc(100vw - 24px); }
  .st2-r1-header { padding: 18px 16px 14px; }
  .st2-r1-icon { width: 54px; height: 54px; font-size: 24px; }
  .st2-r1-title { font-size: 17px; }
  .st2-r1-content { padding: 12px 12px; }
  .st2-r1-node { padding: 8px 10px; gap: 10px; }
  .st2-r1-node-icon { width: 34px; height: 34px; font-size: 16px; }
  .st2-r1-node-cta { width: 28px; height: 28px; }
}

/* ============================================================================
   RESPEC 1 MODAL — V3 (2026-05-19, REHECHO DE CERO)
   Estructura: overlay → modal-box → body scrollable.
   El SCROLL está directamente en .st2r1-body (overflow-y:auto + max-height).
   Sin flex column con scroll en hijo (que iOS Safari maneja mal).
   ============================================================================ */
.st2r1-overlay-v3 {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(10,4,20,0.92) 0%, rgba(0,0,0,0.96) 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.25s ease;
}
.st2r1-modal-v3 {
  background: linear-gradient(180deg, #1c1334 0%, #0a0518 100%);
  border: 1px solid rgba(232, 90, 106, 0.35);
  border-radius: 18px;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 40px rgba(232, 90, 106, 0.15);
  position: relative;
  overflow: hidden;  /* clip al border radius */
}
.st2r1-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s;
}
.st2r1-close-btn:hover { background: rgba(232, 90, 106, 0.5); }

/* EL CONTENEDOR SCROLLABLE — overflow-y:auto directo, max-height en vh */
.st2r1-body {
  max-height: 85vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 24px 20px 16px;
  touch-action: pan-y;
}
.st2r1-header {
  text-align: center;
  padding: 0 0 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(232,90,106,0.25);
}
.st2r1-icon {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: grid; place-items: center;
  margin: 0 auto 10px;
  background: linear-gradient(135deg, rgba(232,90,106,0.32), rgba(232,90,106,0.12));
  border: 1px solid rgba(232,90,106,0.55);
  color: #ffaeb6;
  font-size: 28px;
  box-shadow: 0 0 20px rgba(232,90,106,0.4);
}
.st2r1-title {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 19px;
  color: #fff;
  margin-bottom: 4px;
}
.st2r1-sub {
  font-size: 12.5px;
  color: rgba(255,255,255,0.65);
  line-height: 1.4;
}
.st2r1-sub b { color: #ffc857; }

/* Card de costo / gemas */
.st2r1-cost {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 14px;
}
.st2r1-cost > i {
  font-size: 24px;
  flex: 0 0 auto;
}
.st2r1-cost.is-ok        { background: rgba(78,195,247,0.10); border-color: rgba(78,195,247,0.4); }
.st2r1-cost.is-ok > i    { color: #4ec3f7; }
.st2r1-cost.is-missing   { background: rgba(232,90,106,0.10); border-color: rgba(232,90,106,0.4); }
.st2r1-cost.is-missing > i { color: #ff8898; }
.st2r1-cost.is-creator   { background: rgba(255,210,74,0.12); border-color: rgba(255,210,74,0.45); }
.st2r1-cost.is-creator > i { color: #ffd24a; font-size: 22px; }
.st2r1-cost-lbl {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 2px;
}
.st2r1-cost-val {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 17px;
  color: #fff;
}
.st2r1-cost-small { font-size: 11px; color: rgba(255,255,255,0.55); font-weight: 600; margin-left: 8px; }

/* Listado de nodos por rama — reutilizo el HTML de .st2-r1-branch / .st2-r1-list / .st2-r1-node
   pero ahora viven DENTRO de .st2r1-body sin ningún overflow tricky. */
.st2r1-body .st2-r1-branch { margin-bottom: 12px; }

.st2r1-empty {
  text-align: center;
  padding: 30px 16px;
  color: rgba(255,255,255,0.5);
}
.st2r1-empty i { font-size: 38px; opacity: 0.6; }
.st2r1-empty p { margin-top: 8px; font-size: 13px; }

.st2r1-cancel-btn {
  margin-top: 16px;
  width: 100%;
}

@media (max-width: 480px) {
  /* 2026-05-19: márgenes mucho más chicos para aprovechar ancho del celu */
  .st2r1-overlay-v3 { padding: 4px; }
  .st2r1-modal-v3 { border-radius: 14px; }
  .st2r1-body { padding: 16px 10px 12px; max-height: 92vh; }
  .st2r1-header { padding: 0 0 10px; margin-bottom: 12px; }
  .st2r1-icon { width: 46px; height: 46px; font-size: 22px; margin-bottom: 8px; }
  .st2r1-title { font-size: 16px; }
  .st2r1-sub { font-size: 11.5px; }
  .st2r1-cost { padding: 9px 10px; gap: 10px; margin-bottom: 10px; }
  .st2r1-cost > i { font-size: 20px; }
  .st2r1-cost-val { font-size: 15px; }
  /* Listado heredado .st2-r1-* — compactarlo en mobile */
  .st2r1-body .st2-r1-branch { margin-bottom: 8px; }
  .st2r1-body .st2-r1-branch-head { padding: 8px 10px; font-size: 11px; }
  .st2r1-body .st2-r1-node { padding: 7px 8px; gap: 8px; }
  .st2r1-body .st2-r1-node-icon { width: 32px; height: 32px; font-size: 15px; }
  .st2r1-body .st2-r1-node-cta { width: 26px; height: 26px; font-size: 14px; }
  .st2r1-cancel-btn { margin-top: 10px; }
}
