/* ==========================================
   AGCA Cyber Cockpit Design 【style.css】
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Consolas', 'Courier New', monospace;
}

body {
    background-color: #0A0A0C;
    color: #E2E2E9;
    overflow: hidden;
    height: 100vh;
}

#agca-cockpit {
    display: flex;
    width: 100vw;
    height: 100vh;
    padding: 10px;
    gap: 10px;
}

/* 左側コントロールパネル */
#control-panel {
    width: 450px;
    background-color: #121216;
    border: 1px solid #1C1C24;
    border-radius: 4px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

h2 {
    font-size: 14px;
    color: #00FFCC;
    letter-spacing: 1px;
    border-bottom: 1px solid #1C1C24;
    padding-bottom: 8px;
    margin-bottom: 5px;
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.panel-section label {
    font-size: 11px;
    color: #6C6C7D;
    font-weight: bold;
}

/* 入力パーツ共通スタイル */
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    background-color: #1A1A22;
    border: 1px solid #2A2A35;
    color: #FFFFFF;
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 3px;
    outline: none;
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    border-color: #00FFCC;
    box-shadow: 0 0 5px rgba(0, 255, 204, 0.2);
}

/* キー入力用のグループ */
.input-group {
    display: flex;
    gap: 6px;
}

#toggleApiKeyBtn {
    background-color: #22222A;
    border: 1px solid #3A3A4A;
    color: #00FFCC;
    padding: 0 15px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 11px;
}

#toggleApiKeyBtn:hover {
    background-color: #00FFCC;
    color: #0A0A0C;
}

/* 🌟 新設：形状＆寸法用のレイアウト */
.input-row {
    display: flex;
    align-items: center;
    background-color: #1A1A22;
    border: 1px solid #2A2A35;
    border-radius: 3px;
    overflow: hidden;
}

.field-tag {
    background-color: #22222A;
    color: #6C6C7D;
    font-size: 10px;
    font-weight: bold;
    padding: 9px 10px;
    border-right: 1px solid #2A2A35;
    min-width: 60px;
    text-align: center;
}

.input-row select, 
.input-row input {
    border: none;
    background: transparent;
    padding: 6px 10px;
}

.dimension-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 6px;
}

/* テキストエリア */
textarea {
    resize: none;
    height: 70px;
}

.text-area-section {
    flex-grow: 1;
}

#outputArea {
    height: 100%;
    flex-grow: 1;
    font-size: 12px;
    color: #00FFCC;
    background-color: #0A0A0C;
    border-color: #1C1C24;
}

/* 発破ボタン（マットブラック） */
#generateBtn {
    background-color: #222226;
    border: 1px solid #3A3A4A;
    color: #FFFFFF;
    padding: 12px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

#generateBtn:hover:not(:disabled) {
    background-color: #FFFFFF;
    color: #0A0A0C;
    border-color: #FFFFFF;
}

/* 右側プレビューパネル */
#preview-panel {
    flex-grow: 1;
    background-color: #121216;
    border: 1px solid #1C1C24;
    border-radius: 4px;
    position: relative;
}

#preview-area {
    width: 100%;
    height: 100%;
}

/* 🌟 出力エリアのヘッダー（コピーボタン用） */
.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.copy-btn {
    background-color: #22222A;
    border: 1px solid #3A3A4A;
    color: #00FFCC;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

.copy-btn:hover {
    background-color: #00FFCC;
    color: #0A0A0C;
}

/* ==========================================
   🌟 カスタム調整：寸法文字サイズ ＆ プロンプト高さ
   ========================================== */
#dimA, #dimB, #dimZZYZX {
    font-size: 18px;
    font-weight: bold;
    color: #FFFFFF;
}

#userPrompt {
    height: 140px;
}

/* ==========================================
   🌟 プレビュー画面：X線トグルボタン
   ========================================== */
.overlay-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    background-color: #22222A;
    border: 1px solid #3A3A4A;
    color: #00FFCC;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.overlay-btn:hover {
    background-color: #00FFCC;
    color: #0A0A0C;
}

/* ==========================================
   🌟 カスタムエラー画面（インフォメーション演出）
   ========================================== */
.error-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(10, 10, 12, 0.95);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

/* 🟢 Type-A: CYBER TERMINAL */
.theme-cyber .cyber-text {
    color: #00FFCC;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 16px;
    text-shadow: 0 0 8px rgba(0, 255, 204, 0.8);
    text-align: left;
    line-height: 1.8;
}
.theme-cyber .cursor {
    animation: blink 1s infinite;
}
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

/* 🔵 Type-B: BLUEPRINT */
.theme-blueprint {
    background: radial-gradient(circle, #003366 0%, #001122 100%);
}
.theme-blueprint .blueprint-center {
    color: #FFFFFF;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 2px;
    border: 2px dashed #00FFCC;
    padding: 20px 40px;
    border-radius: 8px;
    background: rgba(0, 51, 102, 0.5);
    text-shadow: 0 0 10px #00FFCC;
}
.theme-blueprint .blueprint-caution {
    width: 100%;
    height: 25px;
    background: repeating-linear-gradient(45deg, #FFCC00, #FFCC00 15px, #111 15px, #111 30px);
    position: absolute;
    top: 0;
}
.theme-blueprint .blueprint-caution.bottom {
    top: auto;
    bottom: 0;
}

/* 🔴 Type-C: EMERGENCY (Eva風) */
.theme-eva {
    background: #440000;
}
.theme-eva .eva-bg {
    position: absolute;
    width: 200%; height: 200%;
    background-image: repeating-linear-gradient(30deg, transparent, transparent 40px, rgba(255,0,0,0.15) 40px, rgba(255,0,0,0.15) 80px);
    animation: slide 15s linear infinite;
}
.theme-eva .eva-text {
    position: relative;
    color: #FF3333;
    font-size: 60px;
    font-weight: 900;
    text-align: center;
    font-family: 'Impact', 'Arial Black', sans-serif;
    text-shadow: 3px 3px 0 #000, 0 0 30px #FF0000;
    z-index: 2;
    border-top: 8px solid #FF3333;
    border-bottom: 8px solid #FF3333;
    padding: 15px 0;
    width: 100%;
    background: #000;
    letter-spacing: 10px;
}
.theme-eva .eva-text span {
    font-size: 20px;
    letter-spacing: 8px;
    display: block;
    margin-top: 5px;
    color: #FFAAAA;
}
@keyframes slide {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100px, -100px); }
}

/* ==========================================
   🌟 プルダウン（選択肢）のカラー修正
   ========================================== */
select option {
    background-color: #22222A; /* マットなダークグレー */
    color: #FFFFFF;            /* 文字はクッキリ白 */
    padding: 5px;              /* 少し余白を持たせて見やすく */
}

/* ==========================================
   🌟 トグルボタン ＆ 入力無効化スタイル
   ========================================== */
button.field-tag {
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    border-right: 1px solid #2A2A35;
}

/* OFFの時の暗い状態 */
button.field-tag:not(.active) {
    background-color: #111116;
    color: #333344;
}

/* 枠がOFFになった入力エリアを半透明で触れなくする */
.input-disabled {
    opacity: 0.3;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* ==========================================
   🌟 テンキー（アンカーポイント）スタイル
   ========================================== */
.anchor-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #1A1A22;
    border: 1px solid #2A2A35;
    padding: 10px;
    border-radius: 3px;
}
.anchor-container {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    justify-content: center;
}
.anchor-numpad {
    display: grid;
    grid-template-columns: repeat(3, 30px);
    gap: 4px;
}
.anchor-btn {
    width: 30px;
    height: 30px;
    background-color: #22222A;
    border: 1px solid #3A3A4A;
    color: #6C6C7D;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.1s;
}
.anchor-btn:hover {
    background-color: #333344;
}
/* 選択中のテンキーはネオンブルーに発光！ */
.anchor-btn.active {
    background-color: #00FFCC;
    color: #0A0A0C;
    border-color: #00FFCC;
    box-shadow: 0 0 8px rgba(0,255,204,0.4);
}
.anchor-desc {
    font-size: 12px;
    color: #00FFCC;
    font-weight: bold;
    width: 130px;
}

/* ==========================================
   🌟 バグ修正：寸法入力の潰れ防止
   ========================================== */
.dimension-grid {
    display: flex;
    flex-wrap: wrap; /* 画面が狭い時は自動で改行して潰れを防ぐえ！ */
    gap: 10px;
}
.dimension-grid .input-row {
    flex: 1 1 120px; /* 最低でも120pxの幅をキープする */
}
#preview-area canvas {
    display: block; /* キャンバスの隙間やズレを防ぐ */
    width: 100% !important;
    height: 100% !important;
}

/* ==========================================
   🌟 新機能：APIデイリーカウンター
   ========================================== */
.api-counter {
    font-size: 11px;
    color: #6C6C7D;
    margin-top: 10px;
    text-align: right;
    font-family: 'Consolas', 'Courier New', monospace;
}
.api-counter span {
    color: #00FFCC;
    font-weight: bold;
    font-size: 13px;
}
.api-gauge {
    width: 100%;
    height: 4px;
    background: #111116;
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
    border: 1px solid #2A2A35;
}
.api-gauge-fill {
    height: 100%;
    background: #00FFCC;
    width: 0%; /* JSで動かすえ */
    transition: width 0.5s ease-out, background-color 0.3s;
}

/* ==========================================
   🌟 究極レイアウト大改造：縦長アンカー＆3段寸法（6桁対応）
   ========================================== */
.geo-layout-container {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    align-items: stretch; /* 左右のパネルの高さをピッタリ揃えるえ */
}

/* 幅を約半分にしてキュッと引き締めた縦長アンカーパネル */
.anchor-sub-panel {
    flex: 0 0 110px; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #1A1A22;
    border: 1px solid #2A2A35;
    padding: 8px 5px;
    border-radius: 3px;
}

.anchor-numpad {
    display: grid;
    grid-template-columns: repeat(3, 30px);
    gap: 4px;
}

.anchor-btn {
    width: 30px;
    height: 30px;
    background-color: #22222A;
    border: 1px solid #3A3A4A;
    color: #6C6C7D;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.1s;
}
.anchor-btn:hover {
    background-color: #333344;
}
.anchor-btn.active {
    background-color: #00FFCC;
    color: #0A0A0C;
    border-color: #00FFCC;
    box-shadow: 0 0 8px rgba(0,255,204,0.4);
}

.anchor-desc-mini {
    font-size: 9px;
    color: #00FFCC;
    font-weight: bold;
    text-align: center;
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    letter-spacing: 0.5px;
}

/* アンカーの横に隣合わせにする3段寸法パネル */
.dimension-vertical-panel {
    flex: 1; /* 残りの横幅をフルに使って6桁表示を確実に確保！ */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}

.dimension-vertical-panel .input-row {
    width: 100%;
    display: flex;
}

.dimension-vertical-panel .input-row input {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: 0 10px; /* 文字が消えないように内側の余白を最適化 */
}

/* 古い不要な単独セクション用スタイルを非表示にする安全装置 */
.anchor-section {
    display: none !important;
}