/* ========================================
   基本設定（必須）
   ======================================== */

html {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* ========================================
   ゲームコンテナ
   ======================================== */

.game-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#game-canvas-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* ========================================
   UI オーバーレイ
   ======================================== */

.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ui-overlay * {
    pointer-events: auto;
}

/* ========================================
   画面表示切り替え
   ======================================== */

.screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

#gameover-screen {
    overflow-y: auto;
    height: 100%;
    align-items: center;
    padding: 20px 0;
}

.screen.active {
    display: flex;
}

/* ========================================
   タイトル画面
   ======================================== */

#title-screen {
    background: rgba(26, 26, 46, 0.95);
    text-align: center;
    padding: 20px;
}

.game-title {
    font-size: 4em;
    color: #fff;
    margin: 0 0 20px 0;
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.8),
                 0 0 40px rgba(118, 75, 162, 0.6);
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { text-shadow: 0 0 20px rgba(102, 126, 234, 0.8), 0 0 40px rgba(118, 75, 162, 0.6); }
    50% { text-shadow: 0 0 30px rgba(102, 126, 234, 1), 0 0 60px rgba(118, 75, 162, 0.8); }
}

.game-subtitle {
    font-size: 1.5em;
    color: #a8b2d1;
    margin: 0 0 40px 0;
}

.game-btn {
    font-size: 1.8em;
    padding: 20px 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    font-weight: bold;
    margin: 20px 0;
}

.game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

.game-btn:active {
    transform: translateY(0);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.controls-info {
    margin-top: 40px;
    color: #a8b2d1;
    font-size: 1.2em;
}

.controls-info p {
    margin: 10px 0;
}

/* ========================================
   ゲーム画面 HUD
   ======================================== */

#game-screen {
    pointer-events: none;
}

.game-hud {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    background: rgba(26, 26, 46, 0.9);
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-label {
    color: #a8b2d1;
    font-size: 1.2em;
    font-weight: bold;
}

.hud-value {
    color: #fff;
    font-size: 1.4em;
    font-weight: bold;
}

.panic-mode-timer {
    animation: panicPulse 0.5s ease-in-out infinite;
}

.panic-value {
    color: #ff6b6b !important;
    font-size: 1.6em !important;
}

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

@keyframes popupBounce {
    0% { transform: scale(0) rotate(-10deg); }
    50% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.meteor-timer, .multiplier-timer {
    animation: panicPulse 0.5s ease-in-out infinite;
}

.meteor-value {
    color: #ff4500 !important;
    font-size: 1.6em !important;
}

.multiplier-value {
    color: #00ff00 !important;
    font-size: 1.6em !important;
}

/* ========================================
   結果画面（ゲームオーバー・ステージクリア）
   ======================================== */

#gameover-screen,
#stageclear-screen {
    background: rgba(26, 26, 46, 0.95);
    text-align: center;
    padding: 20px;
}

.result-title {
    font-size: 4em;
    color: #fff;
    margin: 0 0 20px 0;
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.8);
}

#gameover-screen .result-title {
    color: #ff6b6b;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.8);
}

#stageclear-screen .result-title {
    color: #51cf66;
    text-shadow: 0 0 20px rgba(81, 207, 102, 0.8);
    animation: bounce 1s ease-in-out;
}

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

.result-message {
    font-size: 1.5em;
    color: #a8b2d1;
    margin: 0 0 40px 0;
}

.result-stats {
    margin: 30px 0;
    font-size: 1.5em;
    color: #fff;
}

.result-stats p {
    margin: 15px 0;
}

.game-summary {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(102, 126, 234, 0.5);
    border-radius: 10px;
    padding: 20px;
    margin: 30px auto;
    max-width: 600px;
}

.summary-title {
    font-size: 1.8em;
    color: #667eea;
    margin: 0 0 20px 0;
    text-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    text-align: left;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    transition: all 0.3s ease;
}

.summary-item:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: translateX(5px);
}

.summary-label {
    font-size: 0.9em;
    color: #a8b2d1;
}

.summary-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

.total-score {
    background: rgba(102, 126, 234, 0.3);
    border: 2px solid rgba(102, 126, 234, 0.8);
    margin-top: 10px;
}

.total-score .summary-label {
    color: #ffd43b;
    font-weight: bold;
}

.total-score .summary-value {
    color: #ffd43b;
    font-size: 1.5em;
}

.stat-value {
    color: #ffd43b;
    font-weight: bold;
    font-size: 1.2em;
}

/* ========================================
   レスポンシブ対応
   ======================================== */

@media (max-width: 768px) {
    .game-title {
        font-size: 2.5em;
    }

    .game-subtitle {
        font-size: 1.2em;
    }

    .game-btn {
        font-size: 1.4em;
        padding: 15px 40px;
    }

    .controls-info {
        font-size: 1em;
    }

    .game-hud {
        gap: 15px;
        padding: 10px 20px;
        flex-wrap: wrap;
    }

    .hud-label {
        font-size: 1em;
    }

    .hud-value {
        font-size: 1.1em;
    }

    .result-title {
        font-size: 2.5em;
    }

    .result-message {
        font-size: 1.2em;
    }

    .result-stats {
        font-size: 1.2em;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .game-title {
        font-size: 2em;
    }

    .game-subtitle {
        font-size: 1em;
        margin-bottom: 20px;
    }

    .game-btn {
        font-size: 1.2em;
        padding: 12px 30px;
        margin: 10px 0;
    }

    .controls-info {
        font-size: 0.9em;
        margin-top: 20px;
    }

    .game-hud {
        top: 10px;
        padding: 8px 15px;
        gap: 10px;
    }

    .result-title {
        font-size: 2em;
    }

    .result-message {
        font-size: 1em;
    }

    .result-stats {
        font-size: 1em;
        margin: 15px 0;
    }
}
