* {
    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, #1a237e, #283593);
}

#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: #1565C0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    max-width: 100%;
    height: auto;
    cursor: none;
}

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

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

.instruction {
    font-size: 18px;
    color: white;
    margin-top: 10px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    animation: pulse 2s infinite;
}

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

#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;
}

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

#start-screen h1 {
    font-size: 36px;
    color: #1565C0;
    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, #1565C0, #0D47A1);
    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;
    color: #FF6347;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

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

.message {
    font-size: 18px;
    color: #666;
    margin: 15px 0;
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .rally-display {
        font-size: 24px;
        padding: 8px 16px;
    }

    .instruction {
        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-rally {
        font-size: 22px;
    }

    .message {
        font-size: 16px;
    }
}
