* {
    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);
}

#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: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
}

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

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

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

/* コンボ表示 */
#combo-display {
    position: absolute;
    top: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    padding: 12px 25px;
    border-radius: 15px;
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.5);
    animation: combo-pulse 0.5s ease-in-out infinite alternate;
    z-index: 50;
}

#combo-display.hidden {
    display: none;
}

#combo-bonus {
    font-size: 14px;
    margin-top: 5px;
    color: #ffeaa7;
}

@keyframes combo-pulse {
    from { transform: translateX(-50%) scale(1); }
    to { transform: translateX(-50%) scale(1.05); }
}

/* イベント通知 */
#event-notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #2c3e50, #34495e);
    padding: 20px 40px;
    border-radius: 20px;
    text-align: center;
    z-index: 60;
    animation: event-appear 0.3s ease-out;
    border: 3px solid #f1c40f;
    box-shadow: 0 0 30px rgba(241, 196, 15, 0.5);
}

#event-notification.hidden {
    display: none;
}

#event-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

#event-text {
    font-size: 22px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#event-notification.zangyou {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    border-color: #f39c12;
}

#event-notification.shuden {
    background: linear-gradient(135deg, #2980b9, #3498db);
    border-color: #1abc9c;
}

#event-notification.kimagure {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    border-color: #e74c3c;
}

#event-notification.payday {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-color: #f1c40f;
}

#event-notification.faction {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border-color: #ecf0f1;
}

#event-notification.amakudari {
    background: linear-gradient(135deg, #d4af37, #ffd700);
    border-color: #fff;
}

@keyframes event-appear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* 天下りゲージ */
#amakudari-container {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border-radius: 10px;
    z-index: 40;
}

#amakudari-container.hidden {
    display: none;
}

#amakudari-label {
    font-size: 12px;
    color: #ffd700;
    text-align: center;
    margin-bottom: 5px;
    font-weight: bold;
}

#amakudari-bar {
    width: 150px;
    height: 12px;
    background: #333;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ffd700;
}

#amakudari-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #f39c12, #ffd700);
    transition: width 0.3s ease;
}

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

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

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

#stats {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stat-item {
    font-size: 16px;
    color: #666;
    margin: 8px 0;
}

.stat-item span {
    font-weight: bold;
    color: #e74c3c;
}

#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: 38px;
        gap: 10px;
    }
    
    #game-title {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    #score-display {
        font-size: 16px;
        padding: 8px 16px;
    }
    
    #next-display {
        padding: 6px 10px;
    }
    
    #next-label {
        font-size: 12px;
    }
    
    #next-character {
        width: 40px;
        height: 40px;
    }
    
    #combo-display {
        top: 95px;
        font-size: 18px;
        padding: 8px 15px;
    }
    
    #combo-bonus {
        font-size: 12px;
    }
    
    #event-notification {
        padding: 15px 25px;
    }
    
    #event-icon {
        font-size: 36px;
    }
    
    #event-text {
        font-size: 16px;
    }
    
    #amakudari-container {
        bottom: 60px;
        padding: 6px 12px;
    }
    
    #amakudari-bar {
        width: 120px;
        height: 10px;
    }
    
    #credits {
        font-size: 8px;
    }
    
    #gameover-content {
        padding: 30px 40px;
    }
    
    #gameover-content h1 {
        font-size: 28px;
    }
    
    #gameover-content p {
        font-size: 18px;
    }
    
    #stats {
        padding: 10px;
    }
    
    .stat-item {
        font-size: 14px;
    }
    
    #restart-button {
        padding: 12px 30px;
        font-size: 16px;
    }
}