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

body {
    font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 25%, #0f3460 50%, #533483 75%, #8B4513 100%);
    min-height: 100vh;
    color: #2F1B14;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    overflow-x: hidden;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-header {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.95) 0%, rgba(160, 82, 45, 0.95) 100%);
    color: white;
    padding: 25px;
    border-radius: 20px;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    border: 2px solid rgba(255, 215, 0, 0.3);
    position: relative;
    flex-shrink: 0;
}

.header-controls {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    z-index: 1000;
}



.reset-button {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.reset-button:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
    transform: scale(1.05);
}

.game-header h1 {
    text-align: center;
    font-size: 3em;
    margin-bottom: 20px;
    margin-top: 10px;
    padding-right: 200px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.7);
    background: linear-gradient(45deg, #FFD700, #FFA500, #FF8C00);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5));
}

.stats-compact {
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px;
}

.stats-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 8px;
}

.stats-row:last-child {
    margin-bottom: 0;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95em;
    font-weight: 600;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.stat-icon {
    font-size: 1.1em;
}

.game-main {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    flex: 1;
    min-height: 0; /* Importante para que el grid funcione correctamente */
}

.click-area-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    height: fit-content;
    overflow: hidden;
}

.scrollable-content {
    overflow-y: auto;
    height: 100%;
    padding-right: 10px;
    min-height: 0; /* Importante para que el scroll funcione */
}

.scrollable-content::-webkit-scrollbar {
    width: 8px;
}

.scrollable-content::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.scrollable-content::-webkit-scrollbar-thumb {
    background: rgba(139, 69, 19, 0.6);
    border-radius: 4px;
}

.scrollable-content::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 69, 19, 0.8);
}

.estanco-building {
    text-align: center;
    margin-bottom: 30px;
}

.estanco-sign {
    background: #8B0000;
    color: white;
    padding: 10px;
    font-size: 1.5em;
    font-weight: bold;
    border-radius: 10px 10px 0 0;
    margin-bottom: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.click-area {
    background: linear-gradient(145deg, #F4A460 0%, #DEB887 100%);
    border: 3px solid #8B4513;
    border-radius: 0 0 15px 15px;
    padding: 40px;
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.click-area:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.click-area:active {
    transform: scale(0.98);
}

.counter {
    font-size: 4em;
    margin-bottom: 10px;
}

.click-text {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #8B4513;
    font-weight: bold;
}

.money-per-click {
    font-size: 1.5em;
    color: #228B22;
    font-weight: bold;
}

.business-info {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(145deg, #F0F8FF 0%, #E6F3FF 100%);
    border: 2px solid #4682B4;
    border-radius: 15px;
}

.business-info h3 {
    color: #8B4513;
    margin-bottom: 15px;
    font-size: 1.3em;
    text-align: center;
}

.current-business {
    text-align: center;
}

.business-level {
    font-size: 1.1em;
    font-weight: bold;
    color: #4682B4;
    margin-bottom: 8px;
}

.business-name {
    font-size: 1.4em;
    font-weight: bold;
    color: #8B4513;
    margin-bottom: 8px;
}

.business-description {
    color: #666;
    font-style: italic;
}

.upgrades-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.upgrades-panel h3 {
    color: #8B4513;
    margin-bottom: 20px;
    font-size: 1.3em;
    text-align: center;
}

.upgrade {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(145deg, rgba(245, 222, 179, 0.95) 0%, rgba(222, 184, 135, 0.95) 100%);
    border: 2px solid #D2691E;
    border-radius: 15px;
    padding: 18px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.upgrade:hover {
    transform: translateX(8px) translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.upgrade.affordable {
    border-color: #32CD32;
    background: linear-gradient(145deg, rgba(240, 255, 240, 0.95) 0%, rgba(230, 255, 230, 0.95) 100%);
    box-shadow: 0 0 15px rgba(50, 205, 50, 0.3);
}

.upgrade.affordable:hover {
    background: linear-gradient(145deg, rgba(230, 255, 230, 0.95) 0%, rgba(204, 255, 204, 0.95) 100%);
    box-shadow: 0 0 25px rgba(50, 205, 50, 0.5);
}

.upgrade-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.upgrade-icon {
    font-size: 2em;
    margin-right: 15px;
}

.upgrade-details {
    flex: 1;
}

.upgrade-name {
    font-weight: bold;
    color: #8B4513;
    margin-bottom: 2px;
}

.upgrade-description {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 2px;
}

.upgrade-owned {
    font-size: 0.8em;
    color: #888;
}

.upgrade-cost {
    font-weight: bold;
    color: #228B22;
    font-size: 1.1em;
}

.upgrade-benefit {
    font-size: 0.9em;
    color: #228B22;
    font-weight: bold;
    margin-bottom: 2px;
}

.business-upgrade {
    position: relative;
}

.business-upgrade.owned {
    background: linear-gradient(145deg, #E6FFE6 0%, #CCFFCC 100%);
    border-color: #32CD32;
}

.business-upgrade.owned::after {
    content: "✓ ADQUIRIDO";
    position: absolute;
    top: 10px;
    right: 10px;
    background: #32CD32;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: bold;
}

.prestige-section {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 15px;
    border: 2px solid #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.prestige-section h3 {
    color: #FFD700;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.4em;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.prestige-info-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.prestige-stats {
    flex: 1;
    color: white;
}

.prestige-stats > div {
    margin-bottom: 8px;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    font-weight: bold;
}

.prestige-button {
    padding: 15px 25px;
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 200px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

.prestige-button.available {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a2e;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    animation: prestigePulse 2s infinite;
}

.prestige-button.available:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
}

.prestige-button.unavailable {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    color: #ccc;
    cursor: not-allowed;
}

.prestige-requirement {
    font-size: 0.8em;
    margin-top: 5px;
    opacity: 0.8;
}

@keyframes prestigePulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    }
    50% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 1);
    }
}

.save-system-section {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 15px;
    border: 2px solid #3498db;
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.3);
}

.save-system-section h3 {
    color: #3498db;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.4em;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.save-system-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.save-export, .save-import {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.save-export h4, .save-import h4 {
    color: #ecf0f1;
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.1em;
}

.save-button {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.save-button.export {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
}

.save-button.export:hover {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
}

.save-button.import {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.save-button.import:hover {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.save-code {
    width: 100%;
    height: 80px;
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #ecf0f1;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    resize: vertical;
    outline: none;
}

.save-code:focus {
    border-color: #3498db;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
}

.save-code::placeholder {
    color: rgba(236, 240, 241, 0.6);
}

.achievements {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.achievements h3 {
    color: #8B4513;
    margin-bottom: 15px;
    text-align: center;
}

.achievement {
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.achievement.unlocked {
    background: linear-gradient(145deg, #FFD700 0%, #FFA500 100%);
    border: 2px solid #FF8C00;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.achievement.locked {
    background: linear-gradient(145deg, #888 0%, #666 100%);
    border: 2px solid #555;
    opacity: 0.6;
}

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

.achievement-text {
    flex: 1;
    font-weight: bold;
}

.achievement.unlocked .achievement-text {
    color: #8B4513;
}

.achievement.locked .achievement-text {
    color: #ccc;
}

.achievement-name {
    font-size: 1em;
    margin-bottom: 2px;
}

.achievement-description {
    font-size: 0.85em;
    opacity: 0.8;
    font-weight: normal;
}

.achievement-category {
    margin: 20px 0 10px 0;
    padding: 8px 0;
    border-bottom: 2px solid #8B4513;
}

.achievement-category h4 {
    color: #8B4513;
    margin: 0;
    font-size: 1.1em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.floating-money {
    position: absolute;
    color: #228B22;
    font-weight: bold;
    font-size: 1.2em;
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
    z-index: 1000;
}

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

/* Escritorio grande - Layout fijo con scroll solo en mejoras */
@media (min-width: 1200px) and (min-height: 800px) {
    body {
        overflow: hidden; /* Evitar scroll en la página */
    }

    .game-container {
        height: 100vh;
        overflow: hidden;
    }

    .game-main {
        height: calc(100vh - 200px); /* Ajustar según altura del header */
        overflow: hidden;
    }

    .scrollable-content {
        height: 100%;
        overflow-y: auto;
    }

    .click-area-container {
        height: fit-content;
        max-height: 100%;
        overflow: visible;
    }
}

/* Pantallas medianas - Permitir scroll normal */
@media (max-width: 1199px) or (max-height: 799px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .game-container {
        min-height: 100vh;
        height: auto;
    }

    .game-main {
        min-height: auto;
        height: auto;
    }

    .scrollable-content {
        height: auto;
        overflow-y: visible;
    }
}

/* Móviles - Layout vertical con scroll normal */
@media (max-width: 768px) {
    body {
        min-height: 100vh;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .game-container {
        min-height: 100vh;
        height: auto;
        padding: 10px;
    }

    .game-main {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
    }

    .click-area-container {
        margin-bottom: 15px;
        height: auto;
    }

    .scrollable-content {
        height: auto;
        overflow-y: visible;
    }

    .stats {
        flex-direction: column;
        gap: 10px;
    }

    .header-controls {
        position: relative;
        top: auto;
        right: auto;
        justify-content: center;
        margin-bottom: 15px;
    }

    .game-header {
        padding: 15px;
        margin-bottom: 15px;
    }

    .game-header h1 {
        font-size: 2.5em;
        padding-right: 0;
        margin-top: 0;
    }

    .volume-control {
        flex-direction: column;
        gap: 5px;
    }

    .prestige-info-panel {
        flex-direction: column;
        gap: 15px;
    }

    .prestige-button {
        min-width: auto;
        width: 100%;
    }

    .save-system-panel {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .save-code {
        height: 60px;
        font-size: 0.8em;
    }
}
