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

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 90%;
    max-width: 1200px;
}

.game-area {
    display: flex;
    gap: 0;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    height: 85vh;
    min-height: 500px;
}

.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    background: linear-gradient(180deg, #f5f5f5 0%, #e8e8e8 100%);
    overflow-y: auto;
    overflow-x: hidden;
}

.cookie-section {
    min-height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.scroll-hint {
    margin-top: auto;
    padding-top: 20px;
    color: #999;
    font-size: 0.85em;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-5px);
    }

    60% {
        transform: translateY(-3px);
    }
}

.right-panel {
    flex: 1;
    padding: 20px;
    background: white;
    overflow-y: auto;
    border-left: 2px solid #ddd;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.control-btn {
    flex: 1;
    min-width: 100px;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: bold;
    transition: all 0.3s;
}

.control-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.control-btn:active {
    transform: scale(0.98);
}

.save-btn {
    border-color: #28a745;
    color: #28a745;
}

.save-btn:hover {
    background: rgba(40, 167, 69, 0.1);
}

.load-btn {
    border-color: #007bff;
    color: #007bff;
}

.load-btn:hover {
    background: rgba(0, 123, 255, 0.1);
}

.reset-btn {
    border-color: #dc3545;
    color: #dc3545;
}

.reset-btn:hover {
    background: rgba(220, 53, 69, 0.1);
}

.export-btn {
    border-color: #fd7e14;
    color: #fd7e14;
}

.export-btn:hover {
    background: rgba(253, 126, 20, 0.1);
}

.import-btn {
    border-color: #17a2b8;
    color: #17a2b8;
}

.import-btn:hover {
    background: rgba(23, 162, 184, 0.1);
}

.save-status {
    font-size: 0.85em;
    color: #666;
    margin-top: 10px;
    text-align: center;
    min-height: 20px;
}

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

.export-textarea {
    width: 100%;
    height: 150px;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-family: monospace;
    font-size: 0.85em;
    resize: vertical;
    word-break: break-all;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 30px;
    color: #333;
}

.player-info {
    margin-bottom: 20px;
    width: 100%;
    max-width: 200px;
}

.player-name-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    text-align: center;
    transition: border-color 0.3s;
}

.player-name-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

h2 {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 20px;
}

.cookie-display {
    margin: 20px 0;
    position: relative;
}

.main-stats {
    text-align: center;
    margin-bottom: 15px;
}

.cookie-count-display {
    font-size: 1.8em;
    font-weight: bold;
    color: #333;
    margin: 0;
}

.cookie-count-display span {
    color: #667eea;
}

.cps-display {
    font-size: 1em;
    color: #666;
    margin: 5px 0 0 0;
}

.click-power-display {
    font-size: 0.9em;
    color: #888;
    margin: 3px 0 0 0;
}

.click-power-display span {
    color: #667eea;
    font-weight: bold;
}

#goldenCookieContainer {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

#goldenCookieContainer .golden-cookie {
    pointer-events: auto;
}

@keyframes goldenFloat {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(10deg);
    }
}

@keyframes goldenShimmer {

    0%,
    100% {
        filter: drop-shadow(0 0 5px gold);
    }

    50% {
        filter: drop-shadow(0 0 20px gold) drop-shadow(0 0 30px yellow);
    }
}

.golden-cookie {
    animation: goldenFloat 2s ease-in-out infinite, goldenShimmer 1s ease-in-out infinite !important;
    z-index: 100;
}

/* Stats and Prestige Row */
.stats-prestige-row {
    display: flex;
    gap: 15px;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    flex-shrink: 0;
}

/* Stats Panel */
.stats-panel {
    flex: 1;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd;
}

.stats-panel h3 {
    margin: 0 0 12px 0;
    font-size: 1em;
    color: #333;
    text-align: center;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
}

.stat-label-left {
    font-size: 0.85em;
    color: #666;
}

.stat-value-right {
    font-weight: bold;
    color: #667eea;
    font-size: 0.9em;
}

.stat-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 8px 0;
}

/* Prestige Panel Styles */
.prestige-panel {
    flex: 1;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(155, 89, 182, 0.3);
    flex-shrink: 0;
}

.prestige-header {
    background: linear-gradient(135deg, #9b59b6 0%, #6b4ba3 100%);
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.prestige-icon {
    font-size: 1.3em;
}

.prestige-title {
    font-weight: bold;
    color: white;
    font-size: 1em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.prestige-body {
    padding: 15px;
}

.prestige-chips {
    text-align: center;
    margin-bottom: 15px;
}

.chip-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 5px;
}

.chip-icon {
    font-size: 1.5em;
    filter: drop-shadow(0 0 5px rgba(155, 89, 182, 0.5));
}

.chip-count {
    font-size: 2em;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.chip-label {
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.prestige-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.prestige-stat {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.7em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.1em;
    font-weight: bold;
}

.stat-value.bonus {
    color: #8aff8a;
}

.stat-value.pending {
    color: #ffd700;
}

.prestige-progress {
    margin-bottom: 15px;
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #9b59b6, #e74c3c, #f39c12);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.7em;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    display: block;
}

.prestige-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 1em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3);
}

.prestige-btn:hover {
    background: linear-gradient(135deg, #a569bd 0%, #9b59b6 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.4);
}

.prestige-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.2em;
}

.prestige-requirement {
    margin-top: 10px;
    font-size: 0.7em;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    font-style: italic;
}

/* Casino Panel */
.casino-panel {
    background: linear-gradient(135deg, #2c3e50 0%, #000 100%);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #d4af37;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.casino-panel h2 {
    color: #ffd700;
    margin-top: 0;
    font-size: 1.2em;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 10px;
}

.casino-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.wager-input {
    flex: 1;
    padding: 8px;
    border-radius: 5px;
    border: 1px solid #d4af37;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1em;
}

.max-wager-btn {
    background: #e67e22;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0 15px;
    cursor: pointer;
    font-weight: bold;
}

.gamble-btn {
    width: 100%;
    padding: 10px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: transform 0.1s;
    font-weight: bold;
}

.gamble-btn:active {
    transform: scale(0.98);
}

.casino-result {
    text-align: center;
    min-height: 1.2em;
    margin: 10px 0 0 0;
    font-weight: bold;
}

.prestige-error {
    text-align: center;
    color: #ff6b6b;
    font-size: 0.9em;
    margin: 10px 0 0 0;
    min-height: 1.2em;
}

.flag-display-box {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 10px;
    border: 1px dashed #ffd700;
    text-align: center;
    margin: 20px 0;
}

.flag-text {
    font-family: 'Courier New', monospace;
    font-size: 1.5em;
    color: #ffd700;
    word-break: break-all;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Lifetime Stats Panel */
.lifetime-panel {
    margin-top: 15px;
    width: 100%;
    max-width: 280px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    gap: 10px;
}

.lifetime-stat {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
}

.lifetime-icon {
    font-size: 1.3em;
}

.lifetime-info {
    display: flex;
    flex-direction: column;
}

.lifetime-label {
    font-size: 0.65em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lifetime-value {
    font-size: 0.95em;
    font-weight: bold;
    color: #667eea;
}

/* Utility classes */
.stat-secondary {
    font-size: 0.85em;
    color: #888;
}

.multiplier-badge {
    color: #ffd700;
    font-size: 0.8em;
    font-weight: bold;
}

.flag-display {
    margin-top: 15px;
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    color: #155724;
    text-align: center;
    font-weight: bold;
    display: none;
}

.cookie-btn {
    font-size: 4em;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.1s;
    padding: 20px;
    border-radius: 10px;
    background: rgba(255, 200, 100, 0.1);
}

.cookie-btn:active {
    transform: scale(0.95);
}

.cookie-btn:hover {
    background: rgba(255, 200, 100, 0.2);
}

.stats {
    text-align: center;
    margin-top: 30px;
}

.stats p {
    font-size: 1.2em;
    margin: 10px 0;
    color: #555;
}

.stats span {
    font-weight: bold;
    color: #667eea;
}

.upgrades-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.upgrade {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upgrade:hover:not(.disabled) {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(5px);
}

.upgrade.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.upgrade-info {
    flex: 1;
}

.upgrade-name {
    font-weight: bold;
    font-size: 1em;
    color: #333;
    margin-bottom: 5px;
}

.upgrade-desc {
    font-size: 0.85em;
    color: #666;
}

.upgrade-cost {
    background: #667eea;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: bold;
    white-space: nowrap;
    margin-left: 15px;
}

.upgrade.disabled .upgrade-cost {
    background: #ccc;
}

#flagDisplay {
    margin-top: 30px;
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
    color: #155724;
    text-align: center;
    font-size: 1.1em;
}

@media (max-width: 768px) {
    .game-area {
        flex-direction: column;
    }

    .right-panel {
        border-left: none;
        border-top: 2px solid #ddd;
    }

    h1 {
        font-size: 1.8em;
    }

    .cookie-btn {
        font-size: 2.5em;
    }
}