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

body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Arial', sans-serif;
    background: linear-gradient(to bottom, #87CEEB, #98D8E8);
}

#game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

#gameCanvas {
    border: 3px solid #333;
    border-radius: 8px;
    background: linear-gradient(to bottom, #87CEEB 0%, #87CEEB 60%, #8B4513 60%, #8B4513 100%);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    max-width: 100%;
    height: auto;
}

#ui {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    width: 90%;
}

.time-display, .distance-display {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    text-shadow: 2px 2px 4px rgba(255,255,255,0.8);
    margin: 5px 0;
}

#timing-meter {
    margin: 20px auto;
    width: 300px;
}

.meter-bar {
    position: relative;
    width: 100%;
    height: 40px;
    background: #ddd;
    border-radius: 20px;
    overflow: hidden;
    border: 3px solid #333;
}

.perfect-zone {
    position: absolute;
    left: 22%;
    width: 16%;
    height: 100%;
    background: linear-gradient(to right, rgba(255,215,0,0.6), rgba(255,215,0,0.8), rgba(255,215,0,0.6));
    z-index: 2;
}

.good-zone {
    position: absolute;
    left: 22%;
    width: 28%;
    height: 100%;
    background: linear-gradient(to right, rgba(144,238,144,0.4), rgba(144,238,144,0.6), rgba(144,238,144,0.4));
    z-index: 1;
}

.indicator {
    position: absolute;
    left: 0;
    width: 6px;
    height: 100%;
    background: red;
    transition: left 0.1s ease-out;
}

#judgment-text {
    font-size: 36px;
    font-weight: bold;
    min-height: 50px;
    margin: 10px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.instruction {
    font-size: 18px;
    color: #333;
    margin-top: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

#result-screen {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    text-align: center;
    min-width: 300px;
}

#result-screen.hidden {
    display: none;
}

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

.result-time, .result-rank {
    font-size: 24px;
    margin: 15px 0;
    color: #333;
}

#rank {
    font-size: 48px;
    font-weight: bold;
}

#rank.S { color: #FFD700; }
#rank.A { color: #FF6347; }
#rank.B { color: #4169E1; }
#rank.C { color: #808080; }

#retry-btn {
    margin-top: 20px;
    padding: 12px 32px;
    font-size: 18px;
    background: linear-gradient(to bottom, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: transform 0.1s;
}

#retry-btn:hover {
    transform: scale(1.05);
}

#retry-btn:active {
    transform: scale(0.95);
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .time-display, .distance-display {
        font-size: 18px;
    }

    #timing-meter {
        width: 250px;
    }

    #judgment-text {
        font-size: 28px;
    }

    .instruction {
        font-size: 16px;
    }

    #result-screen {
        padding: 30px;
        min-width: 250px;
    }

    #result-screen h2 {
        font-size: 28px;
    }

    .result-time, .result-rank {
        font-size: 20px;
    }
}
