:root {
  --night: #10151c;
  --panel: #171e28;
  --paper: #f3ead8;
  --ink: #1b140e;
  --muted: #8a7a68;
  --gold: #d6a45a;
  --online: #3dcc8a;
  --line: rgba(243, 234, 216, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  min-height: 100dvh;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--paper);
  background:
    radial-gradient(900px 500px at 80% -10%, #2a3344 0%, transparent 55%),
    radial-gradient(700px 420px at -10% 110%, #3a2a18 0%, transparent 50%),
    var(--night);
}

.stage {
  width: min(440px, 100%);
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 120px),
    var(--panel);
  box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(0,0,0,.35);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.who { display: flex; gap: 10px; align-items: center; }
.avatar {
  width: 42px; height: 42px;
  border-radius: 14px;
  background: var(--gold);
  color: var(--ink);
  font-family: "ZCOOL XiaoWei", serif;
  font-size: 22px;
  display: grid; place-items: center;
}
.top h1 {
  font-family: "ZCOOL XiaoWei", serif;
  font-size: 22px;
  margin: 0;
  font-weight: 400;
}
.top p {
  margin: 2px 0 0;
  font-size: 12px;
  color: #b7c0cc;
  display: flex; align-items: center; gap: 6px;
}
.top p i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 0 4px rgba(61,204,138,.16);
  display: inline-block;
}
.top p.is-type i { background: #f0c14a; box-shadow: 0 0 0 4px rgba(240,193,74,.16); }
.plate {
  font-size: 10px;
  letter-spacing: 0.18em;
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 4px 8px 3px;
}

.feed {
  flex: 1;
  overflow: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.row.me { margin-left: auto; flex-direction: row-reverse; }
.bubble {
  padding: 10px 12px;
  border-radius: 16px 16px 16px 4px;
  background: #243040;
  color: var(--paper);
  font-size: 15px;
  line-height: 1.55;
  animation: in 280ms var(--ease);
}
.row.me .bubble {
  background: var(--gold);
  color: var(--ink);
  border-radius: 16px 16px 4px 16px;
  font-weight: 500;
}
.mini {
  width: 28px; height: 28px;
  border-radius: 10px;
  background: var(--gold);
  color: var(--ink);
  display: grid; place-items: center;
  font-family: "ZCOOL XiaoWei", serif;
  flex: none;
}
.row.me .mini { background: #4a5568; color: #f3ead8; font-family: inherit; font-size: 12px; font-weight: 700; }

.card {
  min-width: 220px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 13px 11px;
  animation: in 280ms var(--ease);
}
.card b { display: block; font-size: 15px; }
.card p { margin: 6px 0 8px; font-size: 13px; color: #5c4a3a; line-height: 1.5; }
.card span {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #9a7a4a;
}

.card-link {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.typing {
  display: inline-flex; gap: 4px; padding: 12px 14px;
}
.typing em {
  width: 6px; height: 6px; border-radius: 50%;
  background: #c9b89a;
  display: block;
  animation: blink 1s infinite;
}
.typing em:nth-child(2) { animation-delay: .15s; }
.typing em:nth-child(3) { animation-delay: .3s; }

.dock {
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(16, 21, 28, .55);
  backdrop-filter: blur(10px);
}
.quick-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; min-height: 0; }
.chip {
  border: 1px solid var(--line);
  background: #1f2834;
  color: var(--paper);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
.composer { display: flex; gap: 8px; }
.composer input {
  flex: 1;
  height: 46px;
  border: 1px solid var(--line);
  background: #10161e;
  color: var(--paper);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.composer input:focus { border-color: var(--gold); }
.composer button {
  height: 46px;
  min-width: 72px;
  border: 0;
  border-radius: 12px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}

@keyframes in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes blink {
  0%, 80%, 100% { opacity: .25; }
  40% { opacity: 1; }
}

body.is-embed {
  background: var(--panel);
}
body.is-embed .stage {
  width: 100%;
  height: 100dvh;
  box-shadow: none;
}
