/* ==========================================================================
   MTG COLLECTION - CONTADOR DE VIDAS DIGITAL MULTIJUGADOR (LIFE TRACKER)
   Diseño Mobile-First Inmersivo para Mesa (Smartphones y Tablets)
   ========================================================================== */

:root {
    --lt-bg-dark: #07090e;
    --lt-panel-border: rgba(255, 255, 255, 0.14);
    --lt-gold: #d4af37;
    --lt-gold-glow: rgba(212, 175, 55, 0.45);
    --lt-danger: #ef4444;
    --lt-success: #10b981;
}

/* Modo Mesa Inmersivo: elimina scroll, pie de página y barra móvil inferior */
body.lt-tabletop-mode {
    overflow: hidden !important;
    overscroll-behavior: none !important;
    background: var(--lt-bg-dark) !important;
}

body.lt-tabletop-mode main {
    padding-bottom: 0 !important;
}

body.lt-tabletop-mode footer.footer {
    display: none !important;
}

body.lt-tabletop-mode.lt-hide-webnav .mobile-bottom-nav,
body.lt-tabletop-mode.lt-hide-webnav .mobile-more-menu {
    display: none !important;
}

/* En pantallas móviles también compactar navbar si estuviera visible */
@media (max-width: 767.98px) {
    body.lt-tabletop-mode .lifetracker-container {
        height: 100vh;
        height: 100dvh;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

@media (min-width: 768px) {
    body.lt-tabletop-mode .lifetracker-container {
        height: calc(100vh - 68px);
        height: calc(100dvh - 68px);
    }
}

/* Contenedor Principal */
.lifetracker-container {
    width: 100%;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--lt-bg-dark);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
    overflow: hidden;
    position: relative;
}

/* Barra de Herramientas Superior Compacta */
.lt-toolbar {
    background: #0e111a;
    border-bottom: 1px solid var(--lt-panel-border);
    padding: 0.35rem 0.6rem;
    padding-top: calc(0.35rem + env(safe-area-inset-top, 0px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    z-index: 25;
    flex-shrink: 0;
}

.lt-toolbar-btn {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
    border-radius: 10px;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    text-decoration: none;
    min-height: 34px;
}

.lt-toolbar-btn:hover, .lt-toolbar-btn:active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border-color: var(--lt-gold);
}

.lt-toolbar-btn.active {
    background: rgba(212, 175, 55, 0.22);
    border-color: var(--lt-gold);
    color: #ffd700;
}

.lt-btn-exit {
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
}

.lt-timer-pill {
    font-family: monospace;
    font-size: 0.72rem;
    background: rgba(0, 0, 0, 0.45);
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    color: #94a3b8;
}

/* Envoltorio del Tablero + Hub Central */
.lt-board-wrapper {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
}

/* Tablero de Jugadores */
.lt-board {
    flex: 1;
    display: grid;
    gap: 6px;
    padding: 6px;
    width: 100%;
    height: 100%;
    min-height: 0;
}

/* Disposiciones según número de jugadores */
.lt-board.mode-2p {
    grid-template-rows: 1fr 1fr;
    grid-template-columns: 1fr;
}

.lt-board.mode-3p {
    grid-template-rows: 1fr 1fr;
    grid-template-columns: 1fr 1fr;
}
.lt-board.mode-3p .player-card:nth-child(3) {
    grid-column: span 2;
}

.lt-board.mode-4p {
    grid-template-rows: 1fr 1fr;
    grid-template-columns: 1fr 1fr;
}

/* ==========================================================================
   HUB CENTRAL FLOTANTE DE MESA (ENTRE LOS JUGADORES)
   ========================================================================== */
.lt-center-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(10, 13, 21, 0.92);
    border: 1.5px solid rgba(212, 175, 55, 0.55);
    border-radius: 999px;
    padding: 4px 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.85), 0 0 18px rgba(212, 175, 55, 0.25);
    backdrop-filter: blur(10px);
}

.lt-hub-main-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f6e27a 0%, #d4af37 55%, #9c7a1c 100%);
    border: 2px solid #fff3b0;
    color: #161104;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 14px rgba(212, 175, 55, 0.6);
    transition: transform 0.15s ease;
}

.lt-hub-main-btn:active {
    transform: scale(0.9);
}

.lt-hub-quick-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #f8fafc;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.12s ease;
}

.lt-hub-quick-btn:active {
    transform: scale(0.9);
    background: rgba(212, 175, 55, 0.25);
}

/* ==========================================================================
   TARJETA DE JUGADOR Y ORIENTACIONES DE MESA
   ========================================================================== */
.player-card {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
    border: 1.5px solid rgba(255, 255, 255, 0.14);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    min-height: 0;
}

/* Rotación 180° para los jugadores sentados al otro lado de la mesa */
.player-card.rot-180 {
    transform: rotate(180deg);
}

/* Jugador activo / Ganador del sorteo de salida */
.player-card.starting-winner {
    border-color: #ffd700 !important;
    box-shadow: 0 0 28px rgba(255, 215, 0, 0.65), inset 0 0 20px rgba(255, 215, 0, 0.25) !important;
}

/* Jugador derrotado */
.player-card.player-defeated {
    filter: saturate(0.45);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Temas de Color de Jugador (Inspirados en los 5 Colores de Magic + Artefacto/Multicolor) */
.theme-white { background: linear-gradient(145deg, #262d3d 0%, #434b5e 100%); border-color: rgba(248, 250, 252, 0.35); }
.theme-blue  { background: linear-gradient(145deg, #0a1e3c 0%, #1d4ed8 100%); border-color: rgba(56, 189, 248, 0.4); }
.theme-black { background: linear-gradient(145deg, #13111c 0%, #3b1d54 100%); border-color: rgba(168, 85, 247, 0.4); }
.theme-red   { background: linear-gradient(145deg, #3b0d11 0%, #991b1b 100%); border-color: rgba(248, 113, 113, 0.4); }
.theme-green { background: linear-gradient(145deg, #092617 0%, #15803d 100%); border-color: rgba(74, 222, 128, 0.4); }
.theme-gold  { background: linear-gradient(145deg, #2e1d09 0%, #92400e 100%); border-color: rgba(251, 191, 36, 0.45); }

/* Cabecera del Jugador */
.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 6;
    pointer-events: auto;
    gap: 0.25rem;
}

.player-name-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    flex: 1;
}

.player-name-input {
    background: transparent;
    border: 1px solid transparent;
    color: #fff;
    font-weight: 800;
    font-size: 0.92rem;
    padding: 0.1rem 0.3rem;
    width: 100%;
    max-width: 145px;
    text-overflow: ellipsis;
    text-shadow: 0 1px 4px rgba(0,0,0,0.85);
    border-radius: 6px;
}

.player-name-input:focus {
    outline: none;
    background: rgba(0, 0, 0, 0.55);
    border-color: var(--lt-gold);
}

.player-icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.75);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    padding: 0;
}

.player-icon-btn:active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.monarch-crown {
    color: #ffd700;
    font-size: 1rem;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.85));
    animation: bounceCrown 1.5s infinite ease-in-out;
}

.initiative-badge {
    color: #38bdf8;
    font-size: 0.95rem;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.85));
}

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

/* ==========================================================================
   ZONA CENTRAL DE VIDAS Y BOTONES TÁCTILES (-5 / -1 / +1 / +5)
   ========================================================================== */
.life-zone {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
    touch-action: manipulation;
}

.life-number-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 4;
}

.life-number {
    font-size: clamp(3.4rem, 13vw, 6.2rem);
    line-height: 1;
    font-weight: 900;
    color: #ffffff;
    font-family: 'Marcellus', 'Inter', sans-serif;
    letter-spacing: -2px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.85);
    transition: transform 0.12s ease, color 0.2s ease;
}

/* En modo 3P y 4P reducir ligeramente el tamaño en pantallas pequeñas para que quepa todo holgado */
.mode-3p .life-number,
.mode-4p .life-number {
    font-size: clamp(2.5rem, 10vw, 4.6rem);
}

.life-status-tag {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    margin-top: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.life-danger {
    color: #f87171 !important;
    text-shadow: 0 0 25px rgba(239, 68, 68, 0.85) !important;
}

/* Mitades táctiles grandes para -1 y +1 */
.life-touch-minus, .life-touch-plus {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    transition: background 0.15s ease;
    border-radius: 12px;
}

.life-touch-minus {
    left: 0;
    justify-content: flex-start;
    padding-left: 0.5rem;
}

.life-touch-plus {
    right: 0;
    justify-content: flex-end;
    padding-right: 0.5rem;
}

.life-touch-minus:active {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.28) 0%, transparent 90%);
}

.life-touch-plus:active {
    background: linear-gradient(-90deg, rgba(16, 185, 129, 0.28) 0%, transparent 90%);
}

.touch-hint-icon {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.22);
    pointer-events: none;
}

/* Botones Rápidos -5 y +5 en los bordes laterales */
.quick-step-btn {
    position: absolute;
    z-index: 6;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.42);
    color: rgba(255, 255, 255, 0.9);
    font-weight: 800;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: transform 0.1s ease, background 0.15s ease;
}

.quick-step-minus {
    left: 4px;
    bottom: 6px;
}

.quick-step-plus {
    right: 4px;
    bottom: 6px;
}

.quick-step-minus:active {
    transform: scale(0.9);
    background: rgba(239, 68, 68, 0.65);
    border-color: #fca5a5;
}

.quick-step-plus:active {
    transform: scale(0.9);
    background: rgba(16, 185, 129, 0.65);
    border-color: #6ee7b7;
}

/* En modo 3P / 4P compactar píldoras -5 / +5 */
.mode-3p .quick-step-btn,
.mode-4p .quick-step-btn {
    width: 32px;
    height: 30px;
    font-size: 0.72rem;
    border-radius: 9px;
}

/* Indicador Flotante de Cambio Acumulado (+1, -4, etc.) */
.life-delta-badge {
    position: absolute;
    top: 8%;
    font-size: 1.35rem;
    font-weight: 900;
    padding: 0.15rem 0.65rem;
    border-radius: 999px;
    pointer-events: none;
    z-index: 9;
    animation: popDelta 0.25s ease-out;
}

.life-delta-plus {
    background: rgba(16, 185, 129, 0.92);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.7);
}

.life-delta-minus {
    background: rgba(239, 68, 68, 0.92);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(239, 68, 68, 0.7);
}

/* Dado sobre jugador para "¿Quién empieza?" */
.player-roll-overlay {
    position: absolute;
    inset: 0;
    background: rgba(7, 9, 14, 0.78);
    backdrop-filter: blur(4px);
    z-index: 15;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeInFast 0.2s ease;
}

.player-roll-number {
    font-family: 'Marcellus', serif;
    font-size: 3.2rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 18px rgba(255, 215, 0, 0.8);
}

@keyframes fadeInFast {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popDelta {
    0% { opacity: 0; transform: scale(0.75); }
    100% { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   BARRA INFERIOR DE CADA JUGADOR (MINI CONTADORES TÁCTILES)
   ========================================================================== */
.player-subbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.2rem;
    z-index: 6;
    background: rgba(0, 0, 0, 0.42);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 11px;
    padding: 0.2rem 0.4rem;
    backdrop-filter: blur(6px);
}

.mini-badge-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 0.74rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.22rem 0.4rem;
    border-radius: 7px;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.mini-badge-btn:hover, .mini-badge-btn:active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.mini-badge-btn.highlight {
    color: #ffd700;
    background: rgba(212, 175, 55, 0.22);
}

.mini-badge-btn.danger-highlight {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.45);
    border: 1px solid rgba(248, 113, 113, 0.6);
}

/* Píldoras de daño de comandante por rival en la subbar */
.cmd-pips-wrap {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.cmd-pip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 5px;
    font-size: 0.66rem;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.cmd-pip.pip-lethal {
    background: #ef4444;
    color: #fff;
}

/* ==========================================================================
   TOAST CENTRAL DE MESA Y MODALES
   ========================================================================== */
.lt-table-toast {
    position: fixed;
    top: 56px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1080;
    background: rgba(15, 19, 30, 0.96);
    border: 1.5px solid var(--lt-gold);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.85), 0 0 15px rgba(212, 175, 55, 0.35);
    white-space: nowrap;
    pointer-events: none;
}

/* Tarjetas de Modo en el Hub Central */
.lt-mode-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 0.6rem 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-align: left;
    transition: all 0.15s ease;
}

.lt-mode-card:hover, .lt-mode-card:active, .lt-mode-card.active {
    background: rgba(212, 175, 55, 0.16);
    border-color: var(--lt-gold);
}

.lt-mode-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Panel Modal de Contadores Especiales */
.counters-modal-content {
    background: #111420;
    border: 1.5px solid rgba(212, 175, 55, 0.35);
    border-radius: 20px;
    color: #e2e8f0;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.85);
}

.counter-grid-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.counter-stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 9px;
    padding: 0.2rem 0.4rem;
    margin-top: 0.45rem;
}

.counter-stepper button {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: #e2e8f0;
    font-size: 1.15rem;
    font-weight: 700;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
}

.counter-stepper button:active {
    background: rgba(212, 175, 55, 0.3);
    color: #fff;
}

.counter-stepper span {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
}

/* Maná Flotante */
.mana-orb-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
    position: relative;
    cursor: pointer;
}

.mana-orb-btn:active {
    transform: scale(0.92);
}

.mana-orb-btn span {
    font-size: 0.68rem;
    position: absolute;
    bottom: -6px;
    background: #000;
    color: #fff;
    padding: 0 5px;
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.25);
}

.mana-orb-w { background: #fef08a; color: #1e293b; border-color: #fde047; }
.mana-orb-u { background: #38bdf8; color: #082f49; border-color: #0284c7; }
.mana-orb-b { background: #64748b; color: #f8fafc; border-color: #475569; }
.mana-orb-r { background: #f87171; color: #450a0a; border-color: #dc2626; }
.mana-orb-g { background: #4ade80; color: #052e16; border-color: #16a34a; }
.mana-orb-c { background: #94a3b8; color: #0f172a; border-color: #64748b; }

/* Historial de Turnos (Offcanvas / Drawer) */
.lt-history-drawer {
    background: #0f131d;
    border-left: 1px solid var(--lt-panel-border);
    color: #e2e8f0;
}

.history-entry {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.82rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

/* Día / Noche Global */
.global-state-pill {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #fff;
    cursor: pointer;
    min-height: 34px;
}

.global-state-day {
    background: rgba(245, 158, 11, 0.22);
    border-color: #f59e0b;
    color: #fbbf24;
}

.global-state-night {
    background: rgba(99, 102, 241, 0.22);
    border-color: #818cf8;
    color: #c7d2fe;
}

/* ==========================================================================
   LANZADOR ARCANO 3D DE DADOS Y MONEDAS (D20, D6, COIN)
   ========================================================================== */
.dice-arena {
    height: 200px;
    perspective: 900px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #181d2a 0%, #0a0c14 100%);
    border-radius: 18px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.9), 0 8px 25px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.dice-arena-shadow {
    position: absolute;
    bottom: 22px;
    width: 100px;
    height: 18px;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.75) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(4px);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* D6 3D (Cubo Real) */
.cube-3d-scene {
    width: 80px;
    height: 80px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.1s cubic-bezier(0.15, 0.85, 0.35, 1.2);
}

.cube-face {
    position: absolute;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #1e2433 0%, #0f121d 100%);
    border: 2px solid #d4af37;
    border-radius: 14px;
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 12px rgba(212, 175, 55, 0.2), 0 0 8px rgba(0,0,0,0.6);
    font-size: 2rem;
    font-weight: 900;
    color: #ffd700;
    backface-visibility: hidden;
}

.cube-face.face-front  { transform: rotateY(0deg) translateZ(40px); }
.cube-face.face-back   { transform: rotateY(180deg) translateZ(40px); }
.cube-face.face-right  { transform: rotateY(90deg) translateZ(40px); }
.cube-face.face-left   { transform: rotateY(-90deg) translateZ(40px); }
.cube-face.face-top    { transform: rotateX(90deg) translateZ(40px); }
.cube-face.face-bottom { transform: rotateX(-90deg) translateZ(40px); }

/* D20 Arcano 3D */
.d20-3d-scene {
    width: 96px;
    height: 96px;
    position: relative;
    transform-style: preserve-3d;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 1.1s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.d20-orb {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffd700 0%, #b45309 60%, #451a03 100%);
    border: 3px solid #fef08a;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

.d20-facets {
    position: absolute;
    width: 76px;
    height: 76px;
    clip-path: polygon(50% 0%, 100% 38%, 81% 100%, 19% 100%, 0% 38%);
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.d20-value {
    font-family: 'Marcellus', serif;
    font-size: 2.8rem;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

/* Moneda 3D */
.coin-3d-scene {
    width: 90px;
    height: 90px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.15, 0.85, 0.35, 1.2);
}

.coin-side {
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px solid #ffd700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backface-visibility: hidden;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5), inset 0 0 10px rgba(0,0,0,0.5);
}

.coin-heads {
    background: linear-gradient(135deg, #f59e0b 0%, #b45309 50%, #78350f 100%);
    color: #fff;
    transform: rotateY(0deg);
}

.coin-tails {
    background: linear-gradient(135deg, #64748b 0%, #334155 50%, #0f172a 100%);
    border-color: #cbd5e1;
    color: #e2e8f0;
    transform: rotateY(180deg);
}

.critical-burst {
    animation: criticalPulse 0.8s infinite alternate;
}

@keyframes criticalPulse {
    from { filter: drop-shadow(0 0 15px #ffd700); transform: scale(1.05); }
    to { filter: drop-shadow(0 0 35px #f59e0b); transform: scale(1.15); }
}

.fumble-shake {
    animation: fumbleShake 0.4s ease-in-out;
    filter: drop-shadow(0 0 20px #ef4444);
}

@keyframes fumbleShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.roll-history-card {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    max-height: 150px;
    overflow-y: auto;
}

.roll-log-item {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
