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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #87CEEB;
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
}

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

#game-canvas {
    display: block;
    touch-action: none;
}

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

#evolution-chart {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

#evolution-chart .evo-item {
    display: flex;
    align-items: center;
}

#evolution-chart .evo-char {
    width: 28px;
    height: 28px;
}

#evolution-chart .evo-char img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#evolution-chart .evo-arrow {
    font-size: 10px;
    color: #666;
    margin: 0 1px;
}

#top-ui {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    justify-content: center;
}

#game-title {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 20px;
    font-weight: bold;
    color: #f1c40f;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

#score-display {
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 30px;
    border-radius: 25px;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

#next-display {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

#next-label {
    font-size: 14px;
    font-weight: bold;
    color: #666;
}

#next-character {
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#next-character img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* KPIゲージ（イベントタイマー） */
#kpi-container {
    position: absolute;
    top: 130px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    text-align: center;
}

#kpi-label {
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    margin-bottom: 2px;
}

#kpi-bar-bg {
    width: 100%;
    height: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.5);
}

#kpi-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    transition: width 0.1s linear;
}

/* イベントバナー */
#event-banner {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(231, 76, 60, 0.9);
    color: #fff;
    padding: 20px 40px;
    border-radius: 10px;
    text-align: center;
    border: 4px solid #fff;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.8);
    z-index: 50;
    transition: opacity 0.3s;
    width: 90%;
    max-width: 400px;
}

#event-banner.hidden {
    opacity: 0;
    pointer-events: none;
}

#event-banner.flash {
    animation: flash 0.5s infinite alternate;
}

@keyframes flash {
    from { transform: translate(-50%, -50%) scale(1); }
    to { transform: translate(-50%, -50%) scale(1.05); }
}

#event-title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
}

#event-desc {
    font-size: 16px;
    font-weight: bold;
}

#credits {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
    pointer-events: none;
}

#gameover-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

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

#gameover-content {
    background: white;
    padding: 40px 60px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90%;
}

#gameover-content h1 {
    font-size: 36px;
    color: #e74c3c;
    margin-bottom: 20px;
}

#gameover-content p {
    font-size: 24px;
    color: #333;
    margin-bottom: 20px;
}

#history-log {
    margin-bottom: 30px;
    font-size: 16px;
    color: #555;
    line-height: 1.5;
}

#restart-button {
    padding: 15px 40px;
    font-size: 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s;
    pointer-events: auto;
}

#restart-button:hover {
    background: #2980b9;
}

#restart-button:active {
    transform: scale(0.98);
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
    #evolution-chart {
        padding: 3px 6px;
        gap: 1px;
    }
    
    #evolution-chart .evo-char {
        width: 20px;
        height: 20px;
    }
    
    #evolution-chart .evo-arrow {
        font-size: 8px;
    }
    
    #top-ui {
        top: 45px;
        gap: 10px;
        flex-direction: column;
    }
    
    #kpi-container {
        top: 150px;
    }
    
    #game-title {
        font-size: 14px;
        padding: 5px 12px;
    }
    
    #score-display {
        font-size: 16px;
        padding: 5px 16px;
    }
    
    #next-display {
        padding: 6px 10px;
        position: absolute;
        top: 5px;
        right: 10px;
    }
    
    #next-label {
        font-size: 12px;
    }
    
    #next-character {
        width: 30px;
        height: 30px;
    }
    
    #event-title {
        font-size: 20px;
    }
    
    #event-desc {
        font-size: 12px;
    }

    #gameover-content {
        padding: 30px 20px;
    }
    
    #gameover-content h1 {
        font-size: 24px;
    }
    
    #gameover-content p {
        font-size: 18px;
    }
}