:root {
    --primary-color: #00f2ff;
    --secondary-color: #7000ff;
    --accent-color: #ff00ea;
    --bg-dark: #0a0a1a;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-dark: #1f2937;
    --text-light: #f9fafb;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    overflow-x: hidden;
    overflow-y: auto;
    /* Permite desplazamiento vertical si la pantalla es muy pequeña */
    touch-action: pan-x pan-y;
}

.game-container {
    max-width: 500px;
    /* Reduced from 800px to avoid excessive height on laptops */
    margin: 60px auto 20px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    color: var(--text-dark);
    position: relative;
    z-index: 10;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.header h1 {
    margin: 0;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #111827;
}

.game-icon-small {
    width: 40px;
    height: 40px;
}

.back-btn {
    padding: 8px 16px;
    background: #f3f4f6;
    border: none;
    border-radius: 12px;
    color: #4b5563;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.back-btn:hover {
    background: #e5e7eb;
}

.game-info {
    display: flex;
    justify-content: space-around;
    background: #f9fafb;
    padding: 15px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.info-label {
    font-size: 0.85rem;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #111827;
}

.game-screen {
    position: relative;
    width: 100%;
    aspect-ratio: 4/5;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.5);
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Screens */
.start-screen,
.game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 100;
    transition: opacity 0.3s;
}

.hidden {
    display: none !important;
}

.start-content,
.game-over-content {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 32px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.start-content p {
    color: #4b5563;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.setup-group {
    margin-bottom: 25px;
    text-align: left;
}

.setup-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #374151;
}

.setup-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    box-sizing: border-box;
}

.game-start-btn,
.restart-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.game-start-btn:hover,
.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.controls-hint {
    background: #f3f4f6;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 25px;
    font-size: 0.9rem;
    color: #4b5563;
}

.record-box {
    margin: 20px 0;
    padding: 15px;
    background: #fffbeb;
    border: 2px solid #fef3c7;
    border-radius: 12px;
    color: #92400e;
}

/* Level Complete Screen */
.level-complete {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 150;
    transition: opacity 0.3s;
}

.level-complete-content {
    text-align: center;
    padding: 30px 25px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(5, 150, 105, 0.1) 100%);
    backdrop-filter: blur(15px);
    border: 3px solid rgba(16, 185, 129, 0.5);
    border-radius: 20px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 20px 60px rgba(16, 185, 129, 0.3);
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.complete-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: bounce 0.6s ease-in-out infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

.level-complete-content h2 {
    color: white;
    font-size: 1.8rem;
    margin: 0 0 20px 0;
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
}

.complete-stats {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row.coins-earned {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.2) 0%, transparent 100%);
    padding: 10px;
    margin: 8px -5px;
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.stat-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: #10b981;
}

.coins-earned .stat-value {
    color: #ffd700;
    font-size: 1.4rem;
}

.complete-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-next-level {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    transition: all 0.3s;
}

.btn-next-level:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

.btn-next-level:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-back-selector {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-back-selector:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(0, 242, 255, 0.8);
}

/* Reward Box Screen */
.reward-box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(15px);
    z-index: 160;
    transition: opacity 0.3s;
}

.reward-box-content {
    text-align: center;
    padding: 30px 25px;
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.2) 0%, rgba(75, 0, 130, 0.1) 100%);
    backdrop-filter: blur(15px);
    border: 3px solid rgba(138, 43, 226, 0.5);
    border-radius: 20px;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(138, 43, 226, 0.4);
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.box-animation {
    position: relative;
    margin-bottom: 20px;
}

.box-icon {
    font-size: 6rem;
    animation: bounce 1s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.8));
}

.box-shine {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
    animation: pulse 2s ease-in-out infinite;
}

.reward-box-content h2 {
    color: white;
    font-size: 1.8rem;
    margin: 0 0 10px 0;
    text-shadow: 0 0 20px rgba(138, 43, 226, 0.8);
}

.box-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.reward-reveal {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    border: 2px solid rgba(255, 215, 0, 0.3);
    animation: slideIn 0.5s ease-out;
}

.reward-icon {
    font-size: 4rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
}

.reward-reveal h3 {
    color: #ffd700;
    font-size: 1.5rem;
    margin: 10px 0;
}

.reward-reveal p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
}

.btn-open-box {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    border: 3px solid rgba(255, 215, 0, 0.5);
    border-radius: 15px;
    color: #000;
    font-size: 1.2rem;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.btn-open-box:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 40px rgba(255, 215, 0, 0.8);
}

.btn-close-box {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-close-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

/* Bottom Ad Styling */
.bottom-ad {
    margin-top: 20px;
    text-align: center;
    border-top: 1px solid #f0f0f0;
    padding-top: 20px;
}

@media (max-height: 750px) {
    .game-container {
        margin: 50px auto 10px;
        padding: 10px;
    }

    .header {
        margin-bottom: 5px;
        padding-bottom: 5px;
    }

    .game-info {
        padding: 8px;
        margin-bottom: 10px;
    }

    .info-value {
        font-size: 1rem;
    }

    .header h1 {
        font-size: 1.2rem;
    }
}

/* Mode Selection Screen */
.mode-selection {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a0a2e 50%, #0a0a1a 100%);
    z-index: 100;
    overflow-y: auto;
}

.mode-content {
    text-align: center;
    padding: 20px;
    width: 90%;
    max-width: 380px;
}

.mode-title {
    color: white;
    font-size: 1.4rem;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(0, 242, 255, 0.5);
}

.mode-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 20px;
}

.mode-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(0, 242, 255, 0.3);
    border-radius: 15px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.mode-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 242, 255, 0.1) 0%, rgba(112, 0, 255, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.mode-card:hover {
    transform: translateY(-10px);
    border-color: rgba(0, 242, 255, 0.8);
    box-shadow: 0 15px 40px rgba(0, 242, 255, 0.3);
}

.mode-card:hover::before {
    opacity: 1;
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 10px rgba(0, 242, 255, 0.5));
}

.mode-card h3 {
    color: white;
    font-size: 1.2rem;
    margin: 10px 0;
    position: relative;
}

.mode-card p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    margin-bottom: 15px;
    position: relative;
}

.mode-badge {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    position: relative;
}

/* Level Selector */
.level-selector {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a0a2e 50%, #0a0a1a 100%);
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
}

.level-selector-content {
    padding: 15px;
    max-width: 100%;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.level-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.star-decoration {
    color: #00f2ff;
    font-size: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
}

.level-header h2 {
    color: white;
    font-size: 1.4rem;
    margin: 0;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #00f2ff 0%, #7000ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
}

.btn-secondary {
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(0, 242, 255, 0.8);
}

.player-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(0, 242, 255, 0.3);
    border-radius: 15px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-item:hover {
    border-color: rgba(0, 242, 255, 0.8);
    transform: translateY(-2px);
}

.stat-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 242, 255, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-item:hover .stat-glow {
    opacity: 1;
}

.stat-max {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    margin-left: 4px;
}

.stat-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
}

.stat-text {
    display: flex;
    flex-direction: column;
}

.stat-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    color: white;
    font-size: 1.8rem;
    font-weight: 800;
}

.btn-upgrade {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #ff00ea 0%, #7000ff 100%);
    border: 2px solid rgba(255, 0, 234, 0.5);
    border-radius: 15px;
    color: white;
    font-size: 1.1rem;
    font-weight: 900;
    cursor: pointer;
    margin-bottom: 15px;
    box-shadow: 0 0 30px rgba(255, 0, 234, 0.4);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
}

.btn-upgrade::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-upgrade:hover::before {
    left: 100%;
}

.btn-upgrade:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 40px rgba(255, 0, 234, 0.7);
}

.btn-icon {
    font-size: 1.5rem;
}

.btn-arrow {
    font-size: 1.5rem;
    transition: transform 0.3s;
}

.btn-upgrade:hover .btn-arrow {
    transform: translateX(5px);
}

.levels-scroll-container {
    position: relative;
    margin: 20px 0;
}

.levels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 10px;
    padding: 10px 40px;
    flex: 1;
    overflow-y: auto;
}

.level-card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, rgba(10, 10, 26, 0.8) 0%, rgba(26, 10, 46, 0.6) 100%);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(0, 242, 255, 0.4);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.level-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 242, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.level-card:hover::before {
    opacity: 1;
}

.level-card.locked {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.6) 0%, rgba(20, 20, 20, 0.4) 100%);
}

.level-card.completed {
    border-color: rgba(16, 185, 129, 0.9);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(5, 150, 105, 0.2) 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.level-card:not(.locked):hover {
    transform: translateY(-5px) scale(1.08);
    border-color: rgba(0, 242, 255, 1);
    box-shadow: 0 10px 35px rgba(0, 242, 255, 0.5);
}

.level-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 5px;
}

.level-status {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
}

.level-stars {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #ffd700;
    font-size: 1.2rem;
}

.scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 242, 255, 0.3);
    border: 2px solid rgba(0, 242, 255, 0.5);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
}

.scroll-btn:hover {
    background: rgba(0, 242, 255, 0.5);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.6);
}

.scroll-left {
    left: 0;
}

.scroll-right {
    right: 0;
}

/* Upgrades Screen */
.upgrades-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0d0d1f 0%, #1a0a2e 50%, #0d0d1f 100%);
    z-index: 101;
    overflow-y: auto;
    overflow-x: hidden;
}

.workshop-banner {
    background: linear-gradient(135deg, rgba(255, 140, 0, 0.2) 0%, rgba(255, 0, 234, 0.15) 100%);
    border: 3px solid rgba(255, 140, 0, 0.4);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(255, 140, 0, 0.3);
}

.workshop-grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 140, 0, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 140, 0, 0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.3;
    pointer-events: none;
}

.workshop-title {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    z-index: 1;
}

.workshop-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 20px rgba(255, 140, 0, 0.8));
    animation: rotate 4s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.workshop-text h2 {
    color: white;
    font-size: 1.8rem;
    margin: 0;
    font-weight: 900;
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(255, 140, 0, 0.8);
}

.workshop-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin: 5px 0 0 0;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.upgrades-content {
    padding: 15px;
    max-width: 100%;
    margin: 0 auto;
}

.upgrades-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.coins-display {
    flex: 1;
}

.coins-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25) 0%, rgba(255, 165, 0, 0.15) 100%);
    padding: 12px 20px;
    border-radius: 15px;
    border: 3px solid rgba(255, 215, 0, 0.6);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.coins-badge::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.2) 0%, transparent 70%);
    animation: pulse 2s ease-in-out infinite;
}

.coin-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8));
    position: relative;
    z-index: 1;
}

.coins-info {
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

.coins-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.coins-value {
    color: white;
    font-size: 1.8rem;
    font-weight: 900;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.upgrades-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.upgrade-card {
    background: linear-gradient(135deg, rgba(30, 30, 50, 0.8) 0%, rgba(20, 20, 40, 0.6) 100%);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 140, 0, 0.4);
    border-radius: 18px;
    padding: 18px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.upgrade-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 140, 0, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 140, 0, 0.05) 1px, transparent 1px);
    background-size: 15px 15px;
    opacity: 0.3;
    pointer-events: none;
}

.upgrade-card:hover {
    border-color: rgba(255, 140, 0, 0.9);
    box-shadow: 0 10px 40px rgba(255, 140, 0, 0.4);
    transform: translateY(-3px);
}

.upgrade-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.upgrade-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 20px rgba(255, 140, 0, 0.8));
}

.upgrade-info {
    flex: 1;
}

.upgrade-card h3 {
    color: white;
    font-size: 1.1rem;
    margin: 0 0 5px 0;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(255, 140, 0, 0.5);
}

.upgrade-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin: 0;
}

.upgrade-details {
    position: relative;
    z-index: 1;
}

.upgrade-level-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    padding: 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(0, 242, 255, 0.3);
    border-radius: 12px;
}

.level-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.level-display strong {
    color: #00f2ff;
    font-size: 1.8rem;
    font-weight: 900;
    text-shadow: 0 0 15px rgba(0, 242, 255, 0.8);
}

.level-display span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    margin-left: 3px;
}

.upgrade-stats {
    text-align: center;
    margin-bottom: 15px;
}

.stat-badge {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(5, 150, 105, 0.2) 100%);
    border: 2px solid rgba(16, 185, 129, 0.6);
    border-radius: 20px;
    color: #10b981;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.btn-buy {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 3px solid rgba(16, 185, 129, 0.5);
    border-radius: 12px;
    color: white;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
    overflow: hidden;
    letter-spacing: 1px;
}

.btn-buy::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-buy:hover:not(:disabled)::before {
    left: 100%;
}

.btn-buy:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.6);
    border-color: rgba(16, 185, 129, 0.9);
}

.btn-buy:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: linear-gradient(135deg, #4b5563 0%, #374151 100%);
    border-color: rgba(75, 85, 99, 0.5);
}

.btn-cost {
    font-size: 1.2rem;
    position: relative;
    z-index: 1;
}

.btn-label {
    position: relative;
    z-index: 1;
    font-size: 1rem;
}

@media (max-width: 600px) {
    .game-container {
        margin: 50px 10px 10px;
        padding: 15px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .info-value {
        font-size: 1.1rem;
    }
    
    .mode-cards {
        grid-template-columns: 1fr;
    }
    
    .levels-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        padding: 20px 40px;
    }
    
    .upgrades-grid {
        grid-template-columns: 1fr;
    }
}