:root {
  --bg: #f4f5f7;
  --bg-elevated: #ffffff;
  --text: #1f2329;
  --text-soft: #5f6672;
  --text-faint: #9aa0aa;
  --accent: #10a37f;
  --accent-dark: #0d8a6c;
  --accent-soft: #e7f6f1;
  --user-bubble: #10a37f;
  --user-text: #ffffff;
  --card: #ffffff;
  --border: #e7e9ee;
  --border-soft: #f0f1f4;
  --danger: #e5484d;
  --warn: #f59e0b;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.09);
  --shadow-lg: 0 -6px 24px rgba(0, 0, 0, 0.12);
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18191b;
    --bg-elevated: #242527;
    --text: #ececf1;
    --text-soft: #aab0ba;
    --text-faint: #6e7682;
    --accent-soft: #16352c;
    --card: #2a2c2f;
    --border: #36383d;
    --border-soft: #2e3034;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  font-size: 16px;
  overscroll-behavior: none;
}
.view {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.hidden {
  display: none !important;
}
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 22px;
  height: 22px;
}
img {
  display: block;
}

/* ---------- Login ---------- */
#login-view {
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: calc(24px + var(--safe-top));
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elevated);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: var(--shadow);
}
.brand {
  text-align: center;
  margin-bottom: 28px;
}
.brand-logo,
.empty-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #16c79a);
  color: #fff;
  font-size: 30px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.brand h1 {
  margin: 0 0 4px;
  font-size: 22px;
}
.brand-sub {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
}
.login-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 22px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.login-tab {
  flex: 1;
  height: 38px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-soft);
  background: transparent;
  transition: background 0.15s, color 0.15s;
}
.login-tab.active {
  background: var(--bg-elevated);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.login-hint {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-faint);
  text-align: center;
}
.gw-options {
  display: flex;
  gap: 20px;
  margin: 2px 0 16px;
}
.gw-options .checkbox {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--text-soft);
  cursor: pointer;
}
.gw-options .checkbox input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}
.field {
  display: block;
  margin-bottom: 18px;
}
.field > span {
  display: block;
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 8px;
}
.field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  outline: none;
}
.field input:focus {
  border-color: var(--accent);
}
.code-row {
  display: flex;
  gap: 10px;
}
.code-row input {
  flex: 1;
}
.ghost-btn {
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 12px;
  padding: 0 14px;
  height: 48px;
  font-size: 14px;
  white-space: nowrap;
  background: transparent;
}
.ghost-btn:disabled {
  opacity: 0.45;
  border-color: var(--text-faint);
  color: var(--text-faint);
}
.ghost-btn.small {
  height: 36px;
  font-size: 13px;
  border-radius: 10px;
  padding: 0 14px;
}
.ghost-btn.danger {
  border-color: var(--danger);
  color: var(--danger);
}
.ghost-btn.full {
  width: 100%;
  height: 48px;
}
.primary-btn {
  width: 100%;
  height: 50px;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  margin-top: 6px;
}
.primary-btn:active {
  background: var(--accent-dark);
}
.primary-btn.small {
  width: auto;
  height: 36px;
  font-size: 14px;
  padding: 0 22px;
  border-radius: 10px;
  margin: 0;
}
.primary-btn:disabled {
  opacity: 0.6;
}
.msg {
  min-height: 18px;
  margin: 12px 0 0;
  font-size: 13px;
  text-align: center;
  color: var(--danger);
}
.msg.ok {
  color: var(--accent);
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 8px;
  padding-top: calc(8px + var(--safe-top));
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 10;
}
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  flex-shrink: 0;
}
.icon-btn:active {
  background: var(--bg);
}
.model-pill {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 10px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  border-radius: 19px;
  background: var(--bg);
  overflow: hidden;
  min-width: 0;
}
.model-avatars {
  display: inline-flex;
  flex-shrink: 0;
}
.model-avatars img,
.model-avatars .ph {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--bg-elevated);
  margin-left: -7px;
  background: var(--accent-soft);
  object-fit: cover;
}
.model-avatars img:first-child,
.model-avatars .ph:first-child {
  margin-left: 0;
}
#model-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.model-pill .chevron {
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  flex-shrink: 0;
}
.battery-pill {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 32px;
  padding: 0 10px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.battery-pill .bolt {
  width: 15px;
  height: 15px;
  fill: var(--accent);
  stroke: none;
}
.avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #16c79a);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Messages ---------- */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px 8px;
  -webkit-overflow-scrolling: touch;
}
.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-faint);
  text-align: center;
  padding: 0 30px;
}
.empty-state .empty-logo {
  opacity: 0.5;
}
.empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-soft);
  margin: 6px 0 0;
}
.empty-sub {
  font-size: 13px;
  margin: 0;
}

.turn {
  margin-bottom: 18px;
}
.user-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.user-bubble {
  max-width: 86%;
  padding: 11px 14px;
  border-radius: var(--radius);
  border-bottom-right-radius: 5px;
  background: var(--user-bubble);
  color: var(--user-text);
  font-size: 15.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* per-engine answer cards */
.answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.answers.multi {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.answer-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.answer-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
}
.answer-head img,
.answer-head .ph {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  object-fit: cover;
  flex-shrink: 0;
}
.answer-head .eng-name {
  font-size: 13.5px;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.answer-head .eng-cost {
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 2px;
}
.answer-head .eng-cost.free {
  color: var(--accent);
}
.answer-body {
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.65;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.answer-body.empty {
  color: var(--text-faint);
}

.thinking-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 2px 12px 0;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--text-faint);
  cursor: pointer;
}
.thinking-toggle .tri {
  width: 12px;
  height: 12px;
  transition: transform 0.2s;
}
.thinking-toggle.open .tri {
  transform: rotate(90deg);
}
.thinking-content {
  margin: 0 12px 6px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-soft);
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
}
.cursor-blink::after {
  content: '▋';
  display: inline-block;
  animation: blink 1s steps(2) infinite;
  color: var(--accent);
  margin-left: 1px;
  font-size: 0.9em;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
.answer-card.failed .answer-body {
  color: var(--danger);
}

/* markdown */
.answer-body p {
  margin: 0 0 10px;
}
.answer-body p:last-child {
  margin-bottom: 0;
}
.answer-body pre {
  background: #0d1117;
  color: #e6edf3;
  padding: 12px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 13px;
  margin: 8px 0;
}
.answer-body code {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.9em;
}
.answer-body :not(pre) > code {
  background: rgba(135, 131, 120, 0.18);
  padding: 1px 5px;
  border-radius: 5px;
}
.answer-body ul,
.answer-body ol {
  margin: 8px 0;
  padding-left: 22px;
}
.answer-body li {
  margin: 3px 0;
}
.answer-body a {
  color: var(--accent);
}
.answer-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 14px;
  display: block;
  overflow-x: auto;
}
.answer-body th,
.answer-body td {
  border: 1px solid var(--border);
  padding: 6px 10px;
}
.answer-body h1,
.answer-body h2,
.answer-body h3 {
  margin: 12px 0 8px;
  line-height: 1.3;
}
.answer-body blockquote {
  margin: 8px 0;
  padding-left: 12px;
  border-left: 3px solid var(--border);
  color: var(--text-soft);
}

/* 数学公式（KaTeX）：禁止正文的 overflow-wrap 把公式字形拆断；长公式横向滚动。 */
.answer-body .katex {
  overflow-wrap: normal;
  word-break: normal;
  white-space: nowrap;
}
.answer-body .katex-display {
  margin: 8px 0;
  padding: 2px 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.answer-body .math-raw {
  white-space: pre-wrap;
}

/* 联网搜索引用：行内上标 [n] + 折叠的「网页来源」列表 */
.cite {
  font-size: 0.7em;
  line-height: 0;
  vertical-align: super;
  margin: 0 1px;
}
.cite a,
.cite {
  color: var(--accent);
}
.cite a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--accent-soft);
  font-weight: 600;
  text-decoration: none;
}
.answer-refs {
  margin-top: 10px;
  border-top: 1px solid var(--border-soft);
  padding-top: 8px;
}
.refs-head {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
}
.refs-head .tri {
  width: 14px;
  height: 14px;
  transition: transform 0.15s;
}
.refs-head.open .tri {
  transform: rotate(90deg);
}
.refs-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ref-item {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-soft) !important;
  font-size: 12.5px;
  text-decoration: none;
}
.ref-item:active {
  background: var(--border-soft);
}
.ref-num {
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}
.ref-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Composer ---------- */
.composer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-soft);
  padding: 8px 10px;
  padding-bottom: calc(8px + var(--safe-bottom));
}
.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 5px 6px 5px 14px;
}
#input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  resize: none;
  max-height: 140px;
  padding: 8px 0;
  font-family: inherit;
}
.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.send-btn:disabled {
  background: var(--text-faint);
  opacity: 0.6;
}
.send-btn.stop {
  background: var(--text);
}
.send-btn svg {
  width: 20px;
  height: 20px;
}
.selected-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-top: 8px;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.selected-bar::-webkit-scrollbar {
  display: none;
}
.selected-bar:empty {
  display: none;
}
.sel-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 12px;
  color: var(--text-soft);
  white-space: nowrap;
  flex-shrink: 0;
}
.sel-chip img,
.sel-chip .ph {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-soft);
}
.sel-chip .x {
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

/* ---------- Composer tools (思考强度 / 联网 / 上传 / 新建) ---------- */
.composer-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.tool-spacer {
  flex: 1;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}
.tool-btn:active {
  background: var(--border-soft);
}
.tool-btn svg {
  width: 17px;
  height: 17px;
}
.tool-btn.icon-only {
  padding: 0;
  width: 36px;
  justify-content: center;
}
.tool-btn.round {
  padding: 0;
  width: 36px;
  justify-content: center;
  color: #fff;
  background: var(--accent);
  border-color: transparent;
}
.tool-btn.round svg {
  width: 20px;
  height: 20px;
}
.tool-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}
.tool-btn.dim {
  opacity: 0.45;
}

/* uploaded attachments awaiting send */
.file-input {
  display: none;
}
.attachments-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.attachments-bar:empty {
  display: none;
}
.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 200px;
  padding: 4px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-soft);
}
.att-chip.error {
  border-color: var(--danger);
}
.att-icon svg {
  width: 15px;
  height: 15px;
  display: block;
}
.att-name {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.att-state {
  color: var(--accent);
  font-size: 11px;
}
.att-state.err {
  color: var(--danger);
}
.att-chip.uploading,
.att-chip.parsing {
  opacity: 0.75;
}
.att-x {
  color: var(--text-faint);
  font-size: 15px;
  line-height: 1;
  padding: 0 1px;
}

/* attachment tags inside the sent user bubble */
.bubble-atts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.bubble-att {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.22);
  color: var(--user-text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* thinking-effort options */
.thinking-list {
  padding: 6px 6px 12px;
}
.thinking-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 12px;
}
.thinking-item:active {
  background: var(--bg);
}
.thinking-item .ti-info {
  flex: 1;
  min-width: 0;
}
.thinking-item .ti-name {
  font-size: 15px;
  font-weight: 600;
}
.thinking-item .ti-desc {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 2px;
}
.thinking-item .ti-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.thinking-item.selected .ti-check {
  background: var(--accent);
  border-color: var(--accent);
}
.thinking-item .ti-check svg {
  width: 14px;
  height: 14px;
  color: #fff;
  opacity: 0;
}
.thinking-item.selected .ti-check svg {
  opacity: 1;
}

/* ---------- Backdrops / drawer / sheets ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 40;
  transition: opacity 0.2s;
}
.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 84%;
  max-width: 330px;
  background: var(--bg-elevated);
  z-index: 50;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.15);
}
.drawer.open {
  transform: translateX(0);
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-soft);
}
.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  padding-bottom: calc(8px + var(--safe-bottom));
}
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
}
.history-item:active,
.history-item.active {
  background: var(--bg);
}
.history-item .title {
  flex: 1;
  font-size: 14.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history-item .del {
  color: var(--text-faint);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.history-item .del svg {
  width: 16px;
  height: 16px;
}
.history-empty {
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
  padding: 40px 16px;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--bg-elevated);
  border-radius: 18px 18px 0 0;
  transform: translateY(100%);
  transition: transform 0.28s ease;
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
  box-shadow: var(--shadow-lg);
}
.sheet.tall {
  height: 82vh;
  max-height: 82vh;
}
.sheet.open {
  transform: translateY(0);
}
.sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 8px auto 4px;
  flex-shrink: 0;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 12px;
  font-weight: 600;
  font-size: 16px;
  border-bottom: 1px solid var(--border-soft);
}
.model-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}

/* rank tabs */
.rank-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  scrollbar-width: none;
  flex-shrink: 0;
}
.rank-tabs::-webkit-scrollbar {
  display: none;
}
.rank-tab {
  padding: 6px 13px;
  border-radius: 16px;
  background: var(--bg);
  color: var(--text-soft);
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}
.rank-tab.active {
  background: var(--accent);
  color: #fff;
}

.model-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}
.model-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 12px;
}
.model-item:active {
  background: var(--bg);
}
.model-item.disabled {
  opacity: 0.4;
}
.model-item .m-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--accent-soft);
  flex-shrink: 0;
}
.model-item .m-info {
  flex: 1;
  min-width: 0;
}
.model-item .m-name {
  font-size: 14.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-item .m-tags {
  display: flex;
  gap: 5px;
  margin-top: 3px;
}
.m-tag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-faint);
  border: 1px solid var(--border-soft);
}
.m-tag.free {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}
.m-tag.cost {
  color: var(--warn);
}
.model-item .m-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.model-item.selected .m-check {
  background: var(--accent);
  border-color: var(--accent);
}
.model-item .m-check svg {
  width: 14px;
  height: 14px;
  color: #fff;
  opacity: 0;
}
.model-item.selected .m-check svg {
  opacity: 1;
}
.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}

/* account sheet */
.account-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px 18px;
}
.account-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #16c79a);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.account-nick {
  font-size: 18px;
  font-weight: 600;
}
.account-phone {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 3px;
}
.account-cards {
  display: flex;
  gap: 12px;
  padding: 0 20px;
}
.account-card {
  flex: 1;
  background: var(--bg);
  border-radius: 14px;
  padding: 14px;
}
.ac-label {
  font-size: 12px;
  color: var(--text-faint);
}
.ac-value {
  font-size: 19px;
  font-weight: 700;
  margin-top: 4px;
}
.ac-value.accent {
  color: var(--accent);
}
.ac-sub {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 2px;
}
.battery-breakdown {
  padding: 16px 20px 8px;
}
.bb-row {
  margin-bottom: 12px;
}
.bb-top {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-soft);
  margin-bottom: 5px;
}
.bb-bar {
  height: 7px;
  border-radius: 4px;
  background: var(--bg);
  overflow: hidden;
}
.bb-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
}
.bb-fill.vip {
  background: linear-gradient(90deg, var(--accent), #16c79a);
}
.bb-fill.extend {
  background: var(--warn);
}
#account-sheet #logout-btn {
  margin: 12px 20px calc(16px + var(--safe-bottom));
  width: calc(100% - 40px);
}

/* ---------- update (一键更新) ---------- */
.update-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 20px 0;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: 14px;
}
.update-info {
  flex: 1;
  min-width: 0;
}
.update-title {
  font-size: 12px;
  color: var(--text-faint);
}
.update-status {
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.update-row .primary-btn.small,
.update-row .ghost-btn.small {
  flex-shrink: 0;
}
.avatar-btn {
  position: relative;
}
.avatar-btn.has-update::after {
  content: '';
  position: absolute;
  top: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
  border: 2px solid var(--bg-elevated);
}

/* toast */
.toast {
  position: fixed;
  bottom: calc(96px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 100;
  max-width: 80vw;
  text-align: center;
}

/* wider screens: show multi answers side by side */
@media (min-width: 720px) {
  .answers.multi {
    grid-template-columns: repeat(2, 1fr);
  }
  .messages {
    padding: 16px 18px 8px;
  }
}
