:root {
        --pad-height: 140px;
        --btn-size: 60px;
    }
    body {
        margin: 0;
        overflow: hidden;
        background-color: #000;
        touch-action: none;
        font-family: 'Comic Sans MS', 'Arial Rounded MT Bold', 'Hiragino Maru Gothic ProN', sans-serif;
        width: 100vw;
        height: 100dvh;
    }
    
    /* ============================
       ゲーム画面 & オーバーレイ
       ============================ */
    #game-container {
        position: absolute;
        top: 0; left: 0; width: 100vw; height: 100dvh;
        overflow: hidden; z-index: 1;
    }
    canvas { display: block; width: 100%; height: 100%; }

    /* タイトル / リザルト画面 */
    #overlay {
        position: absolute; top: 0; left: 0; width: 100%; height: 100%;
        background: radial-gradient(circle, rgba(11,29,58,0.8) 0%, rgba(0,0,0,0.9) 100%);
        backdrop-filter: blur(10px);
        z-index: 200; display: flex; flex-direction: column;
        justify-content: center; align-items: center; color: white; text-align: center;
        transition: opacity 0.5s ease;
    }
    #overlay.hidden { opacity: 0; pointer-events: none; }
    
    .overlay-title {
        font-size: 48px; color: #fff;
        text-shadow: 0 0 10px #FFD700, 0 0 20px #FFD700, 0 0 30px #FF8C00;
        margin-bottom: 10px; font-weight: bold;
    }
    .overlay-score-box {
        background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(240,240,255,0.8));
        color: #333; padding: 20px 40px; border-radius: 20px;
        border: 4px solid #FFD700; box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
        font-size: 28px; font-weight: bold; margin: 20px 0; display: none;
    }
    .high-score-text { color: #FF4500; font-size: 20px; margin-top: 10px; }
    
    .start-btn {
        padding: 15px 50px; font-size: 28px; font-weight: bold; color: white;
        background: linear-gradient(to bottom, #FF7F50, #FF4500);
        border: 3px solid #fff; border-radius: 40px; cursor: pointer;
        box-shadow: 0 8px 15px rgba(0,0,0,0.5), inset 0 2px 5px rgba(255,255,255,0.5);
        margin-top: 15px; touch-action: manipulation; transition: transform 0.1s;
        width: 300px;
    }
    .start-btn:active {
        transform: translateY(6px) scale(0.95);
        box-shadow: 0 2px 5px rgba(0,0,0,0.5), inset 0 2px 5px rgba(255,255,255,0.5);
    }
    #mute-btn {
        margin-top: 18px; padding: 8px 22px; font-size: 16px; font-weight: bold;
        color: #fff; background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.6);
        border-radius: 30px; cursor: pointer; touch-action: manipulation;
        min-height: 48px; min-width: 48px; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
    }
    #mute-btn:active { transform: scale(0.95); }

    /* UIレイヤー */
    #ui-layer {
        position: absolute; top: 150px; left: 20px; right: 20px;
        pointer-events: none; z-index: 50; display: flex; justify-content: space-between; align-items: center;
    }
    .score-box {
        background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(5px);
        border: 3px solid #FFD700; border-radius: 20px; padding: 8px 20px;
        font-size: 28px; font-weight: bold; color: #333; display: flex; align-items: center; gap: 10px;
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    }
    .star-icon { color: #FFD700; font-size: 32px; text-shadow: 0 0 10px #FF8C00; }

    /* タイムゲージ */
    .time-container {
        flex: 1; max-width: 300px; margin-left: 20px;
        background: rgba(0,0,0,0.6); border: 3px solid rgba(255,255,255,0.8);
        border-radius: 20px; height: 25px; position: relative; overflow: hidden;
        box-shadow: 0 4px 15px rgba(0,0,0,0.5), inset 0 0 10px rgba(0,0,0,0.8);
    }
    .time-bar {
        width: 100%; height: 100%;
        background: linear-gradient(to bottom, #32CD32, #228B22);
        box-shadow: inset 0 2px 5px rgba(255,255,255,0.5);
        transition: width 0.1s linear, background 0.3s;
    }

    /* 個別パネル設定 */
    #parent-panel { top: 0; left: 0; border-bottom: 4px solid #FFD700; transform: rotate(180deg); }
    #parent-panel .action-btn { 
        background: radial-gradient(circle at 30% 30%, #E0FFFF, #87CEFA); color: #1e3c72; 
        text-shadow: none; border-color: #fff;
    }
    #parent-panel .action-btn:active, #parent-panel .action-btn.active {
        background: radial-gradient(circle at 30% 30%, #FFFFFF, #ADD8E6);
    }
    #child-panel { bottom: 0; left: 0; border-top: 4px solid #FF6347; }
    .role-label {
        position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
        color: rgba(255,255,255,0.6); font-size: 14px; pointer-events: none; white-space: nowrap;
        text-shadow: 1px 1px 2px #000;
    }
    .hud-group-left, .hud-group-right {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    @media (max-width: 480px) {
        #ui-layer {
            left: 10px;
            right: 10px;
            flex-wrap: nowrap !important;
            justify-content: space-between;
            gap: 4px;
        }
        .hud-group-left, .hud-group-right {
            gap: 2px;
        }
        .score-box {
            font-size: 16px;
            padding: 2px 6px;
            gap: 2px;
            border-width: 2px;
        }
        .score-box .star-icon {
            font-size: 18px;
        }
        #remaining-box {
            font-size: 14px !important;
            padding: 2px 6px !important;
            border-width: 2px !important;
        }
        #audio-control-hud {
            margin-left: 0px !important;
            margin-right: 0px !important;
            padding: 0 2px !important;
            gap: 2px !important;
            height: 48px !important;
            border-radius: 24px !important;
        }
        #back-title-btn {
            margin-left: 0px !important;
            margin-right: 0px !important;
            padding: 0 8px !important;
            font-size: 9px !important;
            min-height: 48px !important;
            border-radius: 24px !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
        }
        .time-container {
            flex: 1 1 100%;
            max-width: 100%;
            margin-left: 0px;
            margin-top: 4px;
            height: 18px;
        }
    }