:root {
  --bg: #0e0f13;
  --panel: #171a21;
  --panel-2: #1e222b;
  --fg: #e8e9ee;
  --dim: #8b90a0;
  --accent: #7aa2ff;
  --ok: #5ad19a;
  --warn: #ffb86b;
  --err: #ff7b7b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #1b2030 0%, var(--bg) 60%);
  color: var(--fg);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  display: flex;
  justify-content: center;
}

.wrap { width: min(720px, 94vw); padding: 28px 0 40px; display: flex; flex-direction: column; gap: 18px; }

header h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: 0.5px; }
header .sub { margin: 4px 0 0; color: var(--dim); font-size: 13px; }

.panel {
  background: var(--panel);
  border: 1px solid #242936;
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.orb {
  width: 96px; height: 96px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3a4a7a, #1b2136 60%);
  box-shadow: 0 0 0 1px #2c3550 inset, 0 0 30px rgba(90, 130, 255, 0.12);
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}
.orb.listening {
  background: radial-gradient(circle at 35% 30%, #3a7a68, #14251f 60%);
  box-shadow: 0 0 0 1px #2c5044 inset, 0 0 34px rgba(90, 209, 154, 0.28);
  animation: pulse 1.6s ease-in-out infinite;
}
.orb.speaking {
  background: radial-gradient(circle at 35% 30%, #4d5fa8, #1a2138 60%);
  box-shadow: 0 0 0 1px #33406b inset, 0 0 40px rgba(122, 162, 255, 0.35);
  animation: pulse .9s ease-in-out infinite;
}
.orb.thinking { background: radial-gradient(circle at 35% 30%, #7a6437, #2a2417 60%); }
.orb.error { background: radial-gradient(circle at 35% 30%, #6a2f2f, #241414 60%); }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.status { font-size: 15px; color: var(--fg); min-height: 22px; }

.meter { width: 100%; height: 6px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.meter-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #4d7cff, #7ae0c0); transition: width .08s linear; }

.buttons { display: flex; gap: 12px; margin-top: 4px; }

button {
  font: inherit; font-size: 15px; padding: 11px 26px; border-radius: 12px;
  border: 1px solid #2b3242; background: var(--panel-2); color: var(--fg); cursor: pointer;
  transition: filter .15s ease, transform .1s ease;
}
button:hover:not(:disabled) { filter: brightness(1.15); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: linear-gradient(180deg, #3f66c9, #3050a3); border-color: #4a6cc0; }
button.ghost { background: transparent; }

.latency { display: flex; gap: 10px; align-items: center; color: var(--dim); font-size: 12.5px; flex-wrap: wrap; justify-content: center; }
.latency b { color: var(--fg); font-weight: 600; margin-right: 10px; font-variant-numeric: tabular-nums; }

.transcript { background: var(--panel); border: 1px solid #242936; border-radius: 18px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.line { display: flex; gap: 10px; font-size: 14.5px; line-height: 1.65; }
.line i { font-style: normal; color: var(--dim); flex: 0 0 26px; padding-top: 1px; }
.line span { flex: 1; word-break: break-word; white-space: pre-wrap; }

footer { color: var(--dim); font-size: 12.5px; line-height: 1.7; }
footer p { margin: 2px 0; }
.hint { color: var(--warn); }

.typebar {
  display: flex; gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid #242936; border-radius: 18px; padding: 12px 14px;
}
.typebar input {
  flex: 1; min-width: 0; font: inherit; font-size: 15px; color: var(--fg);
  background: var(--panel-2); border: 1px solid #2b3242; border-radius: 12px; padding: 11px 14px;
  outline: none;
}
.typebar input:focus { border-color: #4a6cc0; }
.typebar button { padding: 11px 18px; }

/* ---------- 手机 ---------- */
@media (max-width: 560px) {
  .wrap { width: 100%; padding: 16px 12px calc(24px + env(safe-area-inset-bottom)); gap: 12px; }
  header h1 { font-size: 19px; }
  .panel { padding: 16px; border-radius: 16px; }
  .buttons { width: 100%; flex-direction: column; gap: 8px; }
  .buttons button { width: 100%; padding: 14px; font-size: 16px; }
  .typebar { flex-wrap: wrap; padding: 10px; }
  /* iOS 上输入框字号 <16px 会自动放大页面 */
  .typebar input { font-size: 16px; flex: 1 1 100%; }
  .typebar button { flex: 1 1 0; }
  .line { font-size: 15px; }
  .latency { font-size: 12px; }
  .orb { width: 76px; height: 76px; }
}

.orb.yourturn {
  background: radial-gradient(circle at 35% 30%, #3fa76f, #14251c 60%);
  box-shadow: 0 0 0 2px #52d68d inset, 0 0 42px rgba(82, 214, 141, 0.55);
  animation: pulse 1.2s ease-in-out infinite;
}
.beep { display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 12.5px; padding-left: 6px; }
.beep input { accent-color: var(--accent); }
