/* =============================================================================
 * @file        css/style.css
 * @description アプリ全体のスタイル定義。CSS変数・モーダル・HUD等。
 * @created     2026-05-12
 * @updated     2026-05-25
 * @version     3.9.8.A
 * @changes
 *   3.9.5 - ファイルヘッダー追加
 * ============================================================================= */

       :root { --amber: #ff9d00; --gold: #ffdf00; --bg: #050300; }
       * { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; outline: none; }
       body { margin: 0; background: var(--bg); overflow: hidden; position: fixed; width: 100%; height: 100%; overscroll-behavior: none; }
       canvas { display: block; touch-action: none; background: var(--bg); z-index: 1; }
      
       #debug-heat { position: absolute; top: calc(15px + env(safe-area-inset-top)); right: calc(20px + env(safe-area-inset-right)); color: var(--amber); font-size: 11px; opacity: 0.5; pointer-events: none; z-index: 1000; }
       #debug-hidx { position: absolute; top: calc(35px + env(safe-area-inset-top)); right: calc(20px + env(safe-area-inset-right)); color: var(--gold); font-size: 11px; opacity: 0.8; pointer-events: none; z-index: 1000; }
       #system-notice { position: absolute; top: calc(60px + env(safe-area-inset-top)); width: 100%; text-align: center; color: #00ffff; font-size: 13px; letter-spacing: 0.3em; opacity: 0; pointer-events: none; transition: 0.4s ease-out; z-index: 1500; font-family: monospace; }
       #system-notice.visible { opacity: 0.9; transform: translateY(10px); }


       .overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(5, 3, 0, 0.7); display: flex; align-items: center; justify-content: center; z-index: 2000; opacity: 0; pointer-events: none; transition: 0.3s; }
       .overlay.visible { opacity: 1; pointer-events: auto; }
       .modal { background: rgba(20, 15, 0, 0.98); border: 1px solid var(--amber); border-radius: 12px; padding: 20px; position: relative; text-align: center; max-width: 85%; max-height: 85%; overflow-y: auto; }
       .close-x { position: absolute; top: 8px; right: 12px; color: var(--amber); font-size: 22px; cursor: pointer; }
       .modal-title { color: var(--amber); font-size: 12px; letter-spacing: 0.2em; margin-bottom: 10px; }
      
       .legend { display: flex; justify-content: space-around; font-size: 10px; margin-bottom: 5px; }
       #flux-canvas { width: 100%; height: 80px; margin-bottom: 15px; border-bottom: 1px solid rgba(255, 157, 0, 0.3); }
      
        .log-list { list-style: none; padding: 0; margin: 0; width: 100%; text-align: left; }
       .log-item { border-bottom: 1px solid rgba(255, 157, 0, 0.2); padding: 12px 5px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; color: var(--amber); }
       .log-item:active { background: rgba(255, 157, 0, 0.1); }
      
       .system-suggest { color: #00ffff; font-size: 11px; margin-bottom: 20px; opacity: 0.8; }
       .mood-options { display: flex; gap: 15px; justify-content: center; }
       .mood-btn { width: 50px; height: 50px; border-radius: 50%; border: 1px solid var(--amber); background: transparent; color: var(--amber); font-size: 22px; cursor: pointer; transition: 0.2s; }
       .mood-btn:active { background: var(--amber); color: #000; }


       /* ドラムパレット用 */
       #drum-palette { display: none; position: absolute; bottom: calc(15px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: 90%; max-width: 400px; background: rgba(15, 10, 0, 0.95); border: 1px solid #00ffff; border-radius: 8px; padding: 8px; z-index: 1500; flex-wrap: wrap; justify-content: center; gap: 6px; pointer-events: auto; }
       .palette-btn { background: transparent; color: #00ffff; border: 1px solid rgba(0, 255, 255, 0.3); border-radius: 4px; padding: 8px 12px; font-size: 11px; font-family: monospace; cursor: pointer; transition: 0.1s; }
       .palette-btn.active { background: #00ffff; color: #000; border-color: #00ffff; font-weight: bold; }


       /* QRコンテナ（オンデマンド対応） */
       #qrcode-container { margin-top: 15px; display: flex; justify-content: center; background: transparent; padding: 10px; border-radius: 8px; transition: background 0.3s; }
       #qrcode-container.generated { background: rgba(255, 255, 255, 0.9); }
       /* 修正箇所：既存の #save-overlay を削除してこれを貼り付け */
       #save-overlay {
           display: none;
           position: fixed !important; /* 絶対位置から固定位置へ変更 */
           top: 0;
           left: 0;
           width: 100vw;
           height: 100vh;
           background: rgba(5, 3, 0, 0.85); /* 琥珀色の闇 */
           align-items: center;
           justify-content: center;
           z-index: 99999 !important; /* 他の全ての要素より前面へ */
       }


       /* 修正箇所：JavaScriptのclassList.add('visible')に対応 */
       #save-overlay.visible {
           display: flex !important;
       }

        .save-modal {
            position: relative; /* ★ この1行を追加！ */
            background: #120d00 !important;
            border: 1.5px solid var(--amber) !important;
            box-shadow: 0 0 30px rgba(255, 157, 0, 0.4);
            width: 90%;
            max-width: 380px;
            padding: 25px;
            border-radius: 12px;
            text-align: center;
            color: var(--amber);
        }
        .save-input {
        width: 100%;
        background: #000;
        border: 1px solid var(--amber);
        color: var(--gold);
        padding: 12px;
        margin: 15px 0;
        font-family: monospace;
        font-size: 16px;
        outline: none;
        }
        .save-confirm-btn {
        background: var(--amber);
        color: #000;
        border: none;
        padding: 12px 20px;
        cursor: pointer;
        font-weight: bold;
        width: 100%;
        letter-spacing: 0.1em;
        }
        /* 表示非表示の制御を統一 */
        .hidden { display: none !important; }

/* =========================================
   QR Scanner Overlay
   ========================================= */
#qr-scan-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.qr-scan-container {
    position: relative;
    width: 85%;
    max-width: 400px;
}

#qr-video {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 0 20px #00ffff;
    background: #111; /* カメラ起動前のプレースホルダー */
}

/* ターゲットを狙うネオン枠 */
.qr-scan-guide {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 65%; height: 65%;
    border: 2px solid #ffdf00;
    box-shadow: 0 0 10px #ffdf00, inset 0 0 10px #ffdf00;
    pointer-events: none;
    border-radius: 12px;
}

#qr-close-btn {
    margin-top: 24px;
    padding: 12px 0;
    width: 100%;
    background: transparent;
    color: #ff9d00;
    border: 1px solid #ff9d00;
    border-radius: 6px;
    font-family: monospace;
    font-size: 16px;
    letter-spacing: 2px;
    cursor: pointer;
    text-align: center;
}

#qr-close-btn:active {
    background: rgba(255, 157, 0, 0.2);
}
/* 右上HUDのサイバーデザイン */
#cyber-hud {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 140px; /* ゲージの幅 */
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: monospace;
    color: #ffaa00;
    text-shadow: 0 0 5px #ffaa00;
}
.hud-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hud-label {
    width: 30px;
    font-size: 10px;
    text-align: right;
}
.gauge-bg {
    flex-grow: 1;
    height: 4px;
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid rgba(255, 170, 0, 0.3);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}
.gauge-fill {
    height: 100%;
    width: 0%; /* JSでこの値を0〜100%に動かします */
    transition: width 0.1s linear;
}
.heat-fill {
    background: #ff3300;
    box-shadow: 0 0 8px #ff3300;
}
.h-fill {
    background: #00ffcc;
    box-shadow: 0 0 8px #00ffcc;
    transition: width 0.4s ease-out; /* Hは少し滑らかに */
}
.deltah-fill {
    background: #0088ff;
    box-shadow: 0 0 8px #0088ff;
    transition: width 0.3s ease-out;
}
/* ============================================================================
   26-05-25 21:16 No.8: メディア録画用HUD
   ============================================================================ */
.media-hud-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.media-btn {
    padding: 8px 12px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

/* ビデオ録画ボタン */
.btn-video {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid #ff1500;
    color: hsl(7, 100%, 50%);
    text-shadow: 0 0 5px hsl(5, 100%, 50%);
}

/* 26-05-29 12:30 No.14: スクエアトリミング録画ボタン用のサイバーシアン・ネオンフォント */
.btn-square {
    background: rgba(0, 255, 255, 0.05);
    border: 1px solid #00ffff;
    color: #00ffff;
    text-shadow: 0 0 5px #00ffff;
}

/* オーディオ録音ボタン */
.btn-audio {
    background: rgba(255, 223, 0, 0.1);
    border: 1px solid #0d00ff;
    color: hsl(7, 100%, 50%);
    text-shadow: 0 0 5px hsl(5, 100%, 50%);
}

/* 停止ボタン */
.btn-stop {
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid #ff4444;
    color: #ff4444;
    text-shadow: 0 0 5px #ff4444;
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}