/* ─────────────────────────────────────────────────────────────
   一隅 · H5 一对一客服
   ───────────────────────────────────────────────────────────── */

:root {
  --font-sans: "Avenir Next", "Segoe UI Variable Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Songti SC",
    "Noto Serif CJK SC", "Source Han Serif SC", "STSong", serif;

  --paper: #f3eadb;
  --paper-deep: #e8dccb;
  --surface: #fffdf8;
  --chat: #f8f2e8;
  --ink: #1e2722;
  --ink-soft: #4e5851;
  --muted: #878b80;
  --faint: #b1b1a4;
  --line: rgba(30, 39, 34, 0.09);
  --line-strong: rgba(30, 39, 34, 0.15);

  --pine: #173a33;
  --pine-deep: #0e2c26;
  --pine-mid: #28574a;
  --pine-soft: #e4ede6;
  --coral: #d96b4c;
  --coral-deep: #bf5538;
  --coral-soft: #f8e4db;
  --green: #4f9b75;
  --amber: #c58a40;
  --danger: #b94f3d;

  --shadow-shell: 0 34px 90px rgba(27, 42, 34, 0.19), 0 4px 16px rgba(27, 42, 34, 0.05);
  --shadow-soft: 0 8px 30px rgba(27, 42, 34, 0.08);

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 14% 18%, rgba(217, 107, 76, 0.1), transparent 32%),
    radial-gradient(circle at 88% 84%, rgba(23, 58, 51, 0.11), transparent 36%),
    linear-gradient(138deg, #f6efe4 0%, #f0e6d7 52%, #eadfce 100%);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
textarea,
input {
  font: inherit;
  color: inherit;
}

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

svg {
  display: block;
  width: 20px;
  height: 20px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

::selection {
  background: var(--coral);
  color: #fffaf4;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
}

.noscript-note {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 300;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--pine);
  color: #f8f1e5;
  font-size: 12px;
  text-align: center;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Desktop scene ─────────────────────────────────────────── */

.page {
  display: grid;
  grid-template-columns: minmax(330px, 470px) minmax(390px, 430px);
  align-items: center;
  justify-content: center;
  gap: clamp(48px, 8vw, 120px);
  width: 100%;
  max-width: 1240px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px clamp(24px, 4vw, 56px);
}

.intro {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: min(780px, calc(100dvh - 80px));
  padding: 12px 0;
  overflow: hidden;
  isolation: isolate;
}

.brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: none;
  color: var(--pine);
}

.brand-word {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.brand-word strong {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.055em;
  white-space: nowrap;
}

.brand-word span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.32em;
}

.intro-main {
  position: relative;
  z-index: 2;
  margin-top: auto;
  margin-bottom: auto;
  padding: clamp(30px, 6vh, 64px) 0 30px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
  color: var(--pine-mid);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.15em;
}

.pulse-dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.pulse-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px solid rgba(79, 155, 117, 0.5);
  border-radius: 50%;
  animation: ping 2.6s ease-out infinite;
}

.intro h1 {
  margin-left: -0.04em;
  font-family: var(--font-serif);
  font-size: clamp(50px, 5vw, 72px);
  font-weight: 500;
  line-height: 1.28;
  letter-spacing: 0.01em;
}

.intro h1 em {
  position: relative;
  color: var(--coral);
  font-style: normal;
  white-space: nowrap;
}

.intro h1 em::after {
  content: "";
  position: absolute;
  right: 2%;
  bottom: -0.03em;
  left: 0;
  height: 0.055em;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(217, 107, 76, 0.08), var(--coral) 30%, rgba(217, 107, 76, 0.08));
  opacity: 0.55;
}

.intro-lead {
  max-width: 365px;
  margin-top: 22px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 2;
  letter-spacing: 0.02em;
}

.feature-list {
  max-width: 390px;
  margin-top: clamp(30px, 5vh, 48px);
  border-top: 1px solid var(--line-strong);
}

.feature {
  display: flex;
  gap: 18px;
  padding: 15px 2px;
  border-bottom: 1px solid var(--line);
}

.feature-num {
  padding-top: 2px;
  color: var(--coral);
  font-family: var(--font-serif);
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
}

.feature strong {
  display: block;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.feature p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.intro-foot {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.intro-orbit {
  position: absolute;
  top: 12%;
  right: max(-210px, -18vw);
  z-index: 1;
  width: clamp(330px, 38vw, 480px);
  aspect-ratio: 1;
  pointer-events: none;
  opacity: 0.75;
}

.ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(23, 58, 51, 0.14);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.ring-1 {
  width: 31%;
  height: 31%;
  border-color: rgba(23, 58, 51, 0.2);
  animation: breathe 9s ease-in-out infinite;
}

.ring-2 {
  width: 58%;
  height: 58%;
  border-style: dashed;
  border-color: rgba(23, 58, 51, 0.1);
  animation: spin 80s linear infinite;
}

.ring-3 {
  width: 91%;
  height: 91%;
  border-color: rgba(23, 58, 51, 0.07);
  animation: breathe 11s 1s ease-in-out infinite;
}

.sun {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 13%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 38% 32%, #fff8ef 0%, #f4c8b5 32%, #de8b6d 68%, #d66b4c 100%);
  box-shadow:
    0 0 40px rgba(217, 107, 76, 0.22),
    0 0 90px rgba(217, 107, 76, 0.1);
  opacity: 0.82;
}

.spark {
  position: absolute;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 18px rgba(217, 107, 76, 0.35);
}

.spark-1 {
  top: 22%;
  left: 24%;
  width: 5px;
  height: 5px;
}

.spark-2 {
  top: 76%;
  left: 79%;
  width: 4px;
  height: 4px;
  background: var(--pine-mid);
  box-shadow: none;
}

/* ── Chat shell ────────────────────────────────────────────── */

.chat-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: min(860px, calc(100vh - 48px));
  height: min(860px, calc(100dvh - 48px));
  min-height: 520px;
  overflow: hidden;
  border: 1px solid rgba(23, 58, 51, 0.1);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow-shell);
}

.chat-head {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 79px;
  flex: none;
  padding: 13px 19px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
}

.agent-block {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.agent-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 26%, rgba(255, 244, 228, 0.28), transparent 36%),
    linear-gradient(150deg, var(--pine-mid), var(--pine) 58%, var(--pine-deep));
  color: #f8f0e2;
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 5px 14px rgba(23, 58, 51, 0.18);
}

.agent-dot {
  position: absolute;
  right: 0;
  bottom: 1px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--green);
  transition: background 180ms ease;
}

.agent-dot.is-offline {
  background: var(--amber);
}

.agent-copy {
  min-width: 0;
}

.agent-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.agent-name-row h2 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.04em;
}

.one-on-one {
  padding: 2px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 7.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.agent-status {
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-status::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--green);
  vertical-align: 1px;
}

.agent-status.is-offline::before {
  background: var(--amber);
}

.private-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chat);
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.private-badge svg {
  width: 11px;
  height: 11px;
}

.privacy-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  flex: none;
  padding: 5px 19px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 42%, var(--surface));
  color: var(--muted);
  font-size: 8.5px;
  letter-spacing: 0.03em;
}

.privacy-brand {
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.privacy-copy {
  display: flex;
  align-items: center;
  gap: 4px;
}

.privacy-copy svg {
  width: 10px;
  height: 10px;
  opacity: 0.7;
}

.connection-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 30px;
  flex: none;
  padding: 5px 14px;
  background: color-mix(in srgb, var(--amber) 11%, var(--surface));
  color: color-mix(in srgb, var(--amber) 78%, var(--ink));
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.connection-dot {
  width: 9px;
  height: 9px;
  border: 1.5px solid color-mix(in srgb, var(--amber) 25%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

/* ── Conversation ──────────────────────────────────────────── */

.messages {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 14px 17px 8px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background-color: var(--chat);
  background-image: radial-gradient(rgba(23, 58, 51, 0.055) 0.6px, transparent 0.6px);
  background-size: 13px 13px;
  scrollbar-width: thin;
  scrollbar-color: rgba(23, 58, 51, 0.16) transparent;
}

.messages::-webkit-scrollbar {
  width: 6px;
}

.messages::-webkit-scrollbar-thumb {
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(23, 58, 51, 0.16);
  background-clip: padding-box;
}

.messages-inner {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding-bottom: 6px;
}

.system-line {
  display: flex;
  justify-content: center;
  margin: 5px 0 16px;
}

.system-line span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  color: var(--faint);
  font-size: 8.5px;
  letter-spacing: 0.03em;
}

.system-line svg {
  width: 10px;
  height: 10px;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 4px 18px;
  color: var(--faint);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.13em;
}

.date-divider::before,
.date-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.message-list {
  display: flex;
  flex-direction: column;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 17px;
  animation: rise 360ms cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.message.is-compact {
  margin-top: 5px;
}

.message.is-self {
  justify-content: flex-end;
}

.msg-avatar {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 244, 228, 0.22), transparent 38%),
    linear-gradient(150deg, var(--pine-mid), var(--pine));
  color: #f6eee0;
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 1;
}

.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message.is-compact .msg-avatar {
  visibility: hidden;
}

.message-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(82%, 315px);
  min-width: 0;
}

.message.is-self .message-body {
  align-items: flex-end;
}

.message-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 0 4px 4px;
  line-height: 1.2;
}

.message.is-self .message-meta {
  flex-direction: row-reverse;
}

.message-author {
  color: var(--ink-soft);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.message-time {
  color: var(--faint);
  font-size: 8px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.bubble {
  max-width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 4px 15px 15px 15px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  box-shadow: 0 2px 8px rgba(27, 42, 34, 0.035);
}

.message.is-self .bubble {
  border-color: transparent;
  border-radius: 15px 4px 15px 15px;
  background:
    linear-gradient(150deg, var(--pine-mid), var(--pine) 64%, var(--pine-deep));
  color: #f6f1e6;
  box-shadow: 0 6px 18px rgba(23, 58, 51, 0.17);
}

.bubble a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(23, 58, 51, 0.28);
  text-underline-offset: 3px;
}

.message.is-self .bubble a {
  text-decoration-color: rgba(255, 250, 240, 0.45);
}

.bubble a:hover {
  text-decoration-color: currentColor;
}

.quick-wrap {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-strong);
  animation: rise 450ms 120ms ease both;
}

.quick-label {
  margin: 0 6px 8px;
  color: var(--faint);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.quick {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 43px;
  margin-top: 6px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  color: var(--ink-soft);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.quick:hover {
  border-color: color-mix(in srgb, var(--pine) 25%, transparent);
  background: var(--surface);
  transform: translateY(-1px);
}

.quick-index {
  color: var(--coral);
  font-family: var(--font-serif);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.quick-text {
  flex: 1;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.quick svg {
  width: 13px;
  height: 13px;
  color: var(--faint);
  transition: color 160ms ease, transform 160ms ease;
}

.quick:hover svg {
  color: var(--coral);
  transform: translateX(2px);
}

.load-failure {
  margin: 22px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  text-align: center;
}

.load-failure strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
}

.load-failure p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.load-failure button {
  margin-top: 12px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--pine);
  color: #f7f1e6;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.jump-btn {
  position: absolute;
  right: 16px;
  bottom: 128px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 31px;
  padding: 0 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: var(--pine);
  color: #f7f1e6;
  font-size: 9px;
  letter-spacing: 0.03em;
  box-shadow: var(--shadow-soft);
  animation: pop-up 170ms ease both;
}

.jump-btn svg {
  width: 12px;
  height: 12px;
}

/* ── Composer ──────────────────────────────────────────────── */

.compose-zone {
  position: relative;
  z-index: 10;
  flex: none;
  padding: 0 12px max(9px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--surface) 72%, color-mix(in srgb, var(--surface) 72%, transparent));
}

.typing-line {
  display: flex;
  align-items: center;
  height: 21px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 160ms ease;
}

.typing-line.is-active {
  opacity: 1;
}

.typing-dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 4px;
}

.typing-dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  animation: typing 1.2s ease-in-out infinite;
}

.typing-dots i:nth-child(2) {
  animation-delay: 130ms;
}

.typing-dots i:nth-child(3) {
  animation-delay: 260ms;
}

.form-status {
  padding: 0 8px;
  color: var(--danger);
  font-size: 9px;
  line-height: 1.5;
}

.form-status:not(:empty) {
  padding-bottom: 5px;
}

.composer {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 21px;
  background: var(--surface);
  box-shadow: 0 8px 26px rgba(27, 42, 34, 0.08);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.composer:focus-within {
  border-color: color-mix(in srgb, var(--pine) 40%, transparent);
  box-shadow: 0 8px 28px rgba(27, 42, 34, 0.1), 0 0 0 3px rgba(23, 58, 51, 0.055);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  color: var(--muted);
  transition: color 150ms ease, background 150ms ease;
}

.icon-btn:hover {
  background: var(--chat);
  color: var(--ink-soft);
}

.emoji-btn svg {
  width: 18px;
  height: 18px;
}

#message-input {
  display: block;
  flex: 1;
  width: 100%;
  max-height: 126px;
  min-height: 36px;
  padding: 9px 4px 6px;
  overflow-y: auto;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.65;
  resize: none;
  scrollbar-width: thin;
}

#message-input::placeholder {
  color: var(--faint);
}

.send-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: var(--pine);
  color: #f8f1e5;
  box-shadow: 0 4px 12px rgba(23, 58, 51, 0.2);
  transition: transform 150ms ease, opacity 150ms ease, background 150ms ease;
}

.send-btn svg {
  width: 17px;
  height: 17px;
  transform: translate(-1px, 1px);
}

.send-btn:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.03);
}

.send-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.send-btn:disabled {
  background: #e4e1d8;
  color: #aaa99c;
  box-shadow: none;
  opacity: 0.8;
}

.emoji-panel {
  position: absolute;
  bottom: calc(100% + 9px);
  left: 0;
  z-index: 20;
  width: 292px;
  max-width: calc(100vw - 40px);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 22px 60px rgba(27, 42, 34, 0.2);
  animation: pop-up 160ms ease both;
}

.emoji-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.1em;
}

.emoji-head button {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  color: var(--faint);
}

.emoji-head button:hover {
  background: var(--chat);
  color: var(--ink);
}

.emoji-head svg {
  width: 12px;
  height: 12px;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1px;
}

.emoji-grid button {
  display: grid;
  place-items: center;
  height: 31px;
  border-radius: 7px;
  font-size: 17px;
  line-height: 1;
  transition: background 120ms ease, transform 120ms ease;
}

.emoji-grid button:hover {
  background: var(--chat);
  transform: scale(1.1);
}

.compose-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 8px 0;
  color: var(--faint);
  font-size: 7.5px;
  letter-spacing: 0.02em;
}

.compose-safe {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
}

.compose-safe svg {
  width: 9px;
  height: 9px;
}

/* ── Animations ────────────────────────────────────────────── */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop-up {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ping {
  0% {
    opacity: 0.8;
    transform: scale(0.7);
  }
  80%,
  100% {
    opacity: 0;
    transform: scale(2.1);
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.55;
    transform: translate(-50%, -50%) scale(0.985);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.015);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes typing {
  0%,
  70%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  35% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* ── Account / authentication ─────────────────────────────── */

.agent-avatar {
  overflow: hidden;
}

.agent-avatar > span {
  position: relative;
  z-index: 1;
}

.agent-avatar > img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.agent-avatar .agent-dot {
  z-index: 2;
}

.head-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: none;
}

.shop-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 27px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--coral) 20%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--coral-soft) 55%, var(--surface));
  color: var(--coral-deep);
  font-size: 8.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease;
}

.shop-chip:hover {
  border-color: color-mix(in srgb, var(--coral) 38%, transparent);
  background: var(--coral-soft);
}

.shop-chip svg {
  width: 11px;
  height: 11px;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 116px;
  height: 27px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: border-color 150ms ease, background 150ms ease;
}

.account-chip:hover {
  border-color: color-mix(in srgb, var(--pine) 28%, transparent);
  background: var(--chat);
}

.account-chip svg {
  width: 11px;
  height: 11px;
  flex: none;
  color: var(--pine-mid);
}

.account-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-screen {
  flex: 1;
  min-height: 0;
  padding: clamp(18px, 4vh, 38px) 16px;
  overflow-y: auto;
  background-color: var(--chat);
  background-image: radial-gradient(rgba(23, 58, 51, 0.055) 0.6px, transparent 0.6px);
  background-size: 13px 13px;
}

.auth-card {
  width: min(100%, 366px);
  margin: 0 auto;
  padding: clamp(22px, 3.6vh, 30px) clamp(18px, 6vw, 30px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 18px 50px rgba(27, 42, 34, 0.09);
  animation: rise 420ms cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.auth-card .eyebrow {
  margin-bottom: 13px;
  font-size: 8.5px;
}

.auth-card h2 {
  font-family: var(--font-serif);
  font-size: clamp(24px, 6vw, 29px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.auth-lead {
  margin-top: 9px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.8;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  margin: 19px 0 15px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--chat);
}

.auth-tab {
  height: 31px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.auth-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(27, 42, 34, 0.08);
}

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-form label {
  margin: 9px 0 4px;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.auth-form input,
.account-section input {
  width: 100%;
  height: 39px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auth-form input::placeholder,
.account-section input::placeholder {
  color: var(--faint);
}

.auth-form input:focus,
.account-section input:focus {
  border-color: color-mix(in srgb, var(--pine) 45%, transparent);
  box-shadow: 0 0 0 3px rgba(23, 58, 51, 0.06);
}

.auth-hint {
  margin-top: 6px;
  color: var(--faint);
  font-size: 8px;
  line-height: 1.6;
}

.auth-status,
.account-status {
  min-height: 15px;
  margin-top: 7px;
  color: var(--danger);
  font-size: 8.5px;
  line-height: 1.6;
}

.auth-status.is-success,
.account-status.is-success {
  color: var(--green);
}

.auth-submit,
.account-save {
  height: 40px;
  margin-top: 4px;
  border-radius: 10px;
  background: var(--pine);
  color: #f8f1e5;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  box-shadow: 0 6px 16px rgba(23, 58, 51, 0.16);
  transition: transform 150ms ease, opacity 150ms ease, background 150ms ease;
}

.auth-submit:hover:not(:disabled),
.account-save:hover:not(:disabled) {
  background: var(--pine-mid);
  transform: translateY(-1px);
}

.auth-submit:disabled,
.account-save:disabled {
  opacity: 0.6;
  cursor: wait;
}

.auth-foot {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
  color: var(--faint);
  font-size: 7.5px;
  line-height: 1.5;
}

.auth-foot svg {
  width: 9px;
  height: 9px;
  flex: none;
}

/* Account sheet */

.account-sheet {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.account-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 27, 22, 0.52);
  backdrop-filter: blur(5px);
  animation: viewer-in 160ms ease both;
}

.account-card {
  position: relative;
  z-index: 1;
  width: min(100%, 378px);
  max-height: min(88dvh, 660px);
  padding: 22px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 32px 90px rgba(14, 27, 22, 0.3);
  animation: pop-up 180ms ease both;
}

.account-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  color: var(--muted);
}

.account-close:hover {
  background: var(--chat);
  color: var(--ink);
}

.account-close svg {
  width: 14px;
  height: 14px;
}

.account-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-right: 28px;
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--pine);
  color: #f8f1e5;
}

.account-avatar svg {
  width: 20px;
  height: 20px;
}

.account-head .eyebrow {
  margin-bottom: 3px;
  font-size: 7.5px;
}

.account-head h2 {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
}

.account-name {
  margin-top: 12px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--chat);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.account-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.account-section h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 5px;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
}

.account-section h3 svg {
  width: 13px;
  height: 13px;
  color: var(--coral);
}

.account-section form {
  display: flex;
  flex-direction: column;
}

.account-section label {
  margin: 8px 0 4px;
  color: var(--ink-soft);
  font-size: 8.5px;
  font-weight: 600;
}

.account-save {
  height: 37px;
  margin-top: 7px;
  font-size: 10.5px;
}

.account-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 36px;
  margin-top: 17px;
  border: 1px solid color-mix(in srgb, var(--danger) 24%, transparent);
  border-radius: 9px;
  color: var(--danger);
  font-size: 10px;
  transition: background 150ms ease;
}

.account-logout:hover {
  background: color-mix(in srgb, var(--danger) 7%, transparent);
}

.account-logout svg {
  width: 13px;
  height: 13px;
}

@media (max-width: 600px) {
  .shop-chip {
    width: 29px;
    height: 29px;
    justify-content: center;
    padding: 0;
  }

  .shop-chip span {
    display: none;
  }

  .shop-chip svg {
    width: 13px;
    height: 13px;
  }

  .auth-screen {
    padding: 14px 12px;
  }

  .auth-card {
    border-radius: 17px;
  }

  .private-badge {
    display: none;
  }

  .account-sheet {
    align-items: flex-end;
    padding: 0;
  }

  .account-card {
    width: 100%;
    max-height: 88dvh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
    padding: 22px 18px max(22px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 380px) {
  .account-chip {
    width: 29px;
    height: 29px;
    justify-content: center;
    padding: 0;
  }

  .account-chip span {
    display: none;
  }

  .account-chip svg {
    width: 13px;
    height: 13px;
  }
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 1120px) {
  .page {
    grid-template-columns: minmax(300px, 410px) minmax(370px, 410px);
    gap: 52px;
  }

  .intro h1 {
    font-size: clamp(46px, 4.8vw, 64px);
  }

  .intro-orbit {
    right: -240px;
    opacity: 0.6;
  }
}

@media (max-width: 1000px) {
  body {
    background: var(--surface);
  }

  .page {
    display: block;
    max-width: none;
    min-height: 100dvh;
    padding: 0;
  }

  .intro {
    display: none;
  }

  .chat-shell {
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .messages-inner {
    max-width: 560px;
  }

  .compose-zone,
  .chat-head,
  .privacy-strip {
    width: 100%;
  }

  .chat-head {
    padding-right: max(16px, env(safe-area-inset-right));
    padding-left: max(16px, env(safe-area-inset-left));
  }
}

@media (max-width: 600px) {
  .chat-head {
    min-height: 72px;
    padding: 11px 14px;
  }

  .agent-avatar {
    width: 43px;
    height: 43px;
    font-size: 19px;
  }

  .agent-name-row h2 {
    font-size: 18px;
  }

  .agent-status {
    font-size: 9.5px;
  }

  .private-badge {
    padding: 4px 7px;
    font-size: 7.5px;
  }

  .privacy-strip {
    min-height: 28px;
    padding: 4px 14px;
    font-size: 8px;
  }

  .messages {
    padding: 12px 12px 6px;
  }

  .system-line {
    margin-bottom: 13px;
  }

  .message-body {
    max-width: 84%;
  }

  .bubble {
    padding: 8px 11px;
    font-size: 13px;
    line-height: 1.72;
  }

  .quick-wrap {
    margin-top: 18px;
  }

  .compose-zone {
    padding-right: 9px;
    padding-left: 9px;
    padding-bottom: max(7px, env(safe-area-inset-bottom));
  }

  #message-input {
    font-size: 16px;
  }

  .compose-foot {
    padding-top: 4px;
    font-size: 7px;
  }

  .jump-btn {
    right: 12px;
    bottom: 118px;
  }
}

@media (max-width: 380px) {
  .one-on-one {
    display: none;
  }

  .private-badge {
    width: 27px;
    height: 27px;
    justify-content: center;
    padding: 0;
    font-size: 0;
  }

  .private-badge svg {
    width: 12px;
    height: 12px;
  }

  .privacy-copy {
    font-size: 0;
  }

  .privacy-copy svg {
    width: 11px;
    height: 11px;
  }

  .compose-foot .compose-safe {
    display: none;
  }
}

@media (max-height: 720px) and (min-width: 1001px) {
  .intro h1 {
    font-size: 52px;
  }

  .intro-lead {
    margin-top: 16px;
  }

  .feature-list {
    margin-top: 24px;
  }

  .feature {
    padding: 11px 2px;
  }

  .chat-shell {
    height: calc(100dvh - 32px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
