/* 合一（AoI）手机网页壳 · 样式
   手机优先，大字大钮，深浅两套配色跟随系统，不引入外部字体。 */

* { box-sizing: border-box; }

[hidden] { display: none !important; }

:root {
  --bg: #f6f4f0;
  --fg: #171310;
  --muted: #837c72;
  --card: #ffffff;
  --border: #e4ded4;
  --accent: #d94b2a;
  --accent-soft: #f7e1da;
  --ok: #1a7f4b;
  --warn: #b4630a;
  --unknown: #7a756e;
  --danger: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11100e;
    --fg: #f1ede5;
    --muted: #948e83;
    --card: #1c1a17;
    --border: #2d2a26;
    --accent: #ff6a4d;
    --accent-soft: #3a221c;
    --ok: #4ec98a;
    --warn: #f2a13c;
    --unknown: #8f8a80;
    --danger: #ff8a80;
  }
}

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ===== 顶栏 ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 8px;
}

.brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.engine-badge {
  margin-left: auto;
  font-size: 13px;
  line-height: 1;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.engine-badge.live { color: var(--ok); border-color: var(--ok); }
.engine-badge.mock { color: var(--warn); border-color: var(--warn); font-weight: 700; }
.engine-badge.unknown { color: var(--unknown); }

.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--fg);
  border-radius: 50%;
  cursor: pointer;
  flex: 0 0 auto;
}
.icon-btn:active { background: var(--accent-soft); }

/* ===== 正中舞台 ===== */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 16px;
  min-height: 0;
}

.talk {
  position: relative;
  width: 176px;
  height: 176px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.talk:active,
.talk.active {
  transform: scale(0.94);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  background: var(--warn);
}

.talk-label { font-size: 17px; font-weight: 600; }
.talk-count { display: none; font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.talk.active .talk-label { display: none; }
.talk.active .talk-count { display: inline; }

.caption {
  min-height: 1.6em;
  max-width: 100%;
  margin: 0;
  padding: 0 16px;
  font-size: 18px;
  line-height: 1.6;
  text-align: center;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===== 底栏 ===== */
.bottombar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 16px);
}

.usage { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.typing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
}

.type-toggle {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-size: 14px;
  cursor: pointer;
}
.type-toggle:active { background: var(--accent-soft); }

.type-row {
  display: flex;
  gap: 8px;
  width: 100%;
  align-items: center;
}
.type-input {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--fg);
  padding: 0 14px;
  font-size: 16px;
}
.type-send {
  min-height: 44px;
  min-width: 68px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  font-size: 15px;
  cursor: pointer;
}

.footnote { font-size: 12px; color: var(--muted); margin: 2px 0 0; }

/* ===== 设置面板 ===== */
.settings {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 10;
}
.settings-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  color: var(--fg);
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 90vh;
  overflow: auto;
}
.settings-card h2 { margin: 0; font-size: 20px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.field input,
.field select {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--fg);
  padding: 0 12px;
  font-size: 16px;
}

.hint { font-size: 13px; color: var(--warn); margin: 0; min-height: 1em; }

.settings-actions { display: flex; flex-direction: column; gap: 10px; }
.btn-primary {
  min-height: 48px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
}
.btn-ghost {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--danger);
  font-size: 14px;
  cursor: pointer;
}

.close-btn { position: absolute; top: 12px; right: 12px; }

/* ===== 无障碍：尊重减少动效 ===== */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
