/* 东东说 · lyd.chat — tokens first; brand rationale in brand/brand-standard.md */
:root {
  --coral: #ef5f3c;          /* 凤凰花：厦门市树凤凰木的花色，唯一强调色 */
  --coral-press: #d94d2b;
  --coral-tint: #fde8e1;
  --sea: #1a8fa3;            /* 鹭岛海色，耳机与在线点 */
  --ink: #17324a;            /* 深海蓝：正文、用户气泡 */
  --ink-2: #4b6275;
  --ink-3: #627487;
  --canvas: #f6f9fb;
  --surface: #ffffff;
  --bubble: #f1f5f8;
  --line: rgba(23, 50, 74, .09);
  --line-2: rgba(23, 50, 74, .14);
  --r-card: 28px;
  --r-bubble: 20px;
  --r-pill: 999px;
  --shadow-card: 0 1px 1px rgba(23,50,74,.04), 0 8px 24px -6px rgba(23,50,74,.12), 0 32px 64px -24px rgba(23,50,74,.22);
  --shadow-chip: 0 1px 1px rgba(23,50,74,.05), 0 6px 14px -6px rgba(23,50,74,.18);
  --ease: cubic-bezier(.2,.8,.2,1);
  --spring: cubic-bezier(.22,1,.36,1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, "Noto Sans SC", "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
  --chat-w: min(468px, 40vw);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--sea); outline-offset: 2px; border-radius: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { position: relative; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------- scene ---------- */
.scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
@media (prefers-reduced-motion: no-preference) {
  .cloud { animation: drift 60s linear infinite alternate; }
  .c2 { animation-duration: 80s; }
  .c3 { animation-duration: 46s; }
  .egrets { animation: fly 38s linear infinite; }
  .egret { transform-box: fill-box; transform-origin: center; animation: flap 1.6s ease-in-out infinite; }
  .e2 { animation-delay: -.5s; } .e3 { animation-delay: -1s; }
  .waves path { animation: swell 7s ease-in-out infinite alternate; }
  .waves .w2 { animation-delay: -2s; } .waves .w3 { animation-delay: -4s; }
  .glints rect { transform-box: fill-box; transform-origin: center; animation: glint 4.5s ease-in-out infinite; }
  .glints rect:nth-child(2) { animation-delay: -1s; } .glints rect:nth-child(3) { animation-delay: -2s; }
  .glints rect:nth-child(4) { animation-delay: -3s; } .glints rect:nth-child(5) { animation-delay: -1.6s; }
  .foam { animation: foam 6s ease-in-out infinite alternate; }
  .bloom { transform-box: view-box; transform-origin: 910px 0; animation: sway 9s ease-in-out infinite alternate; }
}
@keyframes drift { to { transform: translateX(60px); } }
@keyframes fly { from { transform: translate(-260px, 40px); } to { transform: translate(520px, -60px); } }
@keyframes flap { 50% { transform: scaleY(.55); } }
@keyframes swell { to { transform: translateX(-24px); opacity: .2; } }
@keyframes glint { 50% { transform: scaleX(.6); opacity: .25; } }
@keyframes foam { to { transform: translateY(5px); opacity: .45; } }
@keyframes sway { from { transform: translate(720px, 0) rotate(-1deg); } to { transform: translate(720px, 0) rotate(1.4deg); } }

/* ---------- stage (left) ---------- */
.stage { position: absolute; inset: 0 calc(var(--chat-w) + 56px) 0 0; }

.brand {
  position: absolute; top: 28px; left: 40px; z-index: 2;
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
}
.brand-mark { width: 34px; height: 34px; display: block; filter: drop-shadow(0 4px 10px rgba(239,95,60,.28)); transition: transform .4s var(--spring); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.brand-name { font-size: 19px; font-weight: 600; letter-spacing: .02em; }
.brand-domain { font-size: 13px; color: var(--ink-2); letter-spacing: .04em; padding-left: 10px; border-left: 1px solid var(--line-2); }

.intro { position: absolute; z-index: 2; left: 64px; top: 50%; transform: translateY(-62%); max-width: 430px; }
.eyebrow {
  margin: 0 0 18px; display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; letter-spacing: .18em; color: var(--ink-2);
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sea); box-shadow: 0 0 0 3px rgba(26,143,163,.18); flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .live-dot { animation: pulse 2.4s ease-in-out infinite; }
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(26,143,163,0); } }

h1 {
  margin: 0; font-weight: 600; letter-spacing: -.02em; line-height: 1.12;
  font-size: clamp(38px, 4.4vw, 62px);
}
h1 span { display: block; }
h1 .soft { color: var(--ink-2); font-weight: 500; }
.lede { margin: 18px 0 0; font-size: 17px; line-height: 1.75; color: var(--ink-2); letter-spacing: .02em; }

.tags { list-style: none; margin: 26px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.tags li:nth-child(1) { transform: rotate(-2.5deg); }
.tags li:nth-child(2) { transform: rotate(1.8deg) translateY(3px); }
.tags li:nth-child(3) { transform: rotate(-1.2deg); }
.tags li:nth-child(4) { transform: rotate(2.4deg) translateY(2px); }
.tags button {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px; padding: 8px 16px 8px 12px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.88); border: 1px solid var(--line);
  box-shadow: var(--shadow-chip); font-size: 15px; font-weight: 500;
  transition: transform .35s var(--spring), box-shadow .3s var(--ease), background .3s var(--ease);
}
.tags svg { width: 18px; height: 18px; fill: var(--coral); }
.tags button:hover { transform: translateY(-3px) scale(1.04); background: #fff; box-shadow: 0 2px 2px rgba(23,50,74,.05), 0 14px 26px -10px rgba(23,50,74,.28); }
.tags button:active { transform: translateY(0) scale(.97); }

.mascot {
  position: absolute; z-index: 1; margin: 0;
  left: max(470px, 48%); bottom: 2.5vh; width: min(44vh, 420px); height: min(58vh, 560px);
}
.mascot canvas, .mascot-static { width: 100%; height: 100%; display: block; }
.mascot-static { object-fit: contain; object-position: bottom; }
.mascot.is-3d .mascot-static { display: none; }

/* ---------- chat card (right) ---------- */
.chat {
  position: absolute; z-index: 3; top: 24px; right: 28px; bottom: 24px; width: var(--chat-w);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  border: 1px solid rgba(255,255,255,.7);
  overflow: hidden;
}
.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px 18px;
  border-bottom: 1px solid var(--line);
}
.chat-avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #fff 0, var(--coral-tint) 70%);
}
.chat-avatar img, .chat-avatar canvas { width: 44px; height: 44px; border-radius: 50%; display: block; }
.chat-who { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.chat-who strong { font-size: 16px; font-weight: 600; letter-spacing: .01em; }
.chat-status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-3); }
.chat-status .live-dot { width: 7px; height: 7px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--ink-3);
  display: grid; place-items: center; transition: background .25s var(--ease), color .25s var(--ease), transform .4s var(--spring);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--bubble); color: var(--ink); }
.icon-btn:active { transform: rotate(-40deg); }

.log {
  flex: 1; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth;
  padding: 20px 18px 8px; display: flex; flex-direction: column; gap: 6px;
}
.day { align-self: center; font-size: 12px; color: var(--ink-3); letter-spacing: .12em; margin: 2px 0 10px; }
.msg {
  max-width: 84%; padding: 11px 15px; border-radius: var(--r-bubble);
  font-size: 15.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.bot { align-self: flex-start; background: var(--bubble); border-top-left-radius: 7px; }
.msg.me { align-self: flex-end; background: var(--ink); color: #fff; border-top-right-radius: 7px; }
.msg.me + .msg.bot, .msg.bot + .msg.me { margin-top: 10px; }
.msg.err { background: var(--coral-tint); color: #8a2f1a; }
@media (prefers-reduced-motion: no-preference) {
  .msg.enter { animation: rise .45s var(--ease) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.msg.typing { display: inline-flex; gap: 5px; align-items: center; padding: 15px 16px; }
.msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); opacity: .5; }
@media (prefers-reduced-motion: no-preference) {
  .msg.typing i { animation: dots 1.1s ease-in-out infinite; }
  .msg.typing i:nth-child(2) { animation-delay: .15s; } .msg.typing i:nth-child(3) { animation-delay: .3s; }
}
@keyframes dots { 30% { transform: translateY(-4px); opacity: 1; } 60% { transform: none; opacity: .5; } }
.caret::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--coral); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.chips {
  display: flex; gap: 8px; padding: 8px 18px 4px; overflow-x: auto; scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 88%, transparent);
}
.chips::-webkit-scrollbar { display: none; }
.chips[hidden] { display: none; }
.chips button {
  flex: none; min-height: 36px; padding: 7px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: var(--surface); font-size: 14px; color: var(--ink-2);
  transition: border-color .25s var(--ease), color .25s var(--ease), background .25s var(--ease), transform .35s var(--spring);
}
.chips button:hover { border-color: var(--coral); color: var(--coral-press); background: #fff8f5; transform: translateY(-2px); }

.composer {
  margin: 8px 14px 6px; display: flex; align-items: flex-end; gap: 8px;
  padding: 6px 6px 6px 16px; border-radius: 24px; background: var(--bubble);
  border: 1px solid transparent; transition: border-color .25s var(--ease), background .25s var(--ease), box-shadow .25s var(--ease);
}
.composer:focus-within { background: #fff; border-color: rgba(26,143,163,.45); box-shadow: 0 0 0 4px rgba(26,143,163,.12); }
.composer textarea {
  flex: 1; border: 0; outline: 0; background: transparent; resize: none;
  font-size: 16px; line-height: 1.5; padding: 8px 0; max-height: 132px; min-height: 40px;
}
.composer textarea::placeholder { color: var(--ink-3); }
.send {
  width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0;
  background: var(--coral); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 14px -6px rgba(239,95,60,.7);
  transition: transform .35s var(--spring), background .2s var(--ease), opacity .2s var(--ease);
}
.send svg { width: 20px; height: 20px; }
.send:hover { transform: translateY(-2px) scale(1.05); background: var(--coral-press); }
.send:active { transform: scale(.92); }
.send:disabled { opacity: .45; cursor: default; transform: none; box-shadow: none; }
.fine { margin: 0 0 12px; padding: 0 18px; font-size: 11.5px; color: var(--ink-3); text-align: center; letter-spacing: .02em; }

/* ---------- mid widths ---------- */
@media (max-width: 1180px) {
  .intro { top: 104px; transform: none; left: 40px; max-width: 360px; }
  h1 { font-size: clamp(32px, 3.6vw, 44px); }
  .lede { font-size: 15.5px; }
  .mascot { left: auto; right: 0; width: min(36vh, 320px); height: min(48vh, 440px); }
}

/* ---------- phones and small tablets: scene band on top, chat sheet below ---------- */
@media (max-width: 860px) {
  :root { --chat-w: 100%; }
  .app { display: flex; flex-direction: column; }
  .scene { height: 252px; }
  .stage { position: relative; inset: auto; height: 252px; flex: none; }
  .brand { top: 16px; left: 16px; gap: 8px; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-name { font-size: 16px; }
  .brand-domain { font-size: 12px; padding-left: 8px; }
  .intro { top: 62px; left: 18px; max-width: 58%; }
  .eyebrow { margin-bottom: 8px; font-size: 11.5px; letter-spacing: .14em; }
  h1 { font-size: 27px; line-height: 1.18; }
  .lede { margin-top: 8px; font-size: 13.5px; line-height: 1.6; color: var(--ink); text-shadow: 0 1px 8px rgba(255,255,255,.55); }
  .tags { display: none; }
  .mascot { right: 4px; left: auto; bottom: 14px; width: 168px; height: 196px; }
  .chat {
    position: relative; inset: auto; width: auto; flex: 1; min-height: 0;
    margin-top: -22px; border-radius: 24px 24px 0 0; border: 0;
    box-shadow: 0 -10px 30px -12px rgba(23,50,74,.25);
  }
  .chat-head { padding: 12px 12px 10px 14px; }
  .log { padding: 16px 14px 6px; }
  .msg { max-width: 88%; font-size: 15.5px; }
  .chips { padding: 6px 14px 2px; }
  .composer { margin: 6px 10px 4px; }
  .fine { margin-bottom: max(8px, env(safe-area-inset-bottom)); font-size: 11px; }
}
@media (max-width: 860px) and (max-height: 640px) {
  .scene, .stage { height: 200px; }
  .lede { display: none; }
  .mascot { width: 138px; height: 160px; }
}
