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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 100%;
    padding: 15px;
    padding-bottom: 100px;
    min-height: 100vh;
}

/* Main 3-Column Layout */
.main-layout {
    display: grid;
    grid-template-columns: minmax(250px, 1fr) minmax(200px, 1fr) minmax(200px, 1fr);
    gap: 15px;
    max-width: 1600px;
    margin: 0 auto;
}

.panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    min-height: 600px;
}

.panel-header {
    font-size: 16px;
    font-weight: 700;
    color: #764ba2;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f5576c;
    text-align: center;
}

/* LEFT: Upgrades Panel - Compact Grid */
.upgrades-panel {
    overflow: visible;
}

.upgrades-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    overflow: visible;
}

/* Remove scrollbar styling - no longer needed */

.upgrade-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 60px;
    word-break: break-word;
}

.upgrade-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.3s ease;
}

.upgrade-card:hover::before {
    left: 100%;
}

.upgrade-card:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.upgrade-card.purchased {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.upgrade-card.purchased::after {
    content: '✓';
    position: absolute;
    top: 3px;
    right: 6px;
    font-size: 12px;
    font-weight: bold;
}

.upgrade-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, #bbb 0%, #999 100%);
}

.upgrade-card.disabled:hover {
    transform: none;
    box-shadow: none;
}

.upgrade-card.purchasable {
    animation: purchasablePulse 1.5s ease-in-out infinite;
    border-color: #FFD700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6), inset 0 0 8px rgba(255, 215, 0, 0.2);
}

.upgrade-card.purchasable:hover {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), inset 0 0 10px rgba(255, 215, 0, 0.3);
}

@keyframes purchasablePulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6), inset 0 0 8px rgba(255, 215, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.8), inset 0 0 12px rgba(255, 215, 0, 0.3);
    }
}

.upgrade-name {
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0px;
    line-height: 1.1;
    overflow: visible;
}

.upgrade-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 4px;
}

.upgrade-effect {
    font-size: 8px;
    opacity: 0.85;
    line-height: 1.1;
    overflow: visible;
}

.upgrade-cost {
    font-size: 9px;
    font-weight: 600;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.upgrade-card.purchased .upgrade-cost {
    color: #90EE90;
}

/* MIDDLE: Center Panel (Button) */
.center-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.money-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    text-align: center;
    color: white;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.money-label {
    font-size: 20px;
    flex-shrink: 0;
}

.money-value {
    font-size: 24px;
    font-weight: 700;
    word-break: break-all;
}

.click-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.big-money-button {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 6px solid rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: white;
    font-size: 100px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 50px rgba(255, 215, 0, 0.5), inset 0 2px 10px rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    user-select: none;
    flex-shrink: 0;
    font-weight: 700;
}

.big-money-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    pointer-events: none;
}

.big-money-button:active {
    transform: scale(0.92);
    box-shadow: 0 10px 25px rgba(255, 215, 0, 0.4), inset 0 2px 10px rgba(255, 255, 255, 0.3);
}

.big-money-button:hover:not(:active) {
    transform: scale(1.06);
    box-shadow: 0 16px 35px rgba(255, 215, 0, 0.5);
}

.button-icon {
    font-size: 56px;
    animation: bounce 0.6s ease-in-out infinite;
}

.last-click-display {
    font-size: 13px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.6);
    min-height: 18px;
    animation: fadeIn 0.3s ease;
    text-align: center;
}

/* RIGHT: Stats Panel - Compact Grid */
.stats-panel {
    overflow-y: auto;
    padding-right: 4px;
}

.stats-panel::-webkit-scrollbar {
    width: 5px;
}

.stats-panel::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.stats-panel::-webkit-scrollbar-thumb {
    background: #764ba2;
    border-radius: 3px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.stat-item {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 10px;
    border-radius: 8px;
    color: white;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-icon {
    font-size: 18px;
}

.stat-label {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    font-size: 14px;
    font-weight: 700;
    word-break: break-all;
}

/* Animations */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

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

@keyframes floatUp {
    from {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
    to {
        opacity: 0;
        transform: translateY(-60px) translateX(20px);
    }
}

@keyframes luckyFloat {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(1);
    }
    50% {
        transform: translateY(-30px) translateX(20px) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translateY(-90px) translateX(30px) scale(0.8);
    }
}

@keyframes jackpotBurst {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0) scale(1) rotate(0deg);
    }
    50% {
        transform: translateY(-40px) translateX(25px) scale(1.3) rotate(10deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-120px) translateX(40px) scale(0.5) rotate(20deg);
    }
}

/* Floating Numbers */
#floatingNumbers {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.floating-number {
    position: fixed;
    font-weight: 700;
    font-size: 24px;
    pointer-events: none;
    animation: floatUp 1s ease-out forwards;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.floating-number.lucky {
    font-size: 28px;
    animation: luckyFloat 1.2s ease-out forwards;
    color: #FFC107 !important;
    text-shadow: 0 0 10px rgba(255, 193, 7, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.floating-number.jackpot {
    font-size: 40px;
    animation: jackpotBurst 1.5s ease-out forwards;
    color: #FF6B35 !important;
    text-shadow: 0 0 15px rgba(255, 107, 53, 0.9), 0 0 25px rgba(255, 193, 7, 0.6), 2px 2px 6px rgba(0, 0, 0, 0.4);
    font-weight: 900;
}

.floating-number.passive {
    font-size: 18px;
    animation: floatUp 1s ease-out forwards;
    color: #4CAF50 !important;
    opacity: 0.8;
}

.floating-number.random {
    font-size: 20px;
    animation: floatUp 1.2s ease-out forwards;
    color: #2196F3 !important;
    text-shadow: 0 0 8px rgba(33, 150, 243, 0.6);
}

.floating-number.offline {
    font-size: 22px;
    animation: floatUp 1.3s ease-out forwards;
    color: #667eea !important;
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.7);
    font-weight: 600;
}

/* Footer */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    padding: 12px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 100;
    height: 60px;
}

.reset-button {
    background: #f5576c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.3s ease;
}

.reset-button:hover {
    background: #f23a4a;
    transform: scale(1.05);
}

.reset-button:active {
    transform: scale(0.95);
}

.rebirth-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid #FFD700;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.3s ease;
    margin: 0 8px;
}

.rebirth-button:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.rebirth-button:active {
    transform: scale(0.95);
}

.version {
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 1fr 0.8fr 1fr;
        gap: 12px;
    }

    .panel {
        min-height: 500px;
        padding: 12px;
    }

    .upgrades-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .upgrade-card {
        padding: 8px;
    }

    .upgrade-name {
        font-size: 10px;
    }

    .upgrade-effect {
        font-size: 8px;
    }

    .big-money-button {
        width: 160px;
        height: 160px;
        font-size: 80px;
    }

    .money-value {
        font-size: 28px;
    }

    .stat-item {
        padding: 8px;
    }

    .stat-icon {
        font-size: 16px;
    }

    .stat-value {
        font-size: 13px;
    }
}

@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .upgrades-panel {
        grid-column: 1 / -1;
        min-height: auto;
        max-height: none;
    }

    .upgrades-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .center-panel {
        min-height: 350px;
    }

    .stats-panel {
        max-height: 350px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 10px;
    }

    .main-layout {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .panel {
        min-height: auto;
        padding: 10px;
    }

    .money-display {
        padding: 6px 8px;
        margin-bottom: 8px;
        gap: 6px;
    }

    .money-label {
        font-size: 14px;
        margin-bottom: 0;
    }

    .money-value {
        font-size: 18px;
    }

    .panel-header {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .upgrades-panel {
        max-height: none;
    }

    .upgrades-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }

    .upgrade-card {
        padding: 6px 8px;
        min-height: 60px;
    }

    .upgrade-name {
        font-size: 10px;
        line-height: 1.1;
    }

    .upgrade-effect {
        font-size: 8px;
        line-height: 1.1;
    }

    .upgrade-cost {
        font-size: 9px;
        margin-top: 4px;
        padding-top: 4px;
    }

    .big-money-button {
        width: 140px;
        height: 140px;
        font-size: 70px;
    }
    }

    .button-icon {
        font-size: 44px;
    }

    .money-value {
        font-size: 24px;
    }

    .last-click-display {
        font-size: 11px;
        min-height: 14px;
    }

    .stats-panel {
        max-height: 200px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .stat-item {
        padding: 6px;
    }

    .stat-icon {
        font-size: 14px;
    }

    .stat-label {
        font-size: 9px;
    }

    .stat-value {
        font-size: 12px;
    }

    .footer {
        height: 50px;
        padding: 10px;
        gap: 10px;
    }

    .reset-button {
        padding: 6px 12px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }

    .money-display {
        padding: 5px 6px;
        margin-bottom: 6px;
        gap: 4px;
    }

    .money-label {
        font-size: 12px;
        margin-bottom: 0;
    }

    .money-value {
        font-size: 16px;
    }

    .last-click-display {
        font-size: 10px;
        min-height: 12px;
    }

    .upgrades-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }

    .upgrade-card {
        padding: 5px 6px;
        min-height: 55px;
    }

    .upgrade-name {
        font-size: 9px;
        line-height: 1.1;
    }

    .upgrade-effect {
        font-size: 9px;
        line-height: 1.2;
    }

    .big-money-button {
        width: 130px;
        height: 130px;
        font-size: 60px;
    }

    .money-value {
        font-size: 22px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 5px;
    }

    .stat-item {
        padding: 5px;
    }

    .stat-icon {
        font-size: 12px;
    }

    .stat-value {
        font-size: 11px;
    }
}

/* Bottom Navigation & Modals */
.bottom-nav {
    position: fixed;
    bottom: 60px;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    border-top: 2px solid #667eea;
    z-index: 100;
}

.nav-btn {
    background: rgba(102, 126, 234, 0.7);
    color: white;
    border: 2px solid #667eea;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: #667eea;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.8);
}

/* Modal Panels */
.panel-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #FFD700;
}

.modal-header h2 {
    font-size: 24px;
    margin: 0;
}

.close-btn {
    background: #f5576c;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f23a4a;
    transform: scale(1.1);
}

.modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Shop Grid */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.shop-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.shop-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    border-color: #FFD700;
}

.shop-item-emoji {
    font-size: 32px;
    margin-bottom: 8px;
}

.shop-item-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.shop-item-desc {
    font-size: 11px;
    opacity: 0.8;
    margin-bottom: 8px;
}

.shop-item-price {
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
}

.shop-item.owned {
    opacity: 0.7;
    border-color: #4CAF50;
}

.shop-item.owned::after {
    content: '✓ Owned';
    display: block;
    color: #4CAF50;
    font-weight: 600;
    font-size: 10px;
    margin-top: 4px;
}

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

.achievement-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    opacity: 0.6;
}

.achievement-item.unlocked {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    opacity: 1;
    border-color: #FFD700;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.achievement-emoji {
    font-size: 28px;
    margin-bottom: 4px;
}

.achievement-name {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 2px;
}

.achievement-desc {
    font-size: 9px;
    opacity: 0.8;
}

/* Settings List */
.settings-list {
    max-width: 500px;
    margin: 0 auto;
}

.setting-item {
    background: rgba(102, 126, 234, 0.1);
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.setting-item label {
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.setting-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.setting-item h3 {
    color: white;
    margin-bottom: 8px;
    font-size: 14px;
}

.setting-item p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin: 4px 0;
}
