:root {
    --primary-cyan: #00f0ff;
    --primary-magenta: #ff0055;
    --glass-bg: rgba(15, 20, 35, 0.75);
    --glass-border: rgba(255, 255, 255, 0.1);
}

body {
    margin: 0;
    overflow: hidden;
    background: #020205;
    font-family: 'Exo 2', sans-serif;
    touch-action: none;
}

/* ゲームオーバー時の赤フラッシュ演出 */
@keyframes flashRed {
    0% {
        background-color: rgba(255, 0, 0, 0);
    }

    10% {
        background-color: rgba(255, 0, 0, 0.3);
    }

    100% {
        background-color: rgba(255, 0, 0, 0);
    }
}

.damage-effect {
    animation: flashRed 0.5s ease-out;
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: radial-gradient(circle at 50% 50%, #1a2035 0%, #020205 120%);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    display: flex;
    align-items: center;
    padding-left: 40px;
}

.glass-panel {
    pointer-events: auto;
    width: 280px;
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(160%);
    -webkit-backdrop-filter: blur(25px) saturate(160%);
    border: 1px solid var(--glass-border);
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}

#mobile-hud,
.close-btn {
    display: none;
}

.logo-glitch {
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: 900;
    background: linear-gradient(135deg, #fff 0%, var(--primary-cyan) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    letter-spacing: 1px;
}

.subtitle {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 3px;
    margin-top: 4px;
}

.control-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 25px 0;
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
}

.dim-axis {
    color: var(--primary-cyan);
    font-family: 'Orbitron';
}

.val {
    font-family: 'Orbitron';
    color: #fff;
}

input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #fff;
    border: 2px solid var(--primary-cyan);
    box-shadow: 0 0 10px var(--primary-cyan);
    border-radius: 50%;
    cursor: pointer;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 25px;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: #fff;
    padding: 12px;
    border-radius: 10px;
    font-size: 11px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.btn-glass.primary {
    border-color: var(--primary-cyan);
    color: var(--primary-cyan);
    background: rgba(0, 240, 255, 0.05);
}

.status-monitor {
    background: rgba(0, 0, 0, 0.4);
    padding: 15px;
    border-radius: 10px;
}

.monitor-header {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 5px;
}

.monitor-text {
    font-family: 'Orbitron';
    font-size: 12px;
    color: var(--primary-cyan);
}

/* --- 削除: 赤い線を消しました (.monitor-bar) --- */

@media screen and (max-width: 768px) {
    #ui-layer {
        padding: 0;
        justify-content: center;
        align-items: center;
        z-index: 100;
        pointer-events: none;
    }

    .glass-panel {
        position: fixed;
        width: 85%;
        max-width: 320px;
        opacity: 0;
        pointer-events: none;
        transform: scale(0.9);
        visibility: hidden;
    }

    .glass-panel.active {
        opacity: 1;
        pointer-events: auto;
        transform: scale(1);
        visibility: visible;
        background: rgba(10, 10, 20, 0.95);
    }

    .close-btn {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        color: #fff;
        font-size: 24px;
        cursor: pointer;
        opacity: 0.7;
    }

    .desktop-only {
        display: none;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    #mobile-hud {
        display: block;
        position: fixed;
        /* ★修正: absolute から fixed へ（より安定します） */
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        pointer-events: none;
        z-index: 200;
    }

    .hud-btn {
        pointer-events: auto;
        position: absolute;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background: rgba(20, 25, 40, 0.6);
        border: 1px solid var(--primary-cyan);
        color: var(--primary-cyan);
        backdrop-filter: blur(10px);
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 18px;
        box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
        transition: transform 0.1s;
    }

    .hud-btn:active {
        transform: scale(0.9);
        background: var(--primary-cyan);
        color: #000;
    }

    #mobile-menu-btn {
        top: 20px;
        right: 20px;
    }

    #mobile-undo-btn {
        bottom: 30px;
        left: 20px;
        border-color: var(--primary-magenta);
        color: var(--primary-magenta);
    }
}