* {
    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, #4CAF50, #2E7D32);
}

#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 50%, #4CAF50 50%, #4CAF50 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%;
}

.score-board {
    font-size: 28px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    display: flex;
    justify-content: space-around;
    background: rgba(0,0,0,0.3);
    padding: 10px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.round-display {
    font-size: 22px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    background: rgba(0,0,0,0.3);
    padding: 8px 16px;
    border-radius: 8px;
    display: inline-block;
}

#phase-text {
    font-size: 24px;
    font-weight: bold;
    color: #FFD700;
    margin-top: 10px;
    min-height: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    min-width: 350px;
}

.controls.hidden {
    display: none;
}

.controls h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #333;
}

.timer {
    font-size: 18px;
    font-weight: bold;
    color: #FF6347;
    margin-bottom: 10px;
}

.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.direction-btn {
    padding: 15px 25px;
    font-size: 18px;
    font-weight: bold;
    background: linear-gradient(to bottom, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.direction-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0,0,0,0.3);
}

.direction-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#start-screen, #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;
    display: none; /* デフォルトは非表示 */
}

/* GameBaseの画面管理システムに対応 */
#start-screen.active, #result-screen.active {
    display: block;
}

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

#start-screen h1 {
    font-size: 36px;
    color: #4CAF50;
    margin-bottom: 20px;
}

#start-screen p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

#start-btn, #retry-btn {
    padding: 12px 32px;
    font-size: 20px;
    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;
}

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

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

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

#result-screen h2.win {
    color: #FFD700;
}

#result-screen h2.lose {
    color: #808080;
}

.result-score {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    margin: 20px 0;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .score-board {
        font-size: 20px;
        padding: 8px 15px;
    }

    .round-display {
        font-size: 18px;
    }

    .controls {
        min-width: 280px;
        padding: 15px;
    }

    .controls h3 {
        font-size: 18px;
    }

    .direction-btn {
        padding: 12px 20px;
        font-size: 16px;
    }

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

    #start-screen h1 {
        font-size: 28px;
    }

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

    .result-score {
        font-size: 22px;
    }
}
