:root {
  --ink: #19231f;
  --muted: #68736e;
  --paper: #f2f1ea;
  --panel: #fffefa;
  --line: #d9d8cf;
  --green: #087f5b;
  --green-soft: #dff4e9;
  --orange: #e97723;
  --red: #b83b32;
  --shadow: 0 24px 70px rgba(37, 50, 44, .13);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 12%, rgba(233,119,35,.10), transparent 28rem),
    radial-gradient(circle at 88% 80%, rgba(8,127,91,.11), transparent 30rem),
    var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

button, textarea { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 34px 0 42px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.eyebrow { color: var(--orange); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 4px 0 4px; font-family: "Songti SC", Georgia, serif; font-size: clamp(28px, 4vw, 46px); font-weight: 700; }
.topbar p { color: var(--muted); margin: 0; }
.status { white-space: nowrap; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.6); color: var(--muted); font-size: 13px; }
.status span { display: inline-block; width: 8px; height: 8px; background: var(--green); border-radius: 50%; margin-right: 7px; box-shadow: 0 0 0 5px var(--green-soft); }
.status.real-mode { color: #12623f; border-color: #91c8ae; background: #effaf4; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(330px, .82fr); min-height: 690px; background: var(--panel); border: 1px solid rgba(255,255,255,.8); border-radius: 28px; overflow: hidden; box-shadow: var(--shadow); }
.phone-panel { position: relative; min-width: 0; display: grid; grid-template-rows: auto 1fr auto; border-right: 1px solid var(--line); }
.phone-header { display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 9px 12px; border-bottom: 1px solid #d9d9d9; background: #ededed; }
.nav-icon { width: 38px; height: 38px; border: 0; padding: 0; color: #181818; background: transparent; font-size: 34px; line-height: 1; }
.nav-icon.more { font-size: 17px; letter-spacing: 2px; }
.chat-title { flex: 1; text-align: center; }
.chat-title strong, .chat-title small { display: block; }
.chat-title strong { font-size: 16px; font-weight: 650; }
.chat-title small { margin-top: 1px; color: #777; font-size: 10px; }
.nav-action { border: 0; border-radius: 5px; padding: 5px 7px; color: #666; background: transparent; font-size: 11px; }
.chat { min-height: 0; overflow-y: auto; padding: 22px 14px; background: #ededed; }
.message-row { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 18px; animation: rise .22s ease-out; }
.message-row.user-row { flex-direction: row-reverse; }
.chat-avatar { flex: 0 0 38px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 4px; font-size: 14px; font-weight: 700; }
.service-avatar { color: white; background: #2f7d64; }
.customer-avatar { color: #355733; background: #cce6c7; }
.bubble { position: relative; width: fit-content; max-width: min(74%, 500px); margin: 0; padding: 10px 12px; border-radius: 5px; color: #171717; line-height: 1.62; white-space: pre-wrap; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.bubble::before { content: ""; position: absolute; top: 13px; width: 0; height: 0; border: 6px solid transparent; }
.bubble.bot { background: white; border: 1px solid #e4e4e4; }
.bubble.bot::before { left: -12px; border-right-color: white; }
.bubble.user { background: #95ec69; border: 1px solid #8cde65; }
.bubble.user::before { right: -12px; border-left-color: #95ec69; }
.message-row.system-row { justify-content: center; margin: 2px 0 15px; }
.bubble.system { max-width: 82%; padding: 4px 9px; color: #888; background: rgba(0,0,0,.06); border-radius: 4px; box-shadow: none; font-size: 11px; }
.bubble.system::before { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } }
.composer { display: grid; grid-template-columns: 34px minmax(80px, 1fr) 34px 34px auto; align-items: end; gap: 7px; padding: 9px 10px max(9px, env(safe-area-inset-bottom)); border-top: 1px solid #d6d6d6; background: #f7f7f7; }
.composer-icon { width: 34px; height: 36px; border: 0; padding: 0; color: #222; background: transparent; font-size: 27px; line-height: 1; }
.composer-icon.active { color: #07c160; }
.voice-icon { font-size: 18px; }
textarea { min-height: 38px; max-height: 96px; resize: none; border: 0; border-radius: 5px; padding: 8px 10px; color: #171717; background: white; outline: none; line-height: 1.45; }
textarea:focus { box-shadow: inset 0 0 0 1px #c9c9c9; }
#sendBtn { min-height: 36px; border: 0; border-radius: 4px; padding: 0 13px; color: white; background: #07c160; font-size: 13px; font-weight: 650; }
#sendBtn:hover { filter: brightness(.94); }
.smile-icon { position: relative; display: inline-block; width: 24px; height: 24px; border: 2px solid currentColor; border-radius: 50%; }
.smile-icon::before { content: ""; position: absolute; top: 6px; left: 5px; width: 3px; height: 3px; border-radius: 50%; background: currentColor; box-shadow: 9px 0 0 currentColor; }
.smile-icon::after { content: ""; position: absolute; left: 5px; bottom: 5px; width: 10px; height: 5px; border-bottom: 2px solid currentColor; border-radius: 0 0 10px 10px; }
.emoji-panel { position: absolute; right: 8px; bottom: 59px; z-index: 5; width: min(330px, calc(100% - 16px)); display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 12px; border: 1px solid #d7d7d7; border-radius: 10px 10px 4px 10px; background: rgba(255,255,255,.98); box-shadow: 0 12px 36px rgba(0,0,0,.16); }
.emoji-panel.hidden { display: none; }
.emoji-panel button { display: grid; place-items: center; height: 46px; border: 0; border-radius: 7px; padding: 0; background: transparent; }
.emoji-panel button:hover { background: #f0f0f0; transform: scale(1.08); }
.wechat-emotion-frame { display: inline-block; width: 32px; height: 32px; overflow: hidden; vertical-align: middle; }
.wechat-emotion-icon { display: block; width: 64px; height: 64px; background-image: url("https://res.wx.qq.com/op_res/eROMsLpnNC10dC40vzF8qviz63ic7ATlbGg20lr5pYykOwHRbLZFUhgg23RtVorX"); background-repeat: no-repeat; transform: scale(.5); transform-origin: 0 0; }
.bubble .wechat-emotion-frame { width: 28px; height: 28px; margin: 0 1px; vertical-align: -8px; }
.bubble .wechat-emotion-icon { transform: scale(.4375); }

.inspector { min-width: 0; display: flex; flex-direction: column; gap: 16px; padding: 24px; background: #fbfaf5; }
.section-title { display: flex; justify-content: space-between; align-items: center; }
.section-title span, .section-title small { display: block; }
.section-title span { font-family: "Songti SC", serif; font-size: 23px; font-weight: 700; }
.section-title small { margin-top: 3px; color: var(--muted); }
.badge { color: white; background: var(--red); border-radius: 999px; padding: 7px 10px; font-size: 12px; font-weight: 700; }
.hidden { display: none; }
.scenario-block h2 { margin: 5px 0 10px; font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; color: var(--ink); background: white; font-size: 12px; }
.chips button:hover { border-color: var(--green); color: var(--green); }
.diagnostic-card { border: 1px solid var(--line); border-radius: 16px; padding: 15px; background: rgba(255,255,255,.8); }
.diagnostic-card.grow { flex: 1; min-height: 220px; }
.label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.value { margin-top: 7px; font-size: 19px; font-weight: 700; }
pre { margin: 9px 0 0; color: #335047; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.privacy-note { padding: 15px; border-radius: 16px; color: #6d4b1e; background: #fff0d9; }
.privacy-note strong { font-size: 13px; }
.privacy-note p { margin: 5px 0 0; font-size: 12px; line-height: 1.6; }

@media (max-width: 850px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .workspace { grid-template-columns: 1fr; }
  .phone-panel { min-height: 650px; border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 520px) {
  .shell { width: 100%; padding: 20px 0 0; }
  .topbar { padding: 0 18px; }
  .status { white-space: normal; }
  .workspace { border-radius: 22px 22px 0 0; }
  .bubble { max-width: 88%; }
  .chat-avatar { flex-basis: 34px; width: 34px; height: 34px; }
  .composer { grid-template-columns: 32px minmax(80px, 1fr) 32px 32px auto; gap: 4px; }
  .emoji-panel { grid-template-columns: repeat(6, 1fr); }
}
