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

body {
    font-family: 'Arial', sans-serif;
    background: #1a1a2e;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    color: #fff;
}

#gameContainer {
    position: relative;
    display: inline-block;
    touch-action: none;
}

#gameCanvas {
    display: block;
    background: linear-gradient(to bottom, #87CEEB 0%, #98D8C8 50%, #6B8E23 100%);
    border: 2px solid #333;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    touch-action: none;
}

#ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    padding: 40px 60px;
    border-radius: 20px;
    border: 3px solid #fff;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
    pointer-events: auto;
}

.screen.hidden {
    display: none;
}

.screen h1 {
    font-size: 48px;
    margin-bottom: 20px;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 0.6),
        0 0 30px rgba(255, 215, 0, 0.4),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    color: #FFD700;
    animation: titlePulse 2s ease-in-out infinite,
               titleGlow 3s ease-in-out infinite,
               titleBounce 4s ease-in-out infinite;
    background: linear-gradient(90deg, #FFD700, #FFA500, #FF6B6B, #FFA500, #FFD700);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    letter-spacing: 2px;
    animation: titlePulse 2s ease-in-out infinite,
               titleGlow 3s ease-in-out infinite,
               titleBounce 4s ease-in-out infinite,
               titleGradient 5s linear infinite;
}

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

@keyframes titleGlow {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
        opacity: 1;
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 1)) drop-shadow(0 0 30px rgba(255, 165, 0, 0.8));
        opacity: 0.95;
    }
}

@keyframes titleBounce {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-5px);
    }
    75% {
        transform: translateY(5px);
    }
}

@keyframes titleGradient {
    0% {
        background-position: 0% center;
    }
    100% {
        background-position: 200% center;
    }
}

.screen h2 {
    font-size: 36px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    color: #FF6B6B;
}

.screen p {
    font-size: 18px;
    margin: 10px 0;
    line-height: 1.6;
}

.screen .hint {
    color: #AAA;
    font-size: 14px;
    margin-top: 20px;
}

.desktop-only {
    display: block;
}

.mobile-only {
    display: none;
}

#scoreDisplay {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    color: #FFF;
    pointer-events: none;
}

#scoreDisplay span {
    color: #FFD700;
}

#bestScoreDisplay {
    color: #FFF;
}

#bestScoreDisplay span {
    color: #FFD700;
}

#touchControls {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    pointer-events: none;
}

.touch-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    pointer-events: auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

.touch-button:active,
.touch-button.pressed {
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.2);
}

#banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    padding: 10px;
    text-align: center;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
}

#banner a {
    display: inline-block;
    text-decoration: none;
}

#banner img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    max-height: 120px;
}

@media (hover: none) and (pointer: coarse) {
    #touchControls {
        display: flex;
    }

    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
    }
}

@media (max-width: 768px) {
    .screen {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .screen h1 {
        font-size: 32px;
    }

    .screen h2 {
        font-size: 28px;
    }

    .screen p {
        font-size: 16px;
    }

    #scoreDisplay {
        top: 12px;
        left: 12px;
        font-size: 18px;
    }

    #banner img {
        max-height: 90px;
    }
}


/* leaderboard */
.ui-button {
    margin-top: 16px;
    padding: 10px 18px;
    border-radius: 8px;
    border: 2px solid #fff;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

.ui-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.leaderboard-list {
    width: 100%;
    max-width: 360px;
    margin: 16px auto 0;
    text-align: left;
    font-size: 16px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 6px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nickname-input {
    margin-top: 12px;
    padding: 8px 10px;
    width: 100%;
    max-width: 260px;
    border-radius: 6px;
    border: 2px solid #fff;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 16px;
    outline: none;
}

.nickname-input:focus {
    border-color: #FFD700;
}
