/* ===== 基本設定 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

/* ===== ゲームコンテナ ===== */
#gameContainer {
    position: relative;
    border: 3px solid #fff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    background: #87CEEB;
    overflow: hidden;
}

/* ===== Canvas設定 ===== */
#gameCanvas {
    display: block;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 100%);
    cursor: crosshair;
}

/* プリンキャラクター用の追加スタイル */
#gameCanvas:hover {
    cursor: pointer;
}

/* ===== UI要素 ===== */
#gameUI {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ===== スコア表示 ===== */
#scoreDisplay {
    position: absolute;
    top: 20px;
    left: 20px;
    color: #fff;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

/* ===== 果物カウンター ===== */
#fruitCounter {
    position: absolute;
    top: 60px;
    left: 20px;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

#fruitIcons {
    margin-left: 10px;
    font-size: 16px;
}

/* ===== ジャンプゲージ ===== */
#jumpGaugeContainer {
    position: absolute;
    bottom: 30px;
    left: 20px;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

#jumpGaugeLabel {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
}

#jumpGaugeBar {
    width: 150px;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #fff;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

#jumpGaugeFill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #FFEB3B 50%, #FF5722 100%);
    border-radius: 8px;
    transition: width 0.1s ease;
    position: relative;
}

#jumpGaugeFill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: gaugeShine 1.5s infinite;
}

@keyframes gaugeShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

#jumpGaugeText {
    font-size: 12px;
    margin-top: 5px;
    text-align: center;
    opacity: 0.8;
}

#airJumpStatus {
    display: block;
    font-size: 11px;
    margin-top: 3px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
    min-height: 14px; /* 空文字列時でもレイアウト安定 */
}

/* ===== 難易度表示 ===== */
#difficultyDisplay {
    position: absolute;
    top: 100px;
    left: 20px;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

#difficultyLevel {
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

/* ===== 無敵モード表示 ===== */
#invincibleIndicator {
    position: absolute;
    top: 140px;
    left: 20px;
    color: #FFD700;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    animation: invinciblePulse 1s infinite alternate;
}

@keyframes invinciblePulse {
    from {
        opacity: 0.7;
        transform: scale(1);
    }
    to {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* ===== モバイル操作ボタン ===== */
#mobileControls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: none;
    gap: 10px;
    pointer-events: all;
}

.control-btn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    user-select: none;
}

.control-btn:active {
    background: rgba(255, 255, 255, 1);
    transform: scale(0.95);
}

.jump-btn {
    background: rgba(255, 107, 107, 0.9);
    color: white;
    font-size: 12px;
}

.jump-btn:active {
    background: rgba(255, 107, 107, 1);
}

/* レスポンシブ対応 */
@media (max-width: 1050px) {
    #gameContainer {
        border: 2px solid #fff;
        margin: 10px;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
        max-width: 1000px;
    }
    
    .mobile-only {
        display: flex !important;
    }
    
    #jumpGaugeContainer {
        bottom: 100px; /* モバイルボタンと重ならないよう調整 */
    }
}

@media (max-width: 600px) {
    .overlay h2 {
        font-size: 24px;
    }
    
    .overlay p {
        font-size: 14px;
        padding: 0 15px;
    }
    
    .mode-btn {
        min-width: 140px;
        padding: 12px 15px;
        font-size: 14px;
    }
    
    button {
        padding: 10px 20px;
        font-size: 16px;
    }
    
    #scoreDisplay, #fruitCounter, #difficultyDisplay {
        font-size: 16px;
    }
}

/* ===== ゲームモード選択 ===== */
#gameModeSelector {
    margin: 20px 0;
    text-align: center;
}

#gameModeSelector h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

#modeButtons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 15px 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: rgba(255, 215, 0, 0.3);
    border-color: #FFD700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.mode-desc {
    font-size: 12px;
    opacity: 0.8;
    font-weight: normal;
}

/* ===== オーバーレイ画面共通 ===== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    pointer-events: all;
}

.overlay h2 {
    font-size: 36px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.overlay p {
    font-size: 18px;
    margin-bottom: 30px;
    text-align: center;
    line-height: 1.5;
}

/* ===== ボタンスタイル ===== */
button {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

button:hover {
    background: linear-gradient(45deg, #ff5252, #ff7979);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

/* ===== 非表示クラス ===== */
.hidden {
    display: none !important;
}

/* ===== レスポンシブ対応 ===== */
@media (max-width: 850px) {
    #gameContainer {
        border: 2px solid #fff;
        margin: 10px;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
        max-width: 800px;
    }
    
    .overlay h2 {
        font-size: 28px;
    }
    
    .overlay p {
        font-size: 16px;
        padding: 0 20px;
    }
    
    button {
        padding: 12px 25px;
        font-size: 16px;
    }
    
    #scoreDisplay {
        font-size: 20px;
    }
}

/* ===== アニメーション効果 ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.overlay {
    animation: fadeIn 0.3s ease-out;
}

/* ===== ゲーム要素の視覚効果 ===== */
#gameCanvas {
    transition: filter 0.3s ease;
}

#gameCanvas.game-over {
    filter: blur(2px) brightness(0.7);
}
