/* AI Coprocessor & Chat Styles */
.ai-pane {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
}

.ai-chat-output {
  background: rgba(2, 5, 12, 0.9);
  border: 1px solid var(--hud-panel-border);
  border-radius: 4px;
  padding: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-primary);
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

.ai-input-row {
  display: flex;
  gap: 4px;
  margin-top: auto;
  flex-shrink: 0;
  width: 100%;
}

.ai-msg {
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.ai-msg.user {
  color: var(--hud-cyan);
  background: rgba(0, 243, 255, 0.08);
  border-left: 3px solid var(--hud-cyan);
  border-color: rgba(0, 243, 255, 0.18);
}

.ai-msg.model {
  color: var(--text-primary);
  background: rgba(0, 255, 102, 0.05);
  border-left: 3px solid var(--hud-green);
  border-color: rgba(0, 255, 102, 0.18);
}

.ai-input-row .hud-input {
  background: rgba(3, 8, 20, 0.95);
  border: 1px solid var(--hud-panel-border);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-family: var(--font-sans);
  outline: none;
  margin-top: auto;
}

.ai-input-row .hud-input:focus {
  border-color: var(--hud-cyan);
  box-shadow: var(--hud-cyan-glow);
}

.ai-memory-dashboard {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  user-select: none;
}

.ai-dashboard-label {
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.ai-dashboard-value {
  color: var(--hud-cyan);
  font-weight: bold;
  font-size: 0.9rem;
  text-shadow: var(--hud-cyan-glow);
  transition: color 0.3s ease;
}

.ai-dashboard-unit {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* KaTeX / LaTeX 數學公式渲染微調 */
.ai-msg .katex {
  color: var(--hud-cyan);
  text-shadow: 0 0 2px rgba(0, 243, 255, 0.3);
  font-size: 1.05em;
}

.ai-msg .katex-display {
  margin: 10px 0;
  padding: 6px 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--hud-cyan) transparent;
}

.ai-msg .katex-display::-webkit-scrollbar {
  height: 4px;
}

.ai-msg .katex-display::-webkit-scrollbar-thumb {
  background: var(--hud-cyan);
  border-radius: 2px;
}

/* AI 思考歷程收合區塊 */
.ai-thought-box {
    transition: all 0.3s ease;
}

.ai-thought-box[open] {
    background: rgba(0, 240, 255, 0.05) !important;
}

.ai-thought-box summary:hover {
    color: #00f0ff;
    opacity: 1 !important;
}

.ai-thought-content {
    max-height: 250px;
    overflow-y: auto;
    padding: 6px;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

/* 橫向 Segmented Control 樣式 */
.ai-thinking-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    width: 100%; /* 🎯 讓整體選擇器寬度撐滿容器 */
}

.thinking-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    white-space: nowrap; /* 🎯 防止「思考」標籤被擠壓換行 */
}

.thinking-options {
    display: flex; /* 🎯 從 inline-flex 改為 flex */
    flex: 1; /* 🎯 自動佔滿剩餘的右側寬度 */
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
    box-sizing: border-box;
}

.thinking-options input[type="radio"] {
    display: none; /* 隱藏原生 Radio 圓點 */
}

.thinking-options label {
    flex: 1; /* 🎯 關鍵：不論有 2 個或 4 個選項，皆自動平均瓜分 100% 寬度 */
    text-align: center; /* 🎯 文字水平居中 */
    padding: 3px 10px;
    border-radius: 14px;
    cursor: pointer;
    color: #888;
    font-size: 0.78rem;
    font-weight: 500;
    transition: all 0.2s ease;
    user-select: none;
}

.thinking-options label:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* 選中狀態樣式 (發光科技感) */
.thinking-options input[type="radio"]:checked + label {
    background: #00f0ff;
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

.ai-model-status-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 3px 8px;
  background: rgba(3, 8, 20, 0.85);
  border: 1px solid rgba(0, 243, 255, 0.2);
  border-radius: 4px;
  font-size: 0.72rem;
  user-select: none;
}

.model-status-label {
  color: var(--text-secondary, #888);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.model-status-value {
  color: #00f0ff;
  font-weight: bold;
  text-shadow: 0 0 5px rgba(0, 240, 255, 0.4);
  letter-spacing: 0.5px;
}

/* AI 模式選擇器 (多模態 / 純文字) */
.ai-mode-selector {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 6px;
    padding: 2px;
    margin-bottom: 8px;
}

.ai-mode-selector input[type="radio"] {
    display: none;
}

.ai-mode-selector label {
    flex: 1;
    text-align: center;
    padding: 4px 8px;
    font-size: 0.82em;
    color: #888;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    user-select: none;
}

.ai-mode-selector input[type="radio"]:checked + label {
    background: rgba(0, 240, 255, 0.2);
    color: #00f0ff;
    font-weight: bold;
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}