:root {
  --bg: #f3f1ee;
  --mist: #e9eeeb;
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.76);
  --ink: #2b3032;
  --muted: #6e7778;
  --soft: #9aa3a1;
  --sage: #aab7af;
  --sage-deep: #6f8278;
  --lavender: #d8d4df;
  --mauve: #b28d96;
  --cream: #fbf8f2;
  --line: rgba(86, 96, 98, 0.14);
  --shadow: 0 28px 80px rgba(71, 82, 82, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(135deg, #f7f5f1 0%, #e8eeeb 44%, #f1edf2 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
textarea,
select {
  font: inherit;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 150ms ease, background 180ms ease, border-color 180ms ease;
}

button:active {
  transform: scale(0.98);
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(111, 130, 120, 0.75);
  outline-offset: 3px;
}

i[data-lucide] {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

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

.phone-shell {
  position: relative;
  width: min(430px, 100vw);
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.54), transparent 38%),
    var(--mist);
  box-shadow: var(--shadow);
}

.splash-screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  opacity: 1;
  visibility: visible;
  background:
    radial-gradient(circle at 20% 12%, rgba(216, 212, 223, 0.55), transparent 42%),
    radial-gradient(circle at 82% 18%, rgba(170, 183, 175, 0.42), transparent 38%),
    linear-gradient(165deg, #f7f5f1 0%, #e8eeeb 48%, #f1edf2 100%);
  transition: opacity 360ms ease, visibility 360ms ease;
}

.splash-screen.is-leaving,
body:not(.splash-open) .splash-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-inner {
  display: grid;
  gap: 18px;
  width: min(100%, 360px);
  text-align: center;
  animation: splashContentIn 420ms ease forwards;
}

.splash-screen.is-leaving .splash-inner {
  animation: splashContentOut 260ms ease forwards;
}

.splash-mark {
  display: grid;
  width: 72px;
  height: 72px;
  margin: 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--sage-deep);
  box-shadow: 0 18px 40px rgba(71, 82, 82, 0.12);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.splash-eyebrow {
  margin: 0;
  color: var(--soft);
  font-size: 11px;
  letter-spacing: 0.22em;
}

.splash-title {
  margin: 4px 0 0;
  font-size: clamp(28px, 7vw, 34px);
}

.splash-lead,
.splash-hint {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.splash-lead {
  font-size: 15px;
}

.splash-hint {
  color: var(--soft);
  font-size: 12px;
}

.splash-quote {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--ink);
  font-size: 14px;
  font-style: italic;
  line-height: 1.7;
}

.splash-quote span {
  display: block;
  margin-bottom: 4px;
  color: var(--sage-deep);
  font-size: 11px;
  font-style: normal;
  font-weight: 760;
}

.splash-enter {
  width: 100%;
  min-height: 52px;
  border-radius: 999px;
  background: linear-gradient(135deg, #8ba99a, #6f8278);
  color: white;
  font-weight: 650;
  box-shadow: 0 16px 32px rgba(111, 130, 120, 0.28);
}

body.splash-open {
  overflow: hidden;
}

.chat-app.app-behind-splash {
  visibility: hidden;
}

body:not(.splash-open) .chat-app.app-behind-splash {
  visibility: visible;
}

.chat-app {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  height: 100dvh;
  overflow: hidden;
  padding: max(12px, env(safe-area-inset-top)) 14px 86px;
}

@keyframes splashContentIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes splashContentOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.99);
  }
}

.app-topbar,
.conversation-head,
.drawer-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-topbar {
  margin-bottom: 14px;
}

.search-box {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  margin-bottom: 12px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 23px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--soft);
  box-shadow: 0 10px 24px rgba(71, 82, 82, 0.08);
  backdrop-filter: blur(22px) saturate(1.18);
  -webkit-backdrop-filter: blur(22px) saturate(1.18);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
}

.search-box input::placeholder {
  color: var(--soft);
}

.app-topbar p,
.drawer-panel header p {
  margin: 0 0 4px;
  color: var(--sage-deep);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.04em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.05;
  font-weight: 760;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  font-weight: 740;
}

.icon-button {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 50%;
  background: var(--glass);
  color: var(--sage-deep);
  box-shadow: 0 12px 28px rgba(71, 82, 82, 0.1);
  backdrop-filter: blur(22px) saturate(1.25);
  -webkit-backdrop-filter: blur(22px) saturate(1.25);
}

.icon-button.soft {
  background: rgba(255, 255, 255, 0.38);
  box-shadow: none;
}

.contacts-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 76px;
  gap: 10px;
  overflow-x: auto;
  padding: 3px 1px 12px;
}

.contacts-strip::-webkit-scrollbar,
.messages::-webkit-scrollbar {
  display: none;
}

.contact {
  position: relative;
  flex-direction: column;
  min-height: 94px;
  padding: 8px 6px;
  border: 1px solid transparent;
  border-radius: 22px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.online-dot {
  position: absolute;
  top: 12px;
  right: 17px;
  z-index: 2;
  width: 11px;
  height: 11px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: #8ba99a;
  box-shadow: 0 0 0 4px rgba(139, 169, 154, 0.12);
}

.unread-badge {
  position: absolute;
  top: 8px;
  right: 12px;
  z-index: 3;
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  padding: 0 6px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: var(--mauve);
  color: white;
  font-size: 11px;
  font-weight: 760;
}

.unread-dot {
  position: absolute;
  top: 16px;
  right: 17px;
  z-index: 3;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: var(--mauve);
  box-shadow: 0 0 0 4px rgba(178, 141, 150, 0.12);
}

.online-dot.muted {
  background: #c8bfc2;
  box-shadow: none;
}

.contact img {
  width: 56px;
  height: 56px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 10px 20px rgba(71, 82, 82, 0.14);
}

.contact.active {
  border-color: rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.48);
  color: var(--ink);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.conversation-card {
  min-height: 0;
  overflow: hidden;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.43)),
    rgba(255, 255, 255, 0.5);
  box-shadow: 0 22px 48px rgba(71, 82, 82, 0.14);
  backdrop-filter: blur(26px) saturate(1.18);
  -webkit-backdrop-filter: blur(26px) saturate(1.18);
}

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

.identity img {
  width: 48px;
  height: 48px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  object-fit: cover;
}

.identity p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.memory-note {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  margin: 14px 0;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 18px;
  background: rgba(250, 248, 242, 0.52);
  color: var(--sage-deep);
}

.memory-note p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.scene-pills {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin: -2px 0 14px;
}

.scene-pills span {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--sage-deep);
  font-size: 12px;
}

.inline-pill {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--sage-deep);
  font-size: 12px;
}

.messages {
  display: grid;
  max-height: none;
  min-height: 0;
  gap: 10px;
  overflow-y: auto;
  padding: 2px 1px 12px;
}

.date-divider {
  justify-self: center;
  margin: 1px 0 4px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--soft);
  font-size: 11px;
}

.bubble {
  max-width: 86%;
  padding: 12px 13px;
  line-height: 1.65;
  font-size: 15px;
}

.bubble p {
  margin: 0;
}

.bubble.ai {
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 19px 19px 19px 7px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 9px 20px rgba(71, 82, 82, 0.08);
}

.bubble.user {
  justify-self: end;
  border: 1px solid rgba(178, 141, 150, 0.2);
  border-radius: 19px 19px 7px 19px;
  background: rgba(251, 248, 242, 0.82);
}

.composer {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: 44px 1fr 48px;
  gap: 8px;
  width: min(430px, 100vw);
  padding: 10px 14px max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background:
    linear-gradient(180deg, transparent, rgba(243, 241, 238, 0.95) 24%);
}

textarea {
  width: 100%;
  min-height: 48px;
  max-height: 116px;
  resize: none;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  outline: 0;
  padding: 13px 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 10px 22px rgba(71, 82, 82, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

textarea::placeholder {
  color: var(--soft);
}

.send-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--sage-deep);
  color: white;
  box-shadow: 0 12px 24px rgba(111, 130, 120, 0.24);
}

.composer.is-sending .send-button {
  background: var(--sage);
  box-shadow: none;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 54px;
}

.typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--soft);
  animation: typingPulse 900ms infinite ease-in-out;
}

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

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

.quick-panel {
  position: fixed;
  left: 50%;
  bottom: 78px;
  z-index: 8;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: min(402px, calc(100vw - 28px));
  padding: 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  background: rgba(250, 249, 246, 0.72);
  box-shadow: 0 18px 42px rgba(71, 82, 82, 0.14);
  backdrop-filter: blur(26px) saturate(1.2);
  -webkit-backdrop-filter: blur(26px) saturate(1.2);
}

.quick-panel.open {
  display: grid;
}

.quick-panel button {
  flex-direction: column;
  min-height: 66px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.44);
  color: var(--sage-deep);
  font-size: 12px;
}

.settings-drawer {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(90, 96, 96, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.settings-drawer.open {
  display: flex;
}

.drawer-panel {
  width: min(430px, 100vw);
  padding: 18px 16px 28px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 30px 30px 0 0;
  background: rgba(250, 249, 246, 0.78);
  box-shadow: 0 -24px 60px rgba(71, 82, 82, 0.16);
  backdrop-filter: blur(28px) saturate(1.2);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
}

.drawer-panel header {
  margin-bottom: 14px;
}

.menu-row {
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  margin-top: 8px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--ink);
}

.menu-row span {
  margin-right: auto;
}

.menu-row em {
  color: var(--soft);
  font-size: 12px;
  font-style: normal;
}

.settings-detail {
  display: grid;
  gap: 10px;
}

.creator-mini,
.token-card,
.notice-card,
.detail-row,
.package-row {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.54);
  box-shadow: 0 10px 24px rgba(71, 82, 82, 0.08);
}

.creator-mini {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  padding: 13px;
}

.creator-dot {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: rgba(170, 183, 175, 0.3);
  color: var(--sage-deep);
  font-weight: 780;
}

.creator-mini strong,
.package-row strong {
  color: var(--ink);
}

.creator-mini p,
.token-card span,
.notice-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.detail-row,
.package-row {
  justify-content: space-between;
  min-height: 52px;
  padding: 0 14px;
}

.detail-row span,
.package-row span {
  margin-right: auto;
}

.detail-row em {
  color: var(--soft);
  font-style: normal;
}

.detail-row.danger {
  color: #9b6670;
}

.token-card,
.notice-card {
  padding: 13px;
}

.token-card p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.token-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 30px;
}

.package-row.featured {
  background: rgba(170, 183, 175, 0.22);
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.toggle-grid button {
  min-height: 86px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--muted);
}

.toggle-grid button.selected {
  border-color: rgba(111, 130, 120, 0.26);
  background: rgba(170, 183, 175, 0.24);
  color: var(--sage-deep);
}

.field-label {
  display: block;
  margin: 4px 2px -3px;
  color: var(--sage-deep);
  font-size: 13px;
  font-weight: 720;
}

.glass-select,
.lore-textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(71, 82, 82, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.glass-select {
  min-height: 48px;
  padding: 0 13px;
}

.lore-textarea {
  min-height: 104px;
  max-height: 180px;
  padding: 13px;
  resize: vertical;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.54);
}

.switch-row span {
  display: grid;
  gap: 4px;
}

.switch-row strong {
  color: var(--ink);
}

.switch-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.switch-row input {
  width: 46px;
  height: 28px;
  flex: 0 0 auto;
  accent-color: var(--sage-deep);
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    opacity: 0.34;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (min-width: 760px) {
  body {
    padding: 0;
  }

  .phone-shell {
    height: 100dvh;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 0;
    overflow: hidden;
  }

  .chat-app {
    height: 100dvh;
  }

  .composer {
    border-radius: 0 0 34px 34px;
  }
}

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