@import 'start-screen.css';
@import 'buttons.css';

@font-face {
    font-family: 'Press Start 2P';
    src: url('../fonts/PressStart2P-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-color: #f0f0f0;
    --primary-red: #e60000;
    --primary-purple: #7b297b;
    --secondary-blue: #0055a7;
    --accent-yellow: #ffcc00;
    --text-color: #222;
    /* Colores de partidos */
    --psoe-color: #e60000;
    --pp-color: #0055a7;
    --vox-color: #63be21;
    --podemos-color: #7b297b;
    --neutral-color: #888888;
}

body {
    font-family: "Press Start 2P", cursive;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport para móvil */
    min-height: -webkit-fill-available; /* iOS Safari */
    overflow: auto; /* Permitir scroll */
    user-select: none;
    /* Safe area support */
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

#news-ticker {
    background: black;
    color: lime;
    padding: 5px;
    white-space: nowrap;
    overflow: hidden;
    border-bottom: 2px solid var(--primary-red);
}

#news-content {
    display: inline-block;
    padding-left: 100%;
    animation: scroll 600s linear infinite;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

main {
    display: flex;
    flex: 1;
    height: calc(100vh - 30px); /* Restar altura del ticker */
    height: calc(100dvh - 30px); /* Dynamic viewport */
    height: calc(-webkit-fill-available - 30px); /* iOS Safari */
    overflow: hidden;
}

/* Sección Izquierda: El Mapa y Botón */
#click-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 10px;
    background: radial-gradient(circle, #fff 0%, #ddd 100%);
    border-right: 4px solid var(--primary-purple);
    position: relative;
    overflow-y: auto;
    touch-action: manipulation;
    z-index: 1; /* Por encima del region-info-panel */
}

/* MAPA ESPAÑA */
#map-container {
    width: 80%;
    max-width: 280px;
    margin-bottom: 5px;
}

/* Contenedor horizontal para ranking y personaje */
#ranking-character-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
    width: 95%;
    max-width: 420px;
    margin-bottom: 10px;
}
#map-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(3px 3px 0 rgba(0,0,0,0.2));
}
.region {
    fill: var(--neutral-color);
    stroke: white;
    stroke-width: 0.5;
    transition: fill 0.5s ease;
    cursor: help;
}
.region:hover { opacity: 0.8; }
/* Para grupos SVG (islas), los paths hijos heredan el fill */
.region path {
    fill: inherit;
    stroke: inherit;
    stroke-width: inherit;
}

/* Personaje animado */
#character-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
    width: 120px;
    min-height: 180px; /* Altura fija para evitar saltos */
    margin: 0;
    text-align: center;
}

#character-sprite {
    max-width: 120px;
    height: auto;
    image-rendering: pixelated;
    transition: opacity 0.3s ease;
}

#character-quote {
    font-size: 0.55rem;
    color: #333;
    margin: 8px 0 0 0;
    max-width: 120px;
    line-height: 1.4;
    min-height: 3.5em; /* Espacio fijo para citas */
    text-align: center;
}

/* Panel de Ranking */
#ranking-panel {
    flex: 1;
    max-width: 250px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 0;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}

#ranking-panel h4 {
    margin: 0 0 8px 0;
    text-align: center;
    font-size: 0.7rem;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 5px;
    margin-bottom: 4px;
    border-radius: 4px;
    font-size: 0.6rem;
}

.ranking-item.player {
    border: 2px solid var(--psoe-color);
    background: rgba(230, 0, 0, 0.1);
}

.ranking-position {
    font-weight: bold;
    width: 20px;
    text-align: center;
}

.ranking-emoji {
    font-size: 1.2rem;
    margin: 0 5px;
}

.ranking-name {
    flex: 1;
    font-weight: bold;
}

.ranking-votos {
    text-align: right;
    font-size: 0.55rem;
}

.ranking-regiones {
    width: 40px;
    text-align: center;
    font-size: 0.5rem;
    color: #666;
}

/* Barra de progreso hacia 50M */
#progress-bar-container {
    width: 90%;
    max-width: 300px;
    background: #ddd;
    border-radius: 10px;
    height: 20px;
    margin-bottom: 10px;
    overflow: hidden;
    position: relative;
    border: 2px solid #333;
}

#progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--psoe-color), #ff6666);
    width: 0%;
    transition: width 0.3s ease;
}

#progress-text {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 0.5rem;
    font-weight: bold;
    line-height: 20px;
    color: #333;
    text-shadow: 0 0 3px white;
}

#votos-display {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 5px;
    text-shadow: 2px 2px var(--accent-yellow);
    line-height: 1;
}

#vps-display {
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 10px;
}

#main-button {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 8px solid var(--primary-red);
    background: white;
    font-size: 3.5rem;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 0 var(--primary-red);
    touch-action: manipulation;
}

#main-button:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 var(--primary-red);
}

/* Barra de déficit */
#deficit-container {
    width: 160px;
    margin-top: 10px;
    text-align: center;
}

#deficit-bar-bg {
    width: 100%;
    height: 10px;
    background: #ddd;
    border-radius: 5px;
    overflow: hidden;
    border: 2px solid #003399;
}

#deficit-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #003399, #0055cc);
    transition: width 0.1s ease, background 0.3s ease;
}

#deficit-text {
    font-size: 0.5rem;
    color: #003399;
    margin-top: 4px;
    font-weight: bold;
}

/* BCE button - extiende .btn--bce de buttons.css */
#bce-btn {
    margin-top: 8px;
}

/* Los estilos base vienen de .btn--bce */

/* Sección Derecha: Tienda */
#shop-zone {
    flex: 1;
    background: white;
    padding: 15px;
    overflow-y: auto;
    border-left: 4px solid var(--primary-red);
}

/* Barra de multiplicadores de compra */
#multiplier-bar {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    padding: 8px;
    background: #333;
    border-radius: 5px;
    align-items: center;
    flex-wrap: wrap;
}

#multiplier-bar span {
    color: #aaa;
    font-size: 0.6rem;
    margin-right: 5px;
}

/* Multiplier buttons - extienden .btn--multiplier de buttons.css */
/* Los estilos base vienen de .btn--multiplier */

/* Indicador de cantidad en bulk */
.bulk-qty {
    background: var(--primary-purple);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.6rem;
    margin-left: 5px;
}

.shop-category {
    margin-bottom: 20px;
}

.shop-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 8px;
    border: 2px solid #ccc;
    cursor: pointer;
    background: #fafafa;
    transition: background 0.2s;
    font-size: 0.7rem;
}

.shop-item:hover { background: #eee; }
.shop-item.disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); }

.item-icon { font-size: 2rem; margin-right: 10px; }
.item-info { flex: 1; }
.item-name { font-weight: bold; font-size: 0.8rem; }
.item-cost { color: var(--primary-red); font-weight: bold; font-size: 0.7rem; }
.item-count { font-size: 1.3rem; font-weight: bold; color: var(--primary-purple); margin-left: 10px; }

/* Prestige Button */
#prestige-btn {
    background: var(--primary-purple);
    color: white;
    border: none;
    padding: 8px;
    width: 100%;
    font-size: 0.7rem;
    cursor: pointer;
    margin-top: 15px;
    border-radius: 5px;
}

/* Animación de números al click */
.click-text {
    position: absolute;
    color: var(--primary-red);
    font-weight: bold;
    pointer-events: none;
    animation: float-up 1s forwards;
    z-index: 100;
}

@keyframes float-up {
    to { transform: translateY(-100px); opacity: 0; }
}

/* Tooltip simple */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.55rem;
    pointer-events: none;
    display: none;
    z-index: 200;
    max-width: 200px;
}

/* Overlays de Victoria/Derrota */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease;
}

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

#victory-overlay {
    background: rgba(230, 0, 0, 0.95);
    color: white;
}

#defeat-overlay {
    background: rgba(0, 0, 0, 0.95);
    color: white;
}

.overlay-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.3);
}

.overlay-stats {
    font-size: 0.8rem;
    margin-bottom: 30px;
    text-align: center;
    line-height: 1.8;
}

/* Overlay buttons - extienden .btn--overlay de buttons.css */
/* Los estilos base vienen de .btn--overlay */

/* Botones de derrota */
.defeat-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

/* Reset progresista - extiende .btn--overlay-progresista de buttons.css */
/* Los estilos vienen de .btn--overlay-progresista */

.overlay-ranking {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    line-height: 1.8;
}

.overlay-ranking strong {
    font-size: 0.9rem;
    display: block;
    margin-bottom: 8px;
}

/* Make overlay scrollable on mobile */
.game-overlay {
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

/* Desktop: scroll independiente por sección */
@media (min-width: 801px) {
    body {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }
}

/* Responsive */
@media (max-width: 800px) {
    body {
        /* Ticker height (~27px) + safe-area para evitar status bar */
        padding-top: calc(27px + env(safe-area-inset-top, 0));
    }
    main {
        flex-direction: column;
        flex: 1 1 auto;
        height: auto;
        min-height: auto;
        overflow: visible;
    }
    #click-zone {
        border-right: none;
        border-bottom: 4px solid var(--primary-purple);
        height: auto;
        min-height: auto;
        max-height: none;
        overflow: visible;
        padding-bottom: 20px;
    }
    #shop-zone {
        border-left: none;
        border-top: 4px solid var(--primary-red);
        overflow-y: visible;
        height: auto;
        margin-right: 0; /* Sin margin en móvil */
        padding-right: 15px;
    }
    #map-container {
        max-width: 220px;
    }
    #ranking-character-row {
        max-width: 380px;
    }
    #character-container {
        width: 100px;
        min-height: 150px;
    }
    #character-sprite {
        max-width: 100px;
    }
    #main-button { width: 120px; height: 120px; font-size: 3rem; }
    #news-ticker {
        position: fixed;
        top: env(safe-area-inset-top, 0);
        left: 0;
        right: 0;
        z-index: 100;
    }
    #news-content {
        animation-duration: 600s; /* 10 minutos en tablets */
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    #news-content {
        animation-duration: 480s; /* 8 minutos en móviles */
    }
    #map-container {
        width: 100%;
        max-width: 180px;
    }
    #ranking-character-row {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        max-width: 100%;
    }
    #ranking-panel {
        max-width: none;
        width: 95%;
        padding: 8px;
    }
    #character-container {
        width: auto;
        min-height: auto;
        margin: 0;
    }
    #character-sprite {
        max-width: 80px;
    }
    #character-quote {
        font-size: 0.45rem;
        max-width: 200px;
        min-height: auto;
    }
    #main-button {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
        border-width: 6px;
        box-shadow: 0 6px 0 var(--primary-red);
        min-width: 44px;
        min-height: 44px;
    }
    #main-button:active {
        transform: translateY(6px);
        box-shadow: 0 0 0 var(--primary-red);
    }
    #deficit-container {
        width: 120px;
    }
    #deficit-text {
        font-size: 0.4rem;
    }
    #bce-btn {
        font-size: 0.45rem;
        padding: 6px 8px;
    }
    #ranking-panel h4 {
        font-size: 0.6rem;
    }
    .ranking-item {
        padding: 4px;
        font-size: 0.5rem;
    }
    .ranking-emoji {
        font-size: 1rem;
    }
    #progress-bar-container {
        width: 95%;
        max-width: none;
    }
    #votos-display {
        font-size: 1rem;
    }
    #vps-display {
        font-size: 0.6rem;
    }
    #shop-zone {
        padding: 10px;
    }
    #shop-zone h3 {
        font-size: 0.7rem;
        margin: 8px 0;
    }
    .shop-item {
        padding: 10px 8px;
        font-size: 0.6rem;
        min-height: 44px;
    }
    .item-icon {
        font-size: 1.5rem;
        margin-right: 8px;
    }
    .item-name {
        font-size: 0.6rem;
    }
    .item-cost {
        font-size: 0.55rem;
    }
    .item-count {
        font-size: 1.1rem;
    }
    /* Multiplier bar responsive */
    #multiplier-bar {
        padding: 6px;
        gap: 3px;
        justify-content: center;
    }
    #multiplier-bar span {
        font-size: 0.5rem;
        width: 100%;
        text-align: center;
        margin-bottom: 3px;
    }
    #multiplier-bar button {
        padding: 4px 6px;
        font-size: 0.45rem;
        min-height: 28px;
        min-width: 32px;
    }
    .bulk-qty {
        font-size: 0.5rem;
        padding: 1px 4px;
    }
    .overlay-title {
        font-size: 1.2rem;
    }
    .overlay-stats {
        font-size: 0.7rem;
        padding: 0 15px;
        max-height: 60vh;
        overflow-y: auto;
    }
    .overlay-ranking {
        font-size: 0.6rem;
        padding: 8px;
        margin-top: 8px;
    }
    .overlay-ranking strong {
        font-size: 0.7rem;
        margin-bottom: 5px;
    }
    .overlay-btn {
        padding: 12px 30px;
        font-size: 0.8rem;
        min-width: 44px;
        min-height: 44px;
    }
    /* Tooltips táctiles */
    .tooltip {
        display: none !important;
    }
}

/* Modal de Eventos Aleatorios */
#event-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 900;
    padding: 20px;
    box-sizing: border-box;
}

#event-modal.active {
    display: flex;
}

.event-content {
    background: white;
    border-radius: 12px;
    padding: 25px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.event-title {
    font-size: 0.9rem;
    margin-bottom: 20px;
    color: #333;
    line-height: 1.4;
}

.event-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.event-option {
    padding: 15px 20px;
    border: 2px solid var(--primary-red);
    background: white;
    cursor: pointer;
    font-size: 0.7rem;
    font-family: inherit;
    border-radius: 8px;
    transition: all 0.2s;
    min-height: 44px;
}

.event-option:hover {
    background: var(--primary-red);
    color: white;
}

.event-option:active {
    transform: scale(0.98);
}

.event-effect {
    font-size: 0.55rem;
    color: #666;
    margin-top: 5px;
}

/* Estado deshabilitado para botones de evento */
.event-option.event-option-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.event-option.event-option-disabled:hover {
    background: white;
    color: inherit;
}

/* Mensaje de espera */
.event-wait-message {
    font-size: 0.65rem;
    color: var(--primary-red);
    margin-bottom: 10px;
    font-style: italic;
    animation: pulse-wait 1s ease-in-out infinite;
}

@keyframes pulse-wait {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}


/* ===========================================
   DESKTOP TOOLBAR (Barra vertical derecha)
   =========================================== */

#desktop-toolbar {
    display: none;
    position: fixed;
    right: 0;
    top: 30px; /* Debajo del ticker */
    bottom: 0;
    width: 52px;
    background: linear-gradient(180deg, #2d2d2d, #1a1a1a);
    border-left: 3px solid var(--primary-red);
    z-index: 600;
    flex-direction: column;
    justify-content: space-between;
    padding: 15px 0;
    box-shadow: -3px 0 10px rgba(0,0,0,0.3);
}

@media (min-width: 801px) {
    #desktop-toolbar {
        display: flex;
    }

    main {
        margin-right: 52px;
    }

    #shop-zone {
        margin-right: 0; /* Eliminar margin viejo, el toolbar usa margin en main */
    }
}

.toolbar-main,
.toolbar-secondary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.toolbar-separator {
    flex: 1;
}

/* Toolbar buttons - estilos de posicionamiento dentro del toolbar */
#desktop-toolbar .btn {
    position: static;
    box-shadow: none;
    text-decoration: none;
}

/* Panel de Logros */
#achievements-panel {
    position: fixed;
    top: 50px;
    right: 70px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px;
    max-width: 250px;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 500;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
}

#achievements-panel.visible {
    display: block;
    z-index: 502;
}

/* En desktop, posicionar paneles a la izquierda del toolbar */
@media (min-width: 801px) {
    #achievements-panel {
        right: 62px; /* 52px toolbar + 10px gap */
    }
}

.achievement-item {
    display: flex;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 5px;
    background: #f5f5f5;
    font-size: 0.6rem;
}

.achievement-item.unlocked {
    background: #d4edda;
    border: 1px solid #28a745;
}

.achievement-item.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.achievement-icon {
    font-size: 1.5rem;
    margin-right: 10px;
}

.achievement-info {
    flex: 1;
}

.achievement-name {
    font-weight: bold;
}

.achievement-desc {
    font-size: 0.5rem;
    color: #666;
}

/* Notificación de logro */
.achievement-notification {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: #333;
    padding: 15px 25px;
    border-radius: 10px;
    font-weight: bold;
    z-index: 1000;
    animation: achievementPop 3s forwards;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    transition: top 0.3s ease;
}

@keyframes achievementPop {
    0% { transform: translateX(-50%) translateY(-20px); opacity: 0; }
    10% { transform: translateX(-50%) translateY(0); opacity: 1; }
    80% { transform: translateX(-50%) translateY(0); opacity: 1; }
    100% { transform: translateX(-50%) translateY(-20px); opacity: 0; }
}

/* Indicador de guardado */
#save-indicator {
    position: fixed;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: #0f0;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

#save-indicator.visible {
    opacity: 1;
}

/* Botón Ko-fi (ya no usado como elemento flotante, ahora en toolbar) */

/* Responsive: ocultar toolbar en móvil (se acceden via menú "Más") */
@media (max-width: 480px) {
    /* Ocultar toolbar - botones ahora están en el menú "Más" */
    #desktop-toolbar {
        display: none !important;
    }
}

/* Panel de Estadísticas */
#stats-panel {
    position: fixed;
    top: 100px;
    right: 70px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px;
    max-width: 250px;
    max-height: 350px;
    overflow-y: auto;
    display: none;
    z-index: 500;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.2);
}

#stats-panel.visible {
    display: block;
    z-index: 502;
}

/* En desktop, posicionar paneles a la izquierda del toolbar */
@media (min-width: 801px) {
    #stats-panel {
        right: 62px; /* 52px toolbar + 10px gap */
    }
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 5px;
    background: #f5f5f5;
    font-size: 0.55rem;
}

.stat-label {
    color: #555;
}

.stat-value {
    font-weight: bold;
    color: var(--primary-red);
}

.stats-section h4 {
    margin: 0 0 8px 0;
    font-size: 0.9em;
    color: #888;
    border-bottom: 1px solid #333;
    padding-bottom: 4px;
}

.stats-section + .stats-section {
    margin-top: 12px;
}

/* Header de paneles con botón de cierre */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.panel-header h4 {
    margin: 0;
}

/* Panel close - extiende .btn--panel-close de buttons.css */
/* Los estilos base vienen de .btn--panel-close */

/* Panel de información de región para móvil */
.region-info-panel {
    display: none; /* Oculto en desktop */
    position: fixed;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 15px;
    text-align: center;
    z-index: 50; /* Reducido para no tapar contenido */
    font-size: 0.55rem;
    line-height: 1.6;
    border-top: 2px solid var(--primary-red);
    /* Posicionar encima del bottom-nav */
    bottom: calc(70px + env(safe-area-inset-bottom, 0));
}

.region-info-panel.active {
    display: block;
}

#region-info-content strong {
    color: var(--accent-yellow);
}

/* Mostrar solo en móvil */
@media (max-width: 480px) {
    .region-info-panel.active {
        display: block;
    }
    #achievements-panel, #stats-panel {
        right: 10px;
        left: 10px;
        max-width: none;
        width: auto;
        top: 60px;
    }
}

/* Modal de Eventos Incontrolables */
#uncontrollable-event-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(80, 0, 0, 0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 950;
    padding: 20px;
    box-sizing: border-box;
}

#uncontrollable-event-modal.active {
    display: flex;
    animation: uncontrollableShake 0.5s ease-in-out;
}

@keyframes uncontrollableShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.uncontrollable-event-content {
    background: linear-gradient(135deg, #2d0a0a, #4a1010);
    border: 3px solid #ff3333;
    border-radius: 12px;
    padding: 25px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.5);
    animation: uncontrollablePulse 1s ease-in-out infinite;
}

@keyframes uncontrollablePulse {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 0, 0, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.5); }
    50% { box-shadow: 0 0 50px rgba(255, 0, 0, 0.8), inset 0 0 20px rgba(0, 0, 0, 0.5); }
}

.uncontrollable-event-header {
    font-size: 0.65rem;
    color: #ff6666;
    margin-bottom: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.uncontrollable-event-title {
    font-size: 0.9rem;
    color: #ffffff;
    margin-bottom: 15px;
    line-height: 1.4;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.uncontrollable-event-message {
    font-size: 0.7rem;
    color: #ffcccc;
    margin-bottom: 20px;
    line-height: 1.5;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.uncontrollable-countdown-container {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #ff3333;
}

.uncontrollable-countdown-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff3333, #ff6666);
    border-radius: 4px;
}

/* Responsive para modal incontrolable */
@media (max-width: 480px) {
    .uncontrollable-event-content {
        padding: 18px;
    }
    .uncontrollable-event-header {
        font-size: 0.55rem;
    }
    .uncontrollable-event-title {
        font-size: 0.75rem;
    }
    .uncontrollable-event-message {
        font-size: 0.6rem;
    }
}

/* === Panel de Corrupción === */
#corrupcion-panel {
    background: linear-gradient(135deg, rgba(139, 0, 139, 0.15), rgba(255, 0, 0, 0.1));
    border: 1px solid rgba(139, 0, 139, 0.3);
    border-radius: 6px;
    padding: 6px 12px;
    margin-bottom: 10px;
    font-size: 0.6rem;
    color: #666;
    text-align: center;
    transition: all 0.3s ease;
}

#corrupcion-stats {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.corrupcion-separator { opacity: 0.5; }
.corrupcion-emoji { font-size: 0.8rem; }

#corrupcion-stats span span:last-child {
    color: #8b008b;
    font-weight: bold;
}

#teflon-display {
    font-size: 0.5rem;
    margin-top: 4px;
    color: #888;
}

#teflon-bonus {
    color: #28a745;
    font-weight: bold;
}

/* Animación cuando sube */
.corrupcion-pulse {
    animation: corrupcionPulse 0.5s ease-out;
}

@keyframes corrupcionPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(139, 0, 139, 0); }
    50% { transform: scale(1.03); box-shadow: 0 0 12px rgba(139, 0, 139, 0.4); background: rgba(139, 0, 139, 0.2); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(139, 0, 139, 0); }
}

/* Responsive */
@media (max-width: 480px) {
    #corrupcion-panel { font-size: 0.5rem; padding: 4px 8px; }
    #teflon-display { font-size: 0.4rem; }
}

/* === Botón y Modal de Ayuda === */
#help-toggle {
    background: #9b59b6;
}

#help-toggle:hover {
    background: #8e44ad;
}

#help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 900;
    padding: 20px;
    box-sizing: border-box;
}

#help-modal.active {
    display: flex;
}

.help-content {
    background: white;
    border-radius: 12px;
    max-width: 550px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.help-content .panel-header {
    padding: 15px 20px;
    border-bottom: 2px solid #eee;
    flex-shrink: 0;
}

.help-content .panel-title {
    font-size: 0.9rem;
    font-weight: bold;
    color: #333;
}

.help-body {
    padding: 15px 20px;
    overflow-y: auto;
    flex: 1;
}

.help-section {
    margin-bottom: 18px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.help-section h4 {
    margin: 0 0 8px 0;
    font-size: 0.75rem;
    color: var(--primary-red);
}

.help-section p {
    margin: 0 0 5px 0;
    font-size: 0.6rem;
    line-height: 1.6;
    color: #444;
}

.help-section p:last-child {
    margin-bottom: 0;
}

.help-section strong {
    color: var(--primary-purple);
}

/* Responsive para modal de ayuda en móvil */
@media (max-width: 480px) {
    .help-content {
        max-height: 80vh;
    }
    .help-content .panel-title {
        font-size: 0.75rem;
    }
    .help-section h4 {
        font-size: 0.65rem;
    }
    .help-section p {
        font-size: 0.5rem;
    }
}

/* === Modal de Nueva Partida y Ascensión === */
#new-game-modal,
#ascension-confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

#new-game-modal.active,
#ascension-confirm-modal.active {
    display: flex;
}

.new-game-content {
    background: white;
    border-radius: 10px;
    max-width: 320px;
    width: 90%;
    overflow: hidden;
}

.new-game-content .panel-header {
    padding: 12px 15px;
    border-bottom: 2px solid #eee;
}

.new-game-content .panel-title {
    font-size: 0.8rem;
    font-weight: bold;
}

.new-game-options {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* New game option - extiende .btn de buttons.css */
.new-game-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border: 2px solid #ddd;
    background: #f9f9f9;
    color: inherit;
}

.new-game-option:hover {
    border-color: var(--primary-red);
    background: #fff;
}

.new-game-option.danger {
    border-color: #dc3545;
}

.new-game-option.danger:hover {
    background: #fff5f5;
}

.option-icon { font-size: 2rem; }
.option-title { font-weight: bold; margin: 5px 0; font-size: 0.7rem; }
.option-desc { font-size: 0.55rem; color: #666; text-align: center; }

/* Responsive para modal de nueva partida */
@media (max-width: 480px) {
    .new-game-content {
        max-width: 280px;
    }
    .option-icon { font-size: 1.5rem; }
    .option-title { font-size: 0.6rem; }
    .option-desc { font-size: 0.45rem; }
}

/* ========================================
   SISTEMA DE ASCENSIÓN - Estado Profundo
   ======================================== */

/* Botón de Ascensión */
#ascension-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid #4a3728;
    background: linear-gradient(145deg, #8b6914, #d4af37);
    color: #2d1810;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4), inset 0 1px 2px rgba(255,255,255,0.3);
    transition: all 0.2s ease;
}

#ascension-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0,0,0,0.5), inset 0 1px 2px rgba(255,255,255,0.4);
}

/* Panel de Ascensión */
#ascension-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    background: linear-gradient(180deg, #3d2817 0%, #2d1810 100%);
    border: 4px solid #d4af37;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7), 0 0 20px rgba(212, 175, 55, 0.3);
    z-index: 500;
    display: none;
    opacity: 0;
    transition: all 0.3s ease;
    overflow: hidden;
}

#ascension-panel.visible {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#ascension-panel .panel-header {
    background: linear-gradient(90deg, #4a3728, #6b4423, #4a3728);
    border-bottom: 2px solid #d4af37;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#ascension-panel .panel-header h4 {
    color: #d4af37;
    margin: 0;
    font-size: 0.9rem;
    text-shadow: 2px 2px 0 #000;
}

#ascension-content {
    padding: 15px;
    overflow-y: auto;
    max-height: calc(85vh - 60px);
    color: #e8d5b5;
}

/* Header del panel */
.ascension-header {
    text-align: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #4a3728;
}

.ascension-header h2 {
    color: #d4af37;
    margin: 0 0 10px 0;
    font-size: 1rem;
    text-shadow: 2px 2px 0 #000;
}

.ascension-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.7rem;
}

.casta-display {
    color: #d4af37;
    font-weight: bold;
}

.ascension-count {
    color: #a89078;
}

/* Información de dificultad */
.difficulty-info {
    background: rgba(0,0,0,0.3);
    border: 1px solid #4a3728;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 15px;
}

.difficulty-info h4 {
    color: #c9a54a;
    margin: 0 0 10px 0;
    font-size: 0.65rem;
    text-align: center;
}

.difficulty-bars {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 8px;
}

.diff-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.5rem;
}

.diff-stat span:first-child {
    color: #a89078;
}

.diff-value {
    color: #ff6b6b;
    font-weight: bold;
    margin-top: 2px;
}

/* Reset de Dificultad */
.difficulty-reset {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #4a3728;
    gap: 6px;
}

.difficulty-reset .btn {
    font-size: 0.5rem;
}

.reset-info {
    font-size: 0.45rem;
    color: #a89078;
    text-align: center;
}

.reset-maxed {
    font-size: 0.5rem;
    color: #4caf50;
    font-weight: bold;
}

/* Secciones de Tier */
.tier-section {
    margin-bottom: 20px;
}

.tier-section h3 {
    color: #d4af37;
    font-size: 0.7rem;
    margin: 0 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #4a3728;
}

.tier-range {
    color: #a89078;
    font-size: 0.55rem;
    font-weight: normal;
}

/* Grid de privilegios */
.privilegios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

/* Tarjeta de privilegio */
.privilegio-card {
    background: linear-gradient(180deg, #4a3728, #3d2817);
    border: 2px solid #5a4738;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    transition: all 0.2s ease;
}

.privilegio-card.available {
    border-color: #d4af37;
    cursor: pointer;
}

.privilegio-card.available:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.privilegio-card.owned {
    background: linear-gradient(180deg, #2a4a28, #1d3d1a);
    border-color: #4caf50;
}

.privilegio-card.locked {
    opacity: 0.6;
    filter: grayscale(30%);
}

.priv-emoji {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.priv-name {
    color: #e8d5b5;
    font-size: 0.55rem;
    font-weight: bold;
    margin-bottom: 5px;
    line-height: 1.3;
}

.priv-desc {
    color: #a89078;
    font-size: 0.45rem;
    margin-bottom: 8px;
    line-height: 1.4;
}

.priv-cost {
    color: #d4af37;
    font-size: 0.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.privilegio-card.owned .priv-cost {
    color: #4caf50;
}

/* Priv buy button - extiende .btn--gold de buttons.css */
.priv-buy-btn {
    font-size: 0.45rem;
}

/* Estados de disabled vienen de .btn:disabled */

/* Sección Golpe de Estado */
.golpe-estado-section {
    background: rgba(180, 50, 50, 0.2);
    border: 2px solid #b43232;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    text-align: center;
}

.golpe-estado-section h3 {
    color: #ff6b6b;
    margin: 0 0 10px 0;
    border: none;
    padding: 0;
}

.golpe-estado-section p {
    color: #e8d5b5;
    font-size: 0.55rem;
    margin-bottom: 10px;
}

.golpe-estado-section.eliminated {
    background: rgba(50, 100, 50, 0.2);
    border-color: #4caf50;
}

.golpe-estado-section.eliminated h3 {
    color: #4caf50;
}

.rival-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Rival buttons - extienden .btn--danger de buttons.css */
/* Los estilos base vienen de .btn--danger */

/* Bonuses activos */
.active-bonuses {
    background: rgba(0,0,0,0.3);
    border: 1px solid #4a3728;
    border-radius: 8px;
    padding: 10px;
    margin-top: 15px;
}

.active-bonuses h4 {
    color: #4caf50;
    margin: 0 0 10px 0;
    font-size: 0.6rem;
    text-align: center;
}

.bonus-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
}

.bonus-tag {
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid #4caf50;
    border-radius: 4px;
    padding: 4px 8px;
    color: #4caf50;
    font-size: 0.45rem;
}

/* Ascend button - extiende .btn--gold y .btn--3d de buttons.css */
.ascend-btn {
    margin: 10px;
}

/* Los estilos base vienen de .btn--gold y .btn--3d */

/* Responsive para panel de ascensión */
@media (max-width: 480px) {
    #ascension-panel {
        width: 95%;
        max-height: 90vh;
    }

    .privilegios-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .priv-emoji {
        font-size: 1.2rem;
    }

    .priv-name {
        font-size: 0.5rem;
    }

    .priv-desc {
        font-size: 0.4rem;
    }

    .ascension-header h2 {
        font-size: 0.85rem;
    }

    .tier-section h3 {
        font-size: 0.6rem;
    }
}

/* --- TOAST DE EFECTO (eventos) --- */
.effect-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #d4af37;
    border-radius: 12px;
    padding: 15px 25px;
    z-index: 10001;
    font-family: "Press Start 2P", cursive;
    font-size: 0.7rem;
    color: #fff;
    text-align: center;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5), 0 8px 32px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: all 0.3s ease-out;
}

.effect-toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.effect-toast.hide {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
}

.effect-toast-label {
    color: #d4af37;
    display: block;
    margin-bottom: 8px;
    font-size: 0.6rem;
}

@media (max-width: 480px) {
    .effect-toast {
        width: 85%;
        font-size: 0.55rem;
        padding: 12px 15px;
    }
}

/* --- FASE GOBIERNO UI --- */
.government-panel {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #d4af37;
    border-radius: 12px;
    padding: 15px 25px;
    z-index: 9000;
    font-family: "Press Start 2P", cursive;
    text-align: center;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4), 0 8px 32px rgba(0, 0, 0, 0.5);
    min-width: 280px;
}

.gov-header {
    color: #d4af37;
    font-size: 0.8rem;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.gov-timer {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 8px;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.gov-votos {
    font-size: 0.7rem;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.gov-bar-container {
    position: relative;
    width: 100%;
    height: 20px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.gov-bar {
    height: 100%;
    transition: width 0.3s ease, background 0.3s ease;
    border-radius: 10px;
}

.gov-min-line {
    position: absolute;
    top: 0;
    left: 100%;
    width: 3px;
    height: 100%;
    background: #fff;
    box-shadow: 0 0 5px #fff;
}

.gov-hint {
    color: #aaa;
    font-size: 0.45rem;
}

/* Botón Gobernar - extiende .btn de buttons.css */
.govern-btn {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #d4af37;
    margin: 10px 5px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.govern-btn:hover {
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
    border-color: #ffd700;
}

@media (max-width: 480px) {
    .government-panel {
        top: 35px;
        width: 90%;
        min-width: auto;
        padding: 10px 15px;
    }

    .gov-header {
        font-size: 0.6rem;
    }

    .gov-timer {
        font-size: 1.2rem;
    }

    .gov-votos {
        font-size: 0.55rem;
    }

    .gov-hint {
        font-size: 0.4rem;
    }

    .govern-btn {
        font-size: 0.55rem;
        padding: 12px 15px;
    }
}

/* === EVENTOS CLICKEABLES === */
.click-event {
    position: fixed;
    z-index: 1000;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #ff9800;
    border-radius: 12px;
    padding: 15px;
    min-width: 100px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.5);
    animation: pulse-glow 1s ease-in-out infinite;
}

.click-event.visible {
    opacity: 1;
    transform: scale(1);
}

.click-event.success {
    transform: scale(1.2);
    opacity: 0;
}

.click-event.missed {
    transform: scale(0.8) translateY(20px);
    opacity: 0;
}

.click-event-emoji {
    font-size: 2rem;
    margin-bottom: 5px;
    animation: bounce 0.5s ease infinite alternate;
}

.click-event-name {
    color: #fff;
    font-size: 0.5rem;
    font-family: "Press Start 2P", cursive;
    text-shadow: 1px 1px 0 #000;
}

.click-event-timer {
    width: 100%;
    height: 4px;
    background: #ff9800;
    margin-top: 8px;
    border-radius: 2px;
    transition: width 0.1s linear, background 0.3s ease;
}

.click-event-result {
    position: fixed;
    z-index: 1001;
    color: #4CAF50;
    font-size: 0.6rem;
    font-family: "Press Start 2P", cursive;
    text-shadow: 2px 2px 0 #000;
    animation: float-up 1.5s ease-out forwards;
    pointer-events: none;
}

.click-event-result.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 152, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 152, 0, 0.8);
    }
}

@keyframes bounce {
    0% {
        transform: translateY(0);
    }
    100% {
        transform: translateY(-5px);
    }
}

@keyframes float-up {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-50px);
        opacity: 0.7;
    }
}

@media (max-width: 480px) {
    .click-event {
        padding: 10px;
        min-width: 80px;
    }

    .click-event-emoji {
        font-size: 1.5rem;
    }

    .click-event-name {
        font-size: 0.4rem;
    }

    .click-event-result {
        font-size: 0.5rem;
    }
}

/* ===========================================
   NAVEGACIÓN INFERIOR MÓVIL (BOTTOM NAV)
   =========================================== */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #2d2d2d, #1a1a1a);
    border-top: 3px solid var(--primary-red);
    z-index: 600;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
    justify-content: space-around;
    align-items: center;
}

/* Mostrar bottom-nav directamente en móvil via media query */
@media (max-width: 480px) {
    .bottom-nav {
        display: flex;
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 8px 20px;
    border-radius: 8px;
    transition: all 0.2s ease;
    min-width: 80px;
    min-height: 44px;
    font-family: inherit;
}

.bottom-nav-item:active {
    transform: scale(0.95);
}

.bottom-nav-item.active {
    color: white;
    background: rgba(230, 0, 0, 0.3);
    border: 2px solid var(--primary-red);
}

.bottom-nav-item .nav-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.bottom-nav-item .nav-label {
    font-size: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Clase para ocultar secciones en móvil */
.hidden-mobile {
    display: none !important;
}

/* Ajustar padding de main cuando bottom-nav está visible */
@media (max-width: 480px) {
    main {
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0));
    }

    /* Click zone con padding para no tapar el botón rosa */
    #click-zone:not(.hidden-mobile) {
        flex: 1;
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
    }

    /* Shop zone a pantalla completa cuando es el tab activo */
    #shop-zone:not(.hidden-mobile) {
        flex: 1;
        max-height: calc(100vh - 100px - env(safe-area-inset-bottom, 0));
        padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
        overflow-y: auto;
    }
}

/* ===========================================
   MENÚ "MÁS" PARA MÓVIL
   =========================================== */

.more-menu {
    display: none;
    position: fixed;
    bottom: calc(75px + env(safe-area-inset-bottom, 0));
    right: 10px;
    background: linear-gradient(180deg, #2d2d2d, #1a1a1a);
    border: 2px solid var(--primary-red);
    border-radius: 12px;
    padding: 8px;
    z-index: 610;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
    min-width: 180px;
}

.more-menu.active {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.more-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    color: #ccc;
    padding: 12px 15px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
    text-decoration: none;
}

.more-menu-item:hover,
.more-menu-item:active {
    background: rgba(230, 0, 0, 0.3);
    color: white;
}

.more-menu-item.danger {
    color: #ff6b6b;
}

.more-menu-item span:first-child {
    font-size: 1.2rem;
    min-width: 24px;
    text-align: center;
}

/* Estilo para enlace Ko-fi en el menú */
.more-menu-item.kofi-link {
    color: #ff5f5f;
}

.more-menu-item.kofi-link:hover {
    background: rgba(255, 95, 95, 0.2);
}

/* ===========================================
   ITEMS DE TIENDA COMPACTOS (MÓVIL)
   =========================================== */

@media (max-width: 480px) {
    /* Items más compactos */
    .shop-item {
        padding: 6px;
        margin-bottom: 6px;
        gap: 6px;
    }

    .item-icon {
        font-size: 1.2rem;
        margin-right: 6px;
        min-width: 28px;
        text-align: center;
    }

    .item-name {
        font-size: 0.55rem;
    }

    .item-cost {
        font-size: 0.5rem;
    }

    .item-count {
        font-size: 1rem;
        margin-left: 6px;
    }

    /* Ocultar descripciones en móvil para ahorrar espacio */
    .shop-item .item-info > div:nth-child(3),
    .shop-item .item-info > div:nth-child(4) {
        display: none;
    }

    /* Multiplier bar más compacto */
    #multiplier-bar {
        padding: 4px;
        gap: 2px;
    }

    #multiplier-bar button {
        padding: 3px 5px;
        font-size: 0.4rem;
        min-height: 26px;
        min-width: 28px;
    }

    /* Títulos de sección más pequeños */
    #shop-zone h3 {
        font-size: 0.6rem;
        margin: 6px 0;
    }

    #shop-zone hr {
        margin: 8px 0;
    }
}
