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

body {
    font-family: 'Fredoka', sans-serif;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    min-height: 100vh;
    overflow: hidden;
    color: #333;
}

/* Screen System */
.screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Menu */
.menu-container {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
}

.game-title {
    margin-bottom: 2rem;
    position: relative;
}

.game-title h1 {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    text-shadow: 4px 4px 0 rgba(0,0,0,0.2);
    margin-bottom: 0.5rem;
    animation: bounce 2s ease-in-out infinite;
}

.game-title .subtitle {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.95);
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-block;
}

.emoji-float {
    font-size: 2.5rem;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

.emoji-float.delay {
    animation-delay: 1.5s;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Menu Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.menu-btn {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    background: white;
    color: #11998e;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.menu-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

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

.menu-btn.play-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-size: 1.4rem;
}

.back-btn {
    margin-top: 2rem;
    background: rgba(255,255,255,0.2);
    color: white;
}

.back-btn:hover {
    background: rgba(255,255,255,0.3);
}

.danger-btn {
    background: #e74c3c;
    color: white;
}

.danger-btn:hover {
    background: #c0392b;
}

/* Stats Display */
.stats-display {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.stat-item {
    background: rgba(255,255,255,0.2);
    padding: 0.8rem 1.5rem;
    border-radius: 15px;
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-item span:first-child {
    font-size: 1.3rem;
}

/* Info Screens */
.info-container {
    background: white;
    border-radius: 25px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.info-container h2 {
    font-size: 1.8rem;
    color: #11998e;
    margin-bottom: 1.5rem;
    text-align: center;
}

.info-content {
    text-align: left;
}

.info-section {
    margin-bottom: 1.5rem;
}

.info-section h3 {
    font-size: 1.2rem;
    color: #38ef7d;
    margin-bottom: 0.5rem;
}

.info-section p, .info-section li {
    color: #666;
    line-height: 1.6;
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section li {
    padding: 0.4rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Controls Grid */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f5f5f5;
    border-radius: 10px;
}

.key {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Obstacle and Powerup Icons */
.obstacle-icon, .powerup-icon {
    font-size: 1.3rem;
}

/* Settings */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 15px;
}

.setting-item label {
    font-weight: 600;
    color: #444;
}

.toggle-btn {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn.on {
    background: linear-gradient(135deg, #11998e, #38ef7d);
    color: white;
}

.toggle-btn.off {
    background: #ddd;
    color: #666;
}

.danger-zone {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #fff5f5;
    border-radius: 15px;
    border: 2px solid #ffdddd;
}

.danger-zone h3 {
    color: #e74c3c;
    margin-bottom: 1rem;
}

/* Shop */
.shop-coins {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #f39c12;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.shop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.shop-item {
    background: #f5f5f5;
    border-radius: 15px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.shop-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.shop-item.owned {
    border-color: #2ecc71;
}

.shop-item.selected {
    border-color: #f39c12;
    background: #fff8e7;
}

.shop-item.locked {
    opacity: 0.7;
}

.shop-emoji {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.shop-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.3rem;
}

.shop-price {
    font-size: 0.9rem;
    color: #f39c12;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.shop-owned {
    color: #2ecc71;
    font-weight: 600;
}

/* Game Screen */
#game-screen {
    background: #87CEEB;
    flex-direction: column;
}

#game-screen.active {
    display: flex;
}

/* Game HUD */
.game-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: rgba(0,0,0,0.4);
    z-index: 10;
}

.hud-left, .hud-right {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    background: rgba(255,255,255,0.15);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}

.hud-item.score {
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.3), rgba(243, 156, 18, 0.3));
}

.hud-item.coins {
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.3), rgba(230, 126, 34, 0.3));
}

.hud-icon {
    font-size: 1.1rem;
}

.hud-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.zone-indicator {
    background: rgba(255,255,255,0.2);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
}

.powerup-indicator {
    font-size: 1.5rem;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.hud-btn {
    font-size: 1.3rem;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hud-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* Game Canvas */
#game-canvas {
    display: block;
    margin: auto;
}

/* Mobile Controls */
.mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: none;
    justify-content: space-between;
    align-items: flex-end;
    padding: 1rem;
    z-index: 20;
    pointer-events: none;
}

.mobile-controls.show {
    display: flex;
}

.touch-left, .touch-right {
    pointer-events: auto;
}

.touch-center {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: auto;
}

.touch-btn {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    border: none;
    font-size: 1.8rem;
    color: white;
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.left-btn, .right-btn {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.7), rgba(41, 128, 185, 0.7));
}

.jump-btn {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.7), rgba(39, 174, 96, 0.7));
}

.slide-btn {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.7), rgba(142, 68, 173, 0.7));
}

/* Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background: white;
    border-radius: 25px;
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.overlay-content h2 {
    font-size: 1.8rem;
    color: #11998e;
    margin-bottom: 1.5rem;
}

.pause-stats {
    margin-bottom: 1.5rem;
}

.pause-buttons, .game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* Game Over Screen */
.game-over-content {
    background: linear-gradient(135deg, #ff9a9e, #fecfef);
}

.game-over-content h2 {
    color: #ff4757;
}

.game-over-emoji {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.final-stats {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255,255,255,0.5);
    border-radius: 15px;
}

.stat {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.stat:last-child {
    border-bottom: none;
}

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

.stat span:last-child {
    font-weight: 700;
    color: #333;
}

.big-stat {
    font-size: 1.3rem;
    padding: 0.8rem 0;
}

.new-high {
    margin-top: 1rem;
    padding: 0.8rem;
    background: linear-gradient(135deg, #f1c40f, #f39c12);
    color: white;
    border-radius: 15px;
    font-weight: 700;
    animation: pulse 0.5s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 600px) {
    .game-title h1 {
        font-size: 2.2rem;
    }

    .menu-btn {
        font-size: 1rem;
        padding: 0.8rem 1.5rem;
    }

    .info-container {
        padding: 1.5rem;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .game-hud {
        padding: 0.5rem;
        flex-wrap: wrap;
    }

    .hud-item {
        padding: 0.3rem 0.6rem;
        font-size: 0.9rem;
    }

    .zone-indicator {
        font-size: 0.85rem;
        padding: 0.3rem 0.8rem;
    }

    .shop-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .shop-emoji {
        font-size: 2.5rem;
    }

    .touch-btn {
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
    }

    .stats-display {
        flex-direction: column;
        gap: 0.8rem;
    }
}

/* Touch device detection */
@media (pointer: coarse) {
    .mobile-controls {
        display: flex;
    }
}

/* Scrollbar styling */
.info-container::-webkit-scrollbar {
    width: 8px;
}

.info-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.info-container::-webkit-scrollbar-thumb {
    background: #11998e;
    border-radius: 10px;
}

.info-container::-webkit-scrollbar-thumb:hover {
    background: #0d7a6f;
}
