/* 回答方式:输入框上的"模型 · 思考档位"按钮 + 一体面板(上选模型,下调思考深度)。
   颜色只用中性层级与现有令牌,不另起强调色;模型名过长只截模型名,档位始终完整。 */
#chat-view .input-container > .input-row {
  column-gap: 4px; -webkit-user-select: none; user-select: none;
}
/* 文字区与操作区各占一行，不再靠 flex 排序把 textarea 从按钮之间挪到上面。 */
#chat-view .input-container > .input-wrapper {
  flex: 0 0 auto; min-width: 0; padding: 0 10px;
}
#chat-view .input-row > .thinking-depth-button { margin-left: auto; }

.thinking-depth-button, .thinking-depth-popup {
  --effort-accent: var(--text-muted);
  --effort-surface: color-mix(in srgb, var(--bg-surface) 88%, var(--text-main));
  --effort-border: color-mix(in srgb, var(--text-main) 14%, transparent);
  --effort-thumb: var(--text-bright);
}
:root[data-theme="light"] .thinking-depth-button,
:root[data-theme="light"] .thinking-depth-popup {
  --effort-surface: var(--bg-surface);
  --effort-border: color-mix(in srgb, var(--text-main) 12%, transparent);
  --effort-thumb: var(--bg-surface);
}
.thinking-depth-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; min-width: 0; max-width: 100%; padding: 0 12px; margin-block: 4px;
  border: 1px solid var(--effort-border); border-radius: 20px;
  background: color-mix(in srgb, var(--bg-surface) 94%, var(--text-main));
  color: var(--text-main); font: inherit; font-size: 13px; line-height: 1;
  flex: 0 1 auto; cursor: pointer; white-space: nowrap; letter-spacing: 0;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.thinking-depth-button:hover { background: var(--effort-surface); }
.thinking-depth-button[hidden] { display: none; }
.thinking-depth-button[hidden] ~ .voice-mic-sidecar,
.thinking-depth-button[hidden] + #btn-send { margin-left: auto; }
.thinking-depth-button[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--effort-accent) 70%, transparent);
  background: color-mix(in srgb, var(--effort-accent) 10%, var(--effort-surface));
}
.thinking-depth-button:focus-visible { outline: 2px solid var(--effort-accent); outline-offset: 3px; }
.thinking-model { min-width: 0; max-width: 96px; overflow: hidden; text-overflow: ellipsis; }
.thinking-sep { opacity: .55; }
.thinking-value { flex-shrink: 0; }
.thinking-depth-button:not(.has-level) .thinking-sep,
.thinking-depth-button:not(.has-level) .thinking-value { display: none; }
.thinking-chevron {
  width: 6px; height: 6px; border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px);
  transition: transform 120ms ease; opacity: .7;
}
.thinking-depth-button[aria-expanded="true"] .thinking-chevron { transform: rotate(225deg) translate(-1px, -1px); }
.thinking-depth-popup {
  position: fixed; z-index: 1001; width: 340px; max-width: calc(100% - 24px);
  display: flex; flex-direction: column;
  box-sizing: border-box; border: 1px solid var(--effort-border); border-radius: 20px;
  padding: 8px 8px 12px; background: var(--effort-surface);
  box-shadow: 0 10px 28px var(--shadow-overlay), inset 0 1px 0 color-mix(in srgb, var(--effort-thumb) 7%, transparent);
  color: var(--text-main); --effort-fill: 16px;
  transform-origin: bottom center;
  animation: effort-pop-in 120ms ease-out;
}
.thinking-depth-popup[hidden], .thinking-depth-popup [hidden] { display: none; }
.answer-section {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 12px 6px; font-size: 12px; color: var(--text-secondary); letter-spacing: .04em;
}
/* 模型列表:可滚动(键盘弹起、模型多时),思考区固定在底部 */
.answer-models { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.answer-model {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  min-height: 42px; padding: 0 12px; border: 0; border-radius: 12px; background: none;
  color: var(--text-main); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.answer-model:hover { background: color-mix(in srgb, var(--text-main) 5%, transparent); }
.answer-model[aria-checked="true"] {
  background: color-mix(in srgb, var(--text-main) 8%, transparent);
  color: var(--text-bright); font-weight: 600;
}
.answer-model:focus-visible { outline: 2px solid var(--effort-accent); outline-offset: -2px; }
.answer-model .model-health-dot { margin: 0; }
.answer-model-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.answer-model-tag { flex-shrink: 0; font-size: 11px; font-weight: 400; color: var(--text-secondary); }
.answer-model-check {
  flex-shrink: 0; width: 16px; height: 16px; opacity: 0;
  fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.answer-model[aria-checked="true"] .answer-model-check { opacity: 1; }
.answer-think { flex-shrink: 0; margin-top: 8px; padding: 0 4px; border-top: 1px solid var(--effort-border); }
.answer-think .answer-section { padding-inline: 8px; }
.answer-unavailable { padding: 4px 8px 6px; font-size: 13px; color: var(--text-secondary); }
.thinking-save-status {
  font-size: 10px; line-height: 14px; letter-spacing: 0;
  color: var(--text-secondary); opacity: 0; transition: opacity 120ms ease;
}
.thinking-save-status.is-visible { opacity: 1; }
.thinking-depth-track {
  position: relative; height: 36px;
}
.thinking-depth-track::before {
  content: ''; position: absolute; inset: 15px 16px; border-radius: 3px;
  background: color-mix(in srgb, var(--text-main) 22%, var(--bg-surface));
  box-shadow: inset 0 1px 2px var(--shadow-deep);
}
.thinking-depth-fill {
  position: absolute; top: 15px; left: 16px; height: 6px;
  width: max(0px, calc(var(--effort-fill) - 16px)); border-radius: 3px;
  background: var(--effort-accent);
  pointer-events: none;
}
.thinking-depth-markers { position: absolute; inset: 0 16px; pointer-events: none; }
.thinking-depth-markers span {
  position: absolute; top: 16px; width: 4px; height: 4px; border-radius: 50%;
  transform: translateX(-50%); background: color-mix(in srgb, var(--text-main) 56%, transparent);
}
.thinking-depth-markers span.is-passed { background: color-mix(in srgb, white 60%, transparent); }
.thinking-depth-range {
  position: relative; display: block; appearance: none; -webkit-appearance: none;
  width: 100%; height: 36px; margin: 0; padding: 0; border: 0;
  border-radius: inherit; background: transparent; cursor: pointer; touch-action: pan-y;
}
.thinking-depth-range::-webkit-slider-runnable-track { height: 36px; border: 0; background: transparent; }
.thinking-depth-range::-moz-range-track { height: 36px; border: 0; background: transparent; }
.thinking-depth-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 32px; height: 32px; margin-top: 2px;
  box-sizing: border-box; border-radius: 50%; border: 4px solid transparent;
  background: var(--effort-thumb); background-clip: padding-box;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .32));
}
.thinking-depth-range::-moz-range-thumb {
  width: 32px; height: 32px; box-sizing: border-box; border-radius: 50%;
  border: 4px solid transparent; background: var(--effort-thumb); background-clip: padding-box;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .32));
}
.thinking-depth-range:focus { outline: none; }
.thinking-depth-range:focus-visible { outline: 2px solid var(--effort-accent); outline-offset: 1px; border-radius: 10px; }
.thinking-depth-range:active::-webkit-slider-thumb { transform: scale(1.1); }
.thinking-depth-range:active::-moz-range-thumb { transform: scale(1.1); }
.thinking-depth-range:disabled { cursor: default; }
.thinking-depth-ticks { position: relative; height: 28px; margin: 0 16px; }
.thinking-depth-ticks button {
  position: absolute; top: 0; transform: translateX(-50%); min-height: 28px;
  padding: 2px 6px 6px; border: 0; background: transparent; border-radius: 5px;
  color: var(--text-secondary); font: inherit; font-size: 11px; line-height: 18px; white-space: nowrap; cursor: pointer;
}
.thinking-depth-ticks button[aria-pressed="true"] { color: var(--text-main); font-weight: 600; }
.thinking-depth-ticks button[aria-pressed="true"]::after {
  content: ''; position: absolute; bottom: 0; left: calc(50% - 7px);
  width: 14px; height: 2px; border-radius: 1px; background: var(--effort-accent);
}
.thinking-depth-ticks button:hover:not(:disabled) { color: var(--text-main); background: color-mix(in srgb, var(--text-main) 6%, transparent); }
.thinking-depth-ticks button:focus-visible { outline: 2px solid var(--effort-accent); outline-offset: 1px; }
.thinking-depth-ticks button:disabled { opacity: .55; cursor: default; }
.thinking-depth-popup.needs-selection .thinking-depth-fill { visibility: hidden; }
@keyframes effort-pop-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
/* 手机:控件排(加号/任务/回答方式/麦克风/发送)必须一行放下,不许折行。
   可用宽 ≈ 屏宽 − 66(输入栏边距+卡片内距);三个圆钮与间距 128,回答方式按钮除模型名外约 66(实测)。
   让位顺序:模型名先截断;选了任务未发出时模型名收起只留档位;任务名最后截断(全名在按钮提示里)。 */
@media (max-width: 430px) {
  .thinking-model { max-width: min(96px, calc(100vw - 300px)); }
  #chat-view .input-row:has(.task-mode-toggle.is-active) .thinking-model { max-width: min(96px, calc(100vw - 320px)); }
  #chat-view .input-row:has(.task-mode-toggle.is-intent) .thinking-depth-button.has-level .thinking-model,
  #chat-view .input-row:has(.task-mode-toggle.is-intent) .thinking-depth-button.has-level .thinking-sep { display: none; }
  #chat-view .task-mode-toggle .tm-toggle-name { max-width: clamp(0px, calc(100vw - 336px), 64px); }
  #chat-view .input-row > .upload-btn { width: 40px; }
  #chat-view .input-row > .voice-mic-sidecar { width: 40px; flex: 0 0 40px; }
  #chat-view .input-row > #btn-send { width: 40px; flex: 0 0 40px; }
  #chat-view .input-container > .input-row { column-gap: 2px; }
}
/* 极窄屏(<360,如 iPhone SE 一代):一排放不下模型名,按钮只显示档位,模型在面板里看;
   模型不能调档时仍显示模型名 */
@media (max-width: 359px) {
  .thinking-depth-button.has-level .thinking-model,
  .thinking-depth-button.has-level .thinking-sep { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .thinking-depth-button, .thinking-chevron, .thinking-save-status { transition: none; }
  .thinking-depth-popup { animation: none; }
}
