/* Hermes 语音终端 · 移动端优先。
   暗色底 + 橙色主色（#FF6B35），大圆角卡片、重触控目标（拇指可达）。 */

:root {
  --bg: #12100e;
  --panel: #1c1917;
  --panel-2: #262220;
  --line: #332e2b;
  --txt: #f5efea;
  --txt-dim: #a8a09a;
  --accent: #ff6b35;
  --accent-dim: #b34a24;
  --ok: #3ecf8e;
  --warn: #f5b544;
  --err: #ff5c5c;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--txt);
  font: 15px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* ---------- 顶栏 ---------- */
.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px calc(10px + env(safe-area-inset-top, 0px));
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.logo {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #ff9b6b);
  color: #1b1109; font-weight: 800; font-size: 17px;
}

.brandtxt { min-width: 0; }
.brandtxt b { display: block; font-size: 15px; letter-spacing: .2px; }
.brandtxt small {
  display: block; color: var(--txt-dim); font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
}

.conn {
  flex: none; display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--txt-dim);
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 6px 11px; border-radius: 999px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: #6b6360; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 9px var(--ok); }
.dot.wait { background: var(--warn); }
.dot.bad { background: var(--err); }

/* ---------- 提示条 ---------- */
.banner {
  flex: none;
  margin: 10px 12px 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.5;
  background: rgba(245, 181, 68, .1);
  border: 1px solid rgba(245, 181, 68, .35);
  color: #ffd79a;
}
.banner.err { background: rgba(255, 92, 92, .1); border-color: rgba(255, 92, 92, .4); color: #ffbdbd; }
.banner code {
  background: rgba(0, 0, 0, .35); padding: 1px 5px; border-radius: 5px;
  font-size: 11.5px; word-break: break-all;
}

/* ---------- 对话区 ---------- */
.transcript {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty { color: var(--txt-dim); font-size: 13px; text-align: center; padding: 30px 20px; }
.empty p { margin: 0; }

.msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: var(--radius);
  font-size: 14.5px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  animation: pop .16s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(5px); } }

.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), #ff8b5a);
  color: #20120a;
  border-bottom-right-radius: 5px;
  font-weight: 500;
}
.msg.bot {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.msg.bot.streaming::after {
  content: "▋";
  color: var(--accent);
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.msg.meta {
  align-self: flex-start;
  max-width: 100%;
  background: none; border: none; padding: 0 4px;
  color: var(--txt-dim); font-size: 12px;
}
.msg.err {
  align-self: flex-start;
  background: rgba(255, 92, 92, .1);
  border: 1px solid rgba(255, 92, 92, .38);
  color: #ffc9c9;
  font-size: 13px;
}
.msg .tag {
  display: inline-block; font-size: 10.5px; font-weight: 700;
  letter-spacing: .4px; text-transform: uppercase;
  color: var(--txt-dim); margin-bottom: 3px;
}
.msg.user .tag { color: rgba(32, 18, 10, .6); }

/* ---------- 底部操作区 ---------- */
.dock {
  flex: none;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.statebar { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  background: rgba(255, 107, 53, .14);
  border: 1px solid rgba(255, 107, 53, .4);
  color: #ffb894;
  white-space: nowrap;
}
.chip.ghost {
  background: rgba(255, 255, 255, .04);
  border-color: var(--line);
  color: var(--txt-dim);
}
.chip.on { background: rgba(62, 207, 142, .14); border-color: rgba(62, 207, 142, .45); color: #9be8c4; }

.ptt {
  width: 100%;
  border: none;
  border-radius: 18px;
  padding: 17px 12px;
  background: linear-gradient(135deg, var(--accent), #ff9152);
  color: #1e1008;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  touch-action: none;
  user-select: none;
  transition: transform .08s, filter .12s;
  box-shadow: 0 6px 18px rgba(255, 107, 53, .22);
}
.ptt-main { font-size: 18px; letter-spacing: .5px; }
.ptt-sub { font-size: 11px; font-weight: 600; opacity: .72; }
.ptt:disabled { filter: grayscale(.85) brightness(.7); box-shadow: none; }
.ptt.rec {
  background: linear-gradient(135deg, #ff4d4d, #ff8a3d);
  transform: scale(.985);
  box-shadow: 0 0 0 5px rgba(255, 77, 77, .18);
}
.ptt:active { transform: scale(.985); }

.textrow { display: flex; gap: 8px; }
.textrow input {
  flex: 1 1 auto; min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  color: var(--txt);
  font-size: 15px;
  outline: none;
}
.textrow input:focus { border-color: var(--accent-dim); }
.textrow input::placeholder { color: #756d68; }

button {
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--txt);
  padding: 11px 14px;
}
button:disabled { opacity: .45; cursor: default; }
button.primary {
  background: linear-gradient(135deg, var(--accent), #ff8b5a);
  border-color: transparent; color: #20120a; font-weight: 700;
}
.textrow button { flex: none; padding: 11px 17px; }

.btnrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.btnrow button { padding: 10px 4px; font-size: 12.5px; }

/* ---------- 抽屉 ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 50;
  background: var(--bg);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
}
.sheet-head {
  flex: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.head-actions { display: flex; align-items: center; gap: 8px; }
button.x {
  border: none; background: none; font-size: 18px;
  color: var(--txt-dim); padding: 4px 8px;
}
button.small { padding: 5px 10px; font-size: 12px; }

.sheet-body {
  flex: 1 1 auto; overflow-y: auto;
  padding: 14px 14px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px;
}
.sheet-body label { font-size: 12.5px; color: var(--txt-dim); margin-top: 6px; }
.sheet-body label .val { color: var(--accent); font-weight: 700; }
.sheet-body input[type=text],
.sheet-body input[type=password] {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 12px; color: var(--txt);
  font-size: 15px; outline: none; width: 100%;
}
.sheet-body input[type=text]:focus,
.sheet-body input[type=password]:focus { border-color: var(--accent-dim); }
.sheet-body input[type=range] { width: 100%; accent-color: var(--accent); }

.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--txt); margin-top: 8px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.sheet-hint {
  margin-top: 10px; font-size: 12px; line-height: 1.6;
  color: var(--txt-dim);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 12px;
}
.sheet-hint b { color: var(--txt); }
.sheet-hint code {
  background: rgba(0, 0, 0, .4); padding: 1px 5px; border-radius: 5px;
  font-size: 11.5px; word-break: break-all;
}

.sheet-actions { display: flex; gap: 9px; margin-top: 14px; }
.sheet-actions button { flex: 1 1 0; }

.log {
  margin: 0;
  font: 11.5px/1.5 ui-monospace, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  color: #d6cec9;
}
.log .t { color: #7d746f; }
.log .in { color: #8fd3ff; }
.log .out { color: #ffc08a; }
.log .bin { color: #a5e8c0; }
.log .warn { color: var(--warn); }
.log .err { color: var(--err); }

.hidden { display: none !important; }
