* {
    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;
    background-color: rgba(0, 0, 0, 0.1); /* デバッグ用：Canvasが表示されているか確認 */
}

#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: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    pointer-events: none;
    z-index: 10;
}

#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.95);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 22px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    text-align: center;
}

#next-display {
    background: rgba(255, 255, 255, 0.95);
    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;
    background: rgba(240, 240, 240, 0.8);
    border-radius: 10px;
}

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

#special-meter-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 15px;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 150px;
}

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

#special-meter {
    width: 100%;
    height: 20px;
    background: linear-gradient(135deg, #ecf0f1, #bdc3c7);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#special-meter-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 10px;
    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;
    z-index: 10;
}

#notification-container {
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
    pointer-events: none;
}

.notification {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 240, 240, 0.95));
    padding: 15px 25px;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.5s ease, fadeOut 0.5s ease 2.5s forwards;
    transform-origin: center;
    border: 3px solid;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

.notification.overtime {
    border-color: #e74c3c;
    color: #e74c3c;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(255, 255, 255, 0.95));
}

.notification.vacation {
    border-color: #3498db;
    color: #3498db;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1), rgba(255, 255, 255, 0.95));
}

.notification.bonus {
    border-color: #f39c12;
    color: #f39c12;
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.1), rgba(255, 255, 255, 0.95));
}

.notification.love {
    border-color: #e84393;
    color: #e84393;
    background: linear-gradient(135deg, rgba(232, 67, 147, 0.1), rgba(255, 255, 255, 0.95));
}

.notification.agent {
    border-color: #27ae60;
    color: #27ae60;
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.1), rgba(255, 255, 255, 0.95));
}

.notification.layoff {
    border-color: #7f8c8d;
    color: #7f8c8d;
    background: linear-gradient(135deg, rgba(127, 140, 141, 0.1), rgba(255, 255, 255, 0.95));
}

#special-actions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 50;
}

.special-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}

.special-btn:not(:disabled):hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.special-btn:not(:disabled):active {
    transform: translateY(-2px) scale(1.05);
}

.special-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(100%);
}

#overtime-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

#vacation-btn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

#agent-btn {
    background: linear-gradient(135deg, #27ae60, #219653);
    color: white;
}

.special-btn .btn-icon {
    font-size: 32px;
    margin-bottom: 5px;
}

.special-btn .btn-text {
    font-size: 14px;
}

#bonus-display {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(243, 156, 18, 0.15);
    display: none; /* 初期状態は非表示 */
    justify-content: center;
    align-items: center;
    z-index: 200;
    pointer-events: none;
}

#bonus-display.active {
    display: flex;
    animation: bonusPulse 1s infinite alternate;
}

@keyframes bonusPulse {
    from { background-color: rgba(243, 156, 18, 0.15); }
    to { background-color: rgba(241, 196, 15, 0.25); }
}

#bonus-content {
    background: white;
    padding: 40px 60px;
    border-radius: 25px;
    text-align: center;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
}

#bonus-content h2 {
    font-size: 36px;
    color: #f39c12;
    margin-bottom: 15px;
}

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

#bonus-timer {
    font-size: 28px;
    font-weight: bold;
    color: #e74c3c;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 30px;
    border-radius: 15px;
    display: inline-block;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

#gameover-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none; /* 初期状態は非表示 */
    justify-content: center;
    align-items: center;
    z-index: 300;
}

#gameover-screen.active {
    display: flex;
}

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

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

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

#highest-rank {
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 20px;
}

#special-stats {
    background: rgba(236, 240, 241, 0.8);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0 30px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

#special-stats p {
    font-size: 16px;
    color: #34495e;
    margin: 0;
}

#special-stats span {
    font-weight: bold;
    color: #2c3e50;
}

#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: 768px) {
    #top-ui {
        flex-wrap: wrap;
        justify-content: center;
        top: 30px;
        gap: 10px;
        width: 95%;
    }
    
    #game-title {
        order: 1;
        font-size: 16px;
        padding: 8px 15px;
    }
    
    #score-display {
        order: 2;
        font-size: 18px;
        padding: 8px 15px;
        min-width: 150px;
    }
    
    #next-display {
        order: 3;
        padding: 6px 10px;
    }
    
    #special-meter-container {
        order: 4;
        min-width: 120px;
        padding: 6px 10px;
    }
    
    #special-meter-label {
        font-size: 10px;
    }
    
    #special-meter {
        height: 16px;
    }
    
    #special-actions {
        bottom: 10px;
        gap: 10px;
    }
    
    .special-btn {
        width: 60px;
        height: 60px;
    }
    
    .special-btn .btn-icon {
        font-size: 24px;
    }
    
    .special-btn .btn-text {
        font-size: 11px;
    }
    
    .notification {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    #bonus-content {
        padding: 20px 30px;
    }
    
    #bonus-content h2 {
        font-size: 24px;
    }
    
    #bonus-content p {
        font-size: 18px;
    }
    
    #bonus-timer {
        font-size: 20px;
        padding: 10px 20px;
    }
    
    #gameover-content {
        padding: 20px 30px;
    }
    
    #gameover-content h1 {
        font-size: 28px;
    }
    
    #gameover-content p {
        font-size: 18px;
    }
    
    #special-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    #restart-button {
        padding: 12px 30px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    #evolution-chart {
        padding: 3px 6px;
        gap: 1px;
        top: 5px;
    }
    
    #evolution-chart .evo-char {
        width: 18px;
        height: 18px;
    }
    
    #evolution-chart .evo-arrow {
        font-size: 8px;
    }
    
    #top-ui {
        top: 25px;
    }
    
    #game-title {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    #score-display {
        font-size: 16px;
        padding: 6px 12px;
    }
    
    #next-label {
        font-size: 11px;
    }
    
    #next-character {
        width: 35px;
        height: 35px;
    }
    
    .special-btn {
        width: 50px;
        height: 50px;
    }
    
    .special-btn .btn-icon {
        font-size: 20px;
    }
    
    .special-btn .btn-text {
        font-size: 9px;
    }
    
    #credits {
        font-size: 8px;
        bottom: 3px;
    }
}