/* Main App Styles - Julia Sardá Scale (Mobile First) */
@import url('design_tokens.css');

/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    /* Game feel */
    font-family: var(--font-body);
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--color-ink-primary);
    /* Outer void */
    color: var(--color-ink-primary);
}

/* Global UI heights */
:root {
    /* Ajuste móvil: evita ocupar demasiado alto en pantallas bajas */
    --bottom-nav-height: 0px;
}

/* --- Container Architecture --- */
#game-app {
    position: relative;
    width: 100%;
    height: 100dvh;
    background-color: var(--color-paper-light);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Layers */
.layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass through by default */
}

/* Re-enable pointer events for interactive children */
/* .layer > * rule removed to prevent accidental blocking. Specific interactive elements must set pointer-events: auto. */

#bg-layer {
    z-index: var(--z-bg);
}

#game-layer {
    z-index: var(--z-game);
}

#ui-layer {
    z-index: 40;
    /* Lifted above overlay (30) to allow navigation access */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

#overlay-layer {
    z-index: var(--z-overlay);
}

/* --- Backgrounds --- */
.bg-texture {
    width: 100%;
    height: 100%;
    /* Fondo por vista (sin scroll, estilo videojuego). */
    background-image: url('assets/backgrounds/bg_hub_main.avif');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 1;
}

/* HK set: fondo City of Tears en todas las vistas excepto partida activa
   (durante partida activa sigue usando board_bg_arena.png del selector inferior) */
body[data-theme="wizardbattles"][data-set="hk"]:not([data-game-active="1"]) .bg-texture {
    background-image: url('assets/sets/hk/ui/bg_hub_hk_city_of_tears_wiki.avif');
    background-position: center center;
}

/* ==========================================
   GAME LOADING SCREEN (Start-of-game, diegético)
   ========================================== */
#loading-screen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    pointer-events: auto;
    touch-action: none;
    opacity: 1;
    transition: opacity 360ms var(--ease-paper);
}

#loading-screen.is-done {
    opacity: 0;
    pointer-events: none;
}

#loading-screen.is-hidden {
    display: none !important;
}

.loading-screen__bg,
.loading-screen__vignette {
    position: absolute;
    inset: 0;
}

.loading-screen__bg {
    background: rgba(255, 255, 255, 0.15);
    background-image: url('assets/backgrounds/bg_hub_main.avif');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

body[data-theme="wizardbattles"][data-set="hk"] .loading-screen__bg {
    background-image: url('assets/sets/hk/ui/bg_hub_hk_city_of_tears_wiki.avif');
}

/* Vignette MUY suave: legibilidad sin “overlay pesado” */
.loading-screen__vignette {
    background:
        radial-gradient(ellipse at 50% 46%,
            rgba(20, 15, 20, 0.02) 0%,
            rgba(20, 15, 20, 0.10) 58%,
            rgba(20, 15, 20, 0.22) 100%);
}

.loading-screen__ui {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-left: clamp(18px, 7vw, 34px);
    padding-right: clamp(18px, 7vw, 34px);
    padding-bottom: calc(env(safe-area-inset-bottom) + clamp(56px, 9vh, 92px));
    text-align: center;
    gap: 10px;
}

.loading-sigil {
    width: clamp(96px, 22vw, 140px);
    height: clamp(96px, 22vw, 140px);
    display: grid;
    place-items: center;
    margin-bottom: 2px;
}

.loading-sigil__svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.loading-ring {
    fill: none;
    transform-origin: 60px 60px;
}

.loading-ring--base {
    stroke: rgba(42, 35, 40, 0.30);
    stroke-width: 2.2;
}

.loading-ring--runes {
    stroke: rgba(74, 66, 70, 0.36);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-dasharray: 1.2 8.2;
    transform: rotate(-8deg);
    opacity: 0.95;
}

.loading-ring--progress {
    stroke: rgba(142, 141, 190, 0.88);
    stroke-width: 3.2;
    stroke-linecap: round;
    transform: rotate(-90deg);
    filter: url(#softGlow);
    opacity: 0.92;
}

.loading-sigil__seal {
    fill: rgba(232, 228, 208, 0.85);
    filter: url(#softGlow);
    opacity: 0.85;
}

.loading-percent {
    font-family: var(--font-parchment);
    font-weight: 700;
    font-size: clamp(44px, 10vw, 64px);
    line-height: 1;
    letter-spacing: 0.02em;
    color: rgba(247, 245, 230, 0.93);
    text-shadow: 0 2px 8px rgba(20, 15, 20, 0.32);
}

.loading-flavor {
    font-family: var(--font-magical);
    font-weight: 600;
    font-size: clamp(16px, 4.2vw, 20px);
    line-height: 1.15;
    color: rgba(247, 245, 230, 0.86);
    text-shadow: 0 2px 8px rgba(20, 15, 20, 0.28);
    opacity: 0.92;
    transition: opacity 700ms var(--ease-paper);
}

/* Animación calmada */
@keyframes loadingGlowPulse {
    0% {
        opacity: 0.78;
    }

    50% {
        opacity: 0.96;
    }

    100% {
        opacity: 0.82;
    }
}

@keyframes loadingRuneDrift {
    0% {
        transform: rotate(-8deg);
    }

    100% {
        transform: rotate(352deg);
    }
}

@keyframes loadingSealBreath {
    0% {
        opacity: 0.70;
    }

    50% {
        opacity: 0.92;
    }

    100% {
        opacity: 0.74;
    }
}

.loading-ring--progress {
    animation: loadingGlowPulse 3.6s ease-in-out infinite;
}

.loading-ring--runes {
    animation: loadingRuneDrift 78s linear infinite;
}

.loading-sigil__seal {
    animation: loadingSealBreath 3.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {

    .loading-ring--progress,
    .loading-ring--runes,
    .loading-sigil__seal {
        animation: none !important;
    }
}

body[data-view="game"][data-game-active="1"] .bg-texture {
    background-image: url('assets/backgrounds/board_bg_arena.avif');
    opacity: 1;
}

body[data-view="generator"] .bg-texture {
    background-image: url('assets/backgrounds/bg_hub_main.avif');
    opacity: 1;
}

body[data-view="simulator"] .bg-texture {
    opacity: 1;
}

/* --- HUD (UI Layer) --- */
.hud-bar {
    padding: var(--spacing-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    width: 100%;
}

.hud-bar.bottom {
    padding-bottom: max(var(--spacing-sm), env(safe-area-inset-bottom));
}

.resource-pill {
    background: var(--color-paper-dim);
    border: var(--border-ink-thin);
    border-radius: var(--border-radius-lg);
    padding: 4px 12px;
    font-family: var(--font-ui);
    font-weight: bold;
    box-shadow: var(--shadow-paper);
}

/* ==========================================
   GAME HUD UNIFIED - Solo visible en view-game
   ========================================== */

#game-hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    pointer-events: none;
    transition: opacity 300ms var(--ease-spring), transform 300ms var(--ease-spring);
    opacity: 1;
    transform: translateY(0);
}

/* HUD legacy: oculto para evitar duplicado con el nuevo header */
#game-hud {
    display: none;
}

/* ==========================================
   WB GAME HEADER — Dark / Magical (Mobile 2026)
   ========================================== */
.wb-game-header {
    position: sticky;
    top: 0;
    z-index: 25;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 68px 10px 12px;
    /* Deep magical dark background */
    background:
        linear-gradient(180deg,
            rgba(8, 12, 32, 0.97) 0%,
            rgba(12, 18, 44, 0.95) 100%);
    border-bottom: 1px solid rgba(100, 140, 230, 0.18);
    /* Subtle top shimmer line */
    box-shadow:
        0 1px 0 rgba(160, 200, 255, 0.06),
        0 4px 20px rgba(4, 8, 24, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* ---- Score chips ---- */
.wb-score-chip {
    display: flex;
    align-items: center;
    gap: 0;
    flex-direction: column;
    padding: 6px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        0 2px 8px rgba(0, 0, 0, 0.3);
    min-width: 58px;
    text-align: center;
}

.wb-score-chip--player {
    flex-direction: column;
}

.wb-score-label {
    font-family: var(--font-primary-ui);
    font-size: 0.52rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: rgba(160, 190, 255, 0.5);
    line-height: 1;
    margin-bottom: 2px;
}

.wb-score-value {
    font-family: var(--font-numeric);
    font-size: 1.55rem;
    font-weight: 900;
    color: rgba(220, 235, 255, 0.92);
    line-height: 1;
    text-shadow:
        0 0 18px rgba(120, 170, 255, 0.45),
        0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: -0.01em;
}

/* CPU score — cool blue tint */
.wb-score-chip--cpu .wb-score-value {
    color: rgba(140, 200, 255, 0.9);
    text-shadow:
        0 0 18px rgba(80, 160, 255, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Player score — warm gold tint */
.wb-score-chip--player .wb-score-value {
    color: rgba(255, 215, 100, 0.95);
    text-shadow:
        0 0 18px rgba(220, 170, 40, 0.55),
        0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ---- Center / Round chip ---- */
.wb-center-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
    flex: 1;
}

.wb-round-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: 999px;
    /* Magical orb gradient */
    background:
        radial-gradient(ellipse at 50% 0%, rgba(130, 170, 255, 0.18) 0%, transparent 70%),
        linear-gradient(145deg, rgba(28, 38, 80, 0.95), rgba(16, 22, 58, 0.98));
    border: 1px solid rgba(100, 150, 255, 0.25);
    box-shadow:
        inset 0 1px 0 rgba(180, 210, 255, 0.12),
        0 0 0 1px rgba(60, 100, 200, 0.12),
        0 4px 14px rgba(4, 8, 24, 0.5),
        0 0 20px rgba(80, 120, 220, 0.08);
    min-width: 90px;
}

.wb-round-icon {
    font-size: 0.65rem;
    color: rgba(180, 210, 255, 0.55);
    line-height: 1;
    flex-shrink: 0;
}

.wb-round-label {
    font-family: var(--font-primary-ui);
    font-size: 0.55rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: rgba(140, 175, 255, 0.6);
    line-height: 1;
}

.wb-round-value {
    font-family: var(--font-numeric);
    font-size: 1.15rem;
    font-weight: 900;
    color: rgba(210, 230, 255, 0.95);
    line-height: 1;
    text-shadow:
        0 0 14px rgba(120, 170, 255, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: -0.01em;
}

/* ---- Score pulse animation on score change ---- */
@keyframes wb-score-pop {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.22);
    }

    70% {
        transform: scale(0.94);
    }

    100% {
        transform: scale(1);
    }
}

.wb-score-value.hud-pop {
    animation: wb-score-pop 380ms cubic-bezier(0.22, 0.9, 0.28, 1);
}

/* ---- Mobile: tighter ---- */
@media (max-width: 520px) {
    .wb-game-header {
        padding: 8px 62px 8px 10px;
        gap: 6px;
    }

    .wb-score-chip {
        padding: 5px 10px;
        min-width: 50px;
    }

    .wb-score-value {
        font-size: 1.35rem;
    }

    .wb-round-chip {
        min-width: 80px;
        padding: 5px 10px;
    }

    .wb-round-value {
        font-size: 1rem;
    }
}

/* ==========================================
   INDICATORS BAR - Unified Ticker Strip
   ========================================== */
.wb-indicators-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 10px;
    align-items: stretch;
}

@media (max-width: 520px) {
    .wb-indicators-bar {
        flex-direction: column;
        gap: 4px;
        margin: 4px 8px;
    }
}

@media (min-width: 900px) {
    .wb-indicators-bar {
        flex-wrap: nowrap;
        gap: 8px;
        margin: 8px 14px;
    }
}

/* Próximo efecto (compacto, inline) */
.wb-next-effect-indicator {
    --fx-owner: rgba(126, 158, 255, 0.72);
    --fx-owner-strong: rgba(126, 158, 255, 1);
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    min-height: 36px;
    padding: 7px 11px;
    border-radius: 10px;
    border: 1px solid rgba(124, 165, 236, 0.32);
    background:
        radial-gradient(130% 140% at 0% 0%, rgba(151, 196, 255, 0.2), rgba(151, 196, 255, 0) 48%),
        linear-gradient(145deg, rgba(8, 17, 42, 0.9), rgba(4, 10, 30, 0.92));
    box-shadow:
        inset 0 1px 0 rgba(227, 240, 255, 0.18),
        0 5px 14px rgba(3, 8, 24, 0.3);
    overflow: hidden;
}

.wb-next-effect-indicator::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(112deg, rgba(255, 255, 255, 0) 34%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0) 66%);
    transform: translateX(-130%);
    opacity: 0;
}

.wb-next-effect-indicator.is-idle {
    opacity: 0.82;
}

.wb-next-effect-icon {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
    color: #f3f7ff;
    background:
        radial-gradient(circle at 34% 28%, rgba(223, 240, 255, 0.52), rgba(223, 240, 255, 0) 60%),
        linear-gradient(140deg, rgba(48, 97, 194, 0.82), rgba(18, 49, 114, 0.9));
    border: 1px solid rgba(171, 206, 255, 0.44);
    box-shadow: 0 0 10px rgba(94, 147, 255, 0.28);
}

.wb-next-effect-icon img {
    width: 14px;
    height: 14px;
    display: block;
    filter: saturate(1.08) brightness(1.06);
}

.wb-next-effect-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1 1 auto;
}

.wb-next-effect-label {
    font-family: var(--font-primary-ui);
    font-size: 0.52rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(205, 219, 246, 0.76);
}

.wb-next-effect-text {
    min-width: 0;
    font-family: var(--font-primary-ui);
    font-size: 0.74rem;
    font-weight: 700;
    color: #eff5ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 7px rgba(27, 78, 190, 0.24);
}

.wb-next-effect-owner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 21px;
    min-width: 58px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--fx-owner);
    background: color-mix(in srgb, var(--fx-owner) 22%, transparent);
    color: #f4f8ff;
    font-family: var(--font-primary-ui);
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.wb-next-effect-owner.owner-player {
    --fx-owner: rgba(233, 184, 88, 0.72);
    --fx-owner-strong: rgba(233, 184, 88, 1);
}

.wb-next-effect-owner.owner-cpu {
    --fx-owner: rgba(234, 127, 127, 0.76);
    --fx-owner-strong: rgba(234, 127, 127, 1);
}

.wb-next-effect-owner.owner-neutral {
    --fx-owner: rgba(129, 164, 229, 0.58);
    --fx-owner-strong: rgba(129, 164, 229, 0.86);
}

.wb-next-effect-indicator.tone-force .wb-next-effect-icon {
    background:
        radial-gradient(circle at 30% 26%, rgba(237, 245, 255, 0.56), rgba(237, 245, 255, 0) 62%),
        linear-gradient(140deg, rgba(67, 123, 242, 0.82), rgba(28, 72, 168, 0.92));
}

.wb-next-effect-indicator.tone-control .wb-next-effect-icon {
    background:
        radial-gradient(circle at 30% 26%, rgba(255, 234, 179, 0.58), rgba(255, 234, 179, 0) 62%),
        linear-gradient(140deg, rgba(193, 136, 48, 0.82), rgba(142, 86, 26, 0.92));
}

.wb-next-effect-indicator.tone-lock .wb-next-effect-icon {
    background:
        radial-gradient(circle at 30% 26%, rgba(244, 229, 255, 0.52), rgba(244, 229, 255, 0) 62%),
        linear-gradient(140deg, rgba(143, 84, 199, 0.84), rgba(90, 44, 137, 0.92));
}

.wb-next-effect-indicator.tone-steal .wb-next-effect-icon {
    background:
        radial-gradient(circle at 30% 26%, rgba(214, 255, 244, 0.52), rgba(214, 255, 244, 0) 62%),
        linear-gradient(140deg, rgba(53, 170, 151, 0.84), rgba(26, 119, 107, 0.92));
}

.wb-next-effect-indicator.is-armed {
    animation: wb-next-effect-pulse 1.9s ease-in-out infinite;
}

.wb-next-effect-indicator.is-armed::after {
    animation: wb-next-effect-glint 2.2s ease-in-out infinite;
}

@keyframes wb-next-effect-pulse {

    0%,
    100% {
        box-shadow:
            inset 0 1px 0 rgba(219, 236, 255, 0.1),
            0 2px 8px rgba(3, 7, 20, 0.2);
    }

    50% {
        box-shadow:
            inset 0 1px 0 rgba(219, 236, 255, 0.16),
            0 3px 12px rgba(7, 17, 43, 0.3),
            0 0 10px color-mix(in srgb, var(--fx-owner-strong) 22%, transparent);
    }
}

@keyframes wb-next-effect-glint {

    0%,
    44% {
        transform: translateX(-130%);
        opacity: 0;
    }

    52% {
        opacity: 1;
    }

    100% {
        transform: translateX(136%);
        opacity: 0;
    }
}

@media (max-width: 520px) {
    .wb-next-effect-indicator {
        padding: 5px 8px;
        gap: 5px;
    }

    .wb-next-effect-text {
        font-size: 0.68rem;
    }

    .wb-next-effect-owner {
        min-width: 44px;
        padding-inline: 5px;
        font-size: 0.48rem;
    }
}

/* Duelo en curso — round panel 2026 */
.wb-duel-context-indicator {
    --ctx-rgb: 114, 190, 255;
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: stretch;
    gap: clamp(8px, 1.2vw, 12px);
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: clamp(8px, 1.2vw, 12px);
    border-radius: clamp(16px, 2.4vw, 22px);
    border: 1px solid rgba(var(--ctx-rgb), 0.48);
    background:
        radial-gradient(120% 140% at 0% 0%, rgba(var(--ctx-rgb), 0.22), rgba(var(--ctx-rgb), 0) 58%),
        radial-gradient(110% 120% at 100% 100%, rgba(248, 226, 169, 0.14), rgba(248, 226, 169, 0) 52%),
        linear-gradient(148deg, rgba(7, 16, 38, 0.98), rgba(6, 13, 30, 0.99));
    box-shadow:
        inset 0 1px 0 rgba(219, 241, 255, 0.18),
        inset 0 -1px 0 rgba(66, 120, 205, 0.18),
        0 16px 34px rgba(3, 9, 24, 0.42);
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.wb-duel-context-indicator::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, rgba(255, 255, 255, 0) 28%, rgba(255, 255, 255, 0.08) 42%, rgba(255, 255, 255, 0) 58%);
    transform: translateX(-120%);
    pointer-events: none;
}

.wb-duel-context-indicator.is-live::before {
    animation: wb-duel-context-scan 2.8s ease-in-out infinite;
}

@keyframes wb-duel-context-scan {

    0%,
    36% {
        transform: translateX(-120%);
        opacity: 0;
    }

    44% {
        opacity: 1;
    }

    100% {
        transform: translateX(130%);
        opacity: 0;
    }
}

.wb-duel-ctx-orb {
    width: clamp(38px, 4vw, 46px);
    height: clamp(38px, 4vw, 46px);
    border-radius: 12px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(var(--ctx-rgb), 0.52);
    background:
        radial-gradient(circle at 32% 26%, rgba(231, 245, 255, 0.58), rgba(231, 245, 255, 0) 58%),
        linear-gradient(145deg, rgba(45, 98, 196, 0.86), rgba(21, 54, 124, 0.95));
    box-shadow:
        0 0 0 1px rgba(12, 36, 92, 0.62),
        0 8px 18px rgba(5, 17, 42, 0.48);
}

.wb-duel-ctx-icon {
    color: #f3f9ff;
    font-size: clamp(0.9rem, 1.8vw, 1.12rem);
    line-height: 1;
    text-shadow: 0 0 9px rgba(189, 223, 255, 0.55);
}

.wb-duel-ctx-stage {
    display: grid;
    gap: 6px;
    align-content: center;
    min-width: clamp(86px, 10vw, 110px);
}

.wb-duel-ctx-stage-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(var(--ctx-rgb), 0.32);
    background:
        linear-gradient(160deg, rgba(17, 34, 76, 0.8), rgba(8, 18, 44, 0.84));
    color: rgba(232, 242, 255, 0.9);
    font-family: var(--font-primary-ui);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 8px 18px rgba(2, 8, 18, 0.22);
}

.wb-duel-ctx-stage-chip--duel {
    border-color: rgba(248, 226, 169, 0.34);
    color: rgba(255, 236, 188, 0.96);
}

.wb-duel-ctx-main {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 18px;
    border: 1px solid rgba(var(--ctx-rgb), 0.24);
    background:
        linear-gradient(160deg, rgba(14, 28, 64, 0.84), rgba(7, 15, 38, 0.9));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 12px 26px rgba(2, 8, 18, 0.24);
}

.wb-duel-ctx-copy {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.wb-duel-ctx-title {
    min-width: 0;
    color: #f1f8ff;
    font-family: var(--font-primary-ui);
    font-size: clamp(0.86rem, 1.75vw, 1.02rem);
    font-weight: 800;
    letter-spacing: 0.05em;
    line-height: 1.08;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wb-duel-ctx-sub {
    min-width: 0;
    color: rgba(208, 228, 255, 0.82);
    font-family: var(--font-secondary);
    font-size: clamp(0.7rem, 1.4vw, 0.8rem);
    font-weight: 600;
    line-height: 1.18;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.wb-duel-ctx-rail {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(84px, auto));
    gap: 8px;
    align-content: center;
}

.wb-duel-ctx-panel {
    display: grid;
    justify-items: center;
    gap: 6px;
    min-width: 0;
    padding: 9px 10px;
    border-radius: 16px;
    border: 1px solid rgba(var(--ctx-rgb), 0.28);
    background:
        linear-gradient(160deg, rgba(12, 26, 60, 0.8), rgba(7, 17, 40, 0.88));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 10px 22px rgba(2, 8, 18, 0.24);
}

.wb-duel-ctx-rail-label {
    font-family: var(--font-primary-ui);
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(184, 218, 255, 0.68);
    line-height: 1;
}

.wb-duel-ctx-turn {
    min-height: 30px;
    min-width: 72px;
    padding: 4px 10px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-primary-ui);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid rgba(192, 218, 255, 0.34);
    color: rgba(236, 246, 255, 0.82);
    background: rgba(143, 178, 224, 0.16);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        0 8px 16px rgba(2, 8, 18, 0.18);
}

.wb-duel-ctx-turn.owner-player {
    border-color: rgba(112, 232, 173, 0.52);
    color: #8ef2be;
    background: rgba(49, 142, 101, 0.22);
}

.wb-duel-ctx-turn.owner-cpu {
    border-color: rgba(244, 133, 133, 0.52);
    color: #ffaaaa;
    background: rgba(152, 59, 77, 0.24);
}

.wb-duel-ctx-turn.owner-neutral {
    color: rgba(236, 246, 255, 0.72);
}

.wb-duel-ctx-stat-cluster {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.wb-duel-ctx-stat-ring {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(176, 220, 255, 0.56);
    background:
        radial-gradient(circle at 34% 28%, rgba(228, 242, 255, 0.38), rgba(228, 242, 255, 0) 64%),
        linear-gradient(145deg, rgba(40, 84, 168, 0.9), rgba(15, 37, 92, 0.95));
    box-shadow:
        0 0 0 1px rgba(20, 40, 98, 0.52),
        0 2px 8px rgba(4, 11, 28, 0.56);
}

.wb-duel-ctx-stat-ring::before {
    content: '✦';
    font-family: var(--font-primary-ui);
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1;
    color: rgba(241, 247, 255, 0.72);
    text-shadow: 0 0 10px rgba(189, 223, 255, 0.4);
}

.wb-duel-ctx-stat-ring.has-stat::before {
    display: none;
}

.wb-duel-ctx-stat-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    filter: saturate(1.12) contrast(1.06);
}

.wb-duel-ctx-stat-name {
    max-width: 82px;
    font-family: var(--font-primary-ui);
    font-size: 0.74rem;
    font-weight: 800;
    color: rgba(228, 244, 255, 0.95);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.wb-duel-ctx-stat-name.is-pending {
    color: rgba(210, 228, 248, 0.72);
}

.wb-duel-context-indicator.tone-plan {
    --ctx-rgb: 95, 216, 201;
}

.wb-duel-context-indicator.tone-card {
    --ctx-rgb: 237, 189, 96;
}

.wb-duel-context-indicator.tone-resolve {
    --ctx-rgb: 236, 117, 132;
}

.wb-duel-context-indicator.is-live {
    animation: wb-duel-context-breathe 2.1s ease-in-out infinite;
}

@keyframes wb-duel-context-breathe {

    0%,
    100% {
        box-shadow:
            inset 0 1px 0 rgba(219, 241, 255, 0.2),
            inset 0 -1px 0 rgba(66, 120, 205, 0.16),
            0 8px 24px rgba(3, 9, 24, 0.34);
    }

    50% {
        box-shadow:
            inset 0 1px 0 rgba(236, 248, 255, 0.34),
            inset 0 -1px 0 rgba(66, 120, 205, 0.28),
            0 10px 28px rgba(3, 9, 24, 0.5),
            0 0 12px rgba(var(--ctx-rgb), 0.28);
    }
}

@media (max-width: 620px) {
    .wb-duel-context-indicator {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 8px 10px;
    }

    .wb-duel-ctx-stage {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .wb-duel-ctx-main {
        padding: 10px;
        gap: 10px;
    }

    .wb-duel-ctx-rail {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .wb-duel-ctx-title {
        font-size: 0.78rem;
    }

    .wb-duel-ctx-sub {
        font-size: 0.68rem;
    }
}

/* Duel context indicator when positioned in the arena (between lineups) */
.wb-duel-context-arena {
    order: 2;
    flex: 0 0 auto;
    align-self: center;
    width: calc(100% - 20px);
    max-width: 660px;
    margin: clamp(4px, 0.8vw, 8px) auto;
}

/* ==========================================
   STAT ANNOUNCE - Visual Chip (between lineup rows)
   Inspired by wb-round-chip: light, clean, visual
   ========================================== */
.wb-stat-announce {
    --stat-accent: 123, 190, 255;
    --stat-accent-full: rgba(var(--stat-accent), 0.9);
    position: relative;
    align-self: center;
    width: min(420px, calc(100% - 20px));
    margin: 4px auto;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: 999px;
    border: 1px solid rgba(var(--stat-accent), 0.3);
    background:
        radial-gradient(ellipse at 50% 0%, rgba(var(--stat-accent), 0.12) 0%, transparent 70%),
        rgba(255, 255, 255, 0.88);
    box-shadow:
        0 2px 8px rgba(42, 35, 40, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
    transition:
        opacity calc(220ms * var(--wb-anim-mult, 1)) ease,
        max-height calc(300ms * var(--wb-anim-mult, 1)) cubic-bezier(0.22, 0.9, 0.28, 1);
}

.wb-stat-announce::before,
.wb-stat-announce::after {
    display: none;
}

.wb-stat-announce.is-visible {
    opacity: 1;
    max-height: 64px;
    pointer-events: auto;
    cursor: pointer;
    transform: none;
    animation: wb-stat-announce-enter calc(400ms * var(--wb-anim-mult, 1)) cubic-bezier(0.22, 0.9, 0.28, 1);
}

@keyframes wb-stat-announce-enter {
    0% {
        opacity: 0;
        transform: scale(0.92);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Owner color variants (using raw RGB for flexible mixing) */
.wb-stat-announce.is-player {
    --stat-accent: 212, 165, 55;
}

.wb-stat-announce.is-cpu {
    --stat-accent: 100, 160, 230;
}

.wb-stat-announce.is-neutral {
    --stat-accent: 140, 160, 210;
}

/* Left section: who + label */
.wb-stat-announce-who {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.wb-stat-announce-owner {
    font-family: var(--font-primary-ui);
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(var(--stat-accent), 1);
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(var(--stat-accent), 0.35);
    background: rgba(var(--stat-accent), 0.1);
    white-space: nowrap;
}

.wb-stat-announce-value {
    font-family: var(--font-primary-ui);
    font-size: clamp(0.72rem, 2vw, 0.88rem);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--color-ink-primary, #2a2328);
    white-space: nowrap;
}

/* Center: stat icon (hero element) */
.wb-stat-announce-statline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 12px 3px 4px;
    border-radius: 999px;
    border: 1px solid rgba(var(--stat-accent), 0.3);
    background: rgba(var(--stat-accent), 0.08);
}

.wb-stat-announce-icon-ring {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 40% 35%, rgba(var(--stat-accent), 0.25), transparent 70%),
        rgba(var(--stat-accent), 0.12);
    border: 1.5px solid rgba(var(--stat-accent), 0.4);
    box-shadow:
        0 0 12px rgba(var(--stat-accent), 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
    overflow: hidden;
}

.wb-stat-announce-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    filter: saturate(1.05) contrast(1.03);
}

.wb-stat-announce-stattext {
    font-family: var(--font-primary-ui);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-ink-primary, #2a2328);
    white-space: nowrap;
}

/* Right: subtitle */
.wb-stat-announce-sub {
    font-family: var(--font-primary-ui);
    font-size: 0.62rem;
    font-weight: 600;
    color: rgba(74, 66, 70, 0.7);
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Mode: turn only (no stat icon) */
.wb-stat-announce.mode-turn .wb-stat-announce-statline {
    display: none !important;
}

/* Mode: stat (hide sub when stat line is visible for cleaner look) */
.wb-stat-announce.mode-stat .wb-stat-announce-sub {
    display: none;
}

/* ---- Mobile ---- */
@media (max-width: 520px) {
    .wb-stat-announce {
        padding: 6px 12px;
        gap: 8px;
        width: calc(100% - 12px);
    }

    .wb-stat-announce.is-visible {
        max-height: 58px;
    }

    .wb-stat-announce-value {
        font-size: 0.7rem;
    }

    .wb-stat-announce-sub {
        font-size: 0.56rem;
    }

    .wb-stat-announce-icon-ring {
        width: 26px;
        height: 26px;
    }

    .wb-stat-announce-icon {
        width: 100%;
        height: 100%;
    }

    .wb-stat-announce-stattext {
        font-size: 0.68rem;
    }
}


.game-hud-container {
    padding-top: max(env(safe-area-inset-top), 8px);
    padding-left: max(env(safe-area-inset-left), 12px);
    padding-right: max(env(safe-area-inset-right), 12px);
}

/* REGLA UX GLOBAL: CPU siempre IZQUIERDA (desktop) / ARRIBA (móvil), PLAYER DERECHA (desktop) / ABAJO (móvil) */
.game-hud-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(8px, 2vw, 16px);
    padding: clamp(8px, 1.5vw, 12px) clamp(12px, 3vw, 20px);
    /* Orden visual: CPU primero (izquierda), luego PLAYER (derecha) */
    background-image:
        linear-gradient(to bottom,
            rgba(247, 245, 230, 0.95) 0%,
            rgba(247, 245, 230, 0.85) 100%);
    background-size: cover;
    background-position: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 3px solid var(--color-ink-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    min-height: clamp(60px, 10vh, 80px);
    max-height: clamp(60px, 12vh, 90px);
}

/* Scores */
.game-hud-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: clamp(60px, 15vw, 90px);
    flex: 0 0 auto;
    background: rgba(247, 245, 230, 0.95);
    padding: clamp(6px, 1.5vw, 10px) clamp(10px, 2vw, 14px);
    border-radius: var(--border-radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.game-hud-score-label {
    font-family: var(--font-display);
    font-size: clamp(0.65rem, 1.8vw, 0.85rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-ink-secondary);
    line-height: 1;
}

.game-hud-score-value {
    /* NUMERIC: Scores y números del HUD */
    font-family: var(--font-numeric);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--color-ink-primary);
    line-height: 1;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.game-hud-score-player .game-hud-score-value {
    color: var(--color-accent-gold);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.game-hud-score-cpu .game-hud-score-value {
    color: var(--color-danger);
    text-shadow: 0 0 8px rgba(244, 67, 54, 0.4);
}

/* Center: Round & Turn */
.game-hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
}

.game-hud-round {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: rgba(247, 245, 230, 0.95);
    padding: clamp(6px, 1.5vw, 10px) clamp(12px, 2.5vw, 18px);
    border-radius: var(--border-radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.game-hud-round-label {
    font-family: var(--font-display);
    font-size: clamp(0.6rem, 1.5vw, 0.75rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-ink-secondary);
    line-height: 1;
}

.game-hud-round-number {
    /* NUMERIC: Números de ronda */
    font-family: var(--font-numeric);
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    font-weight: 700;
    color: var(--color-ink-primary);
    line-height: 1;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}

.game-hud-turn {
    display: flex;
    align-items: center;
    gap: clamp(4px, 1vw, 8px);
    padding: clamp(4px, 1vw, 6px) clamp(8px, 2vw, 12px);
    background: #f7f5e6;
    /* Blanco hueso sólido */
    border-radius: var(--border-radius-md);
    border: 2px solid var(--color-ink-secondary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Resolving Indicator (discreto, en el centro del HUD) */
.resolving-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: clamp(3px, 0.8vw, 5px) clamp(8px, 1.5vw, 12px);
    background: rgba(247, 245, 230, 0.85);
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 300ms var(--ease-spring), transform 300ms var(--ease-spring);
    z-index: var(--z-hud);
}

.resolving-text {
    font-family: var(--font-display);
    font-size: clamp(0.6rem, 1.4vw, 0.7rem);
    font-weight: 600;
    color: var(--color-ink-secondary);
    letter-spacing: 0.5px;
    line-height: 1;
}

.resolving-dots {
    display: inline-flex;
    gap: 2px;
    align-items: center;
}

.resolving-dots .dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--color-ink-secondary);
    animation: resolving-dot-pulse 1.4s ease-in-out infinite;
    opacity: 0.6;
}

.resolving-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

.resolving-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.resolving-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes resolving-dot-pulse {

    0%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* HUD micro-animaciones (snappy, legibles) */
.hud-pop {
    animation: hud-pop 650ms var(--ease-spring);
}

.hud-turn-pop {
    animation: hud-turn-pop 650ms var(--ease-spring);
}

@keyframes hud-pop {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.22);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes hud-turn-pop {
    0% {
        transform: translateY(0) scale(1);
    }

    35% {
        transform: translateY(-2px) scale(1.02);
    }

    100% {
        transform: translateY(0) scale(1);
    }
}

.game-hud-turn-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
}

.game-hud-turn-label {
    font-family: var(--font-display);
    font-size: clamp(0.55rem, 1.4vw, 0.7rem);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-ink-secondary);
    line-height: 1;
}

.game-hud-turn-player {
    /* PRIMARY UI: Labels del turno en HUD */
    font-family: var(--font-primary-ui);
    font-size: clamp(0.75rem, 2vw, 0.95rem);
    font-weight: 700;
    color: var(--color-ink-primary);
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f7f5e6;
    /* Blanco hueso sólido */
    padding: clamp(4px, 1vw, 6px) clamp(8px, 1.5vw, 12px);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    display: inline-block;
}

/* Turn states */
.game-hud-bar.turn-player-active .game-hud-turn {
    border-color: var(--color-accent-gold);
    background: #f7f5e6;
    /* Mantener blanco hueso sólido */
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.3);
}

.game-hud-bar.turn-player-active .game-hud-turn-player {
    color: var(--color-accent-gold);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.5);
    background: #f7f5e6;
    /* Mantener blanco hueso sólido */
}

.game-hud-bar.turn-cpu-active .game-hud-turn {
    border-color: var(--color-danger);
    background: #f7f5e6;
    /* Mantener blanco hueso sólido */
    box-shadow: 0 0 12px rgba(244, 67, 54, 0.3);
}

.game-hud-bar.turn-cpu-active .game-hud-turn-player {
    color: var(--color-danger);
    text-shadow: 0 0 8px rgba(244, 67, 54, 0.5);
    background: #f7f5e6;
    /* Mantener blanco hueso sólido */
}

/* ==========================================
   GAME MENU BUTTON
   ========================================== */

#game-menu-button {
    position: fixed;
    top: max(env(safe-area-inset-top), 12px);
    right: max(env(safe-area-inset-right), 12px);
    z-index: calc(var(--z-hud) + 10);
    width: clamp(44px, 10vw, 52px);
    height: clamp(44px, 10vw, 52px);
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 22%, rgba(160, 225, 255, 0.32), rgba(160, 225, 255, 0) 58%),
        linear-gradient(165deg, rgba(22, 34, 74, 0.96) 0%, rgba(11, 19, 50, 0.93) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(170, 214, 255, 0.44);
    box-shadow:
        0 12px 28px rgba(4, 8, 24, 0.48),
        inset 0 1px 0 rgba(244, 250, 255, 0.24),
        0 0 0 1px rgba(76, 124, 201, 0.38);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 300ms var(--ease-spring);
    pointer-events: auto;
    color: var(--color-ink-primary);
    opacity: 1;
    transform: scale(1);
}


#game-menu-button:hover {
    transform: scale(1.05);
    box-shadow:
        0 14px 34px rgba(2, 6, 20, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 0 0 1px rgba(104, 157, 247, 0.58);
    background:
        radial-gradient(circle at 30% 22%, rgba(184, 235, 255, 0.38), rgba(160, 225, 255, 0) 58%),
        linear-gradient(165deg, rgba(26, 40, 86, 0.97) 0%, rgba(12, 22, 58, 0.95) 100%);
}

#game-menu-button:active {
    transform: scale(0.95);
}

/* Hamburger lines */
#game-menu-button {
    flex-direction: column;
    gap: 5px;
}

.hamburger-line {
    width: 60%;
    height: 3px;
    background-color: rgba(238, 246, 255, 0.9);
    border-radius: 2px;
    display: block;
    transition: all 300ms var(--ease-spring);
}

#game-menu-button:hover .hamburger-line {
    background-color: #ffffff;
}

/* ==========================================
   GAME ACTION BUTTONS (Confirmar, Siguiente)
   ========================================== */

.game-action-buttons-container {
    position: fixed;
    bottom: max(env(safe-area-inset-bottom), 20px);
    left: 50%;
    transform: translateX(-50%);
    z-index: calc(var(--z-hud) + 5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(12px, 3vw, 16px);
    pointer-events: none;
}

.game-action-btn {
    pointer-events: auto;
    min-width: clamp(200px, 50vw, 280px);
    padding: clamp(14px, 3.5vw, 18px) clamp(32px, 8vw, 48px);
    font-family: var(--font-display);
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-deep);
    transition: all 300ms var(--ease-spring);
    cursor: pointer;
    border: 3px solid var(--color-ink-primary);
    background: linear-gradient(to bottom,
            rgba(247, 245, 230, 0.98) 0%,
            rgba(247, 245, 230, 0.95) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--color-ink-primary);
    animation: game-action-btn-appear 300ms var(--ease-spring);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.game-action-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    background: rgba(247, 245, 230, 1);
}

.game-action-btn:active {
    transform: translateY(0) scale(0.98);
}

@keyframes game-action-btn-appear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================
   GAME MENU OVERLAY
   ========================================== */

.game-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: calc(var(--z-modal) + 10);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    pointer-events: auto;
    transition: opacity 300ms var(--ease-spring);
}


.game-menu-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fade-in 300ms var(--ease-spring);
}

.game-menu-panel {
    position: relative;
    width: clamp(300px, 33vw, 420px);
    max-width: min(94vw, 420px);
    max-height: calc(100dvh - 12px);
    background:
        radial-gradient(110% 85% at 15% 4%, rgba(127, 198, 255, 0.2), rgba(127, 198, 255, 0) 55%),
        linear-gradient(180deg, rgba(20, 33, 76, 0.96) 0%, rgba(9, 18, 48, 0.97) 100%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-left: 1px solid rgba(163, 208, 247, 0.38);
    border-bottom-left-radius: 24px;
    box-shadow:
        -22px 0 44px rgba(2, 6, 22, 0.52),
        inset 0 1px 0 rgba(244, 249, 255, 0.2);
    display: flex;
    flex-direction: column;
    animation: slide-in-right 300ms var(--ease-spring);
    overflow: hidden auto;
    padding-top: max(env(safe-area-inset-top), 0);
    padding-bottom: max(env(safe-area-inset-bottom), 0);
    will-change: transform, opacity;
}

@keyframes slide-in-right {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.game-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(16px, 4vw, 20px);
    border-bottom: 1px solid rgba(162, 197, 237, 0.28);
}

.game-menu-title {
    font-family: var(--font-display);
    font-size: clamp(1.3rem, 3.5vw, 1.6rem);
    font-weight: 900;
    color: rgba(243, 249, 255, 0.96);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
    text-shadow: 0 3px 14px rgba(0, 0, 0, 0.35);
}

.game-menu-close {
    width: clamp(36px, 8vw, 44px);
    height: clamp(36px, 8vw, 44px);
    border-radius: 50%;
    background: rgba(13, 26, 64, 0.72);
    border: 1px solid rgba(181, 218, 255, 0.46);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 200ms var(--ease-spring);
    color: rgba(239, 247, 255, 0.92);
    flex-shrink: 0;
}

.game-menu-close:hover {
    background: rgba(19, 39, 88, 0.88);
    transform: scale(1.1);
}

.game-menu-close:active {
    transform: scale(0.95);
}

.game-menu-options {
    display: flex;
    flex-direction: column;
    padding: clamp(10px, 2.2vw, 16px);
    gap: clamp(8px, 1.6vw, 12px);
}

.game-menu-option {
    display: flex;
    align-items: center;
    gap: clamp(12px, 3vw, 16px);
    padding: clamp(14px, 3.5vw, 18px) clamp(16px, 4vw, 20px);
    background:
        radial-gradient(120% 120% at 16% 12%, rgba(167, 232, 255, 0.2), rgba(167, 232, 255, 0) 56%),
        linear-gradient(140deg, rgba(33, 52, 108, 0.9), rgba(17, 31, 77, 0.93));
    border: 1px solid rgba(174, 214, 248, 0.34);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 250ms var(--ease-spring);
    text-align: left;
    font-family: var(--font-display);
    font-size: clamp(0.95rem, 2.05vw, 1.08rem);
    font-weight: 800;
    color: rgba(238, 247, 255, 0.95);
    box-shadow:
        0 8px 16px rgba(2, 8, 28, 0.32),
        inset 0 1px 0 rgba(245, 251, 255, 0.18);
}

.game-menu-option:hover {
    transform: translateX(-4px);
    box-shadow:
        0 14px 24px rgba(2, 8, 28, 0.5),
        inset 0 1px 0 rgba(245, 251, 255, 0.25),
        0 0 0 1px rgba(119, 178, 255, 0.52);
    border-color: rgba(132, 190, 255, 0.6);
}

.game-menu-option:active {
    transform: translateX(-2px) scale(0.98);
}

.game-menu-option.is-current {
    border-color: rgba(235, 202, 118, 0.8);
    box-shadow:
        0 14px 24px rgba(4, 9, 31, 0.5),
        inset 0 1px 0 rgba(255, 252, 238, 0.35),
        0 0 0 1px rgba(235, 202, 118, 0.58);
    background:
        radial-gradient(120% 120% at 14% 14%, rgba(255, 221, 136, 0.2), rgba(255, 221, 136, 0) 56%),
        linear-gradient(140deg, rgba(59, 79, 136, 0.96), rgba(27, 45, 100, 0.95));
}

.game-menu-option-icon {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    line-height: 1;
    flex-shrink: 0;
}

.game-menu-option-text {
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.25;
    white-space: normal;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.game-menu-option.is-current .game-menu-option-text {
    color: #fff8df;
}

.game-menu-segment-card {
    margin-top: 8px;
    padding: 12px 14px 14px;
    border-radius: 14px;
    border: 1px solid rgba(166, 207, 246, 0.34);
    background:
        radial-gradient(140% 110% at 20% 0%, rgba(144, 201, 255, 0.18), rgba(144, 201, 255, 0) 60%),
        linear-gradient(165deg, rgba(16, 30, 72, 0.92), rgba(8, 19, 54, 0.95));
    box-shadow: inset 0 1px 0 rgba(241, 248, 255, 0.14);
}

.game-menu-segment-title {
    margin-bottom: 10px;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(225, 239, 255, 0.9);
}

.game-menu-segment-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.game-menu-segment-head .game-menu-segment-title {
    margin-bottom: 0;
}

.game-menu-segment-caption {
    flex: 0 1 auto;
    min-width: 0;
    font-family: var(--font-primary-ui);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: rgba(203, 224, 247, 0.84);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-menu-segment-control {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.game-menu-segment-option {
    min-height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(151, 196, 244, 0.32);
    background:
        linear-gradient(145deg, rgba(32, 52, 108, 0.86), rgba(15, 30, 77, 0.9));
    color: rgba(239, 247, 255, 0.92);
    font-family: var(--font-primary-ui);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 180ms var(--ease-spring), box-shadow 180ms var(--ease-spring), border-color 180ms var(--ease-spring);
    box-shadow:
        0 6px 12px rgba(2, 9, 30, 0.3),
        inset 0 1px 0 rgba(247, 251, 255, 0.12);
}

.game-menu-segment-option:hover {
    border-color: rgba(176, 215, 255, 0.5);
    transform: translateY(-1px);
}

.game-menu-segment-option:active {
    transform: translateY(0) scale(0.98);
}

.game-menu-segment-option.is-active {
    border-color: rgba(233, 184, 88, 0.82);
    background:
        radial-gradient(120% 120% at 20% 0%, rgba(255, 224, 151, 0.24), rgba(255, 224, 151, 0) 58%),
        linear-gradient(145deg, rgba(76, 96, 156, 0.95), rgba(38, 57, 114, 0.95));
    color: #fff8df;
    box-shadow:
        0 10px 18px rgba(3, 10, 34, 0.42),
        inset 0 1px 0 rgba(255, 251, 238, 0.3),
        0 0 0 1px rgba(233, 184, 88, 0.5);
}

.game-menu-set-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 10px;
}

.game-menu-set-option {
    min-height: 74px;
    padding: 11px 12px 12px;
    border-radius: 16px;
    border: 1px solid rgba(151, 196, 244, 0.28);
    background:
        radial-gradient(120% 120% at 20% 0%, rgba(144, 201, 255, 0.18), rgba(144, 201, 255, 0) 58%),
        linear-gradient(145deg, rgba(28, 47, 98, 0.88), rgba(11, 23, 60, 0.94));
    box-shadow:
        0 9px 18px rgba(2, 9, 30, 0.28),
        inset 0 1px 0 rgba(247, 251, 255, 0.12);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    text-align: left;
    color: rgba(239, 247, 255, 0.94);
    cursor: pointer;
    transition: transform 180ms var(--ease-spring), box-shadow 180ms var(--ease-spring), border-color 180ms var(--ease-spring);
}

.game-menu-set-option:hover {
    border-color: rgba(176, 215, 255, 0.5);
    transform: translateY(-1px);
    box-shadow:
        0 14px 24px rgba(2, 8, 28, 0.4),
        inset 0 1px 0 rgba(247, 251, 255, 0.18);
}

.game-menu-set-option:active {
    transform: translateY(0) scale(0.98);
}

.game-menu-set-option.is-active {
    border-color: rgba(233, 184, 88, 0.82);
    background:
        radial-gradient(120% 120% at 20% 0%, rgba(255, 224, 151, 0.24), rgba(255, 224, 151, 0) 58%),
        linear-gradient(145deg, rgba(76, 96, 156, 0.95), rgba(38, 57, 114, 0.95));
    color: #fff8df;
    box-shadow:
        0 10px 18px rgba(3, 10, 34, 0.42),
        inset 0 1px 0 rgba(255, 251, 238, 0.3),
        0 0 0 1px rgba(233, 184, 88, 0.5);
    cursor: default;
}

.game-menu-set-option:disabled {
    opacity: 1;
}

.game-menu-set-option-id {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.game-menu-set-option-name {
    font-family: var(--font-primary-ui);
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.25;
    color: inherit;
    text-wrap: balance;
}

@media (max-width: 900px) {
    .game-menu-panel {
        width: min(94vw, 380px);
    }

    .game-menu-option {
        padding: clamp(12px, 3vw, 16px);
        font-size: clamp(0.92rem, 2.6vw, 1.02rem);
    }

    .game-menu-segment-option {
        min-height: 36px;
        font-size: 0.7rem;
    }

    .game-menu-segment-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .game-menu-segment-caption {
        white-space: normal;
    }
}


/* --- Game Board (Legacy Wrapper Adjustment) --- */
#game-board {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
}

#legacy-game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center the arena */
    align-items: center;
    padding: var(--spacing-md);
}

/* Arena Layout */
.battle-arena {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    position: relative;
    margin: 0 auto;
    padding: 8px 12px 14px;
    flex: 1 1 auto;
    isolation: isolate;
}

/* Capa ambiental reactiva (mood por fase) */
#game-board .battle-arena::before,
#game-board .battle-arena::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(78%, 780px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 0;
    opacity: 0;
    transition: opacity 360ms ease, transform 500ms var(--ease-spring), filter 360ms ease;
}

#game-board .battle-arena::before {
    background:
        radial-gradient(circle at 50% 50%, rgba(168, 214, 255, 0.22) 0%, rgba(168, 214, 255, 0.05) 38%, rgba(168, 214, 255, 0) 70%),
        radial-gradient(circle at 28% 34%, rgba(245, 232, 171, 0.24) 0%, rgba(245, 232, 171, 0) 48%),
        radial-gradient(circle at 74% 68%, rgba(186, 146, 255, 0.2) 0%, rgba(186, 146, 255, 0) 52%);
    filter: blur(0.8px) saturate(1.04);
    animation: arena-mood-orbit 16s linear infinite;
}

#game-board .battle-arena::after {
    width: min(88%, 900px);
    background:
        conic-gradient(from 0deg,
            rgba(120, 214, 255, 0.16) 0deg,
            rgba(120, 214, 255, 0) 72deg,
            rgba(245, 232, 171, 0.16) 140deg,
            rgba(245, 232, 171, 0) 230deg,
            rgba(186, 146, 255, 0.15) 300deg,
            rgba(186, 146, 255, 0.06) 360deg);
    mix-blend-mode: screen;
    filter: blur(0.2px);
    animation: arena-mood-spin 24s linear infinite;
}

#game-board .battle-arena>* {
    position: relative;
    z-index: 1;
}

#game-board.arena-mood-draw .battle-arena::before {
    opacity: 0.08;
}

#game-board.arena-mood-select .battle-arena::before {
    opacity: 0.2;
}

#game-board.arena-mood-place .battle-arena::before {
    opacity: 0.14;
}

#game-board.arena-mood-combat .battle-arena::before {
    opacity: 0.34;
    filter: blur(0.2px) saturate(1.18);
}

#game-board.arena-mood-combat .battle-arena::after {
    opacity: 0.2;
}

#game-board.arena-mood-ability .battle-arena::before {
    opacity: 0.26;
    filter: blur(0.6px) saturate(1.14);
}

#game-board.arena-mood-ability .battle-arena::after {
    opacity: 0.16;
}

#game-board.is-stat-selector-open .battle-arena::before {
    opacity: 0.22;
    transform: translate(-50%, -50%) scale(1.01);
    animation-duration: 10s;
}

#game-board.is-stat-selector-open .battle-arena::after {
    opacity: 0.14;
    animation-duration: 14s;
}

#game-board.is-stat-selector-open .lineup-row {
    opacity: 0.86;
    transform: scale(0.996);
    filter: saturate(0.92) brightness(0.97);
}

/* Classic Mode: Arena más compacta y centrada */
.battle-arena.classic-mode {
    max-width: 560px;
    margin: 0 auto;
}

.battle-arena.classic-mode .arena-rows {
    gap: var(--spacing-lg);
}

@media (max-width: 520px) {
    .battle-arena.classic-mode .arena-rows {
        gap: var(--spacing-md);
    }
}

.arena-rows {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    align-items: center;
}

/* REGLA UX GLOBAL: CPU siempre IZQUIERDA (desktop) / ARRIBA (móvil), PLAYER DERECHA (desktop) / ABAJO (móvil) */
/* Orden visual: Rival arriba, Player abajo (como tablero) */
.rival-zone {
    order: 1;
    /* CPU primero (arriba en móvil) */
}

.player-zone {
    order: 5;
    /* PLAYER último (abajo en móvil) — 2/3/4 reserved for between-lineup elements */
}

/* Between-lineup elements in arena-rows */
#wb-stat-announce {
    order: 3;
}

#combat-vis-container {
    order: 4;
}

/* Classic Mode: Arena más compacta */
.battle-arena.classic-mode {
    max-width: 500px;
    margin: 0 auto;
}

.battle-arena.classic-mode .arena-rows {
    gap: var(--spacing-lg);
}

.lineup-row {
    display: flex;
    justify-content: space-around;
    gap: var(--spacing-xs);
    background: rgba(12, 19, 46, 0.38);
    padding: 10px;
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(182, 212, 255, 0.2);
    position: relative;
    overflow: hidden;
    transition: transform 280ms var(--ease-spring), filter 280ms ease, box-shadow 280ms ease, opacity 240ms ease, border-color 280ms ease;
    box-shadow:
        0 16px 34px rgba(5, 9, 28, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.lineup-row::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 18% 16%, rgba(131, 198, 255, 0.14) 0%, rgba(131, 198, 255, 0) 40%),
        radial-gradient(circle at 82% 84%, rgba(194, 152, 255, 0.12) 0%, rgba(194, 152, 255, 0) 44%);
    opacity: 0.9;
}

/* Fondo "blanco roto" para que se lean las etiquetas (CPU y Player) */
.lineup-row.rival-zone,
.lineup-row.player-zone {
    background:
        linear-gradient(160deg, rgba(17, 24, 60, 0.86) 0%, rgba(10, 17, 46, 0.9) 100%),
        radial-gradient(circle at 24% 18%, rgba(244, 137, 158, 0.14) 0%, rgba(244, 137, 158, 0) 40%);
    border-color: rgba(198, 225, 255, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.lineup-row.player-zone {
    background:
        linear-gradient(160deg, rgba(13, 29, 70, 0.86) 0%, rgba(10, 18, 50, 0.9) 100%),
        radial-gradient(circle at 70% 78%, rgba(122, 227, 202, 0.16) 0%, rgba(122, 227, 202, 0) 44%);
}

#game-board .lineup-row.lineup-ready-burst {
    animation: lineup-ready-burst 900ms cubic-bezier(0.2, 0.9, 0.2, 1);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.62),
        0 0 0 1px rgba(249, 234, 182, 0.44),
        0 0 28px rgba(168, 214, 255, 0.24);
}

#game-board .lineup-row.lineup-ready-burst::after {
    content: '';
    position: absolute;
    inset: -24%;
    pointer-events: none;
    background:
        radial-gradient(circle, rgba(249, 234, 182, 0.34) 0%, rgba(249, 234, 182, 0.1) 30%, rgba(126, 204, 255, 0.12) 48%, rgba(126, 204, 255, 0) 72%);
    opacity: 0;
    animation: lineup-ready-ring 900ms ease-out;
}

.slot-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    position: relative;
}

.slot-between-layer {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 0;
}

.slot-between-layer:empty {
    display: none;
}

.card-slot {
    /* Un poco más grande en móvil, sin desbordar el viewport */
    width: clamp(90px, 24vw, 120px);
    height: clamp(126px, 32vw, 170px);
    /* Card aspect ratio ~ 2.5 x 3.5 */
    background:
        linear-gradient(155deg, rgba(12, 21, 54, 0.52) 0%, rgba(9, 15, 41, 0.64) 100%),
        radial-gradient(circle at 50% 40%, rgba(139, 203, 255, 0.1) 0%, rgba(139, 203, 255, 0) 62%);
    border: 1px dashed rgba(184, 213, 248, 0.46);
    border-radius: var(--border-radius-md);
    position: relative;
    /* Center content */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all var(--duration-fast) var(--ease-spring);
    overflow: hidden;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        inset 0 14px 28px rgba(2, 8, 24, 0.26);
}

.rival-zone .card-slot {
    width: clamp(80px, 22vw, 108px);
    height: clamp(112px, 28vw, 150px);
}

.card-slot.empty {
    background-image:
        linear-gradient(140deg, rgba(8, 14, 36, 0.72) 0%, rgba(17, 23, 62, 0.58) 100%),
        radial-gradient(circle at 50% 42%, rgba(186, 223, 255, 0.12) 0%, rgba(186, 223, 255, 0) 64%),
        url('assets/frames/slot_empty.avif');
    background-size: cover, cover, cover;
    background-position: center, center, center;
    border-style: solid;
    border-color: rgba(196, 224, 255, 0.28);
}

.card-slot .card-back {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-slot .card-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.card-slot.active {
    border-style: solid;
    background: transparent;
    border-color: transparent;
    /* Card covers it */
}

.card-slot.active::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('assets/frames/slot_empty.avif');
    background-size: cover;
    background-position: center;
    opacity: 0.55;
    pointer-events: none;
}

/* Pop al colocar carta (táctil, readable) */
.slot-pop {
    animation: slot-pop 650ms var(--ease-spring);
}

/* Entrada direccional: rival cae desde arriba, jugador asciende desde abajo */
.card-slot.slot-drop-from-top .card-mini img,
.card-slot.slot-drop-from-top .card-back img {
    animation: slot-drop-from-top calc(560ms * var(--wb-anim-mult, 1)) cubic-bezier(0.2, 0.88, 0.22, 1) both;
}

.card-slot.slot-drop-from-bottom .card-mini img,
.card-slot.slot-drop-from-bottom .card-back img {
    animation: slot-drop-from-bottom calc(560ms * var(--wb-anim-mult, 1)) cubic-bezier(0.2, 0.88, 0.22, 1) both;
}

/* Aterrizaje mágico al colocar carta en slot */
.card-slot.slot-impact::after {
    content: '';
    position: absolute;
    inset: -22%;
    pointer-events: none;
    border-radius: 50%;
    background:
        radial-gradient(circle, rgba(245, 232, 171, 0.44) 0%, rgba(245, 232, 171, 0.12) 36%, rgba(245, 232, 171, 0) 72%);
    mix-blend-mode: screen;
    animation: slot-impact-ring 760ms ease-out forwards;
}

.card-slot.slot-impact .card-mini {
    animation: slot-card-land 760ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.slot-impact-burst {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 160%;
    aspect-ratio: 1 / 1;
    pointer-events: none;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.72);
    background:
        conic-gradient(from 0deg,
            rgba(249, 234, 182, 0) 0deg,
            rgba(249, 234, 182, 0.42) 48deg,
            rgba(126, 204, 255, 0.34) 112deg,
            rgba(126, 204, 255, 0) 180deg,
            rgba(193, 149, 255, 0.34) 240deg,
            rgba(193, 149, 255, 0) 320deg,
            rgba(249, 234, 182, 0) 360deg);
    filter: blur(0.4px);
    animation: slot-impact-burst 760ms ease-out forwards;
}

@keyframes slot-pop {
    0% {
        transform: scale(1);
    }

    35% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes slot-drop-from-top {
    0% {
        transform: translateY(-24px) scale(0.9);
        opacity: 0;
        filter: brightness(1.16) saturate(1.06);
    }

    65% {
        transform: translateY(4px) scale(1.03);
        opacity: 1;
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
        filter: brightness(1) saturate(1);
    }
}

@keyframes slot-drop-from-bottom {
    0% {
        transform: translateY(18px) scale(0.93);
        opacity: 0;
        filter: brightness(1.12) saturate(1.04);
    }

    65% {
        transform: translateY(-2px) scale(1.02);
        opacity: 1;
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
        filter: brightness(1) saturate(1);
    }
}

@keyframes slot-impact-ring {
    0% {
        opacity: 0.74;
        transform: scale(0.35);
    }

    100% {
        opacity: 0;
        transform: scale(1.14);
    }
}

@keyframes slot-impact-burst {
    0% {
        opacity: 0.72;
        transform: translate(-50%, -50%) scale(0.72) rotate(0deg);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.18) rotate(28deg);
    }
}

@keyframes slot-card-land {
    0% {
        transform: scale(0.92) translateY(8px);
        filter: brightness(1.1);
    }

    48% {
        transform: scale(1.045) translateY(-3px);
    }

    100% {
        transform: scale(1) translateY(0);
        filter: brightness(1);
    }
}

@keyframes arena-mood-orbit {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) rotate(180deg) scale(1.04);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg) scale(1);
    }
}

@keyframes arena-mood-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes lineup-ready-burst {
    0% {
        transform: scale(0.98);
    }

    46% {
        transform: scale(1.015);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes lineup-ready-ring {
    0% {
        opacity: 0.76;
        transform: scale(0.72);
    }

    100% {
        opacity: 0;
        transform: scale(1.08);
    }
}

.pos-label-vertical {
    font-family: var(--font-ui);
    font-size: 0.66rem;
    text-transform: uppercase;
    color: rgba(223, 236, 255, 0.9);
    letter-spacing: 1.1px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(184, 214, 252, 0.28);
    background: linear-gradient(160deg, rgba(8, 16, 42, 0.66), rgba(17, 23, 59, 0.56));
    box-shadow: 0 8px 14px rgba(5, 8, 24, 0.26);
}

/* --- ANIMATIONS & TRANSITIONS (Sprint 3) --- */

/* View Transitions */
/* --- View Wrapper (Tabs) --- */
.view-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    /* NO scroll: todo debe caber en pantalla */
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    display: none;
    /* Default hidden */
    z-index: 10;
    transform: scale(0.98);
}

.view-wrapper.active {
    opacity: 1;
    pointer-events: auto;
    display: block;
    transform: scale(1);
    z-index: 20;
}


/* ==========================================
   VIEW BACKGROUNDS & CONTENT LAYERS
   ========================================== */

.view-background {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.6;
    pointer-events: none;
}

.view-content {
    position: relative;
    z-index: 1;
    padding: max(env(safe-area-inset-top), 16px) clamp(16px, 4vw, 28px) calc(var(--bottom-nav-height) + max(env(safe-area-inset-bottom), 12px));
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* ==========================================
   HUB (Inicio estilo Snap)
   ========================================== */
.hub-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: clamp(12px, 3vw, 24px);
    padding: 0;
    pointer-events: auto;
    z-index: 5;
    animation: hub-enter 450ms var(--ease-spring);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.hub-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 10%, rgba(255, 240, 200, 0.25), transparent 55%),
        radial-gradient(circle at 80% 0%, rgba(120, 200, 255, 0.18), transparent 50%),
        linear-gradient(180deg, rgba(16, 12, 18, 0.35) 0%, rgba(16, 12, 18, 0) 45%, rgba(16, 12, 18, 0.25) 100%);
    pointer-events: none;
    z-index: 0;
}

.hub-content {
    position: relative;
    z-index: 1;
    min-height: 100%;
    height: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(8px, 2.5vw, 14px);
    padding: max(env(safe-area-inset-top), 16px) 18px calc(var(--bottom-nav-height) + max(env(safe-area-inset-bottom), 16px));
}


.hub-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    pointer-events: none;
}

.hub-mode-title {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 6px;
    margin-bottom: 0;
    pointer-events: none;
    position: relative;
}

.hub-mode-title-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
}

.hub-mode-title-halo img {
    height: auto;
    object-fit: contain;
    animation: rotate-halo 20s linear infinite;
    opacity: 0.7;
    filter: drop-shadow(0 0 20px rgba(142, 141, 190, 0.3));
}

@keyframes rotate-halo {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.hub-mode-title img {
    display: block;
    width: 59.5%;
    height: auto;
    object-fit: contain;
    opacity: 0.96;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
    filter:
        drop-shadow(0 8px 18px rgba(42, 35, 40, 0.22)) drop-shadow(0 0 12px rgba(142, 141, 190, 0.14));
}

.hub-subtitle {
    font-family: var(--font-magical);
    font-size: clamp(0.9rem, 2.2vw, 1.05rem);
    color: rgba(42, 35, 40, 0.92);
    text-align: center;
    text-shadow: none;
    margin-top: -4px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(247, 245, 230, 0.9);
    border: 1px solid rgba(42, 35, 40, 0.12);
    box-shadow: 0 6px 16px rgba(20, 15, 20, 0.18);
}

/* Limitar tamaño en escritorio */
@media (min-width: 768px) {
    .hub-mode-title-halo {
        width: 34.02%;
        max-width: 340.2px;
    }

    .hub-mode-title img {
        width: 31.5%;
        max-width: 315px;
    }

    .hub-mode-title-halo img {
        width: 100%;
    }
}

.hub-brand-mark {
    width: 140px;
    height: 28px;
    opacity: 0.85;
    background: radial-gradient(circle at 30% 50%, rgba(255, 215, 0, 0.35), transparent 60%),
        radial-gradient(circle at 70% 50%, rgba(255, 255, 255, 0.18), transparent 55%);
    filter: blur(0.2px);
}

.hub-set-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(247, 245, 230, 0.6);
    border: 1px solid rgba(42, 35, 40, 0.1);
    box-shadow: 0 3px 10px rgba(42, 35, 40, 0.12);
    font-family: var(--font-magical);
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.48rem;
    color: rgba(42, 35, 40, 0.7);
}

.hub-set-label {
    opacity: 0.75;
}

.hub-set-value {
    font-family: var(--font-numeric);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    color: rgba(120, 96, 40, 0.82);
}

.hub-carousel {
    flex: 0 0 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.hub-carousel-shell {
    width: min(96vw, 560px);
    margin: 0 auto;
    padding: 6px 6px 4px;
    border-radius: 20px;
    background: rgba(18, 14, 22, 0.38);
    border: 1px solid rgba(212, 175, 55, 0.18);
    box-shadow: 0 10px 24px rgba(10, 8, 14, 0.32);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    overflow: hidden;
}

#hub-carousel-track {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    column-gap: 6px;
    padding: 6px clamp(10px, 4vw, 18px);
    overflow-x: hidden;
    overflow-y: hidden;
    scroll-snap-type: none;
    -webkit-overflow-scrolling: auto;
    scrollbar-width: none;
    justify-items: center;
    align-items: center;
    position: relative;
}

.hub-mode-card-wrapper {
    --hub-mode-width: min(46vw, 190px);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    scroll-snap-align: center;
    flex-shrink: 0;
    padding-top: 0;
    gap: 8px;
    height: auto;
    width: var(--hub-mode-width);
    transition: transform 320ms var(--ease-spring);
}

#hub-carousel-track[data-selected="classic"] .hub-mode-card-wrapper:first-child {
    grid-column: 2;
    justify-self: center;
}

#hub-carousel-track[data-selected="classic"] .hub-mode-card-wrapper:nth-child(2) {
    grid-column: 3;
    justify-self: start;
}

#hub-carousel-track[data-selected="master"] .hub-mode-card-wrapper:first-child {
    grid-column: 1;
    justify-self: end;
}

#hub-carousel-track[data-selected="master"] .hub-mode-card-wrapper:nth-child(2) {
    grid-column: 2;
    justify-self: center;
}

.hub-carousel-track::-webkit-scrollbar {
    display: none;
}

.hub-mode-card {
    width: var(--hub-mode-width);
    height: auto;
    aspect-ratio: auto;
    flex-shrink: 0;
    border: none;
    border-radius: 0;
    overflow: visible;
    background: transparent;
    box-shadow: none;
    opacity: 0.92;
    transition: transform 300ms var(--ease-spring), opacity 300ms ease, border-color 300ms ease, box-shadow 300ms ease;
    pointer-events: auto;
    position: relative;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hub-mode-card::after {
    display: none;
}

.hub-mode-card:focus-visible {
    outline: 3px solid rgba(120, 200, 255, 0.65);
    outline-offset: 6px;
}

.hub-mode-card img {
    width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center;
    display: block;
    user-select: none;
    border-radius: 14px;
    position: relative;
    z-index: 1;
    transform-origin: center;
    transition: transform 300ms var(--ease-spring);
    box-shadow: 0 8px 18px rgba(20, 15, 20, 0.28);
    border: 1px solid rgba(247, 245, 230, 0.18);
}

.hub-mode-label {
    position: static;
    width: auto;
    padding: 5px 12px;
    text-align: center;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-family: var(--font-parchment);
    font-weight: 400;
    font-size: 10px;
    line-height: 1.2;
    color: rgba(247, 245, 230, 0.95);
    z-index: 20;
    pointer-events: none;
    background: rgba(28, 22, 32, 0.66);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 999px;
    order: 2;
}

.hub-mode-card {
    order: 1;
}

.hub-mode-label::before,
.hub-mode-label::after {
    display: none;
}

.hub-mode-label--classic {
    color: rgba(247, 245, 230, 0.95);
}

.hub-mode-label--master {
    color: rgba(247, 245, 230, 0.95);
}

.hub-mode-card.is-selected {
    opacity: 1;
    border-color: rgba(212, 175, 55, 0.8);
    box-shadow: none;
    z-index: 2;
    margin: 0;
}

.hub-mode-card.is-selected img {
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.6), 0 12px 24px rgba(20, 15, 20, 0.28);
}

/* Mobile: hacer las cartas de modo más compactas para ver la ilustración completa */
@media (max-width: 520px) {
    .hub-mode-card-wrapper {
        --hub-mode-width: min(52vw, 210px);
        width: var(--hub-mode-width);
    }

    .hub-mode-card {
        margin: 0;
        transform: none;
    }

    .hub-mode-card img {
        transform: none;
    }

    .hub-mode-label {
        padding: 6px 12px;
        font-size: 11px;
    }
}

@media (max-width: 767px) {
    #hub-carousel-track {
        --hub-track-card-width: min(46vw, 190px);
        display: flex;
        justify-content: flex-start;
        column-gap: 0;
        gap: 12px;
        padding-inline: calc(50% - (var(--hub-track-card-width) / 2));
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .hub-mode-card-wrapper {
        --hub-mode-width: var(--hub-track-card-width);
        flex: 0 0 var(--hub-mode-width);
    }
}

@media (max-width: 767px) and (max-height: 760px) {
    .hub-screen {
        justify-content: flex-start;
    }

    .hub-content {
        gap: 8px;
        padding-top: max(env(safe-area-inset-top), 12px);
    }

    .hub-topbar {
        margin-bottom: 2px;
    }

    .hub-mode-title {
        margin-top: 0;
    }

    .hub-mode-title img {
        width: min(68vw, 272px);
    }

    .hub-subtitle {
        margin-top: 0;
        padding: 8px 14px;
        font-size: clamp(0.88rem, 3.9vw, 1rem);
    }

    .hub-carousel {
        gap: 6px;
    }

    .hub-carousel-shell {
        width: min(100%, 420px);
        padding: 4px 4px 2px;
    }

    #hub-carousel-track {
        --hub-track-card-width: min(40vw, 168px);
        gap: 10px;
        padding-block: 4px;
        padding-inline: calc(50% - (var(--hub-track-card-width) / 2));
    }

    .hub-mode-card-wrapper {
        gap: 6px;
    }

    .hub-mode-label {
        padding: 4px 10px;
        font-size: 9px;
    }

    .hub-mode-pill {
        font-size: 0.58rem;
        letter-spacing: 0.16em;
    }

    .hub-primary-action {
        position: sticky;
        bottom: max(env(safe-area-inset-bottom), 12px);
        padding-top: 12px;
        padding-bottom: 0;
        background: linear-gradient(180deg, rgba(16, 12, 18, 0) 0%, rgba(16, 12, 18, 0.58) 42%, rgba(16, 12, 18, 0.82) 100%);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    #hub-play-btn {
        width: min(100%, 320px);
        min-height: 60px;
        padding: 16px 22px;
        font-size: clamp(1rem, 4.2vw, 1.3rem);
    }
}

@media (min-width: 900px) {
    .hub-carousel-shell {
        width: min(88vw, 980px);
        padding: 12px 10px 8px;
    }

    .hub-mode-card-wrapper {
        --hub-mode-width: min(30vw, 280px);
        gap: 10px;
    }

    .hub-mode-label {
        font-size: 12px;
        padding: 6px 14px;
    }
}

.hub-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    opacity: 0.9;
    padding: 6px 12px;
    background: rgba(247, 245, 230, 0.82);
    border: 1px solid rgba(42, 35, 40, 0.12);
    border-radius: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.hub-carousel-footer {
    display: flex;
    justify-content: center;
    padding: 6px 0 4px;
}

.hub-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(247, 245, 230, 0.45);
    border: 1px solid rgba(42, 35, 40, 0.35);
    transition: transform 220ms var(--ease-spring), background 220ms ease;
}

.hub-dot.is-active {
    background: var(--wb-accent);
    transform: scale(1.25);
}

.hub-set-indicator {
    display: flex;
    justify-content: center;
    margin-top: 4px;
    opacity: 0.9;
}

.hub-primary-action {
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    margin: 0;
    margin-top: auto;
    width: 100%;
    position: relative;
    z-index: 2;
}

#hub-play-btn {
    width: min(84vw, 356px);
    min-height: 74px;
    height: auto;
    padding: 0;
    position: relative;
    display: block;
    text-align: center;
    background: transparent;
    border: 0;
    border-radius: 20px;
    color: rgba(42, 35, 40, 0.95);
    box-shadow: none;
    overflow: hidden;
    isolation: isolate;
    transition: transform 220ms var(--ease-spring), filter 220ms ease;
}

.hub-mode-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.hub-mode-pill {
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(42, 35, 40, 0.65);
    color: rgba(247, 245, 230, 0.95);
    font-family: var(--font-primary-ui);
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    box-shadow: 0 6px 16px rgba(20, 15, 20, 0.3);
}

.hub-mode-headline {
    font-family: var(--font-parchment);
    font-size: clamp(1.5rem, 4vw, 2.1rem);
    color: rgba(247, 245, 230, 0.98);
    text-shadow: 0 8px 20px rgba(20, 15, 20, 0.45);
    margin: 0;
}

.hub-mode-desc {
    max-width: 320px;
    font-family: var(--font-magical);
    font-size: 0.92rem;
    color: rgba(42, 35, 40, 0.9);
    line-height: 1.32;
    margin: 0;
    padding: 8px 12px;
    background: rgba(247, 245, 230, 0.9);
    border: 1px solid rgba(42, 35, 40, 0.12);
    border-radius: 12px;
    box-shadow: 0 6px 14px rgba(20, 15, 20, 0.16);
}

#hub-play-btn::before {
    content: none;
}

#hub-play-btn::after {
    content: none;
}

#hub-play-btn:hover {
    transform: translateY(-2px) scale(1.01);
}

#hub-play-btn:active {
    transform: translateY(0) scale(0.99);
}


#hub-play-btn span {
    position: relative;
    z-index: 1;
}

#hub-play-btn .hub-play-btn__backdrop,
#hub-play-btn .hub-play-btn__spark {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

#hub-play-btn .hub-play-btn__spark {
    inset: auto 10% -18% 10%;
    height: 58%;
    border-radius: 999px;
    opacity: 0.42;
    filter: blur(16px);
}

#hub-play-btn .hub-play-btn__content {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 4px;
    padding: 12px 18px 14px;
    text-align: center;
}

#hub-play-btn .hub-play-btn__kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    min-height: 15px;
    font-family: var(--font-primary-ui);
    font-size: 0.54rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1;
}

#hub-play-btn .hub-play-btn__main {
    display: inline-grid;
    grid-template-columns: auto minmax(0, auto);
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#hub-play-btn .hub-play-btn__sigil {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: transform 220ms ease, box-shadow 220ms ease;
}

#hub-play-btn .hub-play-btn__sigil::before {
    content: '✦';
    font-family: var(--font-primary-ui);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1;
}

#hub-play-btn .hub-play-btn__label {
    min-width: 0;
    font-family: var(--font-parchment);
    font-size: clamp(1.18rem, 4vw, 1.56rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

#hub-play-btn .hub-play-btn__arrow {
    display: none;
}

@keyframes hub-enter {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================
   BOTTOM NAV (Tabbar fija, fuera de combate)
   ========================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    min-height: var(--bottom-nav-height);
    padding:
        12px max(14px, env(safe-area-inset-left)) calc(12px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right));
    z-index: 1000;
    /* FORCE VISIBILITY */
    pointer-events: auto;

    /* Componente único (objeto físico): losa/papel tallado */
    position: fixed;
    isolation: isolate;
    border-radius: 26px 26px 0 0;
    background:
        /* motas de papel/gouache muy sutiles */
        radial-gradient(circle at 18% 22%, rgba(42, 35, 40, 0.06) 0 2px, transparent 3px),
        radial-gradient(circle at 72% 38%, rgba(42, 35, 40, 0.05) 0 2px, transparent 3px),
        radial-gradient(circle at 40% 64%, rgba(42, 35, 40, 0.045) 0 2px, transparent 3px),
        /* luz superior + cuerpo */
        linear-gradient(to bottom,
            rgba(255, 255, 255, 0.34) 0%,
            rgba(255, 255, 255, 0.10) 26%,
            rgba(0, 0, 0, 0.03) 100%),
        linear-gradient(to bottom,
            rgba(232, 228, 208, 0.98) 0%,
            rgba(247, 245, 230, 0.96) 62%,
            rgba(232, 228, 208, 0.94) 100%);
    border-top: 2px solid rgba(42, 35, 40, 0.18);
    box-shadow:
        /* separación del tablero */
        0 -14px 30px rgba(42, 35, 40, 0.22),
        0 -2px 0 rgba(255, 255, 255, 0.18),
        /* cuerpo con relieve */
        inset 0 1px 0 rgba(255, 255, 255, 0.32),
        inset 0 -1px 0 rgba(42, 35, 40, 0.06);

    transition: transform 260ms var(--ease-paper), opacity 220ms ease;
    display: flex;
    align-items: center;
    justify-content: space-around;
    /* gap: clamp(10px, 4vw, 18px); */
}

.bottom-nav::before {
    /* Labio tallado superior (silueta + separación) */
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    top: 6px;
    height: 10px;
    border-radius: 999px;
    background:
        linear-gradient(to bottom,
            rgba(255, 255, 255, 0.24),
            rgba(42, 35, 40, 0.05));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.22),
        0 1px 0 rgba(42, 35, 40, 0.08);
    pointer-events: none;
    opacity: 0.9;
}

.bottom-nav::after {
    /* Sombra interior cerca del borde superior: ancla el componente */
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 28px;
    border-radius: 26px 26px 0 0;
    background: linear-gradient(to bottom, rgba(42, 35, 40, 0.08), transparent 78%);
    pointer-events: none;
    opacity: 0.58;
}


.bottom-nav-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    background: transparent;
    /* el "slot" vive en ::before */
    cursor: pointer;
    color: var(--color-ink-primary);
    padding: 10px 10px 8px;
    border-radius: 18px;
    transition: transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1),
        opacity 200ms ease,
        filter 200ms ease;
    will-change: transform;
    touch-action: manipulation;
    --slot-inset: 6px;
    --slot-radius: 18px;
    --slot-ink: rgba(42, 35, 40, 0.14);
    --slot-fill: rgba(42, 35, 40, 0.06);
    --slot-inner: rgba(255, 255, 255, 0.26);
    /* Touch target: móvil first */
    width: clamp(72px, 22vw, 92px);
    height: 78px;
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    opacity: 0.92;
    z-index: 1;
    /* Evitar solapamiento */
    flex-shrink: 0;
}

.bottom-nav-btn::before {
    /* Slot/socket tallado (embebido) */
    content: "";
    position: absolute;
    inset: var(--slot-inset);
    border-radius: var(--slot-radius);
    background:
        radial-gradient(ellipse at 50% 20%, rgba(255, 255, 255, 0.18), transparent 62%),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.10), rgba(0, 0, 0, 0.02)),
        linear-gradient(to bottom, var(--slot-fill), var(--slot-fill));
    border: 1px solid var(--slot-ink);
    box-shadow:
        inset 0 2px 6px rgba(42, 35, 40, 0.18),
        inset 0 -2px 6px var(--slot-inner),
        0 1px 0 rgba(255, 255, 255, 0.16);
    pointer-events: none;
    z-index: 0;
    transition:
        box-shadow 320ms var(--ease-paper),
        background 320ms var(--ease-paper),
        border-color 320ms var(--ease-paper),
        transform 320ms var(--ease-paper),
        opacity 240ms ease;
}

.bottom-nav-btn::after {
    /* Bevel fino: hace que el slot se lea “carved” sin recargar */
    content: "";
    position: absolute;
    inset: calc(var(--slot-inset) + 3px);
    border-radius: calc(var(--slot-radius) - 3px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.20),
        inset 0 -1px 0 rgba(42, 35, 40, 0.10);
    pointer-events: none;
    z-index: 0;
    opacity: 0.85;
    transition: opacity 240ms ease;
}

.bottom-nav-btn img {
    position: relative;
    z-index: 1;
    --nav-icon-radius: 24px;
    width: calc(var(--nav-icon-size, 40px) * 0.92);
    height: calc(var(--nav-icon-size, 40px) * 0.92);
    object-fit: contain;
    /* “Placa” detrás del icono para que se sienta embebido */
    background: rgba(247, 245, 230, 0.18);
    border: 1px solid rgba(42, 35, 40, 0.10);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 2px 4px rgba(42, 35, 40, 0.14);
    /* Sin padding/margen interno + esquinas redondeadas consistentes */
    border-radius: var(--nav-icon-radius);
    clip-path: inset(0 round var(--nav-icon-radius));
    margin: 0;
    padding: 0;
    /* Refuerza silueta, pero menos “flotante” */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.20));
    transition: width 300ms cubic-bezier(0.2, 0.8, 0.2, 1),
        height 300ms cubic-bezier(0.2, 0.8, 0.2, 1),
        filter 220ms ease,
        opacity 220ms ease,
        background 220ms ease,
        box-shadow 220ms ease,
        border-color 220ms ease;
}

.bottom-nav-label {
    position: relative;
    z-index: 1;
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    opacity: 0.82;
    transition: font-size 300ms cubic-bezier(0.2, 0.8, 0.2, 1),
        opacity 200ms ease;
    white-space: nowrap;
}

/* Botones exteriores deshabilitados (1º y 5º) */
.bottom-nav-btn.is-disabled {
    width: 52px;
    height: 52px;
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
    transform: scale(1);
    transition: none !important;
    z-index: 0;
}

.bottom-nav-btn.is-disabled img {
    width: calc(24px * 0.92);
    height: calc(24px * 0.92);
    filter: none;
}

.bottom-nav-btn.is-disabled .bottom-nav-label {
    font-size: 0.55rem;
    opacity: 0.3;
}

/* Botones centrales interactivos (2º, 3º, 4º) */
.bottom-nav-btn[data-nav] {
    /* Variables para componer estados sin “pelearse” con transform */
    --nav-scale: 1;
    --nav-lift: 0px;
    --nav-opacity: 0.92;
    --nav-filter: none;
    transform: translateY(var(--nav-lift)) scale(var(--nav-scale));
    opacity: var(--nav-opacity);
    filter: var(--nav-filter);
    z-index: 2;
}

/* Batalla: slot primario (jerarquía constante) */
.bottom-nav-btn.is-primary {
    --slot-inset: 4px;
    --slot-radius: 20px;
    --slot-fill: rgba(42, 35, 40, 0.075);
    /* +20% vs tamaño anterior */
    --nav-icon-size: 67px;
    --nav-scale: 1.06;
    --nav-lift: -4px;
}

/* Estado INACTIVO */
.bottom-nav-btn[data-nav].is-inactive {
    /* +20% vs tamaño anterior */
    --nav-icon-size: 58px;
    --nav-scale: 0.88;
    --nav-opacity: 0.72;
    --nav-filter: grayscale(0.1) saturate(0.92);
    z-index: 1;
}

.bottom-nav-btn.is-primary.is-inactive {
    /* Jerarquía constante: Batalla sigue dominando aunque no esté seleccionada */
    --nav-icon-size: 64px;
    --nav-scale: 0.98;
    --nav-lift: -3px;
    --nav-opacity: 0.86;
    --slot-inset: 5px;
    --slot-radius: 20px;
    --slot-fill: rgba(42, 35, 40, 0.07);
}

.bottom-nav-btn[data-nav].is-inactive img {
    /* size driven by --nav-icon-size */
    opacity: 0.86;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.16)) grayscale(0.08) saturate(0.92);
    background: rgba(247, 245, 230, 0.12);
}

.bottom-nav-btn[data-nav].is-inactive .bottom-nav-label {
    font-size: 0.66rem;
    opacity: 0.7;
}

/* Estado ACTIVO */
.bottom-nav-btn[data-nav].is-active {
    /* +20% vs tamaño anterior */
    --nav-icon-size: 79px;
    --nav-scale: 1.18;
    --nav-lift: -8px;
    --nav-opacity: 1;
    z-index: 10;
    --nav-filter: none;
    background: transparent;
    box-shadow: none;
}

.bottom-nav-btn[data-nav].is-active::before {
    /* Selección física + halo mágico muy sutil (no flashy) */
    border-color: rgba(42, 35, 40, 0.18);
    background:
        radial-gradient(ellipse at 50% 16%, rgba(255, 255, 255, 0.24), transparent 64%),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.02)),
        linear-gradient(to bottom, rgba(42, 35, 40, 0.07), rgba(42, 35, 40, 0.06));
    box-shadow:
        inset 0 2px 6px rgba(42, 35, 40, 0.16),
        inset 0 -2px 8px rgba(255, 255, 255, 0.28),
        0 10px 18px rgba(42, 35, 40, 0.12),
        0 0 12px rgba(142, 141, 190, 0.22),
        0 0 8px rgba(212, 175, 55, 0.16);
    transform: translateY(-1px);
}

.bottom-nav-btn[data-nav].is-active::after {
    opacity: 0.98;
}

.bottom-nav-btn[data-nav].is-active img {
    background: rgba(247, 245, 230, 0.22);
    border-color: rgba(42, 35, 40, 0.14);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.30),
        0 3px 6px rgba(42, 35, 40, 0.16);
    filter:
        drop-shadow(0 3px 6px rgba(0, 0, 0, 0.22)) drop-shadow(0 0 8px rgba(142, 141, 190, 0.20)) drop-shadow(0 0 6px rgba(212, 175, 55, 0.14));
    animation: none;
}

.bottom-nav-btn[data-nav].is-active .bottom-nav-label {
    font-size: 0.72rem;
    opacity: 1;
    font-weight: 900;
}

/* Nota: el halo vive en el slot (::before) y es deliberadamente sutil. */

@keyframes nav-halo-pulse {

    0%,
    100% {
        opacity: 0.78;
        transform: scale(0.97);
    }

    50% {
        opacity: 0.98;
        transform: scale(1.06);
    }
}

@keyframes nav-border-pulse {

    0%,
    100% {
        opacity: 0.42;
        border-color: rgba(212, 175, 55, 0.52);
        box-shadow:
            0 0 18px rgba(142, 141, 190, 0.5),
            0 0 36px rgba(92, 206, 255, 0.32),
            0 0 54px rgba(212, 175, 55, 0.18),
            inset 0 0 18px rgba(247, 245, 230, 0.1);
    }

    50% {
        opacity: 0.72;
        border-color: rgba(212, 175, 55, 0.78);
        box-shadow:
            0 0 24px rgba(142, 141, 190, 0.62),
            0 0 48px rgba(92, 206, 255, 0.42),
            0 0 72px rgba(212, 175, 55, 0.28),
            inset 0 0 24px rgba(247, 245, 230, 0.14);
    }
}

@keyframes nav-icon-breathe {

    0%,
    100% {
        transform: scale(1);
        filter:
            drop-shadow(0 6px 12px rgba(0, 0, 0, 0.36)) drop-shadow(0 0 8px rgba(212, 175, 55, 0.22)) drop-shadow(0 0 12px rgba(142, 141, 190, 0.18));
    }

    50% {
        transform: scale(1.02);
        filter:
            drop-shadow(0 7px 14px rgba(0, 0, 0, 0.38)) drop-shadow(0 0 10px rgba(212, 175, 55, 0.28)) drop-shadow(0 0 14px rgba(142, 141, 190, 0.24));
    }
}

/* Estados de interacción */
.bottom-nav-btn[data-nav]:not(.is-disabled):active {
    transform: translateY(calc(var(--nav-lift) + 1px)) scale(var(--nav-scale));
    filter: brightness(0.98) saturate(1.03);
}

.bottom-nav-btn[data-nav]:not(.is-disabled):active::before {
    /* Sensación de “pressed” dentro del slot (táctil, no flashy) */
    transform: translateY(0px);
    box-shadow:
        inset 0 3px 7px rgba(42, 35, 40, 0.20),
        inset 0 -1px 5px rgba(255, 255, 255, 0.18),
        0 6px 12px rgba(42, 35, 40, 0.10),
        0 0 10px rgba(142, 141, 190, 0.16),
        0 0 7px rgba(212, 175, 55, 0.12);
    opacity: 0.98;
}

.bottom-nav-btn[data-nav]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(92, 206, 255, 0.4);
}

/* Móvil muy estrecho: evita que las labels “choquen” */
@media (max-width: 360px) {
    .bottom-nav-btn {
        width: clamp(66px, 28vw, 86px);
        height: 74px;
        padding: 10px 8px 7px;
    }

    .bottom-nav-label {
        font-size: 0.64rem;
        letter-spacing: 0.55px;
    }

    .bottom-nav-btn.is-primary {
        /* +20% */
        --nav-icon-size: 62px;
    }

    .bottom-nav-btn[data-nav].is-active {
        /* +20% */
        --nav-icon-size: 72px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bottom-nav-btn {
        transition: none;
    }

    .bottom-nav-btn[data-nav].is-active::before,
    .bottom-nav-btn[data-nav].is-active::after {
        animation: none;
    }

    .bottom-nav-btn[data-nav].is-active img {
        animation: none;
    }
}

/* ==========================================
   PAGER (Generator/No-scroll)
   ========================================== */
.pager-controls {
    margin-top: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.pager-btn {
    width: 44px;
    height: 40px;
    border-radius: 14px;
    border: 2px solid var(--color-ink-primary);
    background: rgba(247, 245, 230, 0.9);
    box-shadow: var(--shadow-paper);
    font-family: var(--font-display);
    font-weight: 900;
    cursor: pointer;
    transition: transform 200ms var(--ease-spring), opacity 200ms ease;
}

.pager-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pager-indicator {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

/* ==========================================
   GENERATOR VIEW - Collection Gallery
   ========================================== */

.view-generator-bg {
    background-image: url('assets/backgrounds/bg_collection_default.avif'),
        linear-gradient(to bottom, rgba(247, 245, 230, 0.95), rgba(247, 245, 230, 0.85));
}

.view-generator .view-background {
    opacity: 1;
    background-color: #f7f5e6;
}

.view-generator {
    position: relative;
}

.generator-redirect-shell {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(7, 10, 16, 0.56);
    backdrop-filter: blur(6px);
}

.generator-legacy-card {
    width: min(560px, 100%);
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: linear-gradient(150deg, rgba(16, 18, 28, 0.96), rgba(22, 28, 42, 0.94));
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.4);
    padding: 20px;
    display: grid;
    gap: 12px;
    text-align: center;
}

.generator-legacy-card h2 {
    margin: 0;
    color: #f8f3e8;
    font-family: var(--font-display);
    font-size: clamp(1.05rem, 2.6vw, 1.45rem);
}

.generator-legacy-card p {
    margin: 0;
    color: rgba(248, 243, 232, 0.84);
    font-size: 0.95rem;
}

.generator-legacy-card .btn {
    justify-self: center;
    min-height: 48px;
    padding-inline: 20px;
}

.generator-redirect-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .generator-redirect-actions {
        width: 100%;
        flex-direction: column;
    }

    .generator-redirect-actions .btn {
        width: 100%;
    }
}

/* Generator Header Compacto */
.generator-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

.generator-header-compact .game-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: var(--color-ink-primary);
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
    margin: 0;
}

/* Botón Toggle para Filtros */
.filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: clamp(10px, 2vw, 12px) clamp(16px, 3vw, 20px);
    background: var(--color-paper-light);
    border: 2px solid var(--color-ink-primary);
    border-radius: var(--border-radius-md);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(0.85rem, 2vw, 1rem);
    color: var(--color-ink-primary);
    cursor: pointer;
    transition: all 300ms var(--ease-spring);
    box-shadow: var(--shadow-paper);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-deep);
    background: rgba(247, 245, 230, 0.98);
}

.filter-toggle-btn.active {
    background: var(--color-ink-primary);
    color: var(--color-paper-light);
    box-shadow: var(--shadow-deep);
}

.filter-toggle-btn .filter-icon {
    font-size: 1.2em;
    transition: transform 300ms var(--ease-spring);
}

.filter-toggle-btn.active .filter-icon {
    transform: rotate(90deg);
}

.filter-toggle-btn .filter-text {
    display: none;
}

@media (min-width: 768px) {
    .filter-toggle-btn .filter-text {
        display: inline;
    }
}

/* Panel Deslizante Moderno */
.sliding-panel {
    max-height: 0;
    height: 0;
    overflow: hidden;
    transition: max-height 400ms var(--ease-spring), height 400ms var(--ease-spring), opacity 300ms ease, margin 300ms ease, padding 300ms ease;
    opacity: 0;
    margin-bottom: 0;
    padding: 0;
    width: 100%;
    background: rgba(247, 245, 230, 0.98);
    backdrop-filter: blur(8px);
    border: 3px solid var(--color-ink-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-deep);
}

.sliding-panel.panel-open {
    max-height: 1000px !important;
    height: auto !important;
    opacity: 1;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    width: 100%;
    overflow: visible;
}

.sliding-panel-content {
    padding: var(--spacing-xs) 0;
    min-height: fit-content;
    height: auto !important;
    max-height: none !important;
    width: 100%;
}


.sliding-panel .toolbar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    padding: var(--spacing-xs) 0;
    min-height: fit-content;
    width: 100%;
}

.sliding-panel .input-premium,
.sliding-panel .btn-primary {
    font-size: clamp(0.75rem, 1.8vw, 0.9rem);
    padding: clamp(6px, 1vw, 8px) clamp(10px, 2vw, 14px);
    min-height: 32px !important;
    height: auto;
    line-height: 1.4;
    margin: 4px;
    border-width: 2px;
}

.sliding-panel .btn-primary {
    font-weight: 600;
    letter-spacing: 0.3px;
}

.sliding-panel .sim-label {
    font-size: clamp(0.85rem, 2vw, 1rem);
}

.sliding-panel .sim-input {
    width: 80px;
    font-size: clamp(0.75rem, 1.8vw, 0.9rem);
    padding: clamp(6px, 1vw, 8px) clamp(8px, 1.5vw, 12px);
    min-height: 32px;
    height: auto;
    border-width: 2px;
}

.sliding-panel select.input-premium {
    min-height: 32px;
    height: auto;
    padding: 0 !important;
    border-width: 2px;
}

.view-generator .toolbar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

/* Generator Card Viewer Modal (Móvil) */
.generator-card-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: calc(var(--z-modal) + 10);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 200ms ease-out;
}


.generator-card-viewer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
}

.generator-card-viewer-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.generator-card-viewer-content .card-premium,
.generator-card-viewer-content .card {
    transform: scale(1.2);
    max-width: 100%;
    max-height: 100%;
    cursor: default;
}

.generator-card-viewer-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(247, 245, 230, 0.95);
    border: 2px solid var(--color-ink-primary);
    color: var(--color-ink-primary);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all 200ms ease;
    box-shadow: var(--shadow-deep);
}

.generator-card-viewer-close:hover {
    background: var(--color-ink-primary);
    color: var(--color-paper-light);
    transform: scale(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (min-width: 769px) {
    .generator-card-viewer {
        display: none !important;
    }
}

.generator-grid {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    align-content: start;
    padding: 0;
    overflow-y: auto;
    /* Scroll vertical para ver todas las cartas */
    overflow-x: hidden;
}

.generator-grid .card {
    transition: transform 300ms var(--ease-spring), box-shadow 300ms ease;
}

.generator-grid .card-premium,
.generator-grid .card {
    transform: scale(0.82);
    transform-origin: top center;
    aspect-ratio: 300 / 420;
    width: 100%;
    height: auto;
}

.generator-grid .card-premium:hover,
.generator-grid .card:hover {
    transform: scale(0.84);
    z-index: 10;
    position: relative;
}

/* Móvil: 3 columnas muy pequeñas y juntas */
@media (max-width: 767px) {
    .generator-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3px;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .generator-grid .card {
        cursor: pointer;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .generator-grid .card-premium,
    .generator-grid .card {
        transform: scale(0.32);
        transform-origin: top center;
        aspect-ratio: 300 / 420;
        width: 100%;
        max-width: 100%;
        height: auto;
    }

    .generator-grid .card-premium:hover,
    .generator-grid .card:hover {
        transform: scale(0.34);
    }
}

@media (min-width: 768px) {
    .generator-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3px;
        padding: 0;
    }

    .generator-grid .card-premium,
    .generator-grid .card {
        transform: scale(0.82);
        cursor: default;
        aspect-ratio: 300 / 420;
        width: 100%;
        height: auto;
        max-width: none;
    }

    .generator-grid .card-premium:hover,
    .generator-grid .card:hover {
        transform: scale(0.82);
    }
}

@media (min-width: 1024px) {
    .generator-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 3px;
    }

    .generator-grid .card-premium,
    .generator-grid .card {
        transform: scale(0.86);
        aspect-ratio: 300 / 420;
        width: 100%;
        height: auto;
    }
}

/* Compacto en móvil para dejar aire a "Salir" (izq) y confirmaciones (der) */
@media (max-width: 520px) {
    .combat-bottom-bar {
        --combat-bottom-offset: max(4px, env(safe-area-inset-bottom));
        padding-bottom: var(--combat-bottom-offset);
        gap: 0;
    }

    .hand-dock-toggle-btn {
        width: 30px;
        height: 14px;
        min-width: 0;
        min-height: 0;
        border-radius: 999px;
    }

    #combat-bottom-bar .combat-action-row {
        padding: 2px 8px;
    }

    .combat-bottom-actions {
        position: static;
        right: auto;
        bottom: auto;
        pointer-events: auto;
        flex: 1 1 auto;
        justify-content: flex-end;
    }

    #btn-exit-combat {
        margin-left: 0;
    }

    .combat-bottom-actions {
        bottom: var(--combat-bottom-offset);
        gap: 6px;
    }

    .combat-bottom-actions .btn-primary,
    .combat-bottom-actions .btn {
        padding: 8px 14px;
        font-size: 0.8rem;
        min-height: 40px;
        min-width: 40px;
        border-width: 2px;
        font-weight: 600;
        letter-spacing: 0.02em;
    }

    .hand-dock {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }

    .hand-dock-content {
        height: 155px;
        padding: 4px 6px 4px;
        max-width: 100%;
    }

    .hand-dock.hand--idle .hand-dock-content {
        height: 145px;
    }

    .hand-dock.hand--focus .hand-dock-content {
        height: 155px;
    }

    .hand-dock-content .card-mini {
        width: 90px;
        height: 126px;
        margin-left: -18px;
    }

    .hand--focus .hand-dock-content .card-mini.hand-card-focused {
        transform: translateY(-10px) scale(1.1);
        margin-right: 10px;
    }
}

@media (min-width: 1440px) {
    .generator-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 16px;
    }

    .generator-grid .card-premium,
    .generator-grid .card {
        transform: scale(0.92);
    }
}

.generator-grid .card:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

/* ==========================================
   SIMULATOR VIEW - Statistics Panel
   ========================================== */

.view-simulator-bg {
    background-image: linear-gradient(to bottom, rgba(247, 245, 230, 0.95), rgba(247, 245, 230, 0.85));
}

/* Simulator Header Compacto */
.simulator-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

.simulator-header-compact .game-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: var(--color-ink-primary);
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
    margin: 0;
}

.view-simulator .toolbar-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.sim-label {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-ink-primary);
    font-size: clamp(1rem, 2.5vw, 1.1rem);
}

.sim-input {
    width: 100px;
    text-align: center;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
}

.sim-output-box {
    background: rgba(247, 245, 230, 0.95);
    backdrop-filter: blur(8px);
    border: 3px solid var(--color-ink-secondary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-paper);
    padding: var(--spacing-xl);
    margin-top: var(--spacing-lg);
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    /* NO scroll */
}

.sim-output-box h3 {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: var(--color-ink-primary);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    border-bottom: 2px solid var(--color-ink-secondary);
    padding-bottom: var(--spacing-md);
}

.sim-output-box h4 {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    color: var(--color-ink-primary);
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    font-weight: 700;
}

.sim-output-box ol,
.sim-output-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sim-output-box li {
    font-family: var(--font-body);
    font-size: clamp(0.9rem, 2.5vw, 1rem);
    color: var(--color-ink-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
    background: rgba(247, 245, 230, 0.5);
    border-left: 3px solid var(--color-ink-secondary);
    border-radius: var(--border-radius-sm);
    transition: all 200ms ease;
}

.sim-output-box li:hover {
    background: rgba(247, 245, 230, 0.8);
    border-left-color: var(--color-accent-gold);
    transform: translateX(4px);
}

/* Simulator Tabs (no scroll) */
.sim-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.sim-tab-btn {
    border-radius: 999px;
    padding: 10px 14px;
    border: 2px solid var(--color-ink-secondary);
    background: rgba(247, 245, 230, 0.65);
    font-family: var(--font-display);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: transform 200ms var(--ease-spring), background 200ms ease, border-color 200ms ease;
}

.sim-tab-btn.is-active {
    border-color: var(--color-accent-gold);
    background: rgba(255, 215, 0, 0.18);
    transform: translateY(-1px);
}


.sim-results-section {
    background: rgba(247, 245, 230, 0.6);
    border: 2px solid var(--color-ink-secondary);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
}

.sim-stats-summary {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: rgba(247, 245, 230, 0.7);
    border-radius: var(--border-radius-md);
    border: 2px solid var(--color-ink-secondary);
    flex-wrap: wrap;
}

.sim-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
}

.sim-stat-label {
    font-family: var(--font-display);
    font-size: clamp(0.85rem, 2vw, 1rem);
    font-weight: 600;
    color: var(--color-ink-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sim-stat-value {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 900;
    color: var(--color-ink-primary);
}

.sim-stat-item.wins-p1 .sim-stat-value {
    color: var(--color-accent-gold);
}

.sim-stat-item.wins-p2 .sim-stat-value {
    color: var(--color-danger);
}

.sim-stat-item.ties .sim-stat-value {
    color: var(--color-ink-secondary);
}

/* Keyframes */
@keyframes fadeInSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGold {
    0% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    }

    100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
    }
}

/* --- Metagame UI (Menu, Settings, Results) --- */

/* Mode Selection Hover Effects */
.mode-card-btn {
    transition: all var(--duration-fast) var(--ease-spring);
    border: 2px solid transparent;
}

.mode-card-btn:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-deep);
    border-color: var(--color-accent-gold);
}

/* Settings Drawer (Parchment Scroll Style) */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-fast);
}

.bottom-sheet-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.bottom-sheet-content {
    width: 100%;
    max-width: 600px;
    min-height: 50vh;
    background: var(--color-paper-light);
    /* Parchment color */
    border-top: 4px solid var(--color-ink-primary);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    padding: var(--spacing-lg);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(100%);
    transition: transform var(--duration-normal) cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.bottom-sheet-overlay.active .bottom-sheet-content {
    transform: translateY(0);
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--color-ink-secondary);
    padding-bottom: var(--spacing-sm);
    font-family: var(--font-display);
    font-size: 1.5rem;
}

/* Victory/Defeat Overlay */
.game-result-panel {
    background: var(--color-paper-light);
    border: 4px double var(--color-ink-primary);
    padding: 40px;
    text-align: center;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 90%;
    animation: fadeInSlideUp 0.6s var(--ease-spring);
}

/* ==========================================
   RESULT OVERLAY - Game-First Design
   ========================================== */

.result-overlay-container {
    max-width: 600px;
    width: 95vw;
}

.result-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-xl);
}

/* Score Display */
/* REGLA UX GLOBAL: CPU siempre IZQUIERDA (desktop) / ARRIBA (móvil), PLAYER DERECHA (desktop) / ABAJO (móvil) */
.result-score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    width: 100%;
    padding: var(--spacing-lg);
    background: rgba(247, 245, 230, 0.5);
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--color-ink-secondary);
    /* Orden visual: CPU primero (izquierda), luego PLAYER (derecha) */
    flex-direction: row;
    /* Desktop: horizontal */
}

.result-score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    flex: 1;
}

.result-score-label {
    font-family: var(--font-display);
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: 600;
    color: var(--color-ink-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result-score-value {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 4.5rem);
    font-weight: 700;
    line-height: 1;
    color: var(--color-ink-primary);
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.result-score-vs {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--color-ink-secondary);
    opacity: 0.6;
}

.result-score-player .result-score-value {
    color: var(--color-accent-gold);
}

.result-score-cpu .result-score-value {
    color: var(--color-danger);
}

/* Message Container */
.result-message-container {
    text-align: center;
    padding: var(--spacing-md);
    width: 100%;
}

.result-message-text {
    font-family: var(--font-body);
    font-size: clamp(1rem, 3vw, 1.2rem);
    line-height: 1.5;
    color: var(--color-ink-primary);
    margin: 0;
}

.result-message-win {
    color: var(--color-accent-gold);
    font-weight: 600;
}

.result-message-loss {
    color: var(--color-danger);
    font-weight: 600;
}

.result-message-tie {
    color: var(--color-ink-primary);
    font-weight: 600;
}

/* Round Stats (Master Mode) */
.result-round-stats {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    width: 100%;
    padding: var(--spacing-md);
    background: rgba(247, 245, 230, 0.3);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--color-ink-secondary);
}


.result-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid rgba(42, 35, 40, 0.1);
}

.result-stat-item:last-child {
    border-bottom: none;
}

.result-stat-label {
    font-family: var(--font-body);
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    color: var(--color-ink-secondary);
}

.result-stat-value {
    font-family: var(--font-display);
    font-size: clamp(1rem, 3vw, 1.2rem);
    font-weight: 700;
    color: var(--color-ink-primary);
}

/* Title States */
.result-title-win {
    color: var(--color-accent-gold) !important;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.result-title-loss {
    color: var(--color-danger) !important;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.result-title-tie {
    color: var(--color-ink-primary) !important;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

/* Overlay State Classes */
#game-result-overlay.result-win .result-overlay-container,
.result-overlay-container.result-win {
    border-color: var(--color-accent-gold);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

#game-result-overlay.result-loss .result-overlay-container,
.result-overlay-container.result-loss {
    border-color: var(--color-danger);
    box-shadow: 0 0 30px rgba(244, 67, 54, 0.3);
}

#game-result-overlay.result-tie .result-overlay-container,
.result-overlay-container.result-tie {
    border-color: var(--color-ink-secondary);
}

/* Animations */
@keyframes result-score-pop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.result-score-value {
    animation: result-score-pop 600ms var(--ease-spring);
}

/* Responsive Adjustments */
@media (min-width: 768px) {
    .result-overlay-container {
        max-width: 700px;
    }

    /* REGLA UX: En móvil, CPU ARRIBA, PLAYER ABAJO */
    .result-score-display {
        padding: var(--spacing-xl);
        flex-direction: column;
        /* Móvil: vertical */
        /* Orden visual mantenido: CPU primero (arriba), luego PLAYER (abajo) */
    }

    .result-score-value {
        font-size: 5rem;
    }
}

@media (min-width: 1024px) {
    .result-overlay-container {
        max-width: 800px;
    }

    .result-score-value {
        font-size: 6rem;
    }
}

/* Mobile Menu Overlay override */
.mobile-menu-overlay {
    background: rgba(42, 35, 40, 0.95);
    /* Deep Ink */
    backdrop-filter: blur(5px);
}

.card-mini:active {
    transform: scale(0.95) !important;
}

/* ==========================================
   MODIFIER SYSTEM (Card-level overlay)
   Requisitos:
   - Máx. 2 visibles por carta
   - Esquina superior derecha
   - No obstruir ilustración
   ========================================== */

/* Baseline (con variables para no romper tamaños existentes) */
.card {
    position: relative;
    width: var(--card-w, 200px);
    height: var(--card-h, 280px);
    border-radius: 12px;
    overflow: hidden;
}

/* En tablero/dock, la carta es "fill" del contenedor */
.card-mini.card {
    width: 100%;
    height: 100%;
    --card-w: 100%;
    --card-h: 100%;
}

.modifiers {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.modifier {
    min-width: 26px;
    height: 18px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
    border-radius: 10px;
    color: #fff;
    backdrop-filter: blur(2px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    user-select: none;
}

.modifier.buff {
    background: rgba(80, 160, 100, 0.9);
}

.modifier.debuff {
    background: rgba(160, 80, 80, 0.9);
}

.modifier.synergy {
    background: rgba(180, 150, 80, 0.9);
}

.slot-result-meta {
    position: absolute;
    left: 50%;
    bottom: 3px;
    transform: translateX(-50%);
    z-index: 12;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid rgba(197, 226, 255, 0.56);
    background:
        linear-gradient(150deg, rgba(8, 20, 50, 0.88), rgba(4, 10, 28, 0.92)),
        radial-gradient(circle at 18% 20%, rgba(126, 204, 255, 0.16), rgba(126, 204, 255, 0) 44%);
    box-shadow:
        0 6px 14px rgba(3, 8, 24, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    pointer-events: none;
    max-width: calc(100% - 10px);
}

.slot-result-meta.slot-result-meta--dock {
    padding: 2px 6px;
    gap: 4px;
    max-width: calc(100% - 8px);
}

.slot-result-meta.slot-result-meta--between {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    margin: 0 auto;
    max-width: min(100%, 92px);
    z-index: 4;
}

.rival-zone .slot-result-meta.slot-result-meta--between {
    margin-top: 0;
    margin-bottom: 0;
}

.slot-result-meta-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    border-radius: 50%;
    flex-shrink: 0;
}

.slot-result-meta-text {
    font-family: var(--font-primary-ui);
    font-size: clamp(0.78rem, 1.8vw, 1.02rem);
    font-weight: 900;
    letter-spacing: 0.01em;
    color: #eaf5ff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.slot-result-meta.is-win {
    border-color: rgba(136, 230, 168, 0.6);
}

.slot-result-meta.is-win .slot-result-meta-text {
    color: #9ff0bb;
}

.slot-result-meta.is-loss {
    border-color: rgba(255, 155, 155, 0.64);
}

.slot-result-meta.is-loss .slot-result-meta-text {
    color: #ff9a9a;
}

.slot-result-meta.is-tie .slot-result-meta-text {
    color: #d8e7f9;
}

.card-mini img {
    /* Generated cards are images, ensuring they fit */
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Asegurar que las cartas en slots se muestren correctamente */
.card-slot.filled .card-mini {
    width: 100%;
    height: 100%;
    position: relative;
    display: block;
}

.card-slot.filled.has-slot-result-meta {
    align-items: stretch;
    justify-content: flex-start;
}

.card-slot.filled.has-slot-result-meta .card-mini {
    height: calc(100% - 20px);
}

.card-slot.filled .card-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

/* Fallback para cartas HTML en slots */
.card-slot.filled .card-premium,
.card-slot.filled .card {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

/* Fallback HTML Card Style (if image fails) */
.card-html-fallback {
    width: 100%;
    height: 100%;
    padding: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.card-html-fallback .fname {
    font-size: 8px;
    font-weight: bold;
    background: var(--color-paper-dim);
    width: 100%;
}

.card-html-fallback .fart {
    flex-grow: 1;
    width: 90%;
    background: #ccc;
    margin: 2px 0;
}

/* --- FULL CARD STYLES (For Generator & Inspector) --- */
/* Standard Poker Size Ratio: 63.5 x 88.9 mm ~ 2.5 x 3.5 */
/* Base Unit: 300px width -> 420px height */
.card-premium {
    width: 300px;
    height: 420px;
    background-color: var(--color-paper-light);
    border-radius: 12px;
    box-shadow: var(--shadow-deep);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 8px solid var(--color-paper-dim);
    /* Frame Edge */
    color: var(--color-ink-primary);
}

/* Marcos específicos por rol (se apoyan en los assets definidos en /art-prompts/) */
.card-premium.frame-leader {
    /* Marco de capitán: más ornamental, dorado */
    border-width: 10px;
    border-color: transparent;
    /* Aún pendiente el asset definitivo; se dejará vacío si no existe. */
    /* background-image: url('assets/frames/slot_empty.avif'); */
    background-size: cover;
    background-position: center;
}

.card-premium.frame-soldier {
    /* Marco de vanguardia/retaguardia: más sencillo */
    border-width: 10px;
    border-color: transparent;
    /* Aún pendiente el asset definitivo; se dejará vacío si no existe. */
    /* background-image: url('assets/frames/slot_empty.avif'); */
    background-size: cover;
    background-position: center;
}

.card-frame {
    width: 100%;
    height: 100%;
    border: 2px solid var(--color-ink-primary);
    /* Inner Ink Line */
    border-radius: 8px;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 10px;
}

/* Faction Colormaps */
.card-premium.faction-hero-ed {
    border-color: #e4d4c4;
}

.card-premium.faction-hero-order {
    border-color: #d4e4c4;
}

.card-premium.faction-dark {
    border-color: #cfc4e4;
}

.card-premium.faction-neutral {
    border-color: #d8d8d8;
}

.card-header-premium {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--color-ink-secondary);
    padding-bottom: 5px;
    margin-bottom: 5px;
}

.card-title-text {
    font-family: var(--font-parchment);
    font-size: 1.2rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(247, 245, 230, 0.92);
    border: 1px solid rgba(42, 35, 40, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.card-cost-badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--color-ink-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    background: var(--color-paper-dim);
}

.card-art-box {
    flex-grow: 1;
    background: #ddd;
    /* Placeholder for art */
    border: 2px solid var(--color-ink-secondary);
    border-radius: 4px;
    margin-bottom: 10px;
    overflow: hidden;
    position: relative;
}

.card-art-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: sepia(0.3) contrast(1.1);
    /* Watercolor vibe */
}

.card-stats-row {
    display: flex;
    justify-content: space-around;
    padding: 5px 0;
    border-top: 1px dashed var(--color-ink-secondary);
    background: rgba(255, 255, 255, 0.3);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.8rem;
    font-family: var(--font-ui);
}

.stat-val {
    font-weight: bold;
    font-size: 1.1rem;
}

.card-body-text {
    font-size: 0.9rem;
    line-height: 1.2;
    font-style: italic;
    text-align: center;
    padding: 5px;
    margin-top: auto;
    /* Push to bottom */
    min-height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

/* ==========================================
   HAND DOCK - Game Component
   ========================================== */

.hand-dock {
    position: relative;
    /* Vive dentro de la barra inferior de combate */
    width: min(900px, 100%);
    max-width: 900px;
    margin: 0 auto;
    z-index: 25;
    pointer-events: none;
    /* se re-activa en children interactivos */
    transition: transform 400ms var(--ease-spring), opacity 300ms ease, z-index 0ms;
    padding-bottom: 0;
    will-change: transform, opacity;
    isolation: isolate;
    /* evita stacking raro con backdrop-filter/filter/transform */
}

.hand-dock-background {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        url('assets/hand_dock/hand_dock_bg.avif'),
        linear-gradient(to top,
            rgba(247, 245, 230, 0.95) 0%,
            rgba(247, 245, 230, 0.85) 50%,
            rgba(247, 245, 230, 0) 100%);
    background-size: cover;
    background-position: center;
    backdrop-filter: blur(8px);
    border-top: 2px solid rgba(42, 35, 40, 0.2);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    pointer-events: none;
    z-index: 0;
}

.hand-dock-content {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    width: 100%;
    max-width: 720px;
    margin: 0 auto;
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-lg);
    gap: 0;
    pointer-events: auto;
    height: 140px;
    transition: height 400ms var(--ease-spring);
    z-index: 1;
}

#player-hand.hand-dock-content {
    overflow-x: hidden;
    scroll-snap-type: none;
    padding-left: 0;
    padding-right: 0;
    justify-content: center;
    gap: 0;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    left: auto;
    transform: none;
}

@media (min-width: 900px) {
    .hand-dock {
        width: min(980px, 100%);
        max-width: 980px;
    }

    #player-hand.hand-dock-content {
        overflow: visible;
        overflow-x: visible;
    }
}

#player-hand.hand-dock-content .card-mini {
    margin-left: -18px;
}

#player-hand.hand-dock-content .card-mini:first-child {
    margin-left: 0;
}

/* Estados del HandDock */
.hand-dock.hand--idle .hand-dock-content {
    height: 140px;
}

.hand-dock.hand--focus .hand-dock-content {
    height: 160px;
}

.hand-dock.hand--locked {
    opacity: 0.3;
    filter: grayscale(60%) blur(1px);
    pointer-events: none;
    z-index: 30;
    /* Visible pero claramente deshabilitado */
}

.hand-dock.hand--hidden {
    transform: translateY(calc(100% - 40px));
}

.hand-dock.hand--hidden .hand-dock-content {
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.hand-dock.hand--hidden .hand-dock-tab {
    display: flex;
}

.hand-dock.hand--revealing {
    transform: translateY(0);
}

.hand-dock.hand--revealing .hand-dock-content {
    animation: hand-reveal 600ms var(--ease-spring);
}

/* Cartas en el dock */
.hand-dock-content .card-mini {
    width: 80px;
    height: 112px;
    flex-shrink: 0;
    background: var(--color-paper-light);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    position: relative;
    border: 2px solid var(--color-ink-secondary);
    margin-left: -25px;
    /* Mejor solapamiento */
    transform-origin: bottom center;
    box-shadow: var(--shadow-deep);
    cursor: pointer;
    transition: transform 300ms var(--ease-spring),
        opacity 300ms ease,
        filter 300ms ease,
        z-index 0ms,
        margin-left 300ms ease;
    pointer-events: auto;
    will-change: transform;
}

.hand-dock-content .card-mini:first-child {
    margin-left: 0;
}

.hand-dock-content .card-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Animación idle (float sutil) - desactivar cuando hay FOCUS para evitar solapes/clicks raros */
.hand--idle:not(.hand--focus) .hand-dock-content .card-mini {
    animation: hand-card-idle 3s ease-in-out infinite;
}

.hand--idle .hand-dock-content .card-mini:nth-child(1) {
    animation-delay: 0s;
}

.hand--idle .hand-dock-content .card-mini:nth-child(2) {
    animation-delay: 0.3s;
}

.hand--idle .hand-dock-content .card-mini:nth-child(3) {
    animation-delay: 0.6s;
}

.hand--idle .hand-dock-content .card-mini:nth-child(4) {
    animation-delay: 0.9s;
}

.hand--idle .hand-dock-content .card-mini:nth-child(5) {
    animation-delay: 1.2s;
}

/* Estado FOCUS: carta elevada */
.hand--focus .hand-dock-content .card-mini {
    opacity: 0.5;
    transform: scale(0.95);
    filter: blur(2px);
}

.hand--focus .hand-dock-content .card-mini.hand-card-focused {
    opacity: 1;
    transform: translateY(-25px) scale(1.2);
    filter: blur(0);
    z-index: 150;
    /* Por encima de todo en el dock */
    margin-left: 0;
    margin-right: 25px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.3);
    border-color: var(--color-accent-gold);
}

/* Pestaña cuando está oculto */
.hand-dock-tab {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 40px;
    background-image:
        linear-gradient(to bottom, rgba(247, 245, 230, 0.95), rgba(247, 245, 230, 0.92));
    background-size: cover;
    background-position: center;
    backdrop-filter: blur(8px);
    border: 2px solid var(--color-ink-secondary);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    pointer-events: auto;
    transition: transform 300ms var(--ease-spring), background 200ms ease;
    z-index: 26;
    /* Por encima del dock pero debajo de overlays */
}

/* ==========================================
   COMBAT BOTTOM BAR (Salir + Dock + Confirmar)
   ========================================== */
.combat-bottom-bar {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    z-index: calc(var(--z-hud) + 6);
    pointer-events: none;
    --combat-bottom-offset: max(12px, env(safe-area-inset-bottom));
    padding-bottom: var(--combat-bottom-offset);
    overflow: visible;
}

.combat-bottom-bar>* {
    pointer-events: auto;
}

.hand-dock-toggle-btn {
    --dock-toggle-lift: -52%;
    position: absolute;
    left: 50%;
    top: 0;
    transform: translate(-50%, var(--dock-toggle-lift));
    width: 34px;
    height: 16px;
    min-width: 0;
    min-height: 0;
    border: 1px solid rgba(42, 35, 40, 0.24);
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(252, 250, 241, 0.98), rgba(238, 233, 216, 0.95));
    box-shadow:
        0 -3px 8px rgba(11, 18, 38, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.78);
    color: rgba(30, 36, 55, 0.9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 42;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease, background 180ms ease;
}

.hand-dock-toggle-btn:hover {
    --dock-toggle-lift: -58%;
    box-shadow:
        0 -4px 10px rgba(14, 22, 45, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.hand-dock-toggle-btn.is-collapsed {
    background:
        linear-gradient(180deg, rgba(241, 236, 218, 0.97), rgba(228, 222, 205, 0.94));
}

.hand-dock-toggle-btn.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -40%) scale(0.92);
}

.hand-dock-toggle-icon {
    font-size: 0.64rem;
    line-height: 1;
    transform: translateY(0);
    transition: transform 160ms ease;
}

.hand-dock-toggle-btn.is-collapsed .hand-dock-toggle-icon {
    transform: translateY(1px);
}

.hand-dock-tab:hover {
    background: rgba(247, 245, 230, 1);
    transform: translateX(-50%) translateY(-2px);
}

.hand-dock-tab:active {
    transform: translateX(-50%) scale(0.95);
}

.hand-tab-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.hand-tab-count {
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--color-ink-primary);
    margin-top: 2px;
}

/* Animaciones mejoradas */
@keyframes hand-card-idle {

    0%,
    100% {
        transform: translateY(0) rotate(var(--card-rotation, 0deg)) scale(1);
    }

    50% {
        transform: translateY(-4px) rotate(var(--card-rotation, 0deg)) scale(1.02);
    }
}

@keyframes hand-reveal {
    0% {
        opacity: 0;
        transform: translateY(50px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mejoras responsive para HandDock */
@media (min-width: 768px) {
    .hand-dock-content {
        height: 180px;
        max-width: 800px;
    }

    .hand-dock-content .card-mini {
        width: 110px;
        height: 154px;
        margin-left: -35px;
    }

    .hand-dock.hand--focus .hand-dock-content {
        height: 200px;
    }

    .hand-dock-tab {
        width: 70px;
        height: 50px;
    }
}

@media (min-width: 1024px) {
    .hand-dock-content {
        height: 220px;
        max-width: 1000px;
    }

    .hand-dock-content .card-mini {
        width: 130px;
        height: 182px;
        margin-left: -40px;
    }

    .hand-dock.hand--focus .hand-dock-content {
        height: 240px;
    }

    .hand-dock-tab {
        width: 80px;
        height: 60px;
    }
}

/* ==========================================
   HAND CONTAINER - Simple & Clean Design
   ========================================== */
.hand-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: var(--spacing-md) var(--spacing-sm);
    padding-bottom: max(var(--spacing-md), env(safe-area-inset-bottom));
    z-index: 25;
    pointer-events: none;
    transition: opacity 300ms ease, transform 300ms ease;
    max-height: 30vh;
    /* Limitar altura máxima */
}

.hand-cards {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: clamp(8px, 1.5vw, 16px);
    flex-wrap: wrap;
    max-width: 100%;
    pointer-events: auto;
    padding: clamp(8px, 2vw, 16px);
    background: rgba(247, 245, 230, 0.85);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    border-top: 2px solid rgba(42, 35, 40, 0.15);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.hand-card {
    width: clamp(70px, 12vw, 130px);
    height: clamp(98px, 16.8vw, 182px);
    flex-shrink: 0;
    background: var(--color-paper-light);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 2px solid var(--color-ink-secondary);
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: all 300ms var(--ease-spring);
    position: relative;
    /* Asegurar que el contenedor no se desborde */
    max-width: clamp(70px, 12vw, 130px);
    max-height: clamp(98px, 16.8vw, 182px);
    box-sizing: border-box;
}

.hand-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    border-color: var(--color-accent-gold);
    z-index: 10;
}

.hand-card:active {
    transform: translateY(-8px) scale(1.02);
}

.hand-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    max-width: 100%;
    max-height: 100%;
    /* Asegurar que la imagen no se desborde */
    box-sizing: border-box;
}

.hand-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    /* Asegurar que la imagen no se desborde del contenedor */
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
}

/* Combat Feedback */
.mod-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--color-accent-gold);
    color: var(--color-ink-primary);
    border: var(--border-ink);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 0.8rem;
    z-index: 20;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

/* Modifier Badges System (Buffs/Debuffs) - Fase 4 */
.mod-list-vertical {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    margin-top: 4px;
    min-height: 20px;
}

.mod-tag-card {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    font-family: var(--font-ui);
    white-space: nowrap;
    box-shadow: var(--shadow-paper);
    border: 1.5px solid;
    line-height: 1.2;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mod-tag-card.positive {
    background: rgba(136, 176, 139, 0.9);
    color: var(--color-ink-primary);
    border-color: rgba(136, 176, 139, 1);
}

.mod-tag-card.negative {
    background: rgba(217, 126, 126, 0.9);
    color: var(--color-ink-primary);
    border-color: rgba(217, 126, 126, 1);
}

.mod-tag-card.neutral {
    background: rgba(200, 200, 200, 0.9);
    color: var(--color-ink-primary);
    border-color: rgba(200, 200, 200, 1);
}

/* Buffs de facción (verde suave) */
.mod-tag-card.faction-ed,
.mod-tag-card.faction-order,
.mod-tag-card.faction-villain,
.mod-tag-card.faction-neutral {
    background: rgba(136, 176, 139, 0.85);
    border-color: rgba(46, 125, 50, 0.8);
}

/* Buffs de habilidad (azul/dorado) */
.mod-tag-card[data-source*="Narcissa"],
.mod-tag-card[data-source*="Sofía"],
.mod-tag-card[data-source*="Hermione"],
.mod-tag-card[data-source*="Dumbledore"] {
    background: rgba(212, 175, 55, 0.2);
    border-color: rgba(212, 175, 55, 0.6);
    color: var(--color-ink-primary);
}

/* Debuffs (rojo suave) */
.mod-tag-card[data-source*="Dani"],
.mod-tag-card[data-source*="Umbridge"] {
    background: rgba(217, 126, 126, 0.85);
    border-color: rgba(198, 40, 40, 0.8);
}

.mod-badge-icon {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.mod-badge-value {
    font-weight: 900;
    font-size: 0.75rem;
}

.mod-badge-duration {
    font-size: 0.6rem;
    opacity: 0.8;
    font-weight: 500;
}

/* ==========================================
   COMBAT RESOLUTION SCREEN - Cinematic Design
   ========================================== */
.combat-resolution-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999 !important;
    /* Z-index superior para tapar el HUD y cualquier otro elemento */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    animation: combat-resolution-enter 500ms ease-out;
}

.combat-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at center, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.9) 100%),
        rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: none;
}

@media (max-width: 768px) {
    .combat-backdrop {
        background:
            radial-gradient(ellipse at center, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.95) 100%),
            rgba(0, 0, 0, 0.9);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }
}

.combat-backdrop::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0, 0, 0, 0.6) 70%);
    pointer-events: none;
}

.combat-light-rays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        linear-gradient(45deg, transparent 30%, rgba(212, 175, 55, 0.1) 50%, transparent 70%),
        linear-gradient(-45deg, transparent 30%, rgba(212, 175, 55, 0.08) 50%, transparent 70%);
    background-size: 200% 200%;
    animation: combat-light-rays 8s ease-in-out infinite;
    pointer-events: none;
    opacity: 0.6;
}

/* Durante el conteo de "puntuación" (valores), congelar animaciones ambientales.
   Evita el "salto" visual al inicio y sincroniza el momento cinematográfico. */
.combat-resolution-overlay.is-score-animating .combat-light-rays {
    animation: none !important;
}

.combat-shockwave {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.4) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
}

.combat-shockwave.active {
    animation: combat-shockwave-expand 800ms ease-out;
}

.combat-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

/* REGLA UX GLOBAL: CPU IZQUIERDA (desktop) / ARRIBA (móvil), PLAYER DERECHA (desktop) / ABAJO (móvil) */
.combat-scene {
    position: relative;
    width: 100%;
    max-width: 1400px;
    height: 100%;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(40px, 8vw, 80px);
    padding: clamp(20px, 4vw, 40px);
    z-index: 2;
    overflow: hidden;
    /* Orden visual: CPU primero (izquierda), luego PLAYER (derecha) */
    flex-direction: row;
    /* Desktop: horizontal */
}

.combat-card {
    position: relative;
    width: clamp(280px, 35vw, 400px);
    height: clamp(320px, 40vw, 450px);
    max-height: 45vh;
    border-radius: 20px;
    overflow: hidden;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(0, 0, 0, 0.4);
    transition: all 600ms var(--ease-spring);
    animation: combat-card-enter 800ms var(--ease-spring);
}

.combat-card-player {
    animation-delay: 0ms;
}

.combat-card-cpu {
    animation-delay: 150ms;
}

.combat-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    /* UX: anclar recorte arriba (se oculta abajo, no arriba) */
    background-position: top center;
    background-repeat: no-repeat;
    filter: brightness(0.85) contrast(1.1);
    transition: filter 600ms ease, transform 600ms ease;
}

.combat-card-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(212, 175, 55, 0.2) 100%);
    opacity: 0;
    transition: opacity 600ms ease;
    pointer-events: none;
}

/* Header CPU (arriba, fondo rojo) */
.combat-card-header {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: clamp(44px, 7.5vh, 58px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(244, 67, 54, 0.85) 0%, rgba(244, 67, 54, 0.0) 100%);
}

.combat-card-header-name {
    /* PRIMARY UI: Header CPU */
    font-family: var(--font-primary-ui);
    font-size: clamp(1.05rem, 2.8vw, 1.35rem);
    font-weight: 700;
    color: rgba(255, 250, 235, 0.98);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(244, 67, 54, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    text-shadow:
        0 2px 10px rgba(0, 0, 0, 0.65),
        0 0 18px rgba(255, 255, 255, 0.3);
    max-width: 92%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
}

/* Footer Player (abajo, fondo verde) */
.combat-card-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: clamp(44px, 7.5vh, 58px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9;
    pointer-events: none;
    background: linear-gradient(to top, rgba(76, 175, 80, 0.85) 0%, rgba(76, 175, 80, 0.0) 100%);
}

.combat-card-footer-name {
    /* PRIMARY UI: Footer Player */
    font-family: var(--font-primary-ui);
    font-size: clamp(1.05rem, 2.8vw, 1.35rem);
    font-weight: 700;
    color: rgba(255, 250, 235, 0.98);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(76, 175, 80, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.3);
    text-shadow:
        0 2px 10px rgba(0, 0, 0, 0.65),
        0 0 18px rgba(255, 255, 255, 0.3);
    max-width: 92%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
}

.combat-card-value-container {
    position: absolute;
    /* Score abajo: ya no colisiona con el nombre (arriba) */
    bottom: clamp(16px, 3vw, 32px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    flex-wrap: wrap;
}

/* Baseline requerido: contador + modificadores inline */
.duel-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: 700;
    transform-origin: center;
}

.duel-counter.counter-bonus-burst {
    animation: counter-burst-bonus 320ms ease-out;
}

.duel-counter.counter-penalty-burst {
    animation: counter-burst-penalty 320ms ease-out;
}

.duel-counter.counter-neutral-burst {
    animation: counter-burst-neutral 300ms ease-out;
}

.duel-modifier {
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 8px;
    color: #fff;
    animation: combat-modifier-appear 500ms ease-out;
    white-space: nowrap;
    pointer-events: none;
}

.duel-modifier.is-bonus {
    background: #3d9e62;
    box-shadow:
        0 0 0 1px rgba(160, 239, 190, 0.55),
        0 0 18px rgba(97, 216, 155, 0.5);
    animation: combat-modifier-bonus-pop 520ms ease-out;
}

.duel-modifier.is-penalty {
    background: #a84040;
    box-shadow:
        0 0 0 1px rgba(255, 163, 177, 0.55),
        0 0 18px rgba(255, 120, 142, 0.5);
    animation: combat-modifier-penalty-pop 520ms ease-out;
}

.duel-modifier.buff {
    background: #4fa36a;
}

.duel-modifier.debuff {
    background: #b85a5a;
}

.duel-modifier.synergy {
    background: #b49650;
}

.final-value {
    margin-left: 6px;
    font-size: 26px;
}

/* Contador del jugador arriba para efecto de enfrentamiento */
.combat-card-player .combat-card-value-container {
    bottom: auto;
    top: clamp(20px, 4vh, 40px);
}

.combat-card-value-base {
    /* NUMERIC: Valores de combate (números grandes) */
    font-family: var(--font-numeric);
    font-size: clamp(4rem, 10vw, 7rem);
    font-weight: 700;
    color: #fff;
    text-shadow:
        0 0 20px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(212, 175, 55, 0.6),
        0 4px 8px rgba(0, 0, 0, 0.5);
    line-height: 1;
    letter-spacing: -2px;
    animation: combat-value-count 1.2s ease-out;
    transition: text-shadow 400ms ease, color 400ms ease;
}

.combat-card-value-base.glow-green {
    color: #88B08B;
    text-shadow:
        0 0 25px rgba(0, 0, 0, 0.8),
        0 0 50px rgba(136, 176, 139, 0.8),
        0 0 80px rgba(136, 176, 139, 0.5),
        0 4px 12px rgba(0, 0, 0, 0.6);
}

.combat-card-value-base.glow-red {
    color: #D97E7E;
    text-shadow:
        0 0 25px rgba(0, 0, 0, 0.8),
        0 0 50px rgba(217, 126, 126, 0.8),
        0 0 80px rgba(217, 126, 126, 0.5),
        0 4px 12px rgba(0, 0, 0, 0.6);
}

.combat-card-value-base.value-impact-bonus {
    animation: combat-value-impact-bonus 460ms ease-out;
}

.combat-card-value-base.value-impact-penalty {
    animation: combat-value-impact-penalty 460ms ease-out;
}

.combat-card-value-base.value-impact-victory {
    animation: combat-value-impact-victory 520ms cubic-bezier(0.2, 0.85, 0.2, 1);
}

.combat-card-value-base.value-impact-defeat {
    animation: combat-value-impact-defeat 520ms cubic-bezier(0.2, 0.85, 0.2, 1);
}

.combat-card-value-base.value-impact-neutral {
    animation: combat-value-impact-neutral 420ms ease-out;
}

.combat-card-value-final {
    /* NUMERIC: Valores finales de combate */
    font-family: var(--font-numeric);
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    text-shadow:
        0 0 15px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(212, 175, 55, 0.5);
    line-height: 1;
    letter-spacing: -1px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 400ms ease, transform 400ms ease;
    display: none;
}

.combat-card-value-final.show {
    opacity: 1;
    transform: translateY(0);
}

/* Hide final value on mobile - use only base value */
@media (max-width: 768px) {
    .combat-card-value-final {
        display: none;
    }

    .combat-card-value-container {
        flex-direction: column;
        gap: 0;
    }
}

.combat-modifiers-container {
    position: relative;
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
    flex-wrap: wrap;
}

/* Mobile: Position modifier tag near the number */
@media (max-width: 768px) {
    .combat-modifiers-container {
        gap: 6px;
    }

    /* Only show one modifier tag on mobile */
    .combat-modifiers-container .combat-modifier:not(:first-child) {
        display: none;
    }
}

.combat-modifier {
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid;
    border-radius: 8px;
    padding: 6px 12px;
    font-family: var(--font-display);
    font-size: clamp(0.9rem, 2.2vw, 1.2rem);
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    animation: combat-modifier-appear 500ms ease-out;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    line-height: 1;
}

.combat-modifier.buff {
    border-color: rgba(136, 176, 139, 0.9);
    color: #88B08B;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.5),
        0 0 24px rgba(136, 176, 139, 0.4);
}

.combat-modifier.debuff {
    border-color: rgba(217, 126, 126, 0.9);
    color: #D97E7E;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.5),
        0 0 24px rgba(217, 126, 126, 0.4);
}

.combat-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(12px, 2.5vw, 18px);
    z-index: 5;
}

.combat-vs-divider {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
    color: rgba(255, 255, 255, 0.9);
    text-shadow:
        0 0 20px rgba(0, 0, 0, 0.8),
        0 0 40px rgba(212, 175, 55, 0.5);
    letter-spacing: 4px;
}

.combat-stat-icon-wrapper {
    width: clamp(80px, 12vw, 140px);
    height: clamp(80px, 12vw, 140px);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    border: 3px solid rgba(212, 175, 55, 0.5);
    box-shadow:
        0 0 34px rgba(212, 175, 55, 0.44),
        inset 0 0 0 1px rgba(255, 242, 205, 0.2);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.combat-stat-icon-wrapper::after {
    content: '';
    position: absolute;
    inset: -10%;
    border-radius: 50%;
    border: 1px solid rgba(226, 196, 118, 0.4);
    opacity: 0.6;
    animation: combat-stat-aura 2.1s ease-in-out infinite;
    pointer-events: none;
}

.combat-stat-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.6));
    border-radius: 50%;
    padding: 12%;
}

@keyframes combat-stat-aura {

    0%,
    100% {
        transform: scale(0.98);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.82;
    }
}

.combat-result-announcement {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-primary-ui);
    font-size: clamp(2.4rem, 6.6vw, 4.2rem);
    font-weight: 900;
    color: rgba(245, 241, 226, 0.98);
    text-shadow:
        0 0 30px rgba(0, 0, 0, 0.8),
        0 0 60px rgba(212, 175, 55, 0.8);
    text-align: center;
    opacity: 0;
    z-index: 100;
    pointer-events: none;
    letter-spacing: 2px;
    background:
        linear-gradient(156deg, rgba(8, 17, 45, 0.96) 0%, rgba(14, 23, 60, 0.95) 52%, rgba(8, 14, 36, 0.97) 100%),
        radial-gradient(circle at 16% 18%, rgba(126, 204, 255, 0.16) 0%, rgba(126, 204, 255, 0) 42%),
        radial-gradient(circle at 80% 84%, rgba(248, 227, 165, 0.14) 0%, rgba(248, 227, 165, 0) 44%);
    border: 1px solid rgba(194, 222, 255, 0.62);
    border-radius: 20px;
    padding: clamp(18px, 4vw, 30px) clamp(30px, 7vw, 52px);
    box-shadow:
        0 22px 46px rgba(3, 8, 24, 0.62),
        0 0 24px rgba(122, 195, 255, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        inset 0 -28px 50px rgba(4, 10, 30, 0.34);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.combat-result-announcement.show {
    animation: combat-result-appear 1s var(--ease-spring);
    opacity: 1;
}

/* Colores de resultado: Victoria verde, Derrota rojo, Empate amarillo */
.combat-result-announcement.result-victory {
    color: rgba(157, 248, 203, 0.98);
    text-shadow:
        0 0 30px rgba(0, 0, 0, 0.8),
        0 0 60px rgba(122, 227, 202, 0.66),
        0 0 100px rgba(122, 227, 202, 0.36);
    border-color: rgba(122, 227, 202, 0.74);
}

.combat-result-announcement.result-defeat {
    color: rgba(255, 179, 194, 0.98);
    text-shadow:
        0 0 30px rgba(0, 0, 0, 0.8),
        0 0 60px rgba(255, 122, 144, 0.7),
        0 0 100px rgba(255, 122, 144, 0.4);
    border-color: rgba(255, 151, 166, 0.7);
}

.combat-result-announcement.result-tie {
    color: rgba(248, 227, 165, 0.98);
    text-shadow:
        0 0 30px rgba(0, 0, 0, 0.8),
        0 0 60px rgba(248, 227, 165, 0.66),
        0 0 100px rgba(248, 227, 165, 0.34);
    border-color: rgba(248, 227, 165, 0.66);
}

.combat-result-announcement.result-captain-bonus {
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 26px rgba(245, 232, 171, 0.44),
        inset 0 2px 8px rgba(139, 69, 19, 0.1);
}

.combat-result-announcement.result-captain-bonus::after {
    content: 'BONUS DE CAPITAN';
    position: absolute;
    left: 50%;
    bottom: -18px;
    transform: translateX(-50%);
    font-family: var(--font-primary-ui);
    font-size: clamp(0.62rem, 1.4vw, 0.74rem);
    letter-spacing: 0.14em;
    color: rgba(245, 232, 171, 0.96);
    text-shadow: 0 0 12px rgba(245, 232, 171, 0.55);
    background: rgba(8, 15, 36, 0.86);
    border: 1px solid rgba(245, 232, 171, 0.42);
    border-radius: 999px;
    padding: 2px 10px;
    white-space: nowrap;
}

.combat-resolution-overlay.combat-clash-impact .combat-vs-divider {
    animation: combat-vs-impact 760ms ease-out;
}

.combat-resolution-overlay.combat-clash-impact .combat-stat-icon-wrapper {
    animation: combat-stat-icon-impact 760ms ease-out;
}

/* Winner effects */
.combat-card.winner {
    transform: scale(1.05);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(212, 175, 55, 0.6),
        0 0 100px rgba(212, 175, 55, 0.4);
    /* Animación satisfactoria de victoria: celebration pop + glow */
    animation: combat-card-winner-celebration 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
        combat-card-winner-glow-loop 2s ease-in-out 1.2s infinite;
}

.combat-card.winner .combat-card-bg {
    filter: brightness(1.1) contrast(1.15);
    animation: combat-card-winner-bg-glow 2s ease-in-out 1.2s infinite;
}

.combat-card.winner .combat-card-glow {
    opacity: 1;
    animation: combat-glow-celebration 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
        combat-glow-pulse 2s ease-in-out 1.2s infinite;
}

/* Loser effects */
.combat-card.loser {
    filter: grayscale(0.7) brightness(0.65);
    animation: combat-card-loser-shake 0.4s ease-out;
    border: 4px solid #ff4444;
    /* Borde rojo para el perdedor */
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(255, 68, 68, 0.5);
    /* Sombra roja */
}

.combat-card.loser .combat-card-bg {
    filter: grayscale(0.8) brightness(0.6);
}

/* Mobile: Softer loser effects */
@media (max-width: 768px) {
    .combat-card.loser {
        filter: grayscale(0.6) brightness(0.7);
        animation: combat-card-loser-shake-mobile 0.3s ease-out;
        border: 3px solid #ff4444;
        /* Borde rojo más delgado en móvil */
        box-shadow:
            0 20px 60px rgba(0, 0, 0, 0.6),
            0 0 30px rgba(255, 68, 68, 0.4);
        /* Sombra roja más suave en móvil */
    }

    .combat-card.loser .combat-card-bg {
        filter: grayscale(0.7) brightness(0.65);
    }
}

/* Animations */
@keyframes combat-resolution-enter {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes combat-light-rays {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@keyframes combat-shockwave-expand {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }

    100% {
        width: 200vw;
        height: 200vw;
        opacity: 0;
    }
}

@keyframes combat-card-enter {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes combat-value-count {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes counter-burst-bonus {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 12px rgba(97, 216, 155, 0.52));
    }

    100% {
        transform: scale(1);
    }
}

@keyframes counter-burst-penalty {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 12px rgba(255, 120, 142, 0.48));
    }

    100% {
        transform: scale(1);
    }
}

@keyframes counter-burst-neutral {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.04);
        filter: drop-shadow(0 0 10px rgba(212, 228, 255, 0.42));
    }

    100% {
        transform: scale(1);
    }
}

@keyframes combat-modifier-appear {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes combat-modifier-bonus-pop {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.88);
    }

    58% {
        opacity: 1;
        transform: translateY(0) scale(1.08);
    }

    100% {
        transform: translateY(0) scale(1);
    }
}

@keyframes combat-modifier-penalty-pop {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.88);
    }

    58% {
        opacity: 1;
        transform: translateY(0) scale(1.08);
    }

    100% {
        transform: translateY(0) scale(1);
    }
}

@keyframes combat-value-impact-bonus {
    0% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 18px rgba(97, 216, 155, 0.52));
    }

    100% {
        transform: scale(1);
    }
}

@keyframes combat-value-impact-penalty {
    0% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 18px rgba(255, 120, 142, 0.5));
    }

    100% {
        transform: scale(1);
    }
}

@keyframes combat-value-impact-victory {
    0% {
        transform: scale(1);
    }

    36% {
        transform: scale(1.15) rotate(-1deg);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes combat-value-impact-defeat {
    0% {
        transform: scale(1);
    }

    36% {
        transform: scale(1.13) rotate(1deg);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes combat-value-impact-neutral {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes combat-vs-impact {
    0% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.16);
        text-shadow:
            0 0 18px rgba(0, 0, 0, 0.8),
            0 0 42px rgba(245, 232, 171, 0.76);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes combat-stat-icon-impact {
    0% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.14);
        box-shadow:
            0 0 30px rgba(212, 175, 55, 0.4),
            0 0 52px rgba(126, 204, 255, 0.48);
    }

    100% {
        transform: scale(1);
    }
}

/* Animación satisfactoria de victoria: celebration pop */
@keyframes combat-card-winner-celebration {
    0% {
        transform: scale(1.05);
        box-shadow:
            0 20px 60px rgba(0, 0, 0, 0.6),
            0 0 60px rgba(212, 175, 55, 0.6),
            0 0 100px rgba(212, 175, 55, 0.4);
    }

    30% {
        transform: scale(1.15) rotate(2deg);
        box-shadow:
            0 30px 80px rgba(0, 0, 0, 0.7),
            0 0 100px rgba(212, 175, 55, 1),
            0 0 150px rgba(212, 175, 55, 0.8),
            0 0 200px rgba(255, 215, 0, 0.4);
    }

    60% {
        transform: scale(1.12) rotate(-1deg);
        box-shadow:
            0 25px 70px rgba(0, 0, 0, 0.65),
            0 0 90px rgba(212, 175, 55, 0.9),
            0 0 130px rgba(212, 175, 55, 0.7),
            0 0 180px rgba(255, 215, 0, 0.35);
    }

    100% {
        transform: scale(1.08) rotate(0deg);
        box-shadow:
            0 20px 60px rgba(0, 0, 0, 0.6),
            0 0 70px rgba(212, 175, 55, 0.75),
            0 0 110px rgba(212, 175, 55, 0.5);
    }
}

/* Loop suave después del celebration pop */
@keyframes combat-card-winner-glow-loop {

    0%,
    100% {
        box-shadow:
            0 20px 60px rgba(0, 0, 0, 0.6),
            0 0 70px rgba(212, 175, 55, 0.75),
            0 0 110px rgba(212, 175, 55, 0.5);
    }

    50% {
        box-shadow:
            0 20px 60px rgba(0, 0, 0, 0.6),
            0 0 85px rgba(212, 175, 55, 0.9),
            0 0 130px rgba(212, 175, 55, 0.65),
            0 0 160px rgba(255, 215, 0, 0.3);
    }
}

@keyframes combat-card-winner-bg-glow {

    0%,
    100% {
        filter: brightness(1.1) contrast(1.15);
    }

    50% {
        filter: brightness(1.25) contrast(1.2) saturate(1.1);
    }
}

@keyframes combat-glow-celebration {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }

    30% {
        opacity: 1;
        transform: scale(1.3);
    }

    60% {
        opacity: 0.9;
        transform: scale(1.15);
    }

    100% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

@keyframes combat-glow-pulse {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }
}

@keyframes combat-card-loser-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-4px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(4px);
    }
}

@keyframes combat-card-loser-shake-mobile {

    0%,
    100% {
        transform: translateX(0);
    }

    25%,
    75% {
        transform: translateX(-2px);
    }

    50% {
        transform: translateX(2px);
    }
}

/* Versión móvil de la animación de victoria (más suave pero satisfactoria) */
@keyframes combat-card-winner-celebration-mobile {
    0% {
        transform: scale(1.05);
        box-shadow:
            0 20px 60px rgba(0, 0, 0, 0.6),
            0 0 50px rgba(212, 175, 55, 0.5),
            0 0 80px rgba(212, 175, 55, 0.3);
    }

    30% {
        transform: scale(1.12) rotate(1.5deg);
        box-shadow:
            0 25px 70px rgba(0, 0, 0, 0.65),
            0 0 80px rgba(212, 175, 55, 0.9),
            0 0 120px rgba(212, 175, 55, 0.7),
            0 0 150px rgba(255, 215, 0, 0.3);
    }

    60% {
        transform: scale(1.1) rotate(-0.8deg);
        box-shadow:
            0 22px 65px rgba(0, 0, 0, 0.62),
            0 0 70px rgba(212, 175, 55, 0.8),
            0 0 100px rgba(212, 175, 55, 0.6);
    }

    100% {
        transform: scale(1.08) rotate(0deg);
        box-shadow:
            0 20px 60px rgba(0, 0, 0, 0.6),
            0 0 60px rgba(212, 175, 55, 0.7),
            0 0 90px rgba(212, 175, 55, 0.5);
    }
}

@keyframes combat-card-winner-glow-loop-mobile {

    0%,
    100% {
        box-shadow:
            0 20px 60px rgba(0, 0, 0, 0.6),
            0 0 60px rgba(212, 175, 55, 0.7),
            0 0 90px rgba(212, 175, 55, 0.5);
    }

    50% {
        box-shadow:
            0 20px 60px rgba(0, 0, 0, 0.6),
            0 0 75px rgba(212, 175, 55, 0.85),
            0 0 110px rgba(212, 175, 55, 0.6),
            0 0 140px rgba(255, 215, 0, 0.25);
    }
}

@keyframes combat-glow-celebration-mobile {
    0% {
        opacity: 0.6;
        transform: scale(1);
    }

    30% {
        opacity: 1;
        transform: scale(1.25);
    }

    60% {
        opacity: 0.85;
        transform: scale(1.12);
    }

    100% {
        opacity: 0.75;
        transform: scale(1.08);
    }
}

@keyframes combat-result-appear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes combat-camera-shake {

    0%,
    100% {
        transform: translate(0, 0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translate(-2px, -2px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translate(2px, 2px);
    }
}

@keyframes combat-particle-float {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(var(--particle-x, 0), var(--particle-y, 0)) scale(0);
    }
}

/* ==========================================
   MOBILE-FIRST COMBAT RESOLUTION
   ========================================== */
@media (max-width: 768px) {
    .combat-resolution-overlay {
        padding: 0;
    }

    .combat-scene {
        flex-direction: column;
        gap: clamp(16px, 4vw, 24px);
        width: 100%;
        height: 100%;
        padding: clamp(20px, 5vw, 32px);
        justify-content: center;
    }

    .combat-card {
        width: clamp(240px, 70vw, 320px);
        height: clamp(280px, 80vw, 380px);
        max-width: 100%;
        max-height: 40vh;
        border-radius: 16px;
    }

    .combat-card-value-container {
        bottom: clamp(16px, 4vw, 28px);
        gap: 8px;
        flex-wrap: wrap;
    }

    .combat-card-value-base {
        font-size: clamp(4rem, 16vw, 6.5rem);
        text-shadow:
            0 0 25px rgba(0, 0, 0, 0.9),
            0 0 50px rgba(212, 175, 55, 0.7),
            0 4px 12px rgba(0, 0, 0, 0.6);
    }

    .combat-modifiers-container {
        gap: 6px;
    }

    .combat-modifier {
        font-size: clamp(0.95rem, 3.5vw, 1.3rem);
        padding: 5px 10px;
        border-radius: 8px;
    }

    .combat-center {
        gap: clamp(12px, 3vw, 20px);
        margin: clamp(8px, 2vw, 16px) 0;
    }

    .combat-vs-divider {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
        letter-spacing: 2px;
    }

    .combat-stat-icon-wrapper {
        width: clamp(70px, 16vw, 100px);
        height: clamp(70px, 16vw, 100px);
        border-width: 3px;
    }

    .combat-stat-icon {
        width: 100%;
        height: 100%;
        padding: 14%;
    }

    .combat-result-announcement {
        font-size: clamp(2.5rem, 10vw, 4rem);
        letter-spacing: 2px;
    }

    /* Hide light rays on mobile for performance */
    .combat-light-rays {
        display: none;
    }

    /* Simplified particles on mobile */
    .combat-particles {
        display: none;
    }

    /* Softer winner effects on mobile (pero mantiene celebration pop) */
    .combat-card.winner {
        animation: combat-card-winner-celebration-mobile 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
            combat-card-winner-glow-loop-mobile 2s ease-in-out 1s infinite;
    }

    .combat-card.winner .combat-card-glow {
        animation: combat-glow-celebration-mobile 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
            combat-glow-pulse 2s ease-in-out 1s infinite;
    }

    /* REGLA UX: En móvil, CPU ARRIBA (order: 1), PLAYER ABAJO (order: 3) */
    .combat-card-cpu {
        order: 1;
        /* CPU primero (arriba) */
    }

    .combat-center {
        order: 2;
    }

    .combat-card-player {
        order: 3;
        /* PLAYER último (abajo) */
    }
}

/* Extra small mobile devices */
@media (max-width: 520px) {
    .combat-scene {
        gap: clamp(12px, 3vw, 20px);
        padding: clamp(16px, 4vw, 24px);
    }

    .combat-card {
        width: clamp(200px, 75vw, 280px);
        height: clamp(240px, 90vw, 340px);
        max-height: 35vh;
    }

    .combat-card-value-container {
        bottom: clamp(12px, 3vw, 20px);
        gap: 6px;
    }

    .combat-card-value-base {
        font-size: clamp(3.5rem, 18vw, 6rem);
    }

    .combat-modifier {
        font-size: clamp(0.9rem, 4vw, 1.2rem);
        padding: 4px 8px;
    }

    /* Reducir animaciones complejas en móvil para mejor performance */
    .combat-light-rays,
    .combat-particles,
    .sparkle-overlay {
        display: none;
    }

    /* Simplificar transiciones en móvil */
    .card-mini,
    .card-slot,
    .hand-dock {
        transition-duration: 200ms;
        will-change: transform;
    }

    /* Mejorar scroll en móvil */
    .hand-dock-body,
    .editor-tab-content {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    /* Prevenir zoom accidental en inputs */
    input,
    select,
    textarea {
        font-size: 16px;
    }

    /* Feedback táctil más pronunciado */
    .card-mini:active,
    .btn:active,
    .hand-dock-tab:active {
        transform: scale(0.96);
        transition-duration: 50ms;
    }

    /* Mejorar área de toque para cartas mini */
    .card-mini {
        position: relative;
        cursor: pointer;
    }

    .card-mini::before {
        content: '';
        position: absolute;
        top: -8px;
        left: -8px;
        right: -8px;
        bottom: -8px;
        z-index: -1;
    }
}

.combat-panel-premium {
    width: 100%;
    max-width: 900px;
    height: auto;
    max-height: calc(100vh - 40px);
    min-height: 280px;
    background: var(--color-paper-light);
    border: 3px solid var(--color-ink-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-deep);
    display: flex;
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

@media (max-width: 768px) {
    .combat-panel-premium {
        max-height: calc(100vh - 80px);
        min-height: 240px;
        aspect-ratio: 4 / 3;
    }

    .combat-vis-overlay {
        padding: 10px;
    }

}

.clash-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(46vw, 320px);
    height: min(34vw, 240px);
    background-image: url('assets/ui/effects/magic_halo.avif');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    color: transparent;
    z-index: 60;
    opacity: 0;
    pointer-events: none;
}

.clash-effect.active {
    animation: anime-clash 0.6s ease-out forwards;
}

.combat-side {
    flex: 1;
    height: 100%;
    background-size: cover;
    background-position: center top;
    /* Focus on face/upper body */
    background-repeat: no-repeat;
    transition: transform 0.5s ease-out, opacity 0.5s;
    position: relative;
    /* Add gradient overlay to make text pop */
    filter: brightness(0.9);
}

.combat-side::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to center, rgba(0, 0, 0, 0.6), transparent 50%);
}

.p-side {
    border-right: 2px solid rgba(0, 0, 0, 0.5);
    background-color: #333;
    /* Fallback */
}

.c-side {
    border-left: 2px solid rgba(0, 0, 0, 0.5);
    background-color: #333;
    /* Fallback */
}

.vanish {
    opacity: 0.3;
    /* Don't hide completely */
    filter: grayscale(100%);
}

.combat-content-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 55;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    pointer-events: none;
    /* Let clicks pass */
}

.combat-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 30%;
    text-align: center;
}

.calc-details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    max-width: 100%;
    padding: var(--spacing-xs);
}

/* Valor total grande */
.calc-total {
    font-size: clamp(2.5rem, 6vw, 4rem) !important;
    font-family: var(--font-display);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 10px #000, 0 0 20px rgba(255, 215, 0, 0.5);
    margin-bottom: var(--spacing-xs);
    line-height: 1;
}

/* Secciones de desglose */
.calc-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    width: 100%;
    margin-top: var(--spacing-xs);
}

.calc-section-label {
    font-size: clamp(0.7rem, 1.5vw, 0.85rem);
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

/* Tags de cálculo */
.calc-tag {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 200px;
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    font-size: clamp(0.7rem, 1.5vw, 0.85rem);
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    gap: var(--spacing-xs);
}

.calc-tag.tag-base {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.calc-tag.tag-bonus {
    background: rgba(136, 176, 139, 0.4);
    color: #a8e6a8;
    border: 1px solid rgba(136, 176, 139, 0.6);
}

.calc-tag.tag-debuff {
    background: rgba(217, 126, 126, 0.4);
    color: #ffaaaa;
    border: 1px solid rgba(217, 126, 126, 0.6);
}

.calc-source {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calc-value {
    flex-shrink: 0;
    font-weight: bold;
    margin-left: var(--spacing-xs);
}

.vs-center-box {
    width: 20%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.combat-attr-icon-large {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
    animation: pulse-icon 2s infinite;
}

@keyframes pulse-icon {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.combat-result-text {
    position: absolute;
    bottom: 20px;
    width: 100%;
    text-align: center;
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: #fff;
    text-shadow: 0 2px 5px #000;
    z-index: 70;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.combat-result-text.show {
    opacity: 1;
    transform: translateY(0);
}

/* Overlay / Modal Styles */
.panel-decorated {
    background: var(--color-paper-light);
    border: var(--border-ink);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-deep);
    text-align: center;
    max-width: 90%;
    position: relative;
    /* Paper Texture effect - CSS Fallback */
    background: var(--color-paper-light);
    background-image: linear-gradient(to bottom right, rgba(0, 0, 0, 0.05), transparent);
}

/* ==========================================
   ABILITY OVERLAY - GAME-FIRST REDESIGN
   ========================================== */
.ability-overlay-container {
    min-width: 300px;
    max-width: 90vw;
    color: rgba(238, 245, 255, 0.96);
    background-image:
        linear-gradient(162deg, rgba(11, 18, 46, 0.96) 0%, rgba(18, 23, 60, 0.97) 45%, rgba(8, 15, 36, 0.98) 100%),
        radial-gradient(circle at 20% 18%, rgba(116, 191, 255, 0.18) 0%, rgba(116, 191, 255, 0) 40%),
        radial-gradient(circle at 82% 84%, rgba(248, 221, 151, 0.16) 0%, rgba(248, 221, 151, 0) 46%),
        url('assets/overlays/overlay_panel_bg.avif');
    background-size: cover, cover, cover, cover;
    background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
    background-position: center, center, center, center;
    border: 1px solid rgba(199, 222, 255, 0.34);
    border-radius: clamp(16px, 2.8vw, 24px);
    box-shadow:
        0 24px 52px rgba(4, 9, 24, 0.56),
        0 0 0 1px rgba(255, 255, 255, 0.07),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    animation: ability-overlay-enter 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Contexto visual del personaje en el header */
#ab-context {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    margin-bottom: clamp(8px, 2vw, 12px);
    padding: clamp(8px, 2vw, 12px);
    background: linear-gradient(to bottom,
            rgba(18, 25, 62, 0.94) 0%,
            rgba(14, 21, 50, 0.9) 100%);
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(200, 223, 255, 0.3);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.18),
        0 8px 18px rgba(0, 0, 0, 0.3);
}

#ab-context-portrait {
    width: clamp(40px, 10vw, 60px);
    height: clamp(40px, 10vw, 60px);
    border-radius: var(--border-radius-md);
    border: 2px solid var(--color-accent-gold);
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

#ab-context-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#ab-context-owner {
    font-family: var(--font-display);
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    font-weight: 700;
    color: rgba(225, 239, 255, 0.94);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#ab-context-subtitle {
    font-family: var(--font-magical);
    font-size: clamp(0.85rem, 2.2vw, 1rem);
    font-weight: 500;
    font-style: italic;
    color: rgba(214, 231, 255, 0.86);
    opacity: 1;
}

.ability-overlay-container .overlay-header {
    border-bottom: 1px solid rgba(198, 219, 255, 0.32);
    background: linear-gradient(to bottom,
            rgba(18, 27, 66, 0.92) 0%,
            rgba(13, 21, 52, 0.85) 100%);
    padding: clamp(12px, 3vw, 20px);
    position: relative;
}

.ability-overlay-container .overlay-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right,
            transparent 0%,
            rgba(212, 175, 55, 0.5) 20%,
            rgba(212, 175, 55, 0.8) 50%,
            rgba(212, 175, 55, 0.5) 80%,
            transparent 100%);
}

.ability-overlay-container .overlay-title {
    color: rgba(249, 233, 185, 1);
    text-shadow:
        0 6px 18px rgba(0, 0, 0, 0.45),
        0 0 20px rgba(249, 233, 185, 0.22);
    font-size: clamp(1.2rem, 3.5vw, 1.5rem);
    font-weight: 700;
    margin-bottom: clamp(8px, 2vw, 12px);
}

.ability-instruction {
    /* MAGICAL: Instrucciones narrativas */
    font-family: var(--font-magical);
    font-size: clamp(1rem, 2.8vw, 1.15rem);
    font-weight: 500;
    font-style: italic;
    color: rgba(235, 243, 255, 0.96);
    text-align: center;
    line-height: 1.55;
    opacity: 1;
    margin-bottom: var(--spacing-md);
    max-height: 8.2em;
    overflow-y: auto;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    padding: clamp(8px, 2vw, 12px);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
    background: linear-gradient(165deg, rgba(17, 26, 66, 0.92) 0%, rgba(12, 18, 46, 0.86) 100%);
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(198, 220, 255, 0.3);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 10px 20px rgba(2, 6, 16, 0.28);
}

.ability-content-area {
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 3vw, 20px);
    padding: clamp(12px, 3vw, 20px);
}

#ab-content {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(12px, 3vw, 20px);
    justify-content: center;
    align-items: center;
    flex: 1;
    overflow: hidden;
    /* NO scroll en overlays */
    max-height: 100%;
    width: 100%;
    padding: clamp(8px, 2vw, 12px) 0;
}

#ab-content.ab-content--slot {
    grid-template-columns: repeat(auto-fit, minmax(clamp(110px, 20vw, 150px), 1fr)) !important;
    max-width: 680px;
    margin: 0 auto;
}

#ab-content.ab-content--swap {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: clamp(10px, 2.4vw, 16px);
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 2px;
}

#ab-content.ab-content--swap .ab-swap-layout {
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 2.4vw, 16px);
    width: 100%;
}

#ab-content.ab-content--swap .ab-selection-section {
    width: 100%;
    border: 1px solid rgba(198, 218, 255, 0.28);
    border-radius: 12px;
    padding: clamp(8px, 2.2vw, 14px);
    background:
        linear-gradient(165deg, rgba(12, 20, 50, 0.78) 0%, rgba(9, 15, 36, 0.72) 100%),
        radial-gradient(circle at 18% 20%, rgba(116, 191, 255, 0.12) 0%, rgba(116, 191, 255, 0) 48%);
    box-shadow:
        0 8px 18px rgba(2, 8, 20, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#ab-content.ab-content--swap .ab-selection-section-title {
    margin: 0 0 10px 0;
    text-align: center;
    font-family: var(--font-primary-ui);
    font-size: clamp(0.88rem, 2.3vw, 1.02rem);
    font-weight: 700;
    letter-spacing: 0.45px;
    color: rgba(249, 233, 185, 0.97);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

#ab-content.ab-content--swap .ab-selection-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(8px, 2.2vw, 12px);
}

#ab-content>div {
    color: rgba(232, 241, 255, 0.95);
}

#ab-content strong {
    color: rgba(249, 233, 185, 0.98);
}

#ab-content::-webkit-scrollbar {
    width: 8px;
}

#ab-content::-webkit-scrollbar-thumb {
    background: rgba(176, 207, 255, 0.42);
    border-radius: 999px;
}

.ability-instruction::-webkit-scrollbar {
    width: 8px;
}

.ability-instruction::-webkit-scrollbar-thumb {
    background: rgba(176, 207, 255, 0.42);
    border-radius: 999px;
}

.ability-content-area #ab-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(100px, 22vw, 140px), 1fr));
    justify-content: center;
    gap: clamp(12px, 3vw, 20px);
    align-items: center;
    width: 100%;
    padding: clamp(12px, 3vw, 20px) 0;
}

/* Grid específico para stats */
.ability-content-area #ab-content:has(.ab-stat-btn) {
    grid-template-columns: repeat(auto-fit, minmax(clamp(100px, 22vw, 140px), 1fr));
    max-width: 600px;
    margin: 0 auto;
}

/* Grid específico para cartas (Dumbledore, slots simples - sin contenedores anidados) */
.ability-content-area #ab-content:has(.ab-option-card):not(:has(> div > .ab-option-card)) {
    /* Más pequeñas para que 3 quepan en una fila */
    grid-template-columns: repeat(auto-fit, minmax(clamp(92px, 18vw, 120px), 1fr));
}

/* Layout específico para Mateo (SELECT CARD SWAP) */
/* Cuando hay contenedores anidados con ab-option-card, usar layout en columna */
.ability-content-area #ab-content:has(> div > .ab-option-card) {
    display: flex !important;
    flex-direction: column !important;
    gap: clamp(12px, 3vw, 20px) !important;
    align-items: center !important;
    grid-template-columns: none !important;
}

/* Títulos dentro de Mateo (divs de texto sin hijos) */
.ability-content-area #ab-content:has(> div > .ab-option-card)>div:not(:has(*)) {
    width: 100% !important;
    text-align: center !important;
    margin-bottom: clamp(8px, 2vw, 12px) !important;
    font-weight: bold !important;
}

/* Contenedores de cartas dentro de Mateo (divs que contienen ab-option-card) */
.ability-content-area #ab-content:has(> div > .ab-option-card)>div:has(.ab-option-card) {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: clamp(8px, 2vw, 12px) !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* View Cards Container (Dumbledore) */
.view-cards-container {
    display: flex;
    gap: var(--spacing-md);
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    padding: var(--spacing-sm) 0;
    justify-content: flex-start;
    align-items: center;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--color-ink-secondary) transparent;
}

.view-cards-container::-webkit-scrollbar {
    height: 6px;
}

.view-cards-container::-webkit-scrollbar-track {
    background: transparent;
}

.view-cards-container::-webkit-scrollbar-thumb {
    background: var(--color-ink-secondary);
    border-radius: 3px;
}

.view-card-item {
    flex-shrink: 0;
    width: 150px;
    height: auto;
    display: flex;
    align-items: flex-start;
}

.view-card-item .card-premium {
    width: 100%;
    height: auto;
}

/* ==========================================
   ABILITY SELECTION BUTTONS - REDISEÑO MODERNO
   ========================================== */
.ab-stat-btn {
    position: relative;
    width: clamp(100px, 22vw, 140px);
    height: clamp(100px, 22vw, 140px);
    min-width: 100px;
    min-height: 100px;
    border: 2px solid rgba(202, 223, 255, 0.4);
    border-radius: 12px;
    cursor: pointer;
    transition: all 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: visible;
    flex-shrink: 0;
    background: linear-gradient(160deg,
            rgba(13, 22, 56, 0.97) 0%,
            rgba(22, 30, 72, 0.92) 100%);
    box-shadow:
        0 10px 22px rgba(2, 8, 20, 0.46),
        0 0 0 1px rgba(255, 255, 255, 0.06);
    background-image:
        radial-gradient(circle at 30% 25%, rgba(116, 191, 255, 0.2) 0%, rgba(116, 191, 255, 0) 46%),
        radial-gradient(circle at 74% 78%, rgba(248, 221, 151, 0.16) 0%, rgba(248, 221, 151, 0) 44%),
        linear-gradient(160deg, rgba(13, 22, 56, 0.97) 0%, rgba(22, 30, 72, 0.92) 100%);
}

.ab-stat-btn-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.9;
    transition: opacity 300ms ease;
    border-radius: 9px;
}

.ab-stat-btn-value {
    position: absolute;
    bottom: clamp(6px, 1.5vw, 10px);
    right: clamp(6px, 1.5vw, 10px);
    background: linear-gradient(160deg, rgba(9, 14, 34, 0.96) 0%, rgba(26, 34, 72, 0.84) 100%);
    border: 1px solid rgba(220, 234, 255, 0.45);
    border-radius: 8px;
    padding: clamp(4px, 1vw, 8px) clamp(8px, 2vw, 12px);
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 900;
    color: rgba(250, 242, 221, 0.98);
    min-width: clamp(36px, 8vw, 44px);
    text-align: center;
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    z-index: 2;
    transition: all 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ab-stat-btn:hover {
    transform: scale(1.05);
    border-color: rgba(249, 230, 180, 0.72);
    box-shadow:
        0 14px 26px rgba(2, 8, 20, 0.6),
        0 0 22px rgba(116, 191, 255, 0.26);
}

.ab-stat-btn:hover .ab-stat-btn-bg {
    opacity: 1;
}

.ab-stat-btn:hover .ab-stat-btn-value {
    background: linear-gradient(160deg, rgba(12, 18, 42, 0.98) 0%, rgba(40, 47, 90, 0.94) 100%);
    border-color: rgba(248, 227, 173, 0.78);
    color: rgba(248, 227, 173, 1);
    box-shadow:
        0 6px 16px rgba(1, 7, 18, 0.6),
        0 0 20px rgba(248, 227, 173, 0.34);
    transform: scale(1.05);
}

.ab-stat-btn.selected {
    transform: scale(1.12);
    border-color: rgba(248, 227, 173, 0.94);
    border-width: 4px;
    box-shadow:
        0 0 0 3px rgba(248, 227, 173, 0.26),
        0 0 32px rgba(116, 191, 255, 0.36),
        0 0 28px rgba(248, 227, 173, 0.34),
        inset 0 0 22px rgba(248, 227, 173, 0.12);
    animation: stat-btn-pulse 2s ease-in-out infinite;
}

.ab-stat-btn.selected::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    border-radius: 16px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.4) 0%, transparent 70%);
    z-index: -1;
    animation: stat-btn-halo 2s ease-in-out infinite;
    pointer-events: none;
}

.ab-stat-btn.selected .ab-stat-btn-bg {
    opacity: 1;
}

.ab-stat-btn.selected .ab-stat-btn-value {
    background: linear-gradient(160deg, rgba(12, 18, 42, 1) 0%, rgba(40, 47, 90, 0.96) 100%);
    border-color: rgba(248, 227, 173, 0.9);
    color: rgba(248, 227, 173, 1);
    box-shadow:
        0 0 24px rgba(248, 227, 173, 0.45),
        0 8px 20px rgba(1, 7, 18, 0.66);
    transform: scale(1.1);
}

/* Atenuar botones no seleccionados cuando hay uno seleccionado */
.ability-content-area #ab-content:has(.ab-stat-btn.selected) .ab-stat-btn:not(.selected) {
    opacity: 0.7;
    filter: grayscale(0.2);
}

/* Animaciones para botones de stats */
@keyframes stat-btn-pulse {

    0%,
    100% {
        box-shadow:
            0 0 0 4px rgba(212, 175, 55, 0.3),
            0 0 30px rgba(212, 175, 55, 0.7),
            inset 0 0 20px rgba(212, 175, 55, 0.2);
    }

    50% {
        box-shadow:
            0 0 0 6px rgba(212, 175, 55, 0.4),
            0 0 40px rgba(212, 175, 55, 0.8),
            inset 0 0 25px rgba(212, 175, 55, 0.3);
    }
}

@keyframes stat-btn-halo {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.05);
    }
}

.ab-option-card {
    width: clamp(92px, 18vw, 120px);
    height: clamp(128px, 24vw, 170px);
    min-width: 92px;
    min-height: 128px;
    border: 1px solid rgba(198, 218, 255, 0.34);
    border-radius: 8px;
    cursor: pointer;
    transition: all 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
    background: linear-gradient(165deg,
            rgba(15, 24, 58, 0.92) 0%,
            rgba(11, 17, 43, 0.88) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow:
        0 8px 18px rgba(2, 8, 20, 0.44),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    background-image:
        radial-gradient(circle at 24% 22%, rgba(116, 191, 255, 0.16) 0%, rgba(116, 191, 255, 0) 44%),
        radial-gradient(circle at 78% 78%, rgba(248, 221, 151, 0.14) 0%, rgba(248, 221, 151, 0) 42%),
        linear-gradient(165deg, rgba(15, 24, 58, 0.92) 0%, rgba(11, 17, 43, 0.88) 100%);
}

.ab-option-card--fullcard,
.ab-option-card--rival-slot {
    width: clamp(102px, 19vw, 132px);
    height: clamp(148px, 27vw, 184px);
    min-width: 102px;
    min-height: 148px;
}

.ab-option-card:not(:has(img)) {
    /* Cuando la opción es texto (slots, etc): centrar y legible */
    text-align: center;
    padding: 10px 8px;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(0.78rem, 2.4vw, 0.95rem);
    line-height: 1.15;
    color: rgba(239, 245, 255, 0.95);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.52);
    letter-spacing: 0.4px;
}

.ab-slot-option {
    flex-direction: column;
    gap: 6px;
    padding: 10px 8px;
    background:
        linear-gradient(160deg, rgba(15, 24, 58, 0.94) 0%, rgba(10, 16, 40, 0.9) 100%),
        radial-gradient(circle at 24% 20%, rgba(116, 191, 255, 0.18) 0%, rgba(116, 191, 255, 0) 44%);
}

.ab-slot-option__target {
    font-family: var(--font-ui);
    font-size: clamp(0.62rem, 1.6vw, 0.74rem);
    font-weight: 800;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: rgba(198, 218, 255, 0.85);
}

.ab-slot-option__label {
    font-family: var(--font-primary-ui);
    font-size: clamp(0.92rem, 2.4vw, 1.05rem);
    font-weight: 700;
    color: rgba(249, 233, 185, 0.97);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.ab-slot-option__hint {
    font-family: var(--font-magical);
    font-size: clamp(0.68rem, 1.8vw, 0.78rem);
    font-style: italic;
    color: rgba(222, 234, 255, 0.76);
}

.ab-slot-badge {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-primary-ui);
    font-size: clamp(0.62rem, 1.5vw, 0.72rem);
    font-weight: 700;
    letter-spacing: 0.35px;
    color: rgba(249, 233, 185, 0.98);
    background: linear-gradient(160deg, rgba(9, 14, 34, 0.94) 0%, rgba(18, 25, 58, 0.9) 100%);
    border: 1px solid rgba(198, 218, 255, 0.42);
    padding: 3px 8px;
    border-radius: 999px;
    box-shadow:
        0 5px 12px rgba(2, 8, 20, 0.52),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
    z-index: 3;
}

.ab-option-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    transition: transform 300ms ease;
}

.ab-option-card:hover {
    transform: translateY(-4px) scale(1.05);
    border-color: rgba(248, 227, 173, 0.78);
    background: linear-gradient(165deg,
            rgba(18, 30, 72, 0.95) 0%,
            rgba(14, 23, 56, 0.92) 100%);
    box-shadow:
        0 16px 26px rgba(2, 8, 20, 0.62),
        0 0 20px rgba(116, 191, 255, 0.26);
    border-width: 3px;
}

.ab-option-card:hover img {
    transform: scale(1.02);
}

.ab-option-card.selected {
    transform: translateY(-4px) scale(1.1);
    border-color: rgba(248, 227, 173, 0.94);
    border-width: 4px;
    background: linear-gradient(165deg,
            rgba(20, 34, 78, 0.97) 0%,
            rgba(16, 26, 62, 0.96) 100%);
    box-shadow:
        0 0 0 3px rgba(248, 227, 173, 0.2),
        0 12px 32px rgba(2, 8, 20, 0.66),
        0 0 20px rgba(116, 191, 255, 0.34),
        inset 0 0 16px rgba(248, 227, 173, 0.14);
}

.ab-option-card.selected img {
    transform: scale(1.05);
}

/* Atenuar cartas no seleccionadas cuando hay una seleccionada */
.ability-content-area #ab-content:has(.ab-option-card.selected) .ab-option-card:not(.selected) {
    opacity: 0.65;
    filter: grayscale(0.3);
}

/* ==========================================
   STAT SELECTOR - Fantasy Game UI
   ========================================== */
.stat-selector-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: calc(var(--z-modal) + 10);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: stat-selector-fade-in 400ms ease-out;
}


.stat-selector-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Menos oscuro: atmósfera cuento, no “dark UI” */
    background: rgba(28, 24, 28, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: auto;
}

.stat-selector-backdrop::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at center, rgba(212, 175, 55, 0.15) 0%, rgba(42, 35, 40, 0.85) 70%),
        url('assets/overlays/overlay_backdrop.avif');
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    pointer-events: none;
}

.stat-selector-panel {
    position: relative;
    z-index: 1;
    /* SIN MARCO: sin borde/sombra/padding/fondo extra */
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    /* Fullscreen-ish: 99% del viewport */
    width: 99vw;
    height: 80vh;
    max-width: 99vw;
    max-height: 99vh;
    pointer-events: auto;
    animation: stat-selector-panel-enter 500ms var(--ease-spring);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.stat-selector-header {
    text-align: center;
    margin-bottom: clamp(10px, 2.2vw, 16px);
    padding-bottom: 0;
    border-bottom: none;
}

.stat-selector-character-name {
    /* PRIMARY UI: Nombres de personajes en selector */
    font-family: var(--font-primary-ui);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--color-ink-primary);
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(212, 175, 55, 0.3);
    margin-bottom: clamp(8px, 2vw, 12px);
    letter-spacing: 0.5px;
}

.stat-selector-subtitle {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    font-style: italic;
    color: var(--color-ink-secondary);
    letter-spacing: 1px;
}

.stat-selector-grid {
    /* Este panel usa la red arcana (nodos absolutos), no grid-cards */
    --arcane-shell-border: rgba(210, 229, 255, 0.28);
    --arcane-shell-shadow: rgba(26, 14, 64, 0.65);
    display: block;
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    flex: 1 1 auto;
    min-height: clamp(420px, 72vh, 760px);
    border-radius: clamp(20px, 2.8vw, 36px);
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(circle at 12% 14%, rgba(123, 192, 255, 0.22) 0%, rgba(123, 192, 255, 0) 44%),
        radial-gradient(circle at 88% 84%, rgba(183, 121, 255, 0.19) 0%, rgba(183, 121, 255, 0) 42%),
        radial-gradient(circle at 50% 48%, rgba(247, 227, 173, 0.17) 0%, rgba(247, 227, 173, 0) 46%),
        linear-gradient(158deg, rgba(14, 24, 62, 0.92) 0%, rgba(28, 21, 70, 0.95) 48%, rgba(9, 15, 42, 0.95) 100%);
    border: 1px solid var(--arcane-shell-border);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        inset 0 -36px 72px rgba(5, 8, 21, 0.42),
        0 28px 64px var(--arcane-shell-shadow),
        0 0 0 1px rgba(255, 255, 255, 0.06);
}

.stat-selector-grid::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(84%, 640px);
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    border: 1px solid rgba(236, 244, 255, 0.15);
    background:
        radial-gradient(circle, rgba(247, 225, 169, 0.11) 0%, rgba(247, 225, 169, 0) 58%),
        radial-gradient(circle at 50% 50%, rgba(192, 167, 255, 0.14) 0%, rgba(192, 167, 255, 0) 72%);
    box-shadow:
        inset 0 0 48px rgba(230, 213, 170, 0.14),
        0 0 38px rgba(123, 192, 255, 0.12);
}

.stat-selector-grid::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(108%, 820px);
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.08;
    mix-blend-mode: screen;
    background:
        conic-gradient(from 0deg, rgba(122, 194, 255, 0.14), rgba(164, 123, 255, 0.1), rgba(251, 229, 154, 0.2), rgba(122, 194, 255, 0.14));
    animation: stat-selector-grid-aura-spin 26s linear infinite;
}

@keyframes stat-selector-grid-aura-spin {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Animations */
@keyframes stat-selector-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes stat-selector-panel-enter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .stat-selector-panel {
        padding: clamp(24px, 5vw, 32px) clamp(16px, 4vw, 24px);
        max-width: 95vw;
    }

    .stat-selector-grid {
        min-height: clamp(360px, 64vh, 620px);
        border-radius: clamp(16px, 5vw, 26px);
    }

}

.game-title {
    font-family: var(--font-display);
    font-size: 2.5rem;
    color: var(--color-ink-primary);
    margin-bottom: var(--spacing-sm);
}

/* ==========================================
   OVERLAY SYSTEM - GAME-FIRST BASE
   ========================================== */
.overlay-screen {
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    position: fixed;
    top: 0;
    left: 0;
    z-index: var(--z-overlay);
    /* Animaciones de entrada */
    animation: overlay-fade-in 300ms ease-out;
}

/* Backdrop mejorado para ability overlay */
#ability-modal-overlay {
    background: rgba(28, 24, 28, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    background-image:
        radial-gradient(ellipse at center, rgba(212, 175, 55, 0.1) 0%, rgba(28, 24, 28, 0.75) 70%);
}

#ability-modal-overlay::before {
    opacity: 0.25;
}

.overlay-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('assets/overlays/overlay_backdrop.avif');
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    z-index: -1;
    pointer-events: none;
}


/* Animaciones de entrada mejoradas para Result Overlay */
#game-result-overlay {
    background: rgba(6, 12, 30, 0.82);
    backdrop-filter: blur(9px) saturate(1.14);
    -webkit-backdrop-filter: blur(9px) saturate(1.14);
}

#game-result-overlay::before {
    opacity: 0.22;
}

#game-result-overlay.active {
    animation: result-overlay-enter 600ms var(--ease-spring);
}

#game-result-overlay.active .result-overlay-container {
    position: relative;
    overflow: hidden;
    border-width: 1px;
    border-style: solid;
    border-color: rgba(198, 220, 255, 0.44);
    box-shadow:
        0 28px 70px rgba(3, 8, 26, 0.68),
        0 0 0 1px rgba(255, 255, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.26),
        inset 0 -42px 82px rgba(6, 12, 32, 0.24);
    background-image:
        linear-gradient(160deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.08) 36%, rgba(255, 255, 255, 0.02) 100%),
        url('assets/overlays/overlay_panel_bg.avif'),
        linear-gradient(to bottom, var(--overlay-bg), var(--overlay-bg));
    background-size: cover, cover, cover;
    background-position: center, center, center;
    animation: result-container-enter 700ms var(--ease-spring) 100ms both;
}

#game-result-overlay.active .result-overlay-container::before,
#game-result-overlay.active .result-overlay-container::after {
    content: '';
    position: absolute;
    pointer-events: none;
    z-index: 0;
}

#game-result-overlay.active .result-overlay-container::before {
    inset: -22%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 32% 36%, rgba(126, 204, 255, 0.26) 0%, rgba(126, 204, 255, 0) 56%),
        radial-gradient(circle at 68% 70%, rgba(245, 232, 171, 0.24) 0%, rgba(245, 232, 171, 0) 52%),
        radial-gradient(circle at 56% 44%, rgba(186, 146, 255, 0.2) 0%, rgba(186, 146, 255, 0) 58%);
    opacity: 0.68;
    animation: result-aurora-drift 18s linear infinite;
}

#game-result-overlay.active .result-overlay-container::after {
    inset: 0;
    background:
        radial-gradient(2px 2px at 14% 24%, rgba(255, 255, 255, 0.36), transparent 64%),
        radial-gradient(1.8px 1.8px at 72% 30%, rgba(245, 232, 171, 0.34), transparent 64%),
        radial-gradient(2.2px 2.2px at 38% 74%, rgba(126, 204, 255, 0.34), transparent 64%),
        radial-gradient(1.6px 1.6px at 84% 68%, rgba(193, 149, 255, 0.3), transparent 64%);
    opacity: 0.46;
    mix-blend-mode: screen;
    animation: result-aurora-spin 20s linear infinite;
}

#game-result-overlay.active .result-overlay-container>* {
    position: relative;
    z-index: 1;
}

#game-result-overlay.active .overlay-title {
    animation: result-title-rise 700ms var(--ease-spring) 120ms both;
}

#game-result-overlay.active .result-message-text {
    animation: result-message-fade 700ms ease 260ms both;
}

#game-result-overlay.active .result-score-value {
    animation: result-value-rise 900ms var(--ease-spring) 260ms both;
}

#game-result-overlay.result-win .result-overlay-container {
    border-color: rgba(245, 232, 171, 0.62);
    box-shadow:
        0 28px 70px rgba(3, 8, 26, 0.68),
        0 0 34px rgba(245, 232, 171, 0.28),
        0 0 64px rgba(126, 204, 255, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -42px 82px rgba(6, 12, 32, 0.22);
}

#game-result-overlay.result-loss .result-overlay-container {
    border-color: rgba(255, 151, 166, 0.58);
    box-shadow:
        0 28px 70px rgba(3, 8, 26, 0.68),
        0 0 30px rgba(255, 122, 144, 0.22),
        0 0 54px rgba(186, 146, 255, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        inset 0 -42px 82px rgba(24, 12, 24, 0.24);
}

#game-result-overlay.result-tie .result-overlay-container {
    border-color: rgba(194, 223, 255, 0.52);
    box-shadow:
        0 28px 70px rgba(3, 8, 26, 0.68),
        0 0 30px rgba(152, 196, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.24),
        inset 0 -42px 82px rgba(8, 18, 42, 0.2);
}

#game-result-overlay.result-win .result-score-player .result-score-value {
    text-shadow:
        0 0 18px rgba(245, 232, 171, 0.56),
        2px 2px 0 rgba(0, 0, 0, 0.24);
}

#game-result-overlay.result-loss .result-score-cpu .result-score-value {
    text-shadow:
        0 0 16px rgba(255, 151, 166, 0.54),
        2px 2px 0 rgba(0, 0, 0, 0.24);
}

#game-result-overlay.result-tie .result-score-value {
    text-shadow:
        0 0 14px rgba(194, 223, 255, 0.44),
        2px 2px 0 rgba(0, 0, 0, 0.24);
}

@keyframes result-overlay-enter {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }

    to {
        opacity: 1;
        backdrop-filter: blur(8px);
    }
}

@keyframes result-container-enter {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes result-aurora-drift {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.05);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes result-aurora-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes result-title-rise {
    0% {
        opacity: 0;
        transform: translateY(-8px) scale(0.94);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes result-message-fade {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes result-value-rise {
    0% {
        opacity: 0;
        transform: translateY(12px) scale(0.82);
    }

    58% {
        opacity: 1;
        transform: translateY(0) scale(1.08);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Soporte para assets de overlay_result si existen */
#game-result-overlay.result-win .result-overlay-container,
.result-overlay-container.result-win {
    background-image:
        linear-gradient(160deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.08) 36%, rgba(255, 255, 255, 0.02) 100%),
        radial-gradient(circle at 50% 18%, rgba(255, 230, 150, 0.22), rgba(255, 230, 150, 0) 46%),
        linear-gradient(to bottom, rgba(255, 215, 0, 0.1), var(--color-paper-light));
    background-size: cover, cover, cover;
    background-repeat: no-repeat, no-repeat, no-repeat;
    background-position: center, center, center;
}

#game-result-overlay.result-loss .result-overlay-container,
.result-overlay-container.result-loss {
    background-image:
        linear-gradient(160deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.08) 36%, rgba(255, 255, 255, 0.02) 100%),
        radial-gradient(circle at 50% 18%, rgba(255, 148, 144, 0.2), rgba(255, 148, 144, 0) 46%),
        linear-gradient(to bottom, rgba(244, 67, 54, 0.1), var(--color-paper-light));
    background-size: cover, cover, cover;
    background-repeat: no-repeat, no-repeat, no-repeat;
    background-position: center, center, center;
}

#game-result-overlay.result-tie .result-overlay-container,
.result-overlay-container.result-tie {
    background-image:
        linear-gradient(160deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.08) 36%, rgba(255, 255, 255, 0.02) 100%),
        radial-gradient(circle at 50% 18%, rgba(206, 218, 236, 0.22), rgba(206, 218, 236, 0) 46%),
        linear-gradient(to bottom, rgba(200, 200, 200, 0.1), var(--color-paper-light));
    background-size: cover, cover, cover;
    background-repeat: no-repeat, no-repeat, no-repeat;
    background-position: center, center, center;
}

@keyframes overlay-fade-in {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }

    to {
        opacity: 1;
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }
}

/* Animación de entrada específica para ability overlay */
@keyframes ability-overlay-enter {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes overlay-container-enter {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes overlay-container-exit {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* Estructura base de overlay game-first */
.game-overlay-container {
    width: 95vw;
    max-width: 800px;
    max-height: calc(100vh - 40px);
    background-image:
        url('assets/overlays/overlay_panel_bg.avif'),
        linear-gradient(to bottom, var(--overlay-bg), var(--overlay-bg));
    background-size: cover;
    background-position: center;
    border: 3px solid var(--color-ink-primary);
    border-radius: var(--overlay-border-radius);
    box-shadow: var(--shadow-deep);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: overlay-container-enter 400ms var(--ease-spring);
    pointer-events: auto;
    position: relative;
}

.overlay-header {
    height: var(--overlay-header-height);
    padding: var(--overlay-padding);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    border-bottom: 2px solid var(--color-ink-secondary);
    flex-shrink: 0;
}

.overlay-title {
    /* PRIMARY UI: Títulos de overlays */
    font-family: var(--font-primary-ui);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    color: var(--color-ink-primary);
    text-align: center;
    line-height: 1.2;
    max-height: calc(var(--overlay-header-height) - var(--overlay-padding) * 2);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    letter-spacing: 0.3px;
}

.overlay-core {
    flex: 1;
    padding: var(--overlay-padding);
    overflow: hidden;
    /* NO scroll en overlays: usar paginación/carrusel/clamp */
    max-height: var(--overlay-core-max-height);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* Permitir overflow visible para la imagen de carta en el inspector */
/* BUG 1 FIX: Aumentar espacio disponible para preview sin recortar imagen (desktop) */
#card-inspection-modal .overlay-core {
    overflow: visible;
    aspect-ratio: auto;
    min-height: 600px;
    max-width: 100%;
    max-height: none;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* BUG 1 FIX: Aumentar altura disponible para modal sin recortar carta (desktop) */
#card-inspection-modal .game-overlay-container {
    overflow: visible;
    max-height: min(900px, calc(100vh - 20px));
}

.inspect-header {
    height: auto;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
}

.inspect-header-topline {
    width: 100%;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.inspect-header .overlay-title {
    margin: 0;
    max-height: none;
    overflow: visible;
    display: block;
    text-align: left;
    font-size: clamp(0.78rem, 1.8vw, 0.94rem);
    line-height: 1.1;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0.82;
}

.inspect-card-name {
    margin: 0;
    font-family: var(--font-primary-ui);
    font-size: clamp(1.12rem, 2.3vw, 1.42rem);
    font-weight: 700;
    line-height: 1.05;
    color: rgba(255, 248, 235, 0.96);
    text-align: left;
    text-wrap: balance;
}

.inspect-ability-summary[hidden] {
    display: none !important;
}

.inspect-ability-summary {
    width: 100%;
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: linear-gradient(180deg, rgba(11, 18, 38, 0.84), rgba(8, 14, 32, 0.74));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        0 10px 24px rgba(0, 0, 0, 0.16);
}

.inspect-ability-name {
    font-family: var(--font-primary-ui);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 238, 186, 0.94);
}

.inspect-ability-desc {
    font-family: var(--font-magical);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.28;
    color: rgba(250, 245, 235, 0.96);
    text-align: left;
}

/* FIX: Card preview image should scale to fit without cropping */
#inspect-img {
    width: 100%;
    height: auto;
    max-width: 480px;
    max-height: 100%;
    object-fit: contain;
    display: block;
    aspect-ratio: 2.5 / 3.5;
}

.inspect-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: clamp(44px, 5vw, 56px);
    height: clamp(44px, 5vw, 56px);
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.38);
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.25), transparent 65%),
        rgba(10, 23, 49, 0.68);
    box-shadow:
        0 12px 22px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
    color: rgba(250, 245, 235, 0.96);
    font-family: var(--font-primary-ui);
    font-size: clamp(1.3rem, 2.2vw, 1.6rem);
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 4;
    transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.inspect-nav-btn:hover {
    filter: brightness(1.08);
}

.inspect-nav-btn:active {
    transform: translateY(-50%) scale(0.97);
}

.inspect-nav-btn[hidden],
.inspect-nav-btn[disabled] {
    display: none !important;
}

.inspect-nav-btn--prev {
    left: clamp(8px, 2vw, 18px);
}

.inspect-nav-btn--next {
    right: clamp(8px, 2vw, 18px);
}


/* Panel "Jugar carta" (inspección): fondo watercolor a pantalla completa del core */
#card-inspection-modal .overlay-core {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Inspector: lista completa de modificadores (siempre visible en modal) */
.inspect-modifiers {
    margin-top: var(--spacing-sm);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    max-width: min(560px, 100%);
}

.inspect-modifiers .inspect-mod {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
    max-width: 100%;
    white-space: nowrap;
}

.inspect-modifiers .inspect-mod.buff {
    background: rgba(80, 160, 100, 0.85);
}

.inspect-modifiers .inspect-mod.debuff {
    background: rgba(160, 80, 80, 0.85);
}

.inspect-modifiers .inspect-mod.synergy {
    background: rgba(180, 150, 80, 0.85);
}

.inspect-modifiers .inspect-mod .inspect-mod-scope {
    font-size: 0.72rem;
    font-weight: 600;
    opacity: 0.9;
}

/* Mismo watercolor por facción también en el área de acciones */
#card-inspection-modal .overlay-actions {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.overlay-actions {
    min-height: var(--overlay-actions-height);
    padding: var(--overlay-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    border-top: 2px solid var(--color-ink-secondary);
    flex-shrink: 0;
    padding-bottom: max(var(--overlay-padding), env(safe-area-inset-bottom));
    flex-wrap: nowrap;
}

.overlay-actions .btn-overlay-primary,
.overlay-actions .btn-overlay-secondary {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    flex: 0 0 auto;

    max-width: none;
}

.overlay-actions .btn-overlay-secondary {
    margin-right: auto;
}

.overlay-actions .btn-overlay-primary {
    margin-left: auto;
}

.btn-overlay-primary {
    min-height: 60px;
    padding: clamp(16px, 3.5vw, 20px) clamp(32px, 7vw, 40px);
    /* PRIMARY UI: Botones principales */
    font-family: var(--font-primary-ui);
    font-size: clamp(1.0rem, 3.2vw, 1.2rem);
    font-weight: 700;
    background: var(--color-paper-light);
    border: 3px solid var(--color-ink-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-deep);
    cursor: pointer;
    transition: all 300ms var(--ease-spring);
    color: var(--color-ink-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;


}

.btn-overlay-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
    background: rgba(247, 245, 230, 0.95);
}

.btn-overlay-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: var(--shadow-paper);
}

.btn-overlay-secondary {
    min-height: 60px;
    padding: clamp(16px, 3.5vw, 20px) clamp(32px, 7vw, 40px);
    /* PRIMARY UI: Botones secundarios */
    font-family: var(--font-primary-ui);
    font-size: clamp(1.0rem, 3.2vw, 1.2rem);
    font-weight: 700;
    background: rgba(247, 245, 230, 0.6);
    border: 3px solid var(--color-ink-secondary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-paper);
    cursor: pointer;
    transition: all 300ms var(--ease-spring);
    color: var(--color-ink-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;


}

.btn-overlay-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    background: rgba(247, 245, 230, 0.9);
    border-color: var(--color-ink-primary);
    color: var(--color-ink-primary);
}

.btn-overlay-secondary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: var(--shadow-paper);
}

/* Buttons */
button {
    cursor: pointer;
    font-family: var(--font-ui);
    border: none;
    outline: none;
    transition: all 300ms var(--ease-spring);
    -webkit-tap-highlight-color: transparent;
}

button:active {
    transform: scale(0.98);
}

button:focus-visible {
    outline: 3px solid var(--color-accent-gold);
    outline-offset: 2px;
}

/* Cap de ancho para botones concretos (UI) */
#btn-exit-combat,
#confirm-lineup-btn,
#btn-ab-confirm,
#hub-play-btn {
    max-width: 270px;
}

#btn-exit-combat {
    min-height: 48px;
    padding: 10px 16px;
    font-family: var(--font-primary-ui);
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-radius: 14px;
    border: 1px solid rgba(139, 69, 19, 0.5);
    background: rgba(247, 245, 230, 0.95);
    color: rgba(90, 55, 25, 0.95);
    box-shadow: 0 6px 16px rgba(20, 15, 20, 0.2);
}

#btn-exit-combat:hover {
    border-color: rgba(139, 69, 19, 0.7);
    background: rgba(247, 245, 230, 1);
}

#confirm-lineup-btn,
#confirm-hand-btn,
#btn-next-round-main {
    min-height: 52px;
    padding: 12px 18px;
    font-family: var(--font-parchment);
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    border-radius: 16px;
    border: 1px solid rgba(212, 175, 55, 0.7);
    background:
        linear-gradient(135deg, rgba(42, 35, 40, 0.95) 0%, rgba(24, 18, 28, 0.98) 60%, rgba(18, 14, 22, 1) 100%),
        radial-gradient(circle at 30% 30%, rgba(212, 175, 55, 0.3), transparent 60%);
    color: rgba(247, 245, 230, 0.98);
    box-shadow:
        0 10px 22px rgba(16, 10, 18, 0.35),
        0 0 18px rgba(212, 175, 55, 0.25);
}

#confirm-lineup-btn:hover,
#confirm-hand-btn:hover,
#btn-next-round-main:hover {
    border-color: rgba(212, 175, 55, 1);
    box-shadow:
        0 14px 26px rgba(16, 10, 18, 0.4),
        0 0 24px rgba(212, 175, 55, 0.35);
}

/* Botón de confirmar con glow cuando hay selección válida */
.ability-overlay-container:has(.ab-stat-btn.selected) #btn-ab-confirm,
.ability-overlay-container:has(.ab-option-card.selected) #btn-ab-confirm {
    border-color: var(--color-accent-gold);
    box-shadow:
        0 0 0 3px rgba(212, 175, 55, 0.3),
        0 0 20px rgba(212, 175, 55, 0.5),
        0 6px 25px rgba(0, 0, 0, 0.3);
    background: linear-gradient(to bottom,
            rgba(255, 250, 235, 0.98) 0%,
            rgba(247, 245, 230, 0.95) 100%);
    animation: confirm-btn-glow 2s ease-in-out infinite;
}

@keyframes confirm-btn-glow {

    0%,
    100% {
        box-shadow:
            0 0 0 3px rgba(212, 175, 55, 0.3),
            0 0 20px rgba(212, 175, 55, 0.5),
            0 6px 25px rgba(0, 0, 0, 0.3);
    }

    50% {
        box-shadow:
            0 0 0 4px rgba(212, 175, 55, 0.4),
            0 0 30px rgba(212, 175, 55, 0.7),
            0 8px 30px rgba(0, 0, 0, 0.35);
    }
}

/* ==========================================
   BUTTONS - Game-First Design
   ========================================== */

.btn-primary {
    background: var(--color-paper-light);
    border: 3px solid var(--color-ink-primary);
    padding: clamp(14px, 3vw, 18px) clamp(28px, 6vw, 36px);
    border-radius: var(--border-radius-lg);
    /* PRIMARY UI: Botones principales del juego */
    font-family: var(--font-primary-ui);
    font-size: clamp(1.0rem, 3.2vw, 1.2rem);
    font-weight: 700;
    color: var(--color-ink-primary);
    box-shadow: var(--shadow-deep);
    margin: 8px;
    cursor: pointer;
    transition: all 300ms var(--ease-spring);
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    background: rgba(247, 245, 230, 0.95);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: var(--shadow-paper);
}

.btn-secondary {
    background: rgba(247, 245, 230, 0.8);
    border: 3px solid var(--color-ink-secondary);
    padding: clamp(14px, 3vw, 18px) clamp(28px, 6vw, 36px);
    border-radius: var(--border-radius-lg);
    font-size: clamp(1rem, 3vw, 1.2rem);
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--color-ink-secondary);
    box-shadow: var(--shadow-paper);
    margin: 8px;
    cursor: pointer;
    transition: all 300ms var(--ease-spring);
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    background: rgba(247, 245, 230, 0.95);
    border-color: var(--color-ink-primary);
    color: var(--color-ink-primary);
}

.btn-secondary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: var(--shadow-paper);
}

/* ==========================================
   INITIATIVE BET UI (Choice Buttons)
   ========================================== */
#initiative-steal-ui .initiative-steal-btn--steal {
    background: var(--color-accent-danger);
    border-color: var(--color-ink-primary);
    color: var(--color-paper-light);
}

#initiative-steal-ui .initiative-steal-btn--steal:hover {
    background: #c86f6f;
}

#initiative-steal-ui .initiative-steal-btn--skip {
    background: var(--color-accent-success);
    border-color: var(--color-ink-primary);
    color: var(--color-paper-light);
}

#initiative-steal-ui .initiative-steal-btn--skip:hover {
    background: #7aa37d;
}

#initiative-steal-ui .initiative-steal-separator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 2px solid rgba(42, 35, 40, 0.25);
    background: rgba(247, 245, 230, 0.9);
    color: var(--color-ink-primary);
    font-family: var(--font-primary-ui);
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    pointer-events: none;
    margin: 2px 0;
}

#initiative-steal-ui .initiative-steal-btn--skip,
#initiative-steal-ui .initiative-steal-btn--steal {
    text-transform: uppercase;
}

.initiative-steal-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    border: 2px solid rgba(42, 35, 40, 0.2);
    background: rgba(247, 245, 230, 0.92);
    color: var(--color-ink-primary);
    font-family: var(--font-primary-ui);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin-top: 6px;
}

.btn-small {
    width: 56px;
    /* Touch target mejorado */
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--color-ink-secondary);
    background: var(--color-paper-light);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-paper);
    transition: all 300ms var(--ease-spring);
}

.btn-small:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-deep);
    border-color: var(--color-ink-primary);
}

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

/* Utility */
.hidden {
    display: none !important;
}

/* Inputs */
.input-premium {
    background: var(--color-paper-light);
    border: var(--border-ink-thin);
    padding: 8px 12px;
    border-radius: var(--border-radius-md);
    font-family: var(--font-ui);
    font-size: 1rem;
    color: var(--color-ink-primary);
    box-shadow: inset 1px 1px 4px rgba(0, 0, 0, 0.1);
    outline: none;
    margin: 5px;
    transition: all 0.2s ease;
}

.input-premium:focus {
    border-color: #8B4513;
    /* Ink Primary */
    box-shadow: inset 1px 1px 6px rgba(139, 69, 19, 0.2);
}

.input-premium option {
    background: #fdf6e3;
    color: #2a2328;
}

/* Simulator Output */
.sim-output-box {
    background: rgba(255, 255, 255, 0.5);
    border: var(--border-ink-thin);
    border-radius: var(--border-radius-sm);
    padding: var(--spacing-md);
    font-family: 'Courier New', monospace;
    /* Monospace for data alignment */
    font-size: 0.9rem;
    color: var(--color-ink-primary);
    text-align: left;
    max-height: none;
    overflow: hidden;
    /* NO scroll */
}

.sim-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.sim-table th {
    border-bottom: 2px solid var(--color-ink-primary);
    text-align: left;
    padding: 5px;
}

.sim-table td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 5px;
}

/* ==========================================
   VS OVERLAY - GAME-FIRST REDESIGN
   ========================================== */
.captain-showdown-container {
    width: 95vw;
    max-width: 700px;
    max-height: calc(100vh - 40px);
    background:
        radial-gradient(140% 120% at 50% 0%,
            rgba(212, 175, 55, 0.10) 0%,
            rgba(255, 255, 255, 0.0) 55%),
        linear-gradient(to bottom, var(--overlay-bg), rgba(244, 241, 234, 0.92));
    border: var(--border-ink);
    border-radius: var(--overlay-border-radius);
    box-shadow: var(--shadow-deep);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: overlay-container-enter 400ms var(--ease-spring);
    pointer-events: auto;
    position: relative;
}

.captain-showdown-header {
    height: var(--overlay-header-height);
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: var(--border-ink-thin);
    flex-shrink: 0;
}

.captain-showdown-header h2 {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: 700;
    color: var(--color-ink-primary);
    margin: 0;
    text-align: center;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.captain-showdown-core {
    flex: 1;
    padding: clamp(12px, 3.2vw, 18px);
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    max-height: var(--overlay-core-max-height);
    overflow: hidden;
    pointer-events: none;
    /* Solo el CTA es interactivo */
}

/* =========================================================
   COMBAT ANNOUNCEMENT (Mobile-first, CPU arriba / Player abajo)
   ========================================================= */
.combat-announce {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 3vw, 16px);
}

.combat-announce-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.combat-announce-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-ui);
    font-size: clamp(0.78rem, 2.2vw, 0.95rem);
    font-weight: 800;
    letter-spacing: 0.9px;
    text-transform: uppercase;
    color: var(--color-ink-secondary);
    width: 100%;
}

.combat-announce-label-icon {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
    opacity: 0.95;
}

.combat-announce-side.cpu .combat-announce-label {
    color: var(--color-ink-faded);
}

.combat-announce-side.player .combat-announce-label {
    color: var(--color-ink-primary);
}

.combat-announce-card {
    display: grid;
    grid-template-columns: clamp(120px, 32vw, 170px) 1fr;
    gap: 0;
    /* retrato full-bleed en la columna izquierda */
    padding: 0;
    /* sin padding para el retrato */
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.55);
    border: var(--border-ink-thin);
    box-shadow:
        0 10px 22px rgba(42, 35, 40, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.combat-announce-side.cpu .combat-announce-card {
    background: rgba(255, 255, 255, 0.42);
    border-color: rgba(74, 66, 70, 0.55);
    box-shadow:
        0 8px 18px rgba(42, 35, 40, 0.14),
        0 0 0 2px rgba(244, 67, 54, 0.4),
        0 0 20px rgba(244, 67, 54, 0.3),
        0 0 40px rgba(244, 67, 54, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
    filter: saturate(0.92) contrast(0.96);
}

.combat-announce-side.player .combat-announce-card {
    border-color: rgba(212, 175, 55, 0.65);
    box-shadow:
        0 12px 26px rgba(42, 35, 40, 0.20),
        0 0 0 2px rgba(76, 175, 80, 0.4),
        0 0 20px rgba(76, 175, 80, 0.3),
        0 0 40px rgba(76, 175, 80, 0.15),
        0 0 0 1px rgba(212, 175, 55, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.combat-announce-portrait {
    width: 100%;
    height: 100%;
    min-height: 150px;
    /* asegura presencia visual en móvil */
    border-radius: 18px 0 0 18px;
    overflow: hidden;
    position: relative;
    background: rgba(0, 0, 0, 0.12);
    border-right: 1px solid rgba(74, 66, 70, 0.35);
}

.combat-announce-portrait::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.14), transparent 65%);
    pointer-events: none;
}

.combat-announce-portrait-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1.02);
}

.combat-announce-side.cpu .combat-announce-portrait-img {
    filter: saturate(0.88) contrast(0.96) brightness(0.98);
}

.combat-announce-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 12px 12px 12px;
}

.combat-announce-name {
    /* PRIMARY UI: Nombres de personajes */
    font-family: var(--font-primary-ui);
    font-size: clamp(1.05rem, 2.8vw, 1.35rem);
    font-weight: 700;
    color: var(--color-ink-primary);
    letter-spacing: 0.3px;
    line-height: 1.15;
}

.combat-announce-side.cpu .combat-announce-name {
    color: rgba(42, 35, 40, 0.78);
}

.combat-announce-ability {
    padding: 10px 10px;
    border-radius: 14px;
    background: rgba(247, 245, 230, 0.72);
    border: 1px solid rgba(74, 66, 70, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.70),
        0 6px 14px rgba(42, 35, 40, 0.10);
}

.combat-announce-side.player .combat-announce-ability {
    border-color: rgba(212, 175, 55, 0.55);
    background: rgba(247, 245, 230, 0.80);
}

.combat-announce-ability-name {
    /* PRIMARY UI: Nombres de habilidades */
    font-family: var(--font-primary-ui);
    font-size: clamp(1.05rem, 2.8vw, 1.35rem);
    font-weight: 700;
    color: var(--color-ink-primary);
    letter-spacing: 0.3px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.ability-overlay-container .overlay-title {
    /* PRIMARY UI: Títulos de overlays */
    font-family: var(--font-primary-ui);
    font-weight: 700;
}

.combat-announce-side.cpu .combat-announce-ability-name {
    color: rgba(42, 35, 40, 0.82);
}

.combat-announce-ability-desc {
    /* MAGICAL: Descripciones narrativas */
    font-family: var(--font-magical);
    font-size: clamp(0.92rem, 2.6vw, 1.05rem);
    font-weight: 500;
    color: rgba(42, 35, 40, 0.88);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    /* 1–2 líneas max */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.combat-announce-side.cpu .combat-announce-ability-desc {
    color: rgba(42, 35, 40, 0.72);
}

.combat-announce-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2px 0;
}

.combat-announce-divider-ring {
    width: 62px;
    height: 62px;
    border-radius: 999px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 20%, rgba(212, 175, 55, 0.28), transparent 55%),
        radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.65), transparent 60%),
        rgba(232, 228, 208, 0.75);
    border: 1px solid rgba(74, 66, 70, 0.35);
    box-shadow:
        0 12px 26px rgba(42, 35, 40, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.combat-announce-divider-icon {
    width: 28px;
    height: 28px;
    opacity: 0.96;
    filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.35));
}

.combat-announce-divider-text {
    /* VS dentro del círculo */
    font-family: var(--font-display);
    font-size: clamp(1.05rem, 3.5vw, 1.35rem);
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--color-accent-gold);
    text-shadow: 0 10px 18px rgba(42, 35, 40, 0.22);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

/* Estilo pergamino para las habilidades */
.ability-scroll {
    background: linear-gradient(to bottom,
            rgba(250, 245, 235, 0.95) 0%,
            rgba(245, 240, 230, 0.95) 50%,
            rgba(250, 245, 235, 0.95) 100%);
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(139, 69, 19, 0.03) 2px, rgba(139, 69, 19, 0.03) 4px),
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><defs><pattern id="paper" x="0" y="0" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="0.5" fill="rgba(139,69,19,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23paper)"/></svg>');
    padding: var(--spacing-md) var(--spacing-sm);
    border-radius: 8px;
    border: 2px solid rgba(139, 69, 19, 0.4);
    box-shadow:
        inset 0 1px 3px rgba(139, 69, 19, 0.2),
        0 2px 8px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(212, 175, 55, 0.3);
    position: relative;
    margin-top: var(--spacing-xs);
}

/* Decoración tipo pergamino - bordes superiores e inferiores */
.ability-scroll::before,
.ability-scroll::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 12px;
    background: linear-gradient(to right,
            transparent 0%,
            rgba(139, 69, 19, 0.2) 20%,
            rgba(139, 69, 19, 0.3) 50%,
            rgba(139, 69, 19, 0.2) 80%,
            transparent 100%);
    pointer-events: none;
}

.ability-scroll::before {
    top: 0;
    border-radius: 8px 8px 0 0;
}

.ability-scroll::after {
    bottom: 0;
    border-radius: 0 0 8px 8px;
}

/* Texto de la habilidad */
.ability-scroll strong {
    /* PRIMARY UI: Nombres de habilidades en scroll */
    font-family: var(--font-primary-ui);
    font-size: clamp(1.05rem, 2.8vw, 1.35rem);
    font-weight: 700;
    color: rgba(139, 69, 19, 0.9);
    text-transform: uppercase;
    display: block;
    letter-spacing: 0.3px;
    margin-bottom: 4px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.ability-scroll .trigger-info {
    /* MAGICAL: Información de trigger */
    font-family: var(--font-magical);
    font-size: clamp(0.85rem, 2.2vw, 0.95rem);
    font-weight: 500;
    font-style: italic;
    color: rgba(139, 69, 19, 0.7);
    margin-top: 2px;
}

.ability-scroll p {
    /* MAGICAL: Descripción de habilidad */
    font-family: var(--font-magical);
    font-size: clamp(0.92rem, 2.6vw, 1.05rem);
    font-weight: 500;
    color: rgba(60, 40, 20, 0.85);
    line-height: 1.5;
    margin: var(--spacing-xs) 0 0 0;
    text-align: left;
}

.vs-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 900;
    color: var(--color-accent-gold);
    padding: 0 var(--spacing-md);
    flex-shrink: 0;
}

.captain-showdown-actions {
    height: var(--overlay-actions-height);
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: var(--border-ink-thin);
    flex-shrink: 0;
    padding-bottom: max(var(--spacing-md), env(safe-area-inset-bottom));
    pointer-events: auto;
}

/* CTA principal (único elemento clicable) */
.btn-combat-cta {
    width: min(520px, 100%);
    padding: 16px 18px;
    border-radius: 14px;
    border: 2px solid rgba(212, 175, 55, 0.85);
    background:
        radial-gradient(140% 140% at 20% 0%, rgba(255, 255, 255, 0.12), transparent 55%),
        linear-gradient(180deg, rgba(42, 35, 40, 0.95) 0%, rgba(20, 15, 20, 0.98) 100%);
    color: rgba(255, 250, 235, 0.98);
    /* PRIMARY UI: Botones CTA */
    font-family: var(--font-primary-ui);
    font-size: clamp(1.0rem, 3.2vw, 1.2rem);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow:
        0 18px 40px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(212, 175, 55, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
    transform: translateY(0);
    transition: transform 120ms var(--ease-spring), filter 120ms ease, box-shadow 120ms ease;
}

.btn-combat-cta:hover,
.btn-combat-cta:focus {
    filter: brightness(1.06) saturate(1.06);
    box-shadow:
        0 22px 46px rgba(0, 0, 0, 0.38),
        0 0 26px rgba(212, 175, 55, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    outline: none;
}

.btn-combat-cta:active {
    transform: translateY(1px) scale(0.99);
    filter: brightness(0.98) saturate(1.02);
    box-shadow:
        0 12px 26px rgba(0, 0, 0, 0.34),
        0 0 18px rgba(212, 175, 55, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

@media (max-width: 768px) {
    .captain-showdown-container {
        width: 95vw;
        max-height: calc(100vh - 20px);
    }

    .combat-announce-card {
        grid-template-columns: clamp(112px, 36vw, 150px) 1fr;
    }

    .combat-announce-portrait {
        min-height: 140px;
    }

    .ability-overlay-container {
        width: 95vw;
        max-height: calc(100vh - 12px);
    }

    .ability-content-area {
        gap: clamp(8px, 2.2vw, 12px);
        padding: clamp(8px, 2.2vw, 12px);
    }

    .ability-content-area #ab-content {
        gap: clamp(8px, 2.2vw, 12px);
        padding: clamp(4px, 1.2vw, 8px) 0;
        grid-template-columns: repeat(2, 1fr) !important;
        max-width: 100%;
    }

    /* Grid compacto para stats en móvil: 3+2 (sin scroll vertical) */
    .ability-content-area #ab-content:has(.ab-stat-btn) {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: clamp(8px, 2vw, 11px);
        align-items: stretch;
    }

    /* Grid de 2 columnas para cartas en móvil */
    .ability-content-area #ab-content:has(.ab-option-card) {
        /* permitir 3 por fila si hay ancho */
        grid-template-columns: repeat(3, 1fr) !important;
        gap: clamp(8px, 2.2vw, 12px);
    }

    #ab-content.ab-content--slot {
        grid-template-columns: repeat(2, 1fr) !important;
        max-width: 100%;
    }

    /* En móvil, Mateo también usa columna */
    .ability-content-area #ab-content:has(> div[style*="flex"]) {
        display: flex !important;
        flex-direction: column !important;
        gap: clamp(12px, 3vw, 16px) !important;
    }

    /* Contenedores de cartas en móvil */
    .ability-content-area #ab-content>div[style*="flex"] {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: clamp(8px, 2vw, 10px) !important;
        justify-content: center !important;
    }

    #ab-content.ab-content--swap {
        gap: clamp(10px, 3vw, 14px) !important;
    }

    #ab-content.ab-content--swap .ab-selection-section {
        padding: clamp(8px, 2.6vw, 12px);
    }

    #ab-content.ab-content--swap .ab-selection-grid {
        gap: clamp(8px, 2.2vw, 10px);
    }

    .ab-option-card--fullcard,
    .ab-option-card--rival-slot {
        width: clamp(92px, 27vw, 118px);
        height: clamp(134px, 40vw, 172px);
        min-width: 92px;
        min-height: 134px;
    }

    .view-cards-container {
        gap: var(--spacing-sm) !important;
        padding: var(--spacing-xs) var(--spacing-sm) !important;
    }

    .view-card-item {
        /* Mobile-only: scale cards without cropping the panel. */
        --view-card-scale: 0.6;
        width: calc(300px * var(--view-card-scale)) !important;
        max-width: none !important;
    }

    .view-card-item .card-premium {
        transform: scale(var(--view-card-scale)) !important;
        transform-origin: top left !important;
    }

    .ab-option-card {
        width: clamp(92px, 18vw, 112px);
        height: clamp(124px, 26vw, 156px);
        min-width: 92px;
        min-height: 124px;
    }

    .ab-stat-btn {
        width: 100%;
        height: clamp(86px, 20vw, 108px);
        min-width: 0;
        min-height: clamp(86px, 20vw, 108px);
        border-radius: 10px;
    }

    .ab-stat-btn-value {
        font-size: clamp(0.96rem, 2.7vw, 1.18rem);
        padding: clamp(3px, 0.9vw, 6px) clamp(6px, 1.6vw, 9px);
        min-width: clamp(30px, 7vw, 38px);
        bottom: clamp(4px, 1vw, 7px);
        right: clamp(4px, 1vw, 7px);
    }

    /* Mejorar touch targets en móvil */
    .ab-stat-btn,
    .ab-option-card {
        min-height: 44px;
        min-width: 44px;
    }

    /* Header mejorado en móvil */
    .ability-overlay-container .overlay-header {
        padding: clamp(10px, 2.5vw, 16px);
    }

    .ability-overlay-container .overlay-title {
        font-size: clamp(1.1rem, 3vw, 1.3rem);
    }

    #ab-context {
        padding: clamp(6px, 1.5vw, 10px);
        gap: clamp(6px, 1.5vw, 10px);
    }

    #ab-context-portrait {
        width: clamp(36px, 9vw, 50px);
        height: clamp(36px, 9vw, 50px);
    }

    /* Instrucciones mejoradas en móvil */
    .ability-instruction {
        font-size: clamp(0.86rem, 2.2vw, 0.98rem);
        padding: clamp(5px, 1.2vw, 8px);
        max-height: 4.2em;
        -webkit-line-clamp: 2;
        line-clamp: 2;
    }

    /* Combat details mobile */
    .calc-total {
        font-size: clamp(2rem, 5vw, 3rem) !important;
    }

    .calc-section {
        gap: 3px;
    }

    .calc-section-label {
        font-size: 0.65rem;
    }

    .calc-tag {
        padding: 3px 6px;
        font-size: 0.7rem;
        max-width: 160px;
    }

    .calc-source {
        font-size: 0.65rem;
    }

    .calc-value {
        font-size: 0.75rem;
    }

    .combat-stat-box {
        width: 35%;
    }

    .vs-center-box {
        width: 15%;
    }

    .combat-attr-icon-large {
        width: 50px;
        height: 50px;
    }

    .inspect-nav-btn {
        width: 46px;
        height: 46px;
        font-size: 1.4rem;
    }

    .inspect-nav-btn--prev {
        left: 6px;
    }

    .inspect-nav-btn--next {
        right: 6px;
    }
}

/* ==========================================
   TABLET & DESKTOP - Aprovechar mejor el espacio
   ========================================== */

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {

    /* Arena más grande */
    .battle-arena {
        max-width: 800px;
    }

    /* Slots más grandes */
    .card-slot {
        width: 110px;
        height: 154px;
    }

    /* Cartas en slots más grandes (se escalan dentro del slot) */
    .card-slot .card-premium {
        width: 100%;
        height: 100%;
    }

    /* Hand cards más grandes - tablet (ya definido arriba con clamp) */

    /* Combat panel más grande */
    .combat-panel-premium {
        max-width: 1000px;
    }

    /* Overlays más grandes */
    .game-overlay-container,
    .captain-showdown-container,
    .ability-overlay-container {
        max-width: 600px;
    }

    /* HUD más grande */
    .hud-bar {
        padding: var(--spacing-md);
    }

    .resource-pill {
        font-size: 1.2rem;
        padding: 8px 16px;
    }

    /* Combat stats más grandes */
    .calc-total {
        font-size: 3.5rem !important;
    }

    .calc-tag {
        max-width: 250px;
        padding: 6px 10px;
        font-size: 0.9rem;
    }

    .combat-stat-box {
        width: 30%;
    }

    .combat-attr-icon-large {
        width: 70px;
        height: 70px;
    }

    /* Hand container más grande en tablet - ya definido arriba */

    /* HandDock tablet */
    .hand-dock-content {
        max-width: 750px;
        height: 180px;
    }

    .hand-dock-content .card-mini {
        width: 110px;
        height: 154px;
        margin-left: -40px;
    }

    .hand-dock-content .card-mini:first-child {
        margin-left: 0;
    }

    .hand-dock-tab {
        width: 70px;
        height: 50px;
    }

    /* Pos labels más grandes */
    .pos-label-vertical {
        font-size: 0.8rem;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {

    /* Arena mucho más grande */
    .battle-arena {
        max-width: 1200px;
    }

    /* Slots mucho más grandes */
    .card-slot {
        width: 140px;
        height: 196px;
    }

    /* Cartas en slots mucho más grandes (se escalan dentro del slot) */
    .card-slot .card-premium {
        width: 100%;
        height: 100%;
    }

    /* Hand container más grande en desktop - ya definido arriba */

    /* HandDock más grande en desktop */
    .hand-dock-content {
        max-width: 900px;
        height: 220px;
        padding: var(--spacing-lg) var(--spacing-lg) var(--spacing-xl);
    }

    .hand-dock-content .card-mini {
        width: 130px;
        height: 182px;
        margin-left: -50px;
    }

    .hand-dock-content .card-mini:first-child {
        margin-left: 0;
    }

    .hand--focus .hand-dock-content {
        height: 240px;
    }

    .hand-dock-tab {
        width: 80px;
        height: 60px;
    }

    .hand-tab-icon {
        font-size: 1.5rem;
    }

    .hand-tab-count {
        font-size: 0.9rem;
    }

    /* Hand cards mucho más grandes - desktop */
    .hand-container {
        max-height: 22vh;
    }

    .hand-card {
        width: clamp(120px, 8vw, 160px);
        height: clamp(168px, 11.2vw, 224px);
    }

    .hand-cards {
        gap: clamp(16px, 2.5vw, 24px);
        padding: clamp(16px, 3vw, 24px);
    }

    /* Hand container más espaciado */
    .hand-container {
        gap: var(--spacing-md);
        padding: var(--spacing-md);
    }

    /* Combat panel mucho más grande */
    .combat-panel-premium {
        max-width: 1400px;
        max-height: calc(100vh - 60px);
    }

    /* Overlays más grandes */
    .game-overlay-container,
    .captain-showdown-container,
    .ability-overlay-container {
        max-width: 900px;
    }

    /* VS Overlay específico */
    .captain-showdown-container {
        max-width: 1000px;
    }

    .showdown-img {
        max-width: 180px;
    }

    .vs-divider {
        font-size: 3rem;
    }

    /* HUD más grande */
    .hud-bar {
        padding: var(--spacing-lg);
    }

    .resource-pill {
        font-size: 1.4rem;
        padding: 10px 20px;
    }

    #round-display {
        font-size: 2rem;
    }

    /* Combat stats mucho más grandes */
    .calc-total {
        font-size: 5rem !important;
    }

    .calc-tag {
        max-width: 300px;
        padding: 8px 12px;
        font-size: 1rem;
    }

    .calc-section-label {
        font-size: 0.9rem;
    }

    .combat-stat-box {
        width: 30%;
    }

    .combat-attr-icon-large {
        width: 100px;
        height: 100px;
    }

    /* Ability overlay cards más grandes */
    .ab-option-card {
        width: 160px;
        height: 224px;
    }

    .ab-stat-btn {
        width: 140px;
        height: 140px;
    }

    .ab-stat-btn-value {
        font-size: 1.6rem;
        padding: 8px 12px;
        min-width: 48px;
    }

    /* View cards más grandes */
    .view-card-item {
        width: 180px;
    }

    .view-card-item .card-premium {
        transform: scale(0.8) !important;
    }

    /* Hand component más espaciado */
    .hand-container {
        gap: var(--spacing-md);
        padding: var(--spacing-md);
    }

    /* Lineup rows más espaciadas */
    .lineup-row {
        gap: var(--spacing-md);
        padding: var(--spacing-md);
    }

    .slot-wrapper {
        gap: var(--spacing-sm);
    }

}

/* =========================================
   ARCANE UI NETWORK (ABILITY SELECTION)
   ========================================= */

.arcane-network-container {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0 auto;
    display: block;
    isolation: isolate;
    padding: clamp(14px, 2vw, 26px);
}

/* Background Circle */
.arcane-circle-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(88%, 540px);
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background-image:
        radial-gradient(circle at 50% 50%, rgba(226, 208, 157, 0.46) 0%, rgba(226, 208, 157, 0.06) 48%, rgba(226, 208, 157, 0) 78%),
        conic-gradient(from 0deg, rgba(208, 228, 255, 0.12), rgba(129, 191, 255, 0.04), rgba(249, 230, 176, 0.16), rgba(208, 228, 255, 0.12));
    background-size: cover, cover;
    background-repeat: no-repeat, no-repeat;
    background-position: center, center;
    border: 1px solid rgba(214, 228, 255, 0.24);
    box-shadow:
        0 26px 56px rgba(8, 11, 28, 0.42),
        0 0 36px rgba(123, 192, 255, 0.16),
        inset 0 0 44px rgba(250, 230, 173, 0.24);
    z-index: 0;
    pointer-events: none;
    opacity: 0.92;
    animation: arcane-circle-breathe 9s ease-in-out infinite;
}

@keyframes arcane-circle-breathe {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(0.98);
        opacity: 0.88;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.015);
        opacity: 1;
    }
}

/* Stat selector: conservar fondo interno para profundidad */
#stat-selector .arcane-circle-bg,
#stat-selector .arcane-particles {
    display: block !important;
}

/* Línea base “ruta de runa” (estática), debajo del flujo mágico */
.arcane-line-base {
    fill: none;
    stroke: rgba(196, 219, 255, 0.44);
    stroke-width: 2.3;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.9;
    filter: drop-shadow(0 0 8px rgba(123, 192, 255, 0.2));
    stroke-dasharray: none;
}

/* Soft particles / atmospheric magic */
.arcane-particles {
    position: absolute;
    inset: 5%;
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
    background-image:
        url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"180\" height=\"180\"><filter id=\"n\"><feTurbulence type=\"fractalNoise\" baseFrequency=\"0.65\" numOctaves=\"2\" stitchTiles=\"stitch\"/></filter><rect width=\"180\" height=\"180\" filter=\"url(%23n)\" opacity=\"0.28\"/></svg>'),
        radial-gradient(circle at 30% 20%, rgba(136, 198, 255, 0.22) 0%, rgba(136, 198, 255, 0) 44%),
        radial-gradient(circle at 74% 74%, rgba(248, 227, 170, 0.2) 0%, rgba(248, 227, 170, 0) 46%);
    background-size: 220px 220px, cover, cover;
    background-position: center, center, center;
    opacity: 0.5;
    mix-blend-mode: screen;
    animation: arcane-particles-drift 15s ease-in-out infinite;
}

@keyframes arcane-particles-drift {

    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    50% {
        transform: translate(-50%, -50%) rotate(2.2deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
}

/* Connection Lines (SVG) */
.arcane-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    opacity: 0.95;
}

.arcane-line {
    fill: none;
    stroke: rgba(248, 231, 181, 0.96);
    stroke-width: 2.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter:
        drop-shadow(0 0 8px rgba(249, 227, 171, 0.46)) drop-shadow(0 0 16px rgba(125, 193, 255, 0.24));
    opacity: 0.94;
    stroke-dasharray: 8 12;
    stroke-dashoffset: 0;
}

.arcane-line.phase-a {
    animation:
        arcane-line-pulse-a 2.4s ease-in-out infinite,
        arcane-line-flow 9s linear infinite;
}

.arcane-line.phase-b {
    animation:
        arcane-line-pulse-b 2.4s ease-in-out infinite,
        arcane-line-flow-reverse 10.4s linear infinite;
    animation-delay: 250ms, 0ms;
}

.arcane-line.arcane-ring {
    opacity: 0.28;
    stroke-width: 1.3;
    stroke-dasharray: 3 9;
    animation: arcane-ring-breathe 4.8s ease-in-out infinite;
}

@keyframes arcane-line-pulse-a {

    0%,
    100% {
        opacity: 0.42;
    }

    50% {
        opacity: 0.92;
    }
}

@keyframes arcane-line-pulse-b {

    0%,
    100% {
        opacity: 0.35;
    }

    50% {
        opacity: 0.74;
    }
}

@keyframes arcane-line-flow {
    from {
        stroke-dashoffset: 0;
    }

    to {
        stroke-dashoffset: -210;
    }
}

@keyframes arcane-line-flow-reverse {
    from {
        stroke-dashoffset: -210;
    }

    to {
        stroke-dashoffset: 0;
    }
}

@keyframes arcane-ring-breathe {

    0%,
    100% {
        opacity: 0.14;
    }

    50% {
        opacity: 0.34;
    }
}

.arcane-spark {
    fill: rgba(255, 250, 235, 0.92);
    opacity: 0.0;
    filter: drop-shadow(0 0 4px rgba(251, 225, 153, 0.42));
    animation: arcane-spark-twinkle 3.2s ease-in-out infinite;
}

.arcane-spark.s1 {
    animation-delay: 0ms;
}

.arcane-spark.s2 {
    animation-delay: 350ms;
}

.arcane-spark.s3 {
    animation-delay: 700ms;
}

.arcane-spark.s4 {
    animation-delay: 1050ms;
}

.arcane-spark.s5 {
    animation-delay: 1400ms;
}

.arcane-spark.s6 {
    animation-delay: 1750ms;
}

@keyframes arcane-spark-twinkle {

    0%,
    100% {
        opacity: 0;
        transform: scale(0.88);
    }

    45% {
        opacity: 0.0;
        transform: scale(0.9);
    }

    55% {
        opacity: 0.95;
        transform: scale(1.18);
    }

    65% {
        opacity: 0.2;
        transform: scale(1.0);
    }
}

/* Node Base Style */
.arcane-node {
    --node-accent: 248, 225, 170;
    position: absolute;
    width: clamp(104px, 9.6vw, 132px);
    height: clamp(148px, 12.8vw, 176px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    z-index: 10;
    transition: filter 220ms ease;
    filter: drop-shadow(0 14px 24px rgba(7, 9, 24, 0.35));
    -webkit-tap-highlight-color: transparent;
}

.arcane-node::before {
    content: '';
    position: absolute;
    top: -18px;
    left: -18px;
    right: -18px;
    bottom: -18px;
    border-radius: 24px;
}

#btn-select-Magia.arcane-node {
    --node-accent: 121, 192, 255;
}

#btn-select-Habilidad.arcane-node {
    --node-accent: 255, 171, 114;
}

#btn-select-Valor.arcane-node {
    --node-accent: 255, 113, 130;
}

#btn-select-Astucia.arcane-node {
    --node-accent: 178, 140, 255;
}

#btn-select-Intel.arcane-node {
    --node-accent: 124, 226, 198;
}

.arcane-node.active {
    z-index: 20;
    filter: drop-shadow(0 18px 34px rgba(7, 9, 24, 0.5));
}

/* Node Visuals */
.node-visual {
    position: relative;
    width: clamp(82px, 8vw, 104px);
    height: clamp(82px, 8vw, 104px);
    border-radius: 50%;
    background:
        radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.38) 0%, rgba(255, 255, 255, 0) 46%),
        radial-gradient(circle at 50% 64%, rgba(var(--node-accent), 0.34) 0%, rgba(39, 30, 81, 0.95) 69%),
        linear-gradient(145deg, rgba(28, 35, 88, 0.94), rgba(11, 16, 45, 0.97));
    border: 1px solid rgba(221, 232, 252, 0.36);
    box-shadow:
        0 12px 26px rgba(8, 11, 31, 0.46),
        0 0 22px rgba(var(--node-accent), 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -12px 24px rgba(0, 0, 0, 0.34);
    transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0;
    overflow: hidden;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.node-visual::before {
    content: '';
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    border: 1px solid rgba(230, 239, 255, 0.26);
    pointer-events: none;
    z-index: 1;
}

.node-visual::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1px solid rgba(var(--node-accent), 0.42);
    pointer-events: none;
    opacity: 0.5;
    animation: node-halo-spin 9s linear infinite;
}

@keyframes node-halo-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Asset Placeholder Icon */
.node-icon {
    position: relative;
    z-index: 2;
    width: 78%;
    height: 78%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-image: url('assets/placeholder.avif');
    opacity: 0.95;
    filter: saturate(1.05) brightness(1.02) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.34));
    border-radius: 50%;
}

.arcane-node:hover .node-visual,
.arcane-node:focus-visible .node-visual {
    transform: translateY(-4px) scale(1.04);
    border-color: rgba(var(--node-accent), 0.8);
    box-shadow:
        0 16px 28px rgba(8, 11, 31, 0.56),
        0 0 32px rgba(var(--node-accent), 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -12px 24px rgba(0, 0, 0, 0.36);
}

.arcane-node:active .node-visual {
    transform: scale(0.96);
}

.arcane-node.active .node-visual {
    border-color: rgba(var(--node-accent), 0.92);
    box-shadow:
        0 22px 36px rgba(8, 11, 31, 0.62),
        0 0 42px rgba(var(--node-accent), 0.46),
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        inset 0 0 24px rgba(var(--node-accent), 0.22);
    transform: translateY(-5px) scale(1.08);
    animation: node-selected-pulse 2.3s ease-in-out infinite;
}

@keyframes node-selected-pulse {

    0%,
    100% {
        box-shadow:
            0 20px 34px rgba(8, 11, 31, 0.58),
            0 0 36px rgba(var(--node-accent), 0.42),
            inset 0 1px 0 rgba(255, 255, 255, 0.5),
            inset 0 0 24px rgba(var(--node-accent), 0.2);
    }

    50% {
        box-shadow:
            0 24px 38px rgba(8, 11, 31, 0.68),
            0 0 48px rgba(var(--node-accent), 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.6),
            inset 0 0 28px rgba(var(--node-accent), 0.26);
    }
}

.arcane-node.active .node-icon {
    opacity: 1;
    filter: saturate(1.15) brightness(1.16) drop-shadow(0 6px 12px rgba(0, 0, 0, 0.42));
}

.arcane-node.active .node-visual::after {
    opacity: 0.9;
}

/* Node Glow Animation */
.node-glow {
    position: absolute;
    top: -30%;
    left: -30%;
    width: 160%;
    height: 160%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--node-accent), 0.52) 0%, rgba(var(--node-accent), 0) 68%);
    opacity: 0.32;
    pointer-events: none;
    transition: opacity 220ms ease, transform 220ms ease;
    filter: blur(8px);
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.arcane-node:hover .node-glow,
.arcane-node:focus-visible .node-glow {
    opacity: 0.56;
    transform: scale(1.04);
}

.arcane-node.active .node-glow {
    opacity: 0.92;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0% {
        transform: scale(1);
        opacity: 0.72;
    }

    50% {
        transform: scale(1.22);
        opacity: 0.28;
    }

    100% {
        transform: scale(1);
        opacity: 0.72;
    }
}

/* Node Label & Value */
.node-label {
    display: block;
    font-family: var(--font-primary-ui);
    font-size: clamp(0.72rem, 1.45vw, 0.9rem);
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: rgba(235, 242, 255, 0.94);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    margin-top: 2px;
    text-align: center;
    width: 100%;
}

.node-value {
    font-family: var(--font-numeric);
    font-size: clamp(1.04rem, 2.2vw, 1.25rem);
    font-weight: 700;
    color: rgba(255, 248, 230, 0.98);
    opacity: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    background: linear-gradient(160deg, rgba(11, 15, 37, 0.96) 0%, rgba(var(--node-accent), 0.32) 100%);
    border: 1px solid rgba(223, 235, 255, 0.4);
    border-radius: 999px;
    padding: 2px 12px;
    box-shadow:
        0 10px 16px rgba(8, 11, 31, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.32);
    margin-top: -14px;
    z-index: 15;
    min-width: 44px;
    text-align: center;
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.node-value[data-mod-tone="neutral"] {
    color: rgba(255, 248, 230, 0.98);
}

.node-value[data-mod-tone="buff"] {
    color: rgba(161, 255, 210, 0.98);
    border-color: rgba(130, 235, 196, 0.66);
    box-shadow:
        0 10px 18px rgba(8, 11, 31, 0.55),
        0 0 16px rgba(130, 235, 196, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.node-value[data-mod-tone="debuff"] {
    color: rgba(255, 177, 188, 1);
    border-color: rgba(255, 150, 164, 0.74);
    box-shadow:
        0 10px 18px rgba(8, 11, 31, 0.55),
        0 0 16px rgba(255, 150, 164, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.arcane-node:hover .node-value,
.arcane-node:focus-visible .node-value {
    transform: translateY(-2px);
}

.arcane-node.active .node-value {
    color: rgba(255, 255, 255, 1);
    text-shadow: 0 0 16px rgba(var(--node-accent), 0.34);
    border-color: rgba(var(--node-accent), 0.84);
    box-shadow:
        0 12px 22px rgba(8, 11, 31, 0.55),
        0 0 24px rgba(var(--node-accent), 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.42);
    transform: scale(1.12);
}

/* Specific Positions (To be applied via JS classes) */
.node-center {
    top: 52%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.node-center .node-visual {
    width: clamp(95px, 9.2vw, 118px);
    height: clamp(95px, 9.2vw, 118px);
    border-width: 2px;
}

.node-center .node-icon {
    width: 80%;
    height: 80%;
}

.node-center.arcane-node {
    width: clamp(116px, 11vw, 146px);
    height: clamp(166px, 14vw, 194px);
}

.node-center .node-value {
    font-size: clamp(1.2rem, 2.5vw, 1.46rem);
}

.node-center .node-visual::before {
    border-color: rgba(248, 229, 173, 0.5);
}

.node-center .node-visual::after {
    border-width: 2px;
    opacity: 0.82;
    animation-duration: 6.4s;
}

.node-center.arcane-node.active .node-visual {
    box-shadow:
        0 24px 40px rgba(8, 11, 31, 0.72),
        0 0 54px rgba(var(--node-accent), 0.58),
        0 0 36px rgba(248, 229, 173, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.56),
        inset 0 0 26px rgba(var(--node-accent), 0.26);
}

.node-center .node-label {
    font-size: clamp(0.78rem, 1.6vw, 0.95rem);
}

.node-top-left {
    top: 24%;
    left: 31.5%;
    transform: translate(-50%, -50%);
}

.node-top-right {
    top: 24%;
    left: 68.5%;
    transform: translate(-50%, -50%);
}

.node-bottom-left {
    top: 80%;
    left: 31.5%;
    transform: translate(-50%, -50%);
}

.node-bottom-right {
    top: 80%;
    left: 68.5%;
    transform: translate(-50%, -50%);
}

@media (min-width: 769px) {
    .arcane-node {
        width: clamp(112px, 9vw, 132px);
        height: clamp(152px, 12vw, 176px);
    }

    .node-visual {
        width: clamp(90px, 7vw, 104px);
        height: clamp(90px, 7vw, 104px);
    }

    .node-icon {
        width: 78%;
        height: 78%;
    }

    .node-center.arcane-node {
        width: clamp(120px, 10vw, 146px);
        height: clamp(170px, 13vw, 194px);
    }

    .node-center .node-visual {
        width: clamp(100px, 8vw, 118px);
        height: clamp(100px, 8vw, 118px);
    }

    .node-center .node-icon {
        width: 80%;
        height: 80%;
    }
}

@media (max-width: 768px) {
    .arcane-network-container {
        padding: clamp(8px, 3vw, 14px);
    }

    .arcane-circle-bg {
        width: min(90%, 430px);
    }

    .arcane-node {
        width: clamp(88px, 22vw, 112px);
        height: clamp(130px, 28vw, 154px);
        gap: 4px;
    }

    .node-visual {
        width: clamp(72px, 19vw, 90px);
        height: clamp(72px, 19vw, 90px);
    }

    .node-label {
        font-size: clamp(0.64rem, 2.8vw, 0.78rem);
        letter-spacing: 0.06em;
    }

    .node-value {
        font-size: clamp(0.96rem, 3.5vw, 1.15rem);
        padding: 2px 10px;
        margin-top: -12px;
    }

    .node-center.arcane-node {
        width: clamp(100px, 24vw, 126px);
        height: clamp(148px, 34vw, 174px);
    }

    .node-center .node-visual {
        width: clamp(82px, 20vw, 100px);
        height: clamp(82px, 20vw, 100px);
    }

    .node-top-left {
        top: 23%;
        left: 31%;
    }

    .node-top-right {
        top: 23%;
        left: 69%;
    }

    .node-bottom-left {
        top: 80.5%;
        left: 31%;
    }

    .node-bottom-right {
        top: 80.5%;
        left: 69%;
    }
}

@media (prefers-reduced-motion: reduce) {

    .stat-selector-grid::after,
    #stat-selector .arcane-network-container::after,
    .arcane-circle-bg,
    .arcane-particles,
    .arcane-line,
    .arcane-line.phase-a,
    .arcane-line.phase-b,
    .arcane-spark,
    .arcane-node.active .node-visual,
    .arcane-node.active .node-glow,
    .node-visual::after {
        animation: none !important;
    }
}

/* Temporary/Fallback Icons until assets generated */
#btn-select-Magia .node-icon {
    background-image: url('assets/stat_magic_v1.avif');
}

#btn-select-Habilidad .node-icon {
    background-image: url('assets/stat_duel_v1.avif');
}

#btn-select-Intel .node-icon {
    background-image: url('assets/stat_intel_v1.avif');
}

#btn-select-Valor .node-icon {
    background-image: url('assets/stat_valor_v1.avif');
}

#btn-select-Astucia .node-icon {
    background-image: url('assets/stat_cunning_v1.avif');
}

/* =========================================
   STAT SELECTOR CONSTELLATION UPGRADE
   ========================================= */

#stat-selector .stat-selector-header {
    position: relative;
    margin-bottom: clamp(14px, 2.8vw, 24px);
    padding-inline: clamp(8px, 2vw, 18px);
}

#stat-selector .stat-selector-character-name {
    color: rgba(245, 240, 219, 0.98);
    text-shadow:
        0 8px 18px rgba(0, 0, 0, 0.48),
        0 0 24px rgba(151, 205, 255, 0.25),
        0 0 36px rgba(249, 228, 161, 0.2);
}

#stat-selector .stat-selector-subtitle {
    color: rgba(230, 241, 255, 0.94);
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

#stat-selector .stat-selector-grid {
    --constellation-cyan: 126, 204, 255;
    --constellation-gold: 248, 227, 165;
    --constellation-violet: 193, 149, 255;
    border-color: rgba(194, 223, 255, 0.38);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.26),
        inset 0 -46px 82px rgba(5, 8, 22, 0.5),
        0 32px 72px rgba(11, 16, 39, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.08);
}

#stat-selector .stat-selector-grid.arcane-network-container {
    background-image:
        linear-gradient(158deg, rgba(10, 18, 48, 0.94) 0%, rgba(20, 24, 64, 0.95) 52%, rgba(8, 13, 36, 0.96) 100%),
        radial-gradient(circle at 18% 24%, rgba(126, 204, 255, 0.2) 0%, rgba(126, 204, 255, 0) 40%),
        radial-gradient(circle at 84% 76%, rgba(193, 149, 255, 0.18) 0%, rgba(193, 149, 255, 0) 44%),
        url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"240\" height=\"240\"><filter id=\"n\"><feTurbulence type=\"fractalNoise\" baseFrequency=\"0.85\" numOctaves=\"2\"/></filter><rect width=\"240\" height=\"240\" opacity=\"0.12\" filter=\"url(%23n)\"/></svg>');
    background-size: cover, cover, cover, 260px 260px;
    background-position: center, center, center, center;
    background-repeat: no-repeat, no-repeat, no-repeat, repeat;
}

#stat-selector .stat-selector-grid::before {
    width: min(84%, 660px);
    border-color: rgba(229, 242, 255, 0.2);
    box-shadow:
        inset 0 0 52px rgba(237, 220, 166, 0.16),
        0 0 42px rgba(137, 200, 255, 0.2);
}

#stat-selector .stat-selector-grid::after {
    opacity: 0.14;
    background:
        conic-gradient(from 0deg,
            rgba(126, 204, 255, 0.2),
            rgba(193, 149, 255, 0.14),
            rgba(248, 227, 165, 0.26),
            rgba(126, 204, 255, 0.2));
    animation-duration: 18s;
}

#stat-selector .arcane-network-container {
    overflow: hidden;
}

#stat-selector .arcane-network-container::before {
    width: min(74%, 560px);
    border-color: rgba(232, 243, 255, 0.22);
    background:
        radial-gradient(circle, rgba(248, 227, 165, 0.15) 0%, rgba(248, 227, 165, 0) 62%),
        radial-gradient(circle at 50% 50%, rgba(126, 204, 255, 0.14) 0%, rgba(126, 204, 255, 0) 74%);
    box-shadow:
        inset 0 0 38px rgba(126, 204, 255, 0.13),
        0 0 18px rgba(248, 227, 165, 0.14);
}

#stat-selector .arcane-network-container::after {
    width: min(82%, 620px);
    border-color: rgba(242, 233, 204, 0.24);
    opacity: 0.44;
    animation-duration: 20s;
}

#stat-selector .arcane-particles {
    top: 50%;
    left: 50%;
    inset: auto;
    width: min(74%, 560px);
    height: auto;
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    opacity: 0.42;
    animation-duration: 14s;
}

#stat-selector .arcane-particles::before,
#stat-selector .arcane-particles::after {
    content: '';
    position: absolute;
    inset: -4%;
    border-radius: 50%;
    pointer-events: none;
}

#stat-selector .arcane-particles::before {
    background-image:
        radial-gradient(2px 2px at 14% 18%, rgba(212, 235, 255, 0.7), transparent 62%),
        radial-gradient(1.8px 1.8px at 72% 22%, rgba(248, 227, 165, 0.78), transparent 62%),
        radial-gradient(1.6px 1.6px at 82% 66%, rgba(172, 214, 255, 0.76), transparent 62%),
        radial-gradient(2px 2px at 28% 78%, rgba(248, 227, 165, 0.72), transparent 62%),
        radial-gradient(1.4px 1.4px at 48% 12%, rgba(212, 235, 255, 0.6), transparent 62%),
        radial-gradient(1.8px 1.8px at 60% 50%, rgba(188, 167, 255, 0.72), transparent 62%),
        radial-gradient(1.6px 1.6px at 36% 40%, rgba(248, 227, 165, 0.64), transparent 62%);
    opacity: 0.38;
    animation: constellation-star-drift 24s linear infinite;
}

#stat-selector .arcane-particles::after {
    background-image:
        radial-gradient(2.2px 2.2px at 22% 34%, rgba(255, 255, 255, 0.85), transparent 62%),
        radial-gradient(2px 2px at 76% 42%, rgba(255, 248, 230, 0.82), transparent 62%),
        radial-gradient(2px 2px at 42% 72%, rgba(225, 242, 255, 0.86), transparent 62%),
        radial-gradient(1.8px 1.8px at 58% 86%, rgba(248, 227, 165, 0.76), transparent 62%);
    opacity: 0.28;
    filter: drop-shadow(0 0 8px rgba(214, 237, 255, 0.36));
    animation: constellation-star-twinkle 6.6s ease-in-out infinite;
}

#stat-selector .arcane-connections {
    z-index: 4;
}

#stat-selector .arcane-line-base {
    stroke: rgba(188, 220, 255, 0.4);
    stroke-width: 2.2;
    opacity: 0.9;
    transition: stroke 220ms ease, opacity 220ms ease, filter 220ms ease;
}

#stat-selector .arcane-line {
    stroke: rgba(248, 229, 173, 0.94);
    stroke-width: 3;
    stroke-dasharray: none;
    opacity: 0.74;
    animation: none;
    transition: stroke 220ms ease, opacity 220ms ease, filter 220ms ease;
}

#stat-selector .arcane-link-habilidad {
    --link-accent: 255, 174, 118;
}

#stat-selector .arcane-link-valor {
    --link-accent: 255, 127, 144;
}

#stat-selector .arcane-link-astucia {
    --link-accent: 178, 140, 255;
}

#stat-selector .arcane-link-intel {
    --link-accent: 124, 226, 198;
}

#stat-selector .arcane-link-habilidad.arcane-line,
#stat-selector .arcane-link-valor.arcane-line,
#stat-selector .arcane-link-astucia.arcane-line,
#stat-selector .arcane-link-intel.arcane-line {
    stroke: rgba(var(--link-accent), 0.9);
    filter:
        drop-shadow(0 0 10px rgba(var(--link-accent), 0.36)) drop-shadow(0 0 16px rgba(138, 204, 255, 0.22));
}

#stat-selector .arcane-link-habilidad.arcane-line-base,
#stat-selector .arcane-link-valor.arcane-line-base,
#stat-selector .arcane-link-astucia.arcane-line-base,
#stat-selector .arcane-link-intel.arcane-line-base {
    stroke: rgba(var(--link-accent), 0.35);
}

#stat-selector .arcane-network-container:has(#btn-select-Habilidad.active) .arcane-link-habilidad,
#stat-selector .arcane-network-container:has(#btn-select-Valor.active) .arcane-link-valor,
#stat-selector .arcane-network-container:has(#btn-select-Astucia.active) .arcane-link-astucia,
#stat-selector .arcane-network-container:has(#btn-select-Intel.active) .arcane-link-intel {
    opacity: 1;
    filter:
        drop-shadow(0 0 14px rgba(248, 227, 165, 0.28)) drop-shadow(0 0 18px rgba(126, 204, 255, 0.22));
}

#stat-selector .arcane-network-container:has(#btn-select-Habilidad.active) .arcane-link-habilidad.arcane-line,
#stat-selector .arcane-network-container:has(#btn-select-Valor.active) .arcane-link-valor.arcane-line,
#stat-selector .arcane-network-container:has(#btn-select-Astucia.active) .arcane-link-astucia.arcane-line,
#stat-selector .arcane-network-container:has(#btn-select-Intel.active) .arcane-link-intel.arcane-line {
    stroke-width: 3.6;
    stroke-dasharray: none;
    animation: arcane-line-pulse-selected 1.45s ease-in-out infinite;
}

#stat-selector .arcane-node {
    z-index: 12;
}

#stat-selector .arcane-line.phase-a,
#stat-selector .arcane-line.phase-b,
#stat-selector .arcane-line.arcane-ring {
    animation: none;
}

#stat-selector #btn-select-Habilidad {
    --node-enter-delay: 220ms;
}

#stat-selector #btn-select-Valor {
    --node-enter-delay: 320ms;
}

#stat-selector #btn-select-Magia {
    --node-enter-delay: 140ms;
}

#stat-selector #btn-select-Astucia {
    --node-enter-delay: 420ms;
}

#stat-selector #btn-select-Intel {
    --node-enter-delay: 520ms;
}

#stat-selector:not(.hidden) .arcane-node .node-visual {
    opacity: 0;
    transform: translateY(16px) scale(0.88);
    animation: constellation-node-appear 560ms var(--ease-spring) forwards;
    animation-delay: var(--node-enter-delay, 0ms);
}

#stat-selector:not(.hidden) .arcane-node .node-label {
    opacity: 0;
    transform: translateY(8px);
    animation: constellation-label-appear 460ms ease forwards;
    animation-delay: calc(var(--node-enter-delay, 0ms) + 80ms);
}

#stat-selector:not(.hidden) .arcane-node .node-value {
    opacity: 0;
    transform: translateY(8px) scale(0.88);
    animation: constellation-value-appear 500ms var(--ease-spring) forwards;
    animation-delay: calc(var(--node-enter-delay, 0ms) + 140ms);
}

#stat-selector .node-label {
    width: auto;
    margin-top: 3px;
    padding: 2px 10px;
    border-radius: 999px;
    background: linear-gradient(150deg, rgba(11, 18, 42, 0.9) 0%, rgba(27, 33, 80, 0.74) 100%);
    border: 1px solid rgba(206, 226, 255, 0.26);
    box-shadow: 0 8px 14px rgba(6, 9, 24, 0.36);
    color: rgba(235, 244, 255, 0.96);
}

#stat-selector .node-value {
    letter-spacing: 0.01em;
    font-weight: 800;
    min-width: 52px;
    margin-top: -12px;
}

#stat-selector .node-center .node-value {
    min-width: 58px;
}

#stat-selector .arcane-node.active .node-value {
    text-shadow:
        0 0 14px rgba(var(--node-accent), 0.42),
        0 1px 4px rgba(0, 0, 0, 0.4);
}

#stat-selector .arcane-node.active .node-visual::after {
    animation-duration: 4.4s;
}

#stat-selector .node-center.arcane-node.active .node-visual {
    animation: node-selected-pulse 1.85s ease-in-out infinite;
}

#stat-selector:not(.hidden) .stat-selector-panel {
    animation: stat-selector-panel-enter 500ms var(--ease-spring);
}

#stat-selector:not(.hidden) .stat-selector-grid.arcane-network-container {
    animation: none;
}

#stat-selector.stat-selector-impacting .stat-selector-grid.arcane-network-container {
    animation: none;
}

#stat-selector.stat-selector-impacting .stat-selector-grid::after {
    animation: stat-selector-shell-flash 620ms ease-out;
}

#stat-selector.stat-selector-impacting .arcane-connections {
    filter:
        drop-shadow(0 0 14px rgba(248, 227, 165, 0.26)) drop-shadow(0 0 18px rgba(126, 204, 255, 0.2));
}

#stat-selector:not(.hidden) .arcane-node.active .node-label {
    animation: stat-node-label-shine 2.8s ease-in-out infinite;
}

#stat-selector .arcane-network-container.constellation-impact::before {
    animation: constellation-impact-aura 760ms ease-out;
}

#stat-selector .arcane-network-container.constellation-impact::after {
    animation: constellation-impact-ring 760ms ease-out;
}

#stat-selector .arcane-node.impact-burst {
    z-index: 26;
    animation: stat-node-card-collapse 760ms cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

#stat-selector .arcane-node.impact-burst .node-visual {
    animation: stat-node-impact-burst 760ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

#stat-selector .arcane-node.impact-burst .node-visual::after {
    animation: stat-node-magic-halo 760ms ease-out;
}

#stat-selector .arcane-node.impact-burst .node-glow {
    animation: stat-node-impact-glow 760ms ease-out;
}

#stat-selector .arcane-node.impact-burst .node-label,
#stat-selector .arcane-node.impact-burst .node-value {
    animation: stat-node-impact-fade 760ms ease-out forwards;
}

#stat-selector .arcane-node.impact-burst::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 36%;
    width: clamp(98px, 10vw, 130px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.46);
    background:
        radial-gradient(circle,
            rgba(248, 227, 165, 0.58) 0%,
            rgba(248, 227, 165, 0.26) 28%,
            rgba(126, 204, 255, 0.24) 48%,
            rgba(126, 204, 255, 0) 74%);
    animation: stat-node-impact-ring 760ms ease-out forwards;
}

@keyframes constellation-star-drift {
    from {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(3deg) scale(1.04);
    }

    to {
        transform: rotate(0deg) scale(1);
    }
}

@keyframes constellation-star-twinkle {

    0%,
    100% {
        opacity: 0.34;
        transform: scale(0.96);
    }

    45% {
        opacity: 0.62;
        transform: scale(1.02);
    }

    50% {
        opacity: 0.84;
        transform: scale(1.06);
    }

    70% {
        opacity: 0.48;
        transform: scale(1);
    }
}

@keyframes constellation-impact-aura {
    0% {
        opacity: 0.76;
        filter: saturate(1.1);
    }

    100% {
        opacity: 1;
        filter: saturate(1);
    }
}

@keyframes constellation-impact-ring {
    0% {
        opacity: 0.95;
        transform: translate(-50%, -50%) scale(0.88);
    }

    100% {
        opacity: 0.72;
        transform: translate(-50%, -50%) scale(1.04);
    }
}

@keyframes stat-node-impact-burst {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    36% {
        opacity: 1;
        transform: translateY(-8px) scale(1.22);
    }

    76% {
        opacity: 0.36;
        transform: translateY(6px) scale(0.34);
    }

    100% {
        opacity: 0;
        transform: translateY(8px) scale(0.06);
    }
}

@keyframes stat-node-card-collapse {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    34% {
        opacity: 1;
        transform: translateY(-3px) scale(1.08);
    }

    78% {
        opacity: 0.34;
        transform: translateY(6px) scale(0.74);
    }

    100% {
        opacity: 0;
        transform: translateY(10px) scale(0.28);
    }
}

@keyframes stat-node-impact-glow {
    0% {
        opacity: 0.34;
        transform: scale(0.92);
    }

    38% {
        opacity: 0.98;
        transform: scale(1.3);
    }

    100% {
        opacity: 0.56;
        transform: scale(1.06);
    }
}

@keyframes stat-node-impact-ring {
    0% {
        opacity: 0.82;
        transform: translate(-50%, -50%) scale(0.46);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

@keyframes stat-node-magic-halo {
    0% {
        opacity: 0.18;
        transform: rotate(0deg) scale(0.96);
    }

    36% {
        opacity: 1;
        transform: rotate(94deg) scale(1.08);
    }

    100% {
        opacity: 0.56;
        transform: rotate(210deg) scale(1.02);
    }
}

@keyframes stat-node-impact-fade {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    44% {
        opacity: 1;
        transform: translateY(-4px) scale(1.08);
    }

    100% {
        opacity: 0;
        transform: translateY(8px) scale(0.72);
    }
}

@keyframes constellation-node-appear {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.88);
        filter: saturate(0.8);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: saturate(1);
    }
}

@keyframes constellation-label-appear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes constellation-value-appear {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.88);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes stat-selector-shell-flash {
    0% {
        opacity: 0.14;
    }

    45% {
        opacity: 0.26;
    }

    100% {
        opacity: 0.14;
    }
}

@keyframes stat-node-label-shine {

    0%,
    100% {
        box-shadow: 0 8px 14px rgba(6, 9, 24, 0.36);
    }

    50% {
        box-shadow:
            0 8px 14px rgba(6, 9, 24, 0.36),
            0 0 16px rgba(248, 227, 165, 0.36);
    }
}

@keyframes arcane-line-pulse-selected {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    #stat-selector .stat-selector-subtitle {
        font-size: clamp(0.95rem, 3.4vw, 1.1rem);
    }

    #stat-selector .node-label {
        padding: 1px 8px;
    }

    #stat-selector .node-value {
        min-width: 46px;
    }
}

@media (prefers-reduced-motion: reduce) {

    #stat-selector .arcane-particles::before,
    #stat-selector .arcane-particles::after,
    #stat-selector .arcane-network-container:has(#btn-select-Habilidad.active) .arcane-link-habilidad.arcane-line,
    #stat-selector .arcane-network-container:has(#btn-select-Valor.active) .arcane-link-valor.arcane-line,
    #stat-selector .arcane-network-container:has(#btn-select-Astucia.active) .arcane-link-astucia.arcane-line,
    #stat-selector .arcane-network-container:has(#btn-select-Intel.active) .arcane-link-intel.arcane-line,
    #stat-selector .arcane-network-container.constellation-impact::before,
    #stat-selector .arcane-network-container.constellation-impact::after,
    #stat-selector:not(.hidden) .stat-selector-panel,
    #stat-selector:not(.hidden) .stat-selector-grid.arcane-network-container,
    #stat-selector.stat-selector-impacting .stat-selector-grid.arcane-network-container,
    #stat-selector:not(.hidden) .arcane-node .node-visual,
    #stat-selector:not(.hidden) .arcane-node .node-label,
    #stat-selector:not(.hidden) .arcane-node .node-value,
    #stat-selector:not(.hidden) .arcane-node.active .node-label,
    #stat-selector .arcane-node.impact-burst .node-visual,
    #stat-selector .arcane-node.impact-burst .node-label,
    #stat-selector .arcane-node.impact-burst .node-value,
    #stat-selector .arcane-node.impact-burst .node-glow,
    #stat-selector .arcane-node.impact-burst::after,
    #stat-selector.stat-selector-mage-casting .stat-selector-mage-slot::before,
    #stat-selector.stat-selector-mage-casting .stat-selector-mage-image,
    #game-board .battle-arena::before,
    #game-board .battle-arena::after,
    #game-board .lineup-row.lineup-ready-burst,
    #game-board .lineup-row.lineup-ready-burst::after,
    #wb-stat-announce.is-visible,
    #wb-stat-announce.is-visible::after {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .card-slot.slot-drop-from-top .card-mini img,
    .card-slot.slot-drop-from-bottom .card-mini img,
    .card-slot.slot-drop-from-top .card-back img,
    .card-slot.slot-drop-from-bottom .card-back img,
    .card-slot.slot-impact::after,
    .card-slot.slot-impact .card-mini,
    .slot-impact-burst,
    .duel-counter.counter-bonus-burst,
    .duel-counter.counter-penalty-burst,
    .duel-counter.counter-neutral-burst,
    .duel-modifier.is-bonus,
    .duel-modifier.is-penalty,
    .combat-card-value-base.value-impact-bonus,
    .combat-card-value-base.value-impact-penalty,
    .combat-card-value-base.value-impact-victory,
    .combat-card-value-base.value-impact-defeat,
    .combat-card-value-base.value-impact-neutral,
    .combat-resolution-overlay.combat-clash-impact .combat-vs-divider,
    .combat-resolution-overlay.combat-clash-impact .combat-stat-icon-wrapper,
    #game-result-overlay.active,
    #game-result-overlay.active .result-overlay-container,
    #game-result-overlay.active .result-overlay-container::before,
    #game-result-overlay.active .result-overlay-container::after,
    #game-result-overlay.active .overlay-title,
    #game-result-overlay.active .result-message-text,
    #game-result-overlay.active .result-score-value {
        animation: none !important;
    }
}

/* ==========================================
   COMBAT + STAT SELECTOR STABILIZATION
   ========================================== */

/* Action buttons always in one row: Salir + (Expeliarmus/Confirmar/Siguiente). */
#combat-bottom-bar .combat-action-row {
    width: min(100%, 1280px);
    margin: 0 auto;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    pointer-events: auto;
}

#combat-bottom-bar .combat-bottom-actions {
    position: static !important;
    right: auto !important;
    bottom: auto !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: nowrap;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

#combat-bottom-bar .combat-bottom-actions::-webkit-scrollbar {
    display: none;
}

#combat-bottom-bar #btn-exit-combat,
#combat-bottom-bar #confirm-lineup-btn,
#combat-bottom-bar #confirm-hand-btn,
#combat-bottom-bar #btn-next-round-main {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    margin: 0 !important;
    white-space: nowrap;
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
}

#combat-bottom-bar #btn-exit-combat {
    flex: 0 0 auto;
}

#combat-bottom-bar .combat-bottom-actions>.btn {
    flex: 0 0 auto;
}

@media (max-width: 768px) {
    #combat-bottom-bar .combat-action-row {
        gap: 8px;
        padding-inline: 10px;
    }

    #combat-bottom-bar #btn-exit-combat,
    #combat-bottom-bar #confirm-lineup-btn,
    #combat-bottom-bar #confirm-hand-btn,
    #combat-bottom-bar #btn-next-round-main {
        min-height: 44px;
        padding: 10px 14px;
        font-size: clamp(0.82rem, 2.8vw, 0.95rem);
    }
}

/* Keep combat numbers fixed in place; move impact emphasis to card shell instead. */
.combat-card-value-container.duel-counter {
    flex-direction: column;
    gap: 6px;
    min-width: clamp(96px, 12vw, 140px);
}

.combat-card-value-base,
.combat-card-value-final,
.combat-card-value-final.show {
    transform: none !important;
}

.duel-counter.counter-bonus-burst,
.duel-counter.counter-penalty-burst,
.duel-counter.counter-neutral-burst {
    animation: none !important;
}

.combat-modifiers-container {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
    width: min(300px, 72vw);
    pointer-events: none;
    z-index: 12;
}

.combat-card.card-impact-neutral {
    animation: combat-card-impact-neutral 420ms ease-out;
}

.combat-card.card-impact-bonus {
    animation: combat-card-impact-bonus 420ms ease-out;
}

.combat-card.card-impact-penalty {
    animation: combat-card-impact-penalty 420ms ease-out;
}

@keyframes combat-card-impact-neutral {

    0%,
    100% {
        filter: brightness(1) saturate(1);
    }

    50% {
        filter: brightness(1.06) saturate(1.06);
    }
}

@keyframes combat-card-impact-bonus {

    0%,
    100% {
        filter: brightness(1) saturate(1);
    }

    50% {
        filter: brightness(1.16) saturate(1.16);
    }
}

@keyframes combat-card-impact-penalty {

    0%,
    100% {
        filter: brightness(1) saturate(1);
    }

    50% {
        filter: brightness(0.92) saturate(1.1);
    }
}

/* Override value impact keyframes: no translate/scale/rotate on numbers. */
@keyframes combat-value-impact-bonus {

    0%,
    100% {
        filter: drop-shadow(0 0 0 rgba(97, 216, 155, 0));
    }

    50% {
        filter: drop-shadow(0 0 18px rgba(97, 216, 155, 0.54));
    }
}

@keyframes combat-value-impact-penalty {

    0%,
    100% {
        filter: drop-shadow(0 0 0 rgba(255, 120, 142, 0));
    }

    50% {
        filter: drop-shadow(0 0 18px rgba(255, 120, 142, 0.52));
    }
}

@keyframes combat-value-impact-victory {

    0%,
    100% {
        filter: drop-shadow(0 0 0 rgba(248, 227, 165, 0));
    }

    50% {
        filter: drop-shadow(0 0 22px rgba(248, 227, 165, 0.6));
    }
}

@keyframes combat-value-impact-defeat {

    0%,
    100% {
        filter: drop-shadow(0 0 0 rgba(255, 127, 144, 0));
    }

    50% {
        filter: drop-shadow(0 0 22px rgba(255, 127, 144, 0.56));
    }
}

@keyframes combat-value-impact-neutral {

    0%,
    100% {
        filter: drop-shadow(0 0 0 rgba(200, 224, 255, 0));
    }

    50% {
        filter: drop-shadow(0 0 14px rgba(200, 224, 255, 0.46));
    }
}

/* Desktop: smooth, low-jank constellation mode. */
@media (min-width: 1024px) {
    #stat-selector:not(.hidden) .stat-selector-panel {
        animation: stat-selector-panel-enter 440ms var(--ease-spring) !important;
    }

    #stat-selector:not(.hidden) .stat-selector-grid.arcane-network-container,
    #stat-selector.stat-selector-impacting .stat-selector-grid.arcane-network-container {
        animation: none !important;
        filter: none !important;
    }

    #stat-selector .arcane-particles,
    #stat-selector .arcane-particles::before,
    #stat-selector .arcane-particles::after {
        animation: none !important;
    }

    #stat-selector .arcane-particles {
        opacity: 0.22;
    }

    #stat-selector .arcane-particles::before {
        opacity: 0.18;
    }

    #stat-selector .arcane-particles::after {
        opacity: 0.12;
        filter: none;
    }

    #stat-selector .arcane-line.phase-a,
    #stat-selector .arcane-line.phase-b,
    #stat-selector .arcane-line.arcane-ring,
    #stat-selector .arcane-network-container:has(#btn-select-Habilidad.active) .arcane-link-habilidad.arcane-line,
    #stat-selector .arcane-network-container:has(#btn-select-Valor.active) .arcane-link-valor.arcane-line,
    #stat-selector .arcane-network-container:has(#btn-select-Astucia.active) .arcane-link-astucia.arcane-line,
    #stat-selector .arcane-network-container:has(#btn-select-Intel.active) .arcane-link-intel.arcane-line {
        animation: none !important;
    }

    #stat-selector .arcane-line {
        stroke-dasharray: none;
        opacity: 0.72;
    }

    #stat-selector .arcane-line-base {
        opacity: 0.55;
    }

    #stat-selector .arcane-node.active .node-visual,
    #stat-selector .node-center.arcane-node.active .node-visual,
    #stat-selector .arcane-node.active .node-glow,
    #stat-selector:not(.hidden) .arcane-node.active .node-label {
        animation: none !important;
    }

    #stat-selector:not(.hidden) .arcane-node.active .node-visual,
    #stat-selector:not(.hidden) .arcane-node.active .node-label {
        opacity: 1;
    }

    #stat-selector .arcane-node.active .node-visual {
        transform: translateY(-2px) scale(1.04);
    }

    #stat-selector .arcane-node.impact-burst .node-visual {
        animation: stat-node-impact-burst 620ms cubic-bezier(0.2, 0.9, 0.2, 1) !important;
    }

    #stat-selector .arcane-node.impact-burst {
        animation: stat-node-card-collapse 620ms cubic-bezier(0.2, 0.9, 0.2, 1) !important;
    }

    #stat-selector .arcane-node.impact-burst .node-label,
    #stat-selector .arcane-node.impact-burst .node-value {
        animation: stat-node-impact-fade 620ms ease-out forwards !important;
    }

    #stat-selector .arcane-node.impact-burst .node-glow {
        animation: stat-node-impact-glow 620ms ease-out !important;
    }

    #stat-selector .arcane-network-container.constellation-impact::before,
    #stat-selector .arcane-network-container.constellation-impact::after {
        animation: constellation-impact-soft 420ms ease-out !important;
    }
}

@keyframes stat-node-impact-soft {
    0% {
        transform: translateY(0) scale(1);
    }

    40% {
        transform: translateY(-2px) scale(1.06);
    }

    100% {
        transform: translateY(-2px) scale(1.04);
    }
}

@keyframes stat-node-impact-glow-soft {
    0% {
        opacity: 0.32;
        transform: scale(1);
    }

    50% {
        opacity: 0.74;
        transform: scale(1.12);
    }

    100% {
        opacity: 0.6;
        transform: scale(1.06);
    }
}

@keyframes constellation-impact-soft {
    0% {
        opacity: 0.62;
    }

    100% {
        opacity: 0.8;
    }
}

/* ======================== */
/* Editor: Cards & Stats    */
/* ======================== */

.editor-tab-content {
    min-height: 0;
}

#tab-stats {
    min-height: 0;
}

.editor-tabs {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(247, 245, 230, 0.96);
    border-bottom: 1px solid rgba(42, 35, 40, 0.12);
    align-items: center;
    box-shadow: 0 6px 14px rgba(20, 15, 20, 0.08);
}

.editor-tabs .tab-btn {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(42, 35, 40, 0.12);
    color: var(--color-ink-primary);
    font-family: var(--font-primary-ui);
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.8;
    padding: 8px 14px;
    position: relative;
    transition: opacity 0.2s ease, color 0.2s ease;
    border-radius: 999px;
}

.editor-tabs .tab-btn.tab {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(42, 35, 40, 0.14);
    color: var(--color-ink-primary);
}

.editor-tabs .tab-btn.active {
    opacity: 1;
    background: rgba(247, 245, 230, 0.98);
    border-color: rgba(212, 175, 55, 0.6);
    box-shadow: 0 4px 10px rgba(20, 15, 20, 0.12);
}

.editor-tabs .tab-btn.tab.active {
    background: rgba(247, 245, 230, 0.98);
    border-color: rgba(212, 175, 55, 0.6);
}

.editor-tabs .tab-btn.active::after {
    display: none;
}

.editor-tab-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: rgba(247, 245, 230, 0.92);
}

.editor-tab-content>.tab-pane {
    flex: 1;
    min-height: 0;
}

.view-generator .input-premium {
    margin: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.92);
}

.view-generator .input-premium:focus {
    background: rgba(255, 255, 255, 0.98);
}

.theme-hk .card-list-panel,
.theme-hk .card-editor-panel {
    background: rgba(14, 14, 18, 0.92);
    border-color: rgba(255, 255, 255, 0.18);
}

.theme-hk .card-browser-panel,
.theme-hk .card-preview-panel,
.theme-hk .card-editor-panel {
    background: rgba(16, 16, 20, 0.94);
    border-color: rgba(255, 255, 255, 0.2);
}

.theme-hk .card-list-item {
    background: rgba(0, 0, 0, 0.34);
    border-color: rgba(255, 255, 255, 0.14);
}

.theme-hk .card-list-item:hover {
    background: rgba(233, 69, 96, 0.14);
    border-color: rgba(233, 69, 96, 0.75);
}

.theme-hk .card-list-item.is-selected {
    border-color: rgba(233, 69, 96, 0.95);
    box-shadow: 0 0 0 1px rgba(233, 69, 96, 0.95);
    background: linear-gradient(90deg, rgba(233, 69, 96, 0.18), rgba(0, 0, 0, 0));
}

.theme-hk .card-preview-box {
    background: rgba(0, 0, 0, 0.38);
    border-color: rgba(255, 255, 255, 0.18);
}

.theme-hk .placeholder-text,
.theme-hk .card-list-subtitle,
.theme-hk .editor-panel-subtitle {
    color: rgba(255, 255, 255, 0.78);
}

.cards-editor-body {
    display: grid;
    grid-template-columns: 1.1fr 1.4fr;
    gap: 18px;
    padding: 20px;
    flex: 1;
    overflow: hidden;
    box-sizing: border-box;
}

.stats-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    max-width: 960px;
    margin: 0 auto;
    align-items: start;
}

.stats-card {
    background: var(--color-paper-dim);
    padding: 16px;
    border-radius: 12px;
    text-align: left;
    border: 1px solid var(--color-ink-secondary);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-width: 0;
}

.stats-card-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-card-icon-img {
    width: 36px;
    height: 36px;
    display: block;
}

.stats-card-body {
    flex: 1;
    min-width: 0;
}

.stats-card-label {
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-ink-primary);
}

.stats-card-key {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 2px;
    font-family: monospace;
}

.stats-card-desc {
    font-size: 0.9rem;
    margin-top: 6px;
    color: var(--color-ink-secondary);
    word-break: break-word;
}

.stats-card-desc-empty {
    opacity: 0.65;
}

.card-list-panel,
.card-editor-panel {
    background: rgba(247, 245, 230, 0.96);
    border: 1px solid rgba(42, 35, 40, 0.12);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 10px 18px rgba(20, 15, 20, 0.12);
    min-height: 0;
}

.card-list-header,
.editor-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-ink-faded);
}

/* El panel derecho (editor) debe poder scrollear para ver opciones abajo */
.card-editor-panel {
    overflow-y: auto;
    padding-bottom: 18px;
}

/* Mantener cabecera visible durante scroll */
.editor-panel-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-top: 6px;
    background: rgba(247, 245, 230, 0.96);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.editor-panel-body {
    display: grid;
    gap: 12px;
    padding-top: 6px;
    min-height: 0;
}

.editor-action-btn {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(42, 35, 40, 0.12);
    background: rgba(255, 255, 255, 0.85);
    color: var(--color-ink-primary);
    font-family: var(--font-primary-ui);
    font-weight: 700;
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.card-editor-panel .editor-action-btn.btn {
    justify-content: flex-start;
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(42, 35, 40, 0.14);
    color: var(--color-ink-primary);
}

.card-editor-panel .editor-action-btn.btn:hover {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(212, 175, 55, 0.7);
}

.editor-action-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 215, 0, 0.6);
    background: rgba(255, 255, 255, 0.98);
}

.card-list-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-ink-primary);
}

.card-list-subtitle,
.editor-panel-subtitle {
    font-size: 0.85rem;
    color: var(--color-ink-secondary);
}

.card-list-active-set {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(42, 35, 40, 0.18);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--color-ink-primary);
    background: rgba(255, 255, 255, 0.8);
}

.card-list-scroll {
    overflow-y: auto;
    max-height: calc(100% - 12px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 6px;
    flex: 1;
    min-height: 0;
}

.card-list-scroll.is-hidden {
    display: none;
}

.card-list-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(42, 35, 40, 0.12);
    background: rgba(255, 255, 255, 0.8);
    color: var(--color-ink-primary);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    text-align: left;
}

.card-list-item:hover {
    border-color: rgba(212, 175, 55, 0.7);
    background: rgba(255, 239, 196, 0.5);
}

.card-list-item.is-selected {
    border-color: var(--color-accent-gold);
    box-shadow: 0 0 0 1px var(--color-accent-gold);
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.2), rgba(255, 255, 255, 0));
}

.card-list-item .card-name {
    font-weight: 700;
}

.card-list-meta {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--color-ink-secondary);
}

.card-list-stats {
    display: flex;
    gap: 8px;
    font-family: var(--font-numeric);
    font-size: 0.82rem;
}

.editor-panel-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--color-ink-primary);
}

.editor-status {
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid rgba(42, 35, 40, 0.2);
    background: rgba(255, 255, 255, 0.85);
}

.editor-status.is-dirty {
    color: var(--color-ink-primary);
    border-color: var(--color-accent-gold);
    background: rgba(255, 215, 0, 0.28);
}

.card-preview-box {
    height: clamp(320px, 46vh, 640px);
    border: 1px dashed var(--color-ink-faded);
    border-radius: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: auto;
    flex: 0 0 auto;
}

.card-preview-strip {
    display: flex;
    gap: 10px;
    padding: 10px 2px 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.card-preview-thumb {
    width: 64px;
    height: 86px;
    border-radius: 10px;
    border: 1px solid rgba(42, 35, 40, 0.12);
    background: rgba(255, 255, 255, 0.85);
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
    flex: 0 0 auto;
}

.card-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.card-preview-thumb:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 215, 0, 0.6);
}

.card-preview-thumb.is-selected {
    border-color: rgba(255, 215, 0, 0.95);
    box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.65);
}

.card-preview-box .card,
.card-preview-box .card-premium {
    margin: 0 auto;
    transform: scale(var(--preview-card-scale, 0.9));
    transform-origin: top center;
}

/* Capas de formulario con fondo más opaco (mejora legibilidad) */
.card-editor-panel .editor-form-grid,
.card-editor-panel .stat-grid,
.card-editor-panel .form-group {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(42, 35, 40, 0.12);
    border-radius: 12px;
    padding: 12px;
}

.card-editor-panel .form-group {
    margin: 0;
}

.card-editor-panel .form-group label {
    margin-top: 0;
}

.placeholder-text {
    color: var(--color-ink-secondary);
    font-size: 0.9rem;
}

.field-hint {
    margin: 6px 0 0;
    font-size: 0.78rem;
    color: var(--color-ink-secondary);
}

.input-premium.is-readonly {
    background: rgba(255, 255, 255, 0.7);
    border-style: dashed;
    color: var(--color-ink-secondary);
}

.editor-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.form-group label {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--color-ink-primary);
    margin-bottom: 4px;
    display: block;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--color-ink-faded);
}

.editor-actions .spacer {
    flex: 1;
}

.card-editor-panel .btn-primary,
.card-editor-panel .btn-secondary {
    padding: 10px 16px;
    min-height: 40px;
    font-size: 0.82rem;
    margin: 0;
    border-width: 2px;
    letter-spacing: 0.4px;
}

.card-editor-panel .btn-primary {
    text-transform: none;
}

.card-editor-panel .btn-secondary {
    text-transform: none;
    font-family: var(--font-primary-ui);
}

.btn-danger {
    border-color: var(--color-accent-danger);
    color: var(--color-accent-danger);
}

.btn-danger:hover {
    background: rgba(217, 126, 126, 0.14);
    border-color: var(--color-accent-danger);
    color: var(--color-ink-primary);
}

.editor-modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(18, 18, 20, 0.6);
    z-index: calc(var(--z-modal) + 20);
    padding: 24px;
}

.editor-modal-overlay.is-active {
    display: flex;
}

.editor-modal {
    width: min(880px, 92vw);
    max-height: 88vh;
    background: rgba(247, 245, 230, 0.96);
    border-radius: 20px;
    border: 2px solid rgba(42, 35, 40, 0.18);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-modal-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(42, 35, 40, 0.12);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.editor-modal-title {
    font-family: var(--font-primary-ui);
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--color-ink-primary);
}

.editor-modal-subtitle {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--color-ink-secondary);
}

.editor-modal-close {
    border: none;
    background: rgba(0, 0, 0, 0.08);
    color: var(--color-ink-primary);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
}

.editor-modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    display: grid;
    gap: 14px;
}

.editor-modal-actions {
    padding: 16px 20px;
    border-top: 1px solid rgba(42, 35, 40, 0.12);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

@media (max-width: 1100px) {
    .cards-editor-body {
        grid-template-columns: 1fr;
    }

    .card-preview-box {
        height: clamp(300px, 42vh, 520px);
    }
}

@media (min-width: 1400px) {
    .card-preview-box {
        height: clamp(380px, 52vh, 720px);
        --preview-card-scale: 0.92;
    }
}

/* HK: subir contraste del editor (fondos y textos) */
.theme-hk .editor-panel-header {
    background: rgba(0, 0, 0, 0.48);
    border-bottom-color: rgba(255, 255, 255, 0.14);
}

.theme-hk .card-editor-panel .editor-form-grid,
.theme-hk .card-editor-panel .stat-grid,
.theme-hk .card-editor-panel .form-group {
    background: rgba(0, 0, 0, 0.42);
    border-color: rgba(255, 255, 255, 0.16);
}

.theme-hk .card-list-meta {
    color: rgba(255, 255, 255, 0.72);
}

/* ======================== */
/* Editor: Pro Layout 2025  */
/* ======================== */

.cards-editor-view {
    height: 100%;
    display: flex;
    width: 100%;
    min-height: 0;
}

.cards-editor-shell {
    display: grid;
    grid-template-columns: minmax(220px, 320px) minmax(0, 1fr) minmax(240px, 360px);
    grid-template-rows: minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
    height: 100%;
    flex: 1;
    box-sizing: border-box;
    min-width: 0;
    min-height: 0;
    align-items: stretch;
    align-content: stretch;
}

.card-browser-panel,
.card-preview-panel,
.card-editor-panel {
    background: rgba(247, 245, 230, 0.98);
    border: 1px solid rgba(42, 35, 40, 0.14);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 18px 40px rgba(20, 15, 20, 0.16);
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    min-width: 0;
    width: 100%;
    max-width: none;
    height: 100%;
}

.card-browser-panel {
    gap: 12px;
}

.card-preview-panel {
    background: rgba(250, 248, 236, 0.98);
    overflow: visible;
}

.card-editor-panel {
    overflow-y: auto;
}

.browser-top {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.browser-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.browser-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    color: var(--color-ink-primary);
}

.browser-subtitle {
    font-size: 0.85rem;
    color: var(--color-ink-secondary);
}

.browser-count {
    font-size: 0.78rem;
    color: var(--color-ink-secondary);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(42, 35, 40, 0.14);
    border-radius: 999px;
    padding: 4px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.browser-set label,
.browser-search label,
.filter-group label,
.preview-control label,
.preview-toggle span,
.editor-section summary span {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--color-ink-secondary);
}

.browser-set {
    display: grid;
    gap: 6px;
}

.browser-search {
    display: grid;
    gap: 6px;
}

.browser-filters {
    display: grid;
    gap: 10px;
}

.filter-group {
    display: grid;
    gap: 6px;
}

.browser-new-btn {
    margin-top: 6px;
}

.card-list-scroll {
    gap: 12px;
}

.card-list-item {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(42, 35, 40, 0.12);
    background: rgba(255, 255, 255, 0.85);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.card-list-item:hover {
    transform: translateY(-1px);
    border-color: rgba(212, 175, 55, 0.7);
    background: rgba(255, 239, 196, 0.6);
}

.card-list-item.is-selected {
    border-color: var(--color-accent-gold);
    background: linear-gradient(110deg, rgba(255, 215, 0, 0.18), rgba(0, 0, 0, 0));
    box-shadow: 0 0 0 1px rgba(255, 215, 0, 0.5);
}

.card-list-thumb {
    width: 44px;
    height: 54px;
    border-radius: 8px;
    border: 1px solid rgba(42, 35, 40, 0.12);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.85);
}

.card-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-list-content {
    display: grid;
    gap: 6px;
}

.card-list-item .card-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--color-ink-primary);
}

.card-list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--color-ink-secondary);
}

.card-list-meta span {
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(42, 35, 40, 0.06);
    border: 1px solid rgba(42, 35, 40, 0.12);
}

.card-list-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.72rem;
}

.preview-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.preview-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--color-ink-primary);
}

.preview-subtitle {
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--color-ink-secondary);
}

.preview-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.preview-control {
    display: grid;
    gap: 6px;
}

.preview-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-preview-box {
    height: clamp(340px, 56vh, 720px);
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.5), transparent 60%), rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(42, 35, 40, 0.14);
    border-radius: 20px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
}

.cards-editor-view .card-preview-box {
    /* Desktop-first: let the preview box flex to avoid clipping. */
    flex: 1 1 auto;
    height: auto;
    min-height: 420px;
}

.cards-editor-view .card-preview-strip {
    flex: 0 0 auto;
}

.editor-section {
    border: 1px solid rgba(42, 35, 40, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.75);
    overflow: hidden;
}

.editor-section.is-empty .ability-preview {
    opacity: 0.6;
}

.editor-section summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.7);
}

.editor-section summary::-webkit-details-marker {
    display: none;
}

.editor-section-body {
    padding: 12px 14px 14px;
    display: grid;
    gap: 12px;
}

.editor-section[open] summary {
    border-bottom: 1px solid rgba(42, 35, 40, 0.12);
}

.ability-preview {
    display: grid;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(42, 35, 40, 0.12);
    font-size: 0.85rem;
}

.ability-preview-title {
    font-weight: 700;
    color: var(--color-ink-primary);
}

.ability-preview-meta {
    font-size: 0.75rem;
    color: var(--color-ink-secondary);
}

.ability-preview-desc {
    color: var(--color-ink-secondary);
    line-height: 1.3;
}

.stat-editor-grid {
    display: grid;
    gap: 10px;
}

.stat-control {
    display: grid;
    grid-template-columns: minmax(140px, 1.2fr) minmax(160px, 1.6fr) 54px;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(42, 35, 40, 0.12);
    background: rgba(255, 255, 255, 0.8);
}

.stat-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(42, 35, 40, 0.08);
    border: 1px solid rgba(42, 35, 40, 0.12);
    padding: 4px;
    object-fit: contain;
}

.stat-meta-text {
    display: grid;
    gap: 2px;
}

.stat-name {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--color-ink-primary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.stat-code {
    font-size: 0.72rem;
    color: var(--color-ink-secondary);
}

.stat-number {
    text-align: center;
}

.stat-range {
    width: 100%;
    accent-color: var(--color-accent-gold);
}

.stat-inputs {
    display: grid;
    grid-template-columns: 70px 1fr;
    align-items: center;
    gap: 10px;
}

.stat-value {
    font-family: var(--font-numeric);
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--color-ink-primary);
    text-align: center;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    padding: 6px 8px;
    border: 1px solid rgba(42, 35, 40, 0.12);
}

.image-editor {
    display: grid;
    gap: 12px;
}

.image-preview-panel {
    display: grid;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(42, 35, 40, 0.12);
    background: rgba(255, 255, 255, 0.78);
}

.image-preview-label {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-ink-secondary);
}

.image-preview-frame {
    position: relative;
    width: min(100%, 260px);
    aspect-ratio: 3 / 4;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(42, 35, 40, 0.16);
    background: rgba(14, 10, 18, 0.75);
}

.image-preview-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-option.is-hidden {
    display: none;
}

.form-group textarea {
    min-height: 110px;
    resize: vertical;
}

.editor-actions.secondary {
    margin-top: 6px;
    justify-content: space-between;
}

.input-premium.is-changed,
.stat-range.is-changed {
    border-color: var(--color-accent-gold);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.2);
}

@media (max-width: 1280px) {
    .cards-editor-shell {
        grid-template-columns: 280px 1fr;
        grid-template-rows: auto auto;
    }

    .card-editor-panel {
        grid-column: 1 / -1;
        max-height: 42vh;
    }

    .card-preview-box {
        height: clamp(300px, 42vh, 520px);
    }
}

@media (max-width: 980px) {
    .cards-editor-shell {
        grid-template-columns: 1fr;
    }

    .card-preview-panel,
    .card-editor-panel {
        max-height: none;
    }

    .stats-preview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    /* Mobile-only: let the cards editor panels scroll instead of cropping. */
    .editor-tab-content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .cards-editor-view,
    .cards-editor-shell {
        height: auto;
    }

    .cards-editor-shell {
        gap: 16px;
        padding: 16px;
    }

    .card-browser-panel,
    .card-preview-panel,
    .card-editor-panel {
        min-height: auto;
        border-radius: 16px;
        padding: 16px;
    }

    /* Mejores touch targets para botones del editor */
    .card-editor-panel .btn,
    .card-browser-panel .btn,
    .card-preview-panel .btn {
        min-height: 48px;
        min-width: 48px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    /* Inputs más grandes para móvil */
    .card-editor-panel input,
    .card-editor-panel select,
    .card-editor-panel textarea {
        min-height: 48px;
        font-size: 16px;
        /* Previene zoom en iOS */
        padding: 10px 12px;
    }

    /* Preview box más alto en móvil */
    .card-preview-box {
        min-height: 400px;
        max-height: 60vh;
    }

    /* Navegador de cartas más usable */
    .card-list-item {
        min-height: 56px;
        padding: 12px;
        font-size: 0.95rem;
    }

    /* Tabs más grandes para touch */
    .editor-tabs .tab {
        min-height: 48px;
        padding: 10px 16px;
        font-size: 0.95rem;
    }
}

/* ========================================== */
/* NUEVO SISTEMA: ESTILOS PARA MANO OCULTA */
/* ========================================== */

/* Ventana Pre-Capitán (FASE 0) */
.pre-captain-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: rgba(247, 245, 230, 0.98);
    border: 3px solid rgba(42, 35, 40, 0.3);
    border-radius: 24px;
    padding: 24px;
    min-width: 320px;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
}

.pre-captain-window.hidden {
    display: none;
}

.pre-captain-window .ability-header {
    text-align: center;
    margin-bottom: 20px;
}

.pre-captain-window .ability-header h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-ink-primary);
    margin-bottom: 8px;
}

.pre-captain-window .ability-character {
    font-size: 1rem;
    color: var(--color-ink-secondary);
    font-weight: 600;
}

.pre-captain-window .ability-description {
    text-align: center;
    font-size: 1rem;
    color: var(--color-ink-primary);
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(42, 35, 40, 0.08);
    border-radius: 12px;
}

.pre-captain-window .ability-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.pre-captain-window .btn-primary,
.pre-captain-window .btn-secondary {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid;
    transition: all 0.2s ease;
}

.pre-captain-window .btn-primary {
    background: var(--color-accent-gold);
    border-color: var(--color-accent-gold);
    color: var(--color-ink-primary);
}

.pre-captain-window .btn-primary:hover {
    background: rgba(255, 215, 0, 0.9);
    transform: translateY(-2px);
}

.pre-captain-window .btn-secondary {
    background: transparent;
    border-color: rgba(42, 35, 40, 0.3);
    color: var(--color-ink-primary);
}

.pre-captain-window .btn-secondary:hover {
    background: rgba(42, 35, 40, 0.1);
}

/* Selector de Cartas Oculto (FASE 2) */
.card-pick-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: rgba(247, 245, 230, 0.98);
    border: 3px solid rgba(42, 35, 40, 0.3);
    border-radius: 24px;
    padding: 24px;
    min-width: 400px;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
}

.card-pick-window.hidden {
    display: none;
}

.card-pick-window .card-pick-header {
    text-align: center;
    margin-bottom: 20px;
}

.card-pick-window .card-pick-header h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--color-ink-primary);
}

.card-pick-window .hidden-cards {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.card-pick-window .hidden-card {
    width: 120px;
    height: 168px;
    border-radius: 12px;
    border: 3px solid rgba(42, 35, 40, 0.2);
    background: rgba(42, 35, 40, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
}

.card-pick-window .hidden-card:hover {
    transform: translateY(-4px);
    border-color: var(--color-accent-gold);
    box-shadow: 0 8px 20px rgba(255, 215, 0, 0.3);
}

.card-pick-window .hidden-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Ventana Post-Combate (FASE 4) */
.post-combat-window {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: rgba(247, 245, 230, 0.98);
    border: 3px solid rgba(42, 35, 40, 0.3);
    border-radius: 24px;
    padding: 24px;
    min-width: 320px;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
}

.post-combat-window.hidden {
    display: none;
}

.post-combat-window .ability-header {
    text-align: center;
    margin-bottom: 20px;
}

.post-combat-window .ability-header h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-ink-primary);
    margin-bottom: 8px;
}

.post-combat-window .ability-character {
    font-size: 1rem;
    color: var(--color-ink-secondary);
    font-weight: 600;
}

.post-combat-window .ability-description {
    text-align: center;
    font-size: 1rem;
    color: var(--color-ink-primary);
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(42, 35, 40, 0.08);
    border-radius: 12px;
}

.post-combat-window .ability-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.post-combat-window .btn-primary,
.post-combat-window .btn-secondary {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid;
    transition: all 0.2s ease;
}

.post-combat-window .btn-primary {
    background: var(--color-accent-gold);
    border-color: var(--color-accent-gold);
    color: var(--color-ink-primary);
}

.post-combat-window .btn-primary:hover {
    background: rgba(255, 215, 0, 0.9);
    transform: translateY(-2px);
}

.post-combat-window .btn-secondary {
    background: transparent;
    border-color: rgba(42, 35, 40, 0.3);
    color: var(--color-ink-primary);
}

.post-combat-window .btn-secondary:hover {
    background: rgba(42, 35, 40, 0.1);
}

/* ==========================================
   HAND DOCK v2 (DaisyUI card)
   ========================================== */
.hand-dock {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 4px 0;
    border-radius: 0;
    background: rgba(247, 245, 230, 0.95);
    border: none;
    border-top: 1px solid rgba(42, 35, 40, 0.16);
    box-shadow: 0 -4px 12px rgba(20, 15, 20, 0.12);
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    --hand-card-width: clamp(78px, 20vw, 132px);
    --hand-card-height: calc(var(--hand-card-width) * 1.4);
    --hand-overlap: clamp(10px, 3.2vw, 32px);
    --hand-focus-lift: clamp(16px, 4vw, 28px);
    overflow: visible;
    transition: transform 0.3s ease-out, max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.hand-dock-header {
    display: none;
}

.hand-dock-title {
    display: none;
}

.hand-dock-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hand-count {
    border-color: rgba(42, 35, 40, 0.2);
    color: rgba(42, 35, 40, 0.8);
    padding: 2px 8px;
}

.hand-dock-body {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    overflow: visible;
    padding: 0;
    min-height: clamp(160px, 24vw, 210px);
    scrollbar-width: none;
}

.hand-dock-body::-webkit-scrollbar {
    display: none;
}

#player-hand.hand-dock-content {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    padding: 0 8px 0;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    overflow: visible;
    min-height: clamp(160px, 24vw, 210px);
}

#player-hand.hand-dock-content .card-mini {
    width: var(--hand-card-width);
    height: var(--hand-card-height);
    margin-left: calc(var(--hand-overlap) * -1);
    border-radius: 12px;
    border-width: 2px;
}

#player-hand.hand-dock-content .card-mini:first-child {
    margin-left: 0;
}

.hand-dock-tab {
    position: static;
    transform: none;
    display: none;
    min-height: 32px;
    width: auto;
    height: auto;
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
}

.hand--hidden .hand-dock-tab {
    display: inline-flex;
}

.hand--tucked {
    max-height: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out, padding 0.3s ease-out;
}

.hand--tucked .hand-dock-body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.hand--hidden {
    max-height: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out, padding 0.3s ease-out;
}

.hand--hidden .hand-dock-body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

/* Transición suave al mostrar la mano */
.hand-dock:not(.hand--tucked):not(.hand--hidden) {
    max-height: 300px;
    opacity: 1;
    pointer-events: auto;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out, padding 0.3s ease-out;
}

.hand-dock:not(.hand--tucked):not(.hand--hidden) .hand-dock-body {
    max-height: 280px;
    opacity: 1;
    overflow: visible;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
}

.hand--focus .hand-dock-content .card-mini {
    opacity: 0.6;
    transform: scale(0.96);
    filter: blur(1px);
}

.hand--focus .hand-dock-content .card-mini.hand-card-focused {
    opacity: 1;
    transform: translateY(calc(var(--hand-focus-lift) * -1)) scale(1.12);
    filter: blur(0);
    margin-right: var(--hand-overlap);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35), 0 0 18px rgba(255, 215, 0, 0.24);
    border-color: var(--color-accent-gold);
}

@media (max-width: 520px) {

    /* Mobile-only: cards fill as much space as possible */
    .hand-dock {
        padding: 2px 0;
        width: 100%;
        border-radius: 0;
        --hand-card-width: clamp(76px, 22vw, 110px);
        --hand-overlap: clamp(18px, 5.5vw, 28px);
        --hand-focus-lift: clamp(14px, 4vw, 24px);
    }

    .hand-dock-body {
        overflow-x: auto;
        overflow-y: visible;
        padding: 2px 0;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
        justify-content: center;
    }

    #player-hand.hand-dock-content {
        width: 100%;
        max-width: 100%;
        justify-content: center;
        padding: 0 4px;
        gap: 0;
        flex: 0 0 auto;
        min-height: 0;
    }

    #player-hand.hand-dock-content .card-mini {
        --card-rotation: 0deg !important;
        border-radius: 8px;
        border-width: 2px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    }

    .hand-count {
        font-size: 0.75rem;
        padding: 1px 6px;
        min-width: 24px;
        text-align: center;
    }

    #btn-exit-combat {
        margin-right: auto;
    }
}

@media (min-width: 900px) {
    .hand-dock {
        width: min(980px, 100%);
        --hand-card-width: clamp(104px, 9vw, 152px);
        --hand-overlap: clamp(20px, 2.6vw, 44px);
        --hand-focus-lift: clamp(18px, 2.4vw, 32px);
    }

    .hand-dock-body {
        overflow: visible;
        min-height: clamp(200px, 20vw, 260px);
    }

    .hand-dock:not(.hand--tucked):not(.hand--hidden) .hand-dock-body {
        max-height: 320px;
    }
}


@media (min-width: 1200px) {
    .hand-dock {
        width: min(1080px, 100%);
        --hand-card-width: clamp(124px, 8.5vw, 176px);
        --hand-overlap: clamp(22px, 2.2vw, 54px);
        --hand-focus-lift: clamp(20px, 2vw, 36px);
    }

    .hand-dock-body {
        min-height: clamp(230px, 19vw, 290px);
    }

    .hand-dock:not(.hand--tucked):not(.hand--hidden) .hand-dock-body {
        max-height: 360px;
    }
}

/* ==========================================
   BOTTOM NAV v2 (Dock profesional)
   ========================================== */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-height: var(--bottom-nav-height);
    padding: 10px max(14px, env(safe-area-inset-left)) calc(12px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right));
    border-radius: 22px 22px 0 0;
    background: rgba(247, 245, 230, 0.96);
    border-top: 1px solid rgba(42, 35, 40, 0.18);
    box-shadow:
        0 -12px 24px rgba(20, 15, 20, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-items: center;
    justify-items: center;
    pointer-events: auto;
    z-index: 1000;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transform: none;
}

.bottom-nav::before,
.bottom-nav::after {
    display: none;
}

.bottom-nav-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 64px;
    border-radius: 16px;
    padding: 6px;
    background: transparent;
    gap: 6px;
    transition: transform 200ms var(--ease-spring), opacity 200ms ease, filter 200ms ease;
    transform: none;
    opacity: 1;
    filter: none;
}

.bottom-nav-btn::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 12px;
    background: rgba(42, 35, 40, 0.04);
    border: 1px solid rgba(42, 35, 40, 0.1);
    opacity: 0;
    transition: opacity 200ms ease, border-color 200ms ease, background 200ms ease;
}

.bottom-nav-btn::after {
    display: none;
}

.bottom-nav-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(42, 35, 40, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.bottom-nav-btn img {
    width: 22px;
    height: 22px;
    background: transparent;
    border: none;
    box-shadow: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.bottom-nav-label {
    font-family: var(--font-parchment);
    font-size: 0.6rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.78;
}

.bottom-nav-btn.is-active::before {
    opacity: 1;
    background: rgba(212, 175, 55, 0.18);
    border-color: rgba(212, 175, 55, 0.45);
}

.bottom-nav-btn[data-nav].is-active::before {
    opacity: 1;
    background: rgba(212, 175, 55, 0.18);
    border-color: rgba(212, 175, 55, 0.45);
}

.bottom-nav-btn[data-nav].is-active::after {
    display: none;
}

.bottom-nav-btn.is-active .bottom-nav-icon-container {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(212, 175, 55, 0.5);
    box-shadow:
        0 0 0 2px rgba(212, 175, 55, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.bottom-nav-btn.is-active .bottom-nav-label {
    opacity: 1;
    color: rgba(42, 35, 40, 0.95);
}

.bottom-nav-btn[data-nav].is-active .bottom-nav-label {
    opacity: 1;
    color: rgba(42, 35, 40, 0.95);
    font-size: 0.6rem;
}

.bottom-nav-btn[data-nav] {
    transform: none;
    opacity: 1;
    filter: none;
}

.bottom-nav-btn[data-nav].is-active,
.bottom-nav-btn[data-nav].is-inactive {
    transform: none;
}

.bottom-nav-btn[data-nav].is-inactive img {
    opacity: 0.9;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
    background: transparent;
}

.bottom-nav-btn[data-nav].is-inactive .bottom-nav-label {
    opacity: 0.78;
    font-size: 0.6rem;
}

.bottom-nav-btn[data-nav].is-active img {
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.24));
    background: transparent;
    border: none;
    box-shadow: none;
}

.bottom-nav-btn.is-inactive {
    opacity: 0.7;
    filter: saturate(0.9);
}

.bottom-nav-btn.is-primary {
    transform: none;
}

@media (max-width: 360px) {
    .bottom-nav {
        width: 100%;
    }

    .bottom-nav-btn {
        height: 60px;
    }

    .bottom-nav-icon-container {
        width: 32px;
        height: 32px;
    }

    .bottom-nav-btn img {
        width: 20px;
        height: 20px;
    }
}

/* ==========================================
   ABILITY ANNOUNCEMENT OVERLAY — Automáticas (sin input)
   Aparece ~2s cuando el Capitán activa una habilidad pasiva
   ========================================== */

.ability-announcement-screen {
    background: rgba(14, 12, 20, 0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: overlay-fade-in 200ms ease-out;
}

.ability-announcement-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 28px 36px;
    background: linear-gradient(160deg, rgba(40, 32, 60, 0.98) 0%, rgba(20, 16, 36, 0.98) 100%);
    border: 1px solid rgba(212, 175, 55, 0.4);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(212, 175, 55, 0.12) inset;
    max-width: min(380px, 90vw);
    text-align: center;
    animation: ability-card-pop 300ms var(--ease-spring, cubic-bezier(0.34, 1.56, 0.64, 1));
}

@keyframes ability-card-pop {
    from {
        opacity: 0;
        transform: scale(0.85) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.announce-owner-badge {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid rgba(212, 175, 55, 0.35);
    color: rgba(212, 175, 55, 0.9);
    margin-bottom: 4px;
}

.announce-owner-badge.badge-rival {
    background: rgba(220, 80, 80, 0.15);
    border-color: rgba(220, 80, 80, 0.35);
    color: rgba(220, 120, 120, 0.9);
}

.announce-ability-icon {
    font-size: 2rem;
    line-height: 1;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.6));
}

.announce-character {
    font-size: 0.75rem;
    color: rgba(200, 190, 220, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.announce-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: rgba(212, 175, 55, 0.95);
    text-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
    letter-spacing: 0.02em;
}

.announce-description {
    font-size: 0.875rem;
    color: rgba(220, 210, 240, 0.85);
    line-height: 1.45;
    max-width: 280px;
}

/* ==========================================
   EFFECT ANNOUNCEMENT TOAST — Feedback rápido (1.5s)
   ========================================== */

.effect-announcement-screen {
    background: transparent;
    align-items: flex-end;
    padding-bottom: 80px;
    pointer-events: none;
}

.effect-announcement-toast {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(30, 26, 46, 0.95);
    border: 1px solid rgba(120, 100, 180, 0.4);
    border-radius: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    animation: toast-slide-up 250ms ease-out;
    max-width: min(340px, 88vw);
}

@keyframes toast-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.effect-icon {
    font-size: 1rem;
    color: rgba(150, 130, 220, 0.9);
}

.effect-description {
    font-size: 0.8rem;
    color: rgba(210, 205, 230, 0.9);
    font-weight: 500;
}

/* ==========================================
   STAT SELECTOR ALT - Tactical Command (2026)
   ========================================== */

.stat-selector-mage-slot {
    display: none;
}

#stat-selector.stat-selector-overlay--command .stat-selector-mage-slot,
#stat-selector.stat-selector-overlay--draft .stat-selector-mage-slot {
    --mage-accent: 126, 204, 255;
    --mage-shift-x: 0%;
    --mage-shift-y: 0%;
    --mage-rotate: -4deg;
    --mage-beam-angle: -92deg;
    --mage-beam-length: clamp(70px, 8.8vw, 118px);
    --mage-beam-scale: 0.76;
    --mage-beam-opacity: 0.62;
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: clamp(126px, 18vh, 188px);
    border-radius: 16px;
    border: 1px dashed rgba(194, 224, 255, 0.26);
    background:
        radial-gradient(circle at 50% 26%, rgba(var(--mage-accent), 0.18), rgba(var(--mage-accent), 0) 60%),
        linear-gradient(168deg, rgba(8, 20, 50, 0.76), rgba(6, 16, 42, 0.86));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 10px 22px rgba(3, 8, 24, 0.38);
    overflow: hidden;
    pointer-events: none;
}

#stat-selector.stat-selector-overlay--command .stat-selector-mage-slot::after,
#stat-selector.stat-selector-overlay--draft .stat-selector-mage-slot::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 38%;
    width: var(--mage-beam-length);
    height: 3px;
    border-radius: 999px;
    background:
        linear-gradient(90deg,
            rgba(252, 246, 225, 0.95) 0%,
            rgba(var(--mage-accent), 0.86) 34%,
            rgba(var(--mage-accent), 0) 100%);
    transform-origin: 0 50%;
    transform: translateX(-6%) rotate(var(--mage-beam-angle)) scaleX(var(--mage-beam-scale));
    opacity: var(--mage-beam-opacity);
    filter: drop-shadow(0 0 9px rgba(var(--mage-accent), 0.5));
    transition:
        transform 420ms cubic-bezier(0.2, 0.9, 0.24, 1),
        opacity 260ms ease,
        width 420ms cubic-bezier(0.2, 0.9, 0.24, 1);
}

.stat-selector-mage-aura {
    position: absolute;
    left: 50%;
    bottom: 18%;
    width: clamp(84px, 10.6vw, 142px);
    aspect-ratio: 1 / 1;
    transform: translate(-50%, 0);
    border-radius: 50%;
    background:
        radial-gradient(circle,
            rgba(var(--mage-accent), 0.34) 0%,
            rgba(var(--mage-accent), 0.14) 40%,
            rgba(var(--mage-accent), 0) 74%);
    opacity: 0.48;
    filter: blur(3px);
}

.stat-selector-mage-image {
    width: clamp(88px, 11vw, 148px);
    height: auto;
    max-width: 90%;
    object-fit: contain;
    transform-origin: 52% 80%;
    transform: translate(var(--mage-shift-x), var(--mage-shift-y)) rotate(var(--mage-rotate));
    transition:
        transform 420ms cubic-bezier(0.2, 0.9, 0.24, 1),
        filter 240ms ease;
    filter:
        drop-shadow(0 12px 14px rgba(3, 8, 24, 0.56)) drop-shadow(0 0 12px rgba(var(--mage-accent), 0.26));
    user-select: none;
    -webkit-user-drag: none;
}

#stat-selector .stat-selector-mage-image.guide-swap {
    animation: stat-selector-guide-swap 360ms cubic-bezier(0.24, 0.92, 0.26, 1);
}

@keyframes stat-selector-guide-swap {
    0% {
        opacity: 0;
        transform: translate(var(--mage-shift-x), calc(var(--mage-shift-y) + 4%)) rotate(calc(var(--mage-rotate) - 6deg)) scale(0.84);
        filter:
            drop-shadow(0 6px 8px rgba(3, 8, 24, 0.34)) drop-shadow(0 0 8px rgba(var(--mage-accent), 0.2));
    }

    58% {
        opacity: 1;
        transform: translate(var(--mage-shift-x), var(--mage-shift-y)) rotate(calc(var(--mage-rotate) + 1.5deg)) scale(1.05);
        filter:
            drop-shadow(0 13px 15px rgba(3, 8, 24, 0.58)) drop-shadow(0 0 14px rgba(var(--mage-accent), 0.36));
    }

    100% {
        opacity: 1;
        transform: translate(var(--mage-shift-x), var(--mage-shift-y)) rotate(var(--mage-rotate)) scale(1);
        filter:
            drop-shadow(0 12px 14px rgba(3, 8, 24, 0.56)) drop-shadow(0 0 12px rgba(var(--mage-accent), 0.26));
    }
}

body.theme-hp #stat-selector .stat-selector-mage-slot {
    --mage-accent: 126, 204, 255;
}

body.theme-af #stat-selector .stat-selector-mage-slot {
    --mage-accent: 168, 224, 152;
}

body.theme-hk #stat-selector .stat-selector-mage-slot {
    --mage-accent: 206, 168, 255;
}

#stat-selector[data-pointing-stat="Magia"] .stat-selector-mage-slot {
    --mage-shift-x: 0%;
    --mage-shift-y: 0%;
    --mage-rotate: -3deg;
    --mage-beam-angle: -92deg;
    --mage-beam-length: clamp(62px, 7.8vw, 104px);
    --mage-beam-scale: 0.66;
}

#stat-selector[data-pointing-stat="Habilidad"] .stat-selector-mage-slot {
    --mage-shift-x: -14%;
    --mage-shift-y: -5%;
    --mage-rotate: -15deg;
    --mage-beam-angle: -142deg;
    --mage-beam-length: clamp(100px, 10.8vw, 154px);
    --mage-beam-scale: 1;
}

#stat-selector[data-pointing-stat="Valor"] .stat-selector-mage-slot {
    --mage-shift-x: 14%;
    --mage-shift-y: -5%;
    --mage-rotate: 10deg;
    --mage-beam-angle: -40deg;
    --mage-beam-length: clamp(100px, 10.8vw, 154px);
    --mage-beam-scale: 1;
}

#stat-selector[data-pointing-stat="Astucia"] .stat-selector-mage-slot {
    --mage-shift-x: -12%;
    --mage-shift-y: 1%;
    --mage-rotate: -11deg;
    --mage-beam-angle: 170deg;
    --mage-beam-length: clamp(70px, 8.8vw, 124px);
    --mage-beam-scale: 0.9;
}

#stat-selector[data-pointing-stat="Intel"] .stat-selector-mage-slot {
    --mage-shift-x: 12%;
    --mage-shift-y: 1%;
    --mage-rotate: 8deg;
    --mage-beam-angle: 10deg;
    --mage-beam-length: clamp(70px, 8.8vw, 124px);
    --mage-beam-scale: 0.9;
}

#stat-selector[data-guide-character="knight"] .stat-selector-mage-slot,
#stat-selector[data-guide-character="dobby"] .stat-selector-mage-slot {
    --mage-shift-x: 0%;
    --mage-shift-y: 0%;
    --mage-rotate: 0deg;
    --mage-beam-opacity: 0.72;
}

#stat-selector[data-guide-character="knight"] .stat-selector-mage-slot {
    --mage-beam-opacity: 0.78;
}

#stat-selector[data-guide-character="dobby"] .stat-selector-mage-slot {
    --mage-beam-opacity: 0.9;
}

#stat-selector[data-guide-character="knight"] .stat-selector-mage-slot::after {
    height: 4px;
    background:
        linear-gradient(90deg,
            rgba(235, 242, 255, 0.98) 0%,
            rgba(170, 188, 214, 0.9) 46%,
            rgba(113, 130, 160, 0.24) 82%,
            rgba(113, 130, 160, 0) 100%);
    filter:
        drop-shadow(0 0 10px rgba(201, 217, 255, 0.56)) drop-shadow(0 0 4px rgba(88, 104, 136, 0.36));
}

#stat-selector[data-guide-character="dobby"] .stat-selector-mage-slot::after {
    height: 5px;
    background:
        linear-gradient(90deg,
            rgba(255, 248, 228, 0.96) 0%,
            rgba(180, 241, 255, 0.92) 32%,
            rgba(155, 192, 255, 0.84) 62%,
            rgba(198, 153, 255, 0.66) 84%,
            rgba(198, 153, 255, 0) 100%);
    filter:
        drop-shadow(0 0 12px rgba(170, 231, 255, 0.72)) drop-shadow(0 0 5px rgba(150, 170, 255, 0.5));
}

#stat-selector[data-guide-character="knight"] .stat-selector-mage-slot::before,
#stat-selector[data-guide-character="dobby"] .stat-selector-mage-slot::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 38%;
    opacity: 0;
    pointer-events: none;
    transform-origin: 0 50%;
}

#stat-selector[data-guide-character="knight"] .stat-selector-mage-slot::before {
    width: 54px;
    height: 12px;
    border-radius: 999px;
    border: 1px solid rgba(204, 215, 236, 0.72);
    background: linear-gradient(90deg, #4e596f 0%, #b8c4d8 58%, #f0f5ff 100%);
    clip-path: polygon(0 38%, 66% 38%, 82% 18%, 100% 50%, 82% 82%, 66% 62%, 0 62%);
    box-shadow:
        inset 0 0 4px rgba(242, 247, 255, 0.38),
        0 0 14px rgba(180, 201, 236, 0.52);
    transform: translateX(-6%) rotate(var(--mage-beam-angle)) scale(0.58);
}

#stat-selector[data-guide-character="dobby"] .stat-selector-mage-slot::before {
    width: 58px;
    height: 28px;
    background:
        radial-gradient(circle, rgba(255, 251, 231, 0.98) 0 30%, rgba(255, 251, 231, 0) 62%) 8% 52% / 16px 16px no-repeat,
        radial-gradient(circle, rgba(206, 248, 255, 0.96) 0 32%, rgba(206, 248, 255, 0) 60%) 44% 26% / 12px 12px no-repeat,
        radial-gradient(circle, rgba(205, 185, 255, 0.9) 0 34%, rgba(205, 185, 255, 0) 62%) 74% 72% / 11px 11px no-repeat,
        radial-gradient(circle, rgba(150, 225, 255, 0.96) 0 36%, rgba(150, 225, 255, 0) 65%) 100% 48% / 14px 14px no-repeat;
    filter:
        drop-shadow(0 0 10px rgba(151, 231, 255, 0.82)) drop-shadow(0 0 4px rgba(195, 164, 255, 0.58));
    transform: translateX(-6%) rotate(var(--mage-beam-angle)) scale(0.66);
}

#stat-selector[data-guide-character="knight"] .stat-selector-mage-image {
    width: clamp(122px, 14vw, 196px);
}

#stat-selector[data-guide-character="dobby"] .stat-selector-mage-image {
    width: clamp(112px, 12.8vw, 182px);
}

#stat-selector.stat-selector-overlay--command[data-guide-character="knight"] .stat-selector-mage-image,
#stat-selector.stat-selector-overlay--draft[data-guide-character="knight"] .stat-selector-mage-image {
    width: clamp(122px, 14vw, 196px);
}

#stat-selector.stat-selector-overlay--command[data-guide-character="dobby"] .stat-selector-mage-image,
#stat-selector.stat-selector-overlay--draft[data-guide-character="dobby"] .stat-selector-mage-image {
    width: clamp(112px, 12.8vw, 182px);
}

#stat-selector.stat-selector-mage-casting .stat-selector-mage-aura {
    animation: stat-selector-mage-aura-cast 740ms ease-out;
}

#stat-selector.stat-selector-mage-casting .stat-selector-mage-slot::after {
    animation: stat-selector-mage-beam-cast 740ms ease-out;
}

#stat-selector.stat-selector-mage-casting .stat-selector-mage-image {
    animation: stat-selector-guide-cast-pop 740ms cubic-bezier(0.2, 0.92, 0.2, 1);
}

#stat-selector.stat-selector-mage-casting[data-guide-character="knight"] .stat-selector-mage-slot::before {
    animation: stat-selector-knight-nail-cast 760ms cubic-bezier(0.12, 0.92, 0.18, 1) both;
}

#stat-selector.stat-selector-mage-casting[data-guide-character="dobby"] .stat-selector-mage-slot::before {
    animation: stat-selector-dobby-particles-cast 820ms cubic-bezier(0.18, 0.88, 0.22, 1) both;
}

@keyframes stat-selector-mage-aura-cast {
    0% {
        opacity: 0.3;
        transform: translate(-50%, 6px) scale(0.84);
    }

    35% {
        opacity: 0.94;
        transform: translate(-50%, -4px) scale(1.18);
    }

    100% {
        opacity: 0.52;
        transform: translate(-50%, 0) scale(1);
    }
}

@keyframes stat-selector-mage-beam-cast {
    0% {
        opacity: 0.14;
        transform: translateX(-6%) rotate(var(--mage-beam-angle)) scaleX(0.18);
        filter: drop-shadow(0 0 4px rgba(var(--mage-accent), 0.22));
    }

    42% {
        opacity: 1;
        transform: translateX(-6%) rotate(var(--mage-beam-angle)) scaleX(1.08);
        filter: drop-shadow(0 0 16px rgba(var(--mage-accent), 0.62));
    }

    100% {
        opacity: var(--mage-beam-opacity);
        transform: translateX(-6%) rotate(var(--mage-beam-angle)) scaleX(var(--mage-beam-scale));
        filter: drop-shadow(0 0 9px rgba(var(--mage-accent), 0.5));
    }
}

@keyframes stat-selector-guide-cast-pop {
    0% {
        transform: translate(var(--mage-shift-x), calc(var(--mage-shift-y) + 2%)) rotate(calc(var(--mage-rotate) - 4deg)) scale(0.9);
    }

    38% {
        transform: translate(var(--mage-shift-x), calc(var(--mage-shift-y) - 1%)) rotate(calc(var(--mage-rotate) + 3deg)) scale(1.08);
    }

    100% {
        transform: translate(var(--mage-shift-x), var(--mage-shift-y)) rotate(var(--mage-rotate)) scale(1);
    }
}

@keyframes stat-selector-knight-nail-cast {
    0% {
        opacity: 0;
        transform: translateX(-8%) rotate(var(--mage-beam-angle)) scale(0.46);
    }

    24% {
        opacity: 1;
    }

    70% {
        opacity: 0.96;
        transform: translateX(calc(-6% + (var(--mage-beam-length) * 0.74))) rotate(var(--mage-beam-angle)) scale(0.98);
    }

    100% {
        opacity: 0;
        transform: translateX(calc(-6% + (var(--mage-beam-length) * 0.9))) rotate(var(--mage-beam-angle)) scale(0.82);
    }
}

@keyframes stat-selector-dobby-particles-cast {
    0% {
        opacity: 0;
        transform: translateX(-8%) rotate(var(--mage-beam-angle)) scale(0.56);
    }

    36% {
        opacity: 1;
        transform: translateX(calc(-6% + (var(--mage-beam-length) * 0.28))) rotate(var(--mage-beam-angle)) scale(0.86);
    }

    72% {
        opacity: 0.92;
        transform: translateX(calc(-6% + (var(--mage-beam-length) * 0.62))) rotate(var(--mage-beam-angle)) scale(1.04);
    }

    100% {
        opacity: 0;
        transform: translateX(calc(-6% + (var(--mage-beam-length) * 0.86))) rotate(var(--mage-beam-angle)) scale(0.88);
    }
}

#stat-selector.stat-selector-overlay--command .stat-selector-backdrop {
    background:
        radial-gradient(circle at 50% 18%, rgba(122, 201, 255, 0.12), rgba(122, 201, 255, 0) 48%),
        linear-gradient(165deg, rgba(4, 10, 24, 0.8), rgba(4, 10, 24, 0.9));
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
}

#stat-selector.stat-selector-overlay--command .stat-selector-panel {
    width: min(980px, 96vw);
    height: auto;
    max-height: min(92vh, 900px);
    padding: clamp(14px, 2.2vw, 24px);
    border-radius: clamp(20px, 2.6vw, 30px);
    background:
        radial-gradient(circle at 10% 8%, rgba(152, 219, 255, 0.18), rgba(152, 219, 255, 0) 34%),
        radial-gradient(circle at 92% 92%, rgba(238, 187, 110, 0.13), rgba(238, 187, 110, 0) 36%),
        linear-gradient(168deg, rgba(8, 18, 44, 0.96), rgba(4, 12, 34, 0.98));
    border: 1px solid rgba(164, 210, 255, 0.34);
    box-shadow:
        0 26px 60px rgba(3, 8, 24, 0.6),
        inset 0 1px 0 rgba(236, 247, 255, 0.24);
}

#stat-selector.stat-selector-overlay--command .stat-selector-header {
    text-align: left;
    margin-bottom: clamp(12px, 1.8vw, 18px);
    padding-inline: clamp(2px, 0.8vw, 8px);
}

#stat-selector.stat-selector-overlay--command .stat-selector-character-name {
    font-family: var(--font-primary-ui);
    font-size: clamp(1.25rem, 2.8vw, 2rem);
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(243, 248, 255, 0.98);
    text-shadow: 0 6px 14px rgba(0, 0, 0, 0.44);
}

#stat-selector.stat-selector-overlay--command .stat-selector-subtitle {
    margin-top: 4px;
    font-family: var(--font-secondary);
    font-size: clamp(0.82rem, 1.55vw, 1.02rem);
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(197, 220, 247, 0.94);
}

#stat-selector.stat-selector-overlay--command .stat-selector-grid.arcane-network-container {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(140px, 1fr));
    gap: clamp(10px, 1.6vw, 16px);
    padding: clamp(10px, 1.8vw, 16px);
    min-height: min(58vh, 500px);
    border-radius: clamp(16px, 2.2vw, 22px);
    border: 1px solid rgba(167, 207, 249, 0.26);
    background:
        linear-gradient(156deg, rgba(10, 23, 58, 0.9), rgba(6, 18, 46, 0.94)),
        radial-gradient(circle at 12% 16%, rgba(123, 202, 255, 0.15), rgba(123, 202, 255, 0) 34%),
        radial-gradient(circle at 88% 84%, rgba(251, 215, 151, 0.12), rgba(251, 215, 151, 0) 36%);
    box-shadow:
        inset 0 1px 0 rgba(237, 246, 255, 0.16),
        inset 0 -24px 44px rgba(2, 8, 22, 0.46);
}

#stat-selector.stat-selector-overlay--command .stat-selector-grid::before,
#stat-selector.stat-selector-overlay--command .stat-selector-grid::after,
#stat-selector.stat-selector-overlay--command .arcane-network-container::before,
#stat-selector.stat-selector-overlay--command .arcane-network-container::after,
#stat-selector.stat-selector-overlay--command .arcane-connections,
#stat-selector.stat-selector-overlay--command .arcane-circle-bg,
#stat-selector.stat-selector-overlay--command .arcane-particles {
    display: none !important;
    content: none !important;
}

#stat-selector.stat-selector-overlay--command .arcane-node {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    transform: none;
    width: auto;
    height: auto;
    min-height: clamp(136px, 17vh, 176px);
    padding: 10px 10px 12px;
    border-radius: 16px;
    border: 1px solid rgba(196, 224, 255, 0.24);
    background:
        radial-gradient(circle at 16% 14%, rgba(var(--node-accent), 0.26), rgba(var(--node-accent), 0) 40%),
        linear-gradient(162deg, rgba(19, 35, 79, 0.86), rgba(10, 21, 54, 0.9));
    box-shadow:
        0 12px 28px rgba(4, 9, 26, 0.44),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
    display: grid;
    grid-template-rows: auto auto auto;
    justify-items: center;
    align-content: center;
    gap: 8px;
    filter: none;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

#stat-selector.stat-selector-overlay--command .arcane-node::before {
    display: none;
}

#stat-selector.stat-selector-overlay--command .arcane-node:hover,
#stat-selector.stat-selector-overlay--command .arcane-node:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(var(--node-accent), 0.76);
    box-shadow:
        0 16px 30px rgba(4, 9, 26, 0.5),
        0 0 24px rgba(var(--node-accent), 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#stat-selector.stat-selector-overlay--command .arcane-node.active {
    transform: translateY(-3px) scale(1.015);
    border-color: rgba(var(--node-accent), 0.92);
    box-shadow:
        0 18px 32px rgba(3, 7, 21, 0.58),
        0 0 32px rgba(var(--node-accent), 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

#stat-selector.stat-selector-overlay--command .arcane-node.is-recommended:not(.impact-burst)::after {
    content: 'RECOMENDADO';
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    font-family: var(--font-primary-ui);
    font-size: 0.52rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    color: rgba(20, 18, 8, 0.94);
    background: linear-gradient(140deg, rgba(251, 229, 160, 0.96), rgba(233, 182, 95, 0.96));
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.32);
    pointer-events: none;
}

#stat-selector.stat-selector-overlay--command .node-visual {
    width: clamp(70px, 7.2vw, 90px);
    height: clamp(70px, 7.2vw, 90px);
    margin: 0;
}

#stat-selector.stat-selector-overlay--command .node-visual::after {
    animation: none;
}

#stat-selector.stat-selector-overlay--command .node-glow {
    opacity: 0.42;
    filter: blur(6px);
}

#stat-selector.stat-selector-overlay--command .node-label {
    width: auto;
    margin-top: 0;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid rgba(214, 234, 255, 0.3);
    background: rgba(5, 13, 36, 0.5);
    font-size: clamp(0.7rem, 1.2vw, 0.86rem);
    font-weight: 700;
    letter-spacing: 0.07em;
    color: rgba(233, 244, 255, 0.96);
}

#stat-selector.stat-selector-overlay--command .node-value {
    margin-top: 0;
    min-width: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    font-family: var(--font-numeric);
    font-size: clamp(1.34rem, 2.8vw, 2rem);
    font-weight: 900;
    line-height: 1;
    color: rgba(248, 252, 255, 0.99);
    text-shadow:
        0 0 18px rgba(var(--node-accent), 0.44),
        0 2px 8px rgba(0, 0, 0, 0.58);
    transform: none;
}

#stat-selector.stat-selector-overlay--command .node-value[data-mod-tone="buff"] {
    color: rgba(171, 255, 213, 0.99);
}

#stat-selector.stat-selector-overlay--command .node-value[data-mod-tone="debuff"] {
    color: rgba(255, 182, 191, 0.99);
}

#stat-selector.stat-selector-overlay--command #btn-select-Habilidad {
    grid-column: 1;
    grid-row: 1;
}

#stat-selector.stat-selector-overlay--command #btn-select-Valor {
    grid-column: 3;
    grid-row: 1;
}

#stat-selector.stat-selector-overlay--command #btn-select-Magia {
    grid-column: 2;
    grid-row: 1;
}

#stat-selector.stat-selector-overlay--command #btn-select-Astucia {
    grid-column: 1;
    grid-row: 2;
}

#stat-selector.stat-selector-overlay--command #btn-select-Intel {
    grid-column: 3;
    grid-row: 2;
}

#stat-selector.stat-selector-overlay--command .stat-selector-mage-slot {
    grid-column: 2;
    grid-row: 2;
}

#stat-selector.stat-selector-overlay--command #btn-select-Magia .node-visual {
    width: clamp(78px, 8.8vw, 110px);
    height: clamp(78px, 8.8vw, 110px);
}

#stat-selector.stat-selector-overlay--command #btn-select-Magia .node-value {
    font-size: clamp(1.5rem, 3vw, 2.1rem);
}

#stat-selector.stat-selector-overlay--command:not(.hidden) .arcane-node {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    animation: stat-command-node-rise 360ms var(--ease-spring) forwards;
    animation-delay: var(--node-enter-delay, 0ms);
}

@keyframes stat-command-node-rise {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 760px) {
    #stat-selector.stat-selector-overlay--command .stat-selector-panel {
        width: min(95vw, 560px);
        padding: 12px;
    }

    #stat-selector.stat-selector-overlay--command .stat-selector-header {
        text-align: center;
    }

    #stat-selector.stat-selector-overlay--command .stat-selector-grid.arcane-network-container {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: repeat(2, minmax(118px, auto));
        min-height: 0;
    }

    #stat-selector.stat-selector-overlay--command #btn-select-Magia {
        grid-column: 2;
        grid-row: 1;
    }

    #stat-selector.stat-selector-overlay--command #btn-select-Habilidad {
        grid-column: 1;
        grid-row: 1;
    }

    #stat-selector.stat-selector-overlay--command #btn-select-Valor {
        grid-column: 3;
        grid-row: 1;
    }

    #stat-selector.stat-selector-overlay--command #btn-select-Astucia {
        grid-column: 1;
        grid-row: 2;
    }

    #stat-selector.stat-selector-overlay--command #btn-select-Intel {
        grid-column: 3;
        grid-row: 2;
    }

    #stat-selector.stat-selector-overlay--command .stat-selector-mage-slot {
        grid-column: 2;
        grid-row: 2;
        min-height: 118px;
    }

    #stat-selector.stat-selector-overlay--command .arcane-node {
        min-height: 122px;
        padding-block: 10px;
    }

    #stat-selector.stat-selector-overlay--command .node-visual {
        width: clamp(62px, 20vw, 82px);
        height: clamp(62px, 20vw, 82px);
    }

    #stat-selector.stat-selector-overlay--command .node-value {
        font-size: clamp(1.18rem, 5.8vw, 1.7rem);
    }

    #stat-selector.stat-selector-overlay--command .stat-selector-mage-image {
        width: clamp(70px, 20vw, 108px);
    }

    #stat-selector[data-guide-character="knight"] .stat-selector-mage-image {
        width: clamp(100px, 28vw, 146px);
    }

    #stat-selector[data-guide-character="dobby"] .stat-selector-mage-image {
        width: clamp(92px, 25vw, 136px);
    }

    #stat-selector.stat-selector-overlay--command[data-guide-character="knight"] .stat-selector-mage-image,
    #stat-selector.stat-selector-overlay--draft[data-guide-character="knight"] .stat-selector-mage-image {
        width: clamp(100px, 28vw, 146px);
    }

    #stat-selector.stat-selector-overlay--command[data-guide-character="dobby"] .stat-selector-mage-image,
    #stat-selector.stat-selector-overlay--draft[data-guide-character="dobby"] .stat-selector-mage-image {
        width: clamp(92px, 25vw, 136px);
    }
}

@media (prefers-reduced-motion: reduce) {

    #stat-selector.stat-selector-overlay--command .arcane-node,
    #stat-selector.stat-selector-overlay--command .arcane-node.active,
    #stat-selector.stat-selector-overlay--command .node-glow,
    #stat-selector.stat-selector-overlay--command .stat-selector-mage-slot::before,
    #stat-selector.stat-selector-overlay--command .stat-selector-mage-slot::after,
    #stat-selector.stat-selector-overlay--command .stat-selector-mage-aura,
    #stat-selector.stat-selector-overlay--command .stat-selector-mage-image {
        animation: none !important;
        transition: none !important;
    }
}

/* ==========================================
   STAT SELECTOR ALT 2 - Draft Rail
   ========================================== */

#stat-selector.stat-selector-overlay--draft .stat-selector-backdrop {
    background:
        radial-gradient(circle at 50% -10%, rgba(173, 215, 255, 0.18), rgba(173, 215, 255, 0) 52%),
        linear-gradient(160deg, rgba(4, 10, 24, 0.82), rgba(5, 12, 28, 0.92));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#stat-selector.stat-selector-overlay--draft .stat-selector-panel {
    width: min(1160px, 96vw);
    height: auto;
    max-height: min(90vh, 840px);
    padding: clamp(14px, 2vw, 22px);
    border-radius: clamp(20px, 2.6vw, 30px);
    background:
        radial-gradient(circle at 10% 8%, rgba(151, 212, 255, 0.2), rgba(151, 212, 255, 0) 35%),
        radial-gradient(circle at 92% 90%, rgba(243, 197, 120, 0.16), rgba(243, 197, 120, 0) 32%),
        linear-gradient(166deg, rgba(8, 19, 46, 0.96), rgba(4, 12, 34, 0.98));
    border: 1px solid rgba(157, 204, 248, 0.34);
    box-shadow:
        0 26px 64px rgba(3, 8, 22, 0.62),
        inset 0 1px 0 rgba(235, 246, 255, 0.24);
}

#stat-selector.stat-selector-overlay--draft .stat-selector-header {
    margin-bottom: clamp(10px, 1.8vw, 16px);
    text-align: left;
    padding-inline: clamp(4px, 0.8vw, 10px);
}

#stat-selector.stat-selector-overlay--draft .stat-selector-character-name {
    font-family: var(--font-primary-ui);
    font-size: clamp(1.2rem, 2.2vw, 1.9rem);
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(245, 250, 255, 0.98);
    text-shadow: 0 6px 14px rgba(0, 0, 0, 0.46);
}

#stat-selector.stat-selector-overlay--draft .stat-selector-subtitle {
    margin-top: 4px;
    font-family: var(--font-secondary);
    font-size: clamp(0.8rem, 1.34vw, 0.96rem);
    font-weight: 600;
    color: rgba(197, 222, 250, 0.92);
}

#stat-selector.stat-selector-overlay--draft .stat-selector-grid.arcane-network-container {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(148px, 1fr));
    gap: clamp(10px, 1.25vw, 14px);
    padding: clamp(10px, 1.4vw, 14px);
    min-height: min(56vh, 492px);
    border-radius: clamp(16px, 2.2vw, 22px);
    border: 1px solid rgba(171, 208, 248, 0.26);
    background:
        linear-gradient(160deg, rgba(9, 23, 58, 0.9), rgba(5, 16, 44, 0.94)),
        radial-gradient(circle at 12% 16%, rgba(123, 202, 255, 0.12), rgba(123, 202, 255, 0) 34%),
        radial-gradient(circle at 84% 82%, rgba(251, 215, 151, 0.1), rgba(251, 215, 151, 0) 36%);
    box-shadow:
        inset 0 1px 0 rgba(236, 246, 255, 0.16),
        inset 0 -24px 42px rgba(2, 8, 24, 0.48);
}

#stat-selector.stat-selector-overlay--draft .stat-selector-grid::before,
#stat-selector.stat-selector-overlay--draft .stat-selector-grid::after,
#stat-selector.stat-selector-overlay--draft .arcane-network-container::before,
#stat-selector.stat-selector-overlay--draft .arcane-network-container::after,
#stat-selector.stat-selector-overlay--draft .arcane-connections,
#stat-selector.stat-selector-overlay--draft .arcane-circle-bg,
#stat-selector.stat-selector-overlay--draft .arcane-particles {
    display: none !important;
    content: none !important;
}

#stat-selector.stat-selector-overlay--draft .arcane-node {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
    transform: none;
    width: auto;
    height: auto;
    min-height: clamp(142px, 22vh, 204px);
    padding: 14px 10px 12px;
    border-radius: 16px;
    border: 1px solid rgba(191, 221, 255, 0.24);
    background:
        radial-gradient(circle at 16% 12%, rgba(var(--node-accent), 0.22), rgba(var(--node-accent), 0) 42%),
        linear-gradient(164deg, rgba(20, 36, 82, 0.88), rgba(8, 21, 54, 0.92));
    box-shadow:
        0 14px 28px rgba(3, 8, 24, 0.42),
        inset 0 1px 0 rgba(255, 255, 255, 0.14);
    display: grid;
    grid-template-rows: auto auto auto;
    justify-items: center;
    align-content: center;
    gap: 10px;
    filter: none;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

#stat-selector.stat-selector-overlay--draft .arcane-node::before,
#stat-selector.stat-selector-overlay--draft .arcane-node::after {
    display: none;
}

#stat-selector.stat-selector-overlay--draft .arcane-node:hover,
#stat-selector.stat-selector-overlay--draft .arcane-node:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(var(--node-accent), 0.74);
    box-shadow:
        0 18px 30px rgba(3, 8, 24, 0.52),
        0 0 24px rgba(var(--node-accent), 0.24),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#stat-selector.stat-selector-overlay--draft .arcane-node.active {
    transform: translateY(-3px) scale(1.02);
    border-color: rgba(var(--node-accent), 0.92);
    box-shadow:
        0 22px 36px rgba(3, 7, 21, 0.6),
        0 0 34px rgba(var(--node-accent), 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

#stat-selector.stat-selector-overlay--draft .node-visual {
    width: clamp(72px, 6.6vw, 94px);
    height: clamp(72px, 6.6vw, 94px);
    margin: 0;
}

#stat-selector.stat-selector-overlay--draft .node-visual::before,
#stat-selector.stat-selector-overlay--draft .node-visual::after {
    animation: none;
}

#stat-selector.stat-selector-overlay--draft .node-glow {
    opacity: 0.4;
    filter: blur(6px);
}

#stat-selector.stat-selector-overlay--draft .node-label {
    width: auto;
    margin-top: 0;
    padding: 2px 10px;
    border-radius: 999px;
    border: 1px solid rgba(214, 234, 255, 0.28);
    background: rgba(5, 13, 36, 0.5);
    font-size: clamp(0.68rem, 1.12vw, 0.84rem);
    font-weight: 800;
    letter-spacing: 0.08em;
    color: rgba(235, 245, 255, 0.96);
}

#stat-selector.stat-selector-overlay--draft .node-value {
    margin-top: 0;
    min-width: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    font-family: var(--font-numeric);
    font-size: clamp(1.44rem, 2.2vw, 2.1rem);
    font-weight: 900;
    line-height: 1;
    color: rgba(248, 252, 255, 0.99);
    text-shadow:
        0 0 18px rgba(var(--node-accent), 0.44),
        0 2px 8px rgba(0, 0, 0, 0.58);
    transform: none;
}

#stat-selector.stat-selector-overlay--draft .node-value[data-mod-tone="buff"] {
    color: rgba(171, 255, 213, 0.99);
}

#stat-selector.stat-selector-overlay--draft .node-value[data-mod-tone="debuff"] {
    color: rgba(255, 182, 191, 0.99);
}

#stat-selector.stat-selector-overlay--draft #btn-select-Magia {
    grid-column: 2;
    grid-row: 1;
}

#stat-selector.stat-selector-overlay--draft #btn-select-Habilidad {
    grid-column: 1;
    grid-row: 1;
}

#stat-selector.stat-selector-overlay--draft #btn-select-Intel {
    grid-column: 3;
    grid-row: 2;
}

#stat-selector.stat-selector-overlay--draft #btn-select-Valor {
    grid-column: 3;
    grid-row: 1;
}

#stat-selector.stat-selector-overlay--draft #btn-select-Astucia {
    grid-column: 1;
    grid-row: 2;
}

#stat-selector.stat-selector-overlay--draft .stat-selector-mage-slot {
    grid-column: 2;
    grid-row: 2;
}

/* Draft Rail enter animation removed – Void Tiles handles its own entrance */

@keyframes stat-draft-node-rise {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 760px) {
    #stat-selector.stat-selector-overlay--draft .stat-selector-panel {
        width: min(95vw, 640px);
        max-height: min(92vh, 760px);
        padding: 10px;
    }

    #stat-selector.stat-selector-overlay--draft .stat-selector-header {
        text-align: center;
        margin-bottom: 8px;
    }

    #stat-selector.stat-selector-overlay--draft .stat-selector-grid.arcane-network-container {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: repeat(2, minmax(118px, auto));
        gap: 8px;
        padding: 8px;
        overflow: visible;
        min-height: 0;
    }

    #stat-selector.stat-selector-overlay--draft .arcane-node {
        min-height: 124px;
        padding: 10px 6px 8px;
        gap: 8px;
    }

    #stat-selector.stat-selector-overlay--draft .stat-selector-mage-slot {
        min-height: 118px;
    }

    #stat-selector.stat-selector-overlay--draft .node-visual {
        width: clamp(54px, 14vw, 72px);
        height: clamp(54px, 14vw, 72px);
    }

    #stat-selector.stat-selector-overlay--draft .node-label {
        font-size: clamp(0.58rem, 2vw, 0.72rem);
        padding: 2px 8px;
    }

    #stat-selector.stat-selector-overlay--draft .node-value {
        font-size: clamp(1.08rem, 4.6vw, 1.42rem);
    }

    #stat-selector.stat-selector-overlay--draft .stat-selector-mage-image {
        width: clamp(66px, 19vw, 102px);
    }
}

@media (prefers-reduced-motion: reduce) {

    #stat-selector.stat-selector-overlay--draft .arcane-node,
    #stat-selector.stat-selector-overlay--draft .arcane-node.active,
    #stat-selector.stat-selector-overlay--draft .node-glow,
    #stat-selector.stat-selector-overlay--draft .stat-selector-mage-slot::before,
    #stat-selector.stat-selector-overlay--draft .stat-selector-mage-slot::after,
    #stat-selector.stat-selector-overlay--draft .stat-selector-mage-aura,
    #stat-selector.stat-selector-overlay--draft .stat-selector-mage-image {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================================
   STAT SELECTOR — VOID TILES REDESIGN
   CSS Grid layout. All JS hooks (IDs, class names) preserved.
   ============================================================ */

/* --- Per-set accent (panel chrome, header name, backdrop) --- */
#stat-selector {
    --ss-accent: 130, 220, 210;      /* default: teal */
}
body[data-set="hp"] #stat-selector,
body[data-set="HP"] #stat-selector {
    --ss-accent: 240, 200, 80;       /* HP: warm gold */
}
body[data-set="hk"] #stat-selector,
body[data-set="HK"] #stat-selector {
    --ss-accent: 32, 214, 199;       /* HK: cyan-teal */
}
body[data-set="af"] #stat-selector,
body[data-set="AF"] #stat-selector {
    --ss-accent: 180, 100, 255;      /* AF: arcane violet */
}

/* --- Backdrop: atmospheric radial void --- */
#stat-selector .stat-selector-backdrop {
    background: radial-gradient(
        ellipse 80% 60% at 50% 20%,
        rgba(var(--ss-accent), 0.09) 0%,
        rgba(4, 6, 20, 0.82) 55%,
        rgba(2, 3, 12, 0.92) 100%
    ) !important;
}
#stat-selector .stat-selector-backdrop::before {
    display: none !important;
}

/* --- Grid container: 3-col layout with mage character in center --- */
#stat-selector .stat-selector-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    grid-template-rows: 1fr 1fr !important;
    grid-template-areas:
        "habilidad  magia   valor"
        "astucia    mage    intel" !important;
    gap: clamp(8px, 1.4vw, 14px) !important;
    min-height: unset !important;
    padding: 2px !important;
    align-items: stretch !important;
}
/* Kill the spinning conic aura pseudo-elements on the old grid */
#stat-selector .stat-selector-grid::before,
#stat-selector .stat-selector-grid::after {
    display: none !important;
}

/* --- Hide decorative arcane elements (keep mage-slot visible) --- */
#stat-selector .arcane-circle-bg,
#stat-selector .arcane-particles,
#stat-selector .arcane-connections,
#stat-selector .node-glow {
    display: none !important;
}

/* --- Grid area assignments (JS engine assigns IDs, not areas) --- */
#stat-selector #btn-select-Habilidad { grid-area: habilidad; }
#stat-selector #btn-select-Valor     { grid-area: valor; }
#stat-selector #btn-select-Astucia   { grid-area: astucia; }
#stat-selector #btn-select-Intel     { grid-area: intel; }
#stat-selector #btn-select-Magia     { grid-area: magia; }

/* --- Mage character slot (center cell, grid-aware) --- */
#stat-selector .stat-selector-mage-slot {
    grid-area: mage !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    background: radial-gradient(
        circle at 50% 40%,
        rgba(var(--ss-accent), 0.10) 0%,
        rgba(6, 9, 26, 0.70) 70%
    ) !important;
    border: 1px solid rgba(var(--ss-accent), 0.18) !important;
}
#stat-selector .stat-selector-mage-aura {
    position: absolute !important;
    inset: 0 !important;
    background: radial-gradient(
        circle at 50% 50%,
        rgba(var(--ss-accent), 0.15) 0%,
        transparent 65%
    ) !important;
    pointer-events: none !important;
    transition: opacity 300ms ease !important;
}
#stat-selector .stat-selector-mage-image {
    position: relative !important;
    width: clamp(80px, 10vw, 130px) !important;
    height: auto !important;
    max-height: 100% !important;
    object-fit: contain !important;
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.5))
            drop-shadow(0 0 12px rgba(var(--ss-accent), 0.25)) !important;
    transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1) !important;
}
/* Casting animation: mage glows + scales up when stat is picked */
#stat-selector.stat-selector-mage-casting .stat-selector-mage-image {
    transform: scale(1.08) !important;
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.5))
            drop-shadow(0 0 28px rgba(var(--ss-accent), 0.6)) !important;
}
#stat-selector.stat-selector-mage-casting .stat-selector-mage-aura {
    opacity: 1 !important;
}

/* --- Override absolute positioning set by engine's position classes --- */
#stat-selector .arcane-node.node-center,
#stat-selector .arcane-node.node-top-left,
#stat-selector .arcane-node.node-top-right,
#stat-selector .arcane-node.node-bottom-left,
#stat-selector .arcane-node.node-bottom-right {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;
}

/* --- Tile base style --- */
#stat-selector .arcane-node {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 100% !important;
    height: auto !important;

    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    padding: clamp(14px, 2vw, 22px) clamp(10px, 1.6vw, 18px) clamp(16px, 2.4vw, 26px) !important;

    background:
        linear-gradient(
            155deg,
            rgba(var(--node-accent), 0.06) 0%,
            rgba(10, 14, 38, 0.88) 40%,
            rgba(6, 9, 26, 0.94) 100%
        ) !important;
    border: 1px solid rgba(var(--node-accent), 0.26) !important;
    border-radius: 14px !important;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(var(--node-accent), 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;

    cursor: pointer !important;
    filter: none !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    animation: void-tile-enter 0.42s cubic-bezier(0.22, 1, 0.36, 1) both !important;
    transition:
        border-color 190ms ease,
        box-shadow 190ms ease,
        transform 160ms ease !important;
}

/* --- Click-target expander: hide (tile is full clickable area) --- */
#stat-selector .arcane-node::before {
    display: none !important;
}

/* --- Staggered entrance delays --- */
#stat-selector #btn-select-Habilidad.arcane-node { animation-delay: 0.06s !important; }
#stat-selector #btn-select-Valor.arcane-node     { animation-delay: 0.12s !important; }
#stat-selector #btn-select-Astucia.arcane-node   { animation-delay: 0.18s !important; }
#stat-selector #btn-select-Intel.arcane-node     { animation-delay: 0.24s !important; }
#stat-selector #btn-select-Magia.arcane-node     { animation-delay: 0.30s !important; }

@keyframes void-tile-enter {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* --- Hover --- */
#stat-selector .arcane-node:hover {
    border-color: rgba(var(--node-accent), 0.65) !important;
    box-shadow:
        0 8px 28px rgba(0, 0, 0, 0.6),
        0 0 16px rgba(var(--node-accent), 0.14),
        0 0 0 1px rgba(var(--node-accent), 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.09) !important;
    transform: translateY(-3px) !important;
}
#stat-selector .arcane-node:active {
    transform: scale(0.97) !important;
}

/* --- Active / selected state --- */
#stat-selector .arcane-node.active {
    border-color: rgba(var(--node-accent), 0.88) !important;
    background:
        linear-gradient(
            155deg,
            rgba(var(--node-accent), 0.16) 0%,
            rgba(10, 14, 38, 0.88) 50%,
            rgba(6, 9, 26, 0.94) 100%
        ) !important;
    box-shadow:
        0 8px 28px rgba(0, 0, 0, 0.6),
        0 0 24px rgba(var(--node-accent), 0.26),
        0 0 0 1px rgba(var(--node-accent), 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    transform: none !important;
}

/* --- Icon badge (circular, floats at top of tile) --- */
#stat-selector .node-visual {
    position: relative !important;
    width: clamp(54px, 5.4vw, 72px) !important;
    height: clamp(54px, 5.4vw, 72px) !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
    margin-bottom: clamp(9px, 1.2vw, 13px) !important;
    background:
        radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 48%),
        radial-gradient(circle at 50% 62%, rgba(var(--node-accent), 0.26) 0%, rgba(14, 18, 50, 0.96) 70%) !important;
    border: 1px solid rgba(var(--node-accent), 0.32) !important;
    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.45),
        0 0 10px rgba(var(--node-accent), 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
    transition: transform 190ms ease, box-shadow 190ms ease !important;
    overflow: hidden !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}
/* Remove old ring and halo-spin on icon inside stat-selector */
#stat-selector .node-visual::before,
#stat-selector .node-visual::after {
    display: none !important;
}

/* Hover: lift icon badge */
#stat-selector .arcane-node:hover .node-visual {
    transform: translateY(-2px) scale(1.07) !important;
    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.5),
        0 0 16px rgba(var(--node-accent), 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
}
#stat-selector .arcane-node.active .node-visual {
    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.5),
        0 0 24px rgba(var(--node-accent), 0.46),
        inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
    transform: none !important;
}

/* --- Stat label --- */
#stat-selector .node-label {
    font-family: var(--font-primary-ui, 'Cinzel Decorative', serif) !important;
    font-size: clamp(0.58rem, 1.05vw, 0.7rem) !important;
    font-weight: 600 !important;
    letter-spacing: 0.14em !important;
    text-transform: uppercase !important;
    color: rgba(200, 218, 238, 0.6) !important;
    margin-bottom: 3px !important;
    display: block !important;
    text-shadow: none !important;
}
#stat-selector .arcane-node.active .node-label {
    color: rgba(var(--node-accent), 0.85) !important;
}

/* --- Stat value (the big number) --- */
#stat-selector .node-value {
    font-family: var(--font-numeric, 'Bebas Neue', sans-serif) !important;
    font-size: clamp(2rem, 3.5vw, 2.8rem) !important;
    line-height: 1 !important;
    font-weight: 400 !important;
    color: rgb(var(--node-accent)) !important;
    display: block !important;
    text-shadow: 0 0 14px rgba(var(--node-accent), 0.45) !important;
    min-width: unset !important;
    padding: 0 !important;
    margin-top: 0 !important;
}
/* Mod tone colour overrides still honoured */
#stat-selector .node-value[data-mod-tone="buff"] {
    color: rgba(161, 255, 210, 0.98) !important;
    text-shadow: 0 0 14px rgba(161, 255, 210, 0.4) !important;
}
#stat-selector .node-value[data-mod-tone="debuff"] {
    color: rgba(255, 177, 188, 1) !important;
    text-shadow: 0 0 14px rgba(255, 177, 188, 0.4) !important;
}
#stat-selector .arcane-node.active .node-value {
    text-shadow:
        0 0 22px rgba(var(--node-accent), 0.75),
        0 0 5px rgba(255, 255, 255, 0.25) !important;
}

/* --- Magia node: same size as other stats (no special banner) --- */

/* --- Header: tint character name with set accent --- */
#stat-selector .stat-selector-character-name {
    color: rgb(var(--ss-accent)) !important;
    text-shadow: 0 0 22px rgba(var(--ss-accent), 0.3) !important;
}

/* --- Footer spacing --- */
#stat-selector .stat-selector-footer {
    margin-top: clamp(8px, 1.2vw, 14px) !important;
}

/* --- Mobile: slightly tighter --- */
@media (max-width: 480px) {
    #stat-selector .stat-selector-grid {
        gap: 6px !important;
    }
    #stat-selector .node-visual {
        width: clamp(40px, 11vw, 56px) !important;
        height: clamp(40px, 11vw, 56px) !important;
        margin-bottom: 6px !important;
    }
    #stat-selector .node-value {
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
    }
    #stat-selector .stat-selector-mage-image {
        width: clamp(60px, 18vw, 90px) !important;
    }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    #stat-selector .arcane-node {
        animation: none !important;
        transition: none !important;
    }
}
