:root {
  --canvas: #fff9f3;
  --surface: #fffcf8;
  --surface-muted: #f8f3ef;
  --ink: #2f2b58;
  --muted: #716a78;
  --line: #ede3dc;
  --blue: #88a9d2;
  --blue-soft: #eaf3f8;
  --coral: #eca47e;
  --coral-soft: #fff0e5;
  --rose: #dfa2af;
  --rose-soft: #fcecef;
  --violet: #9c8ee8;
  --violet-soft: #f0ecff;
  --safe: #6f927c;
  --danger: #453b62;
  --shadow: 0 18px 48px rgba(66, 50, 82, 0.1);
  --serif: "Songti SC", "Noto Serif SC", STSong, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #f4eee8;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 8%, rgba(215, 228, 251, .64), transparent 27%),
    radial-gradient(circle at 88% 16%, rgba(255, 218, 213, .54), transparent 26%),
    linear-gradient(180deg, #fff9f3 0%, #f8f0ed 100%);
}

#app {
  position: relative;
  width: min(100%, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: rgba(255, 249, 243, .82);
  box-shadow: 0 0 80px rgba(51, 39, 64, .1);
}

.screen {
  min-height: 100dvh;
  padding: max(18px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  animation: screen-in 360ms cubic-bezier(.2, .8, .2, 1) both;
}

.select-screen {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.home-screen {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.home-hero {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding: 22px 0 12px;
}

.home-visual {
  position: relative;
  width: min(100%, 300px);
  height: 230px;
  margin: 0 auto 5px;
}

.home-orb {
  position: absolute;
  left: 50%;
  top: 29px;
  display: grid;
  place-items: center;
  width: 158px;
  height: 158px;
  transform: translateX(-50%);
  border-radius: 48% 52% 45% 55%;
  background: radial-gradient(circle at 34% 27%, #fff 0 8%, #e4dcff 31%, #bddded 67%, #ffd8cf 100%);
  box-shadow: inset -15px -18px 34px rgba(121,107,202,.16), 0 22px 45px rgba(103,89,166,.18);
  animation: orb 5.6s ease-in-out infinite;
}

.home-orb span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 10px rgba(255,255,255,.15), 0 0 30px rgba(255,255,255,.9);
}

.home-orbit {
  position: absolute;
  left: 50%;
  top: 13px;
  border: 1px solid rgba(156,142,232,.25);
  border-radius: 50%;
  transform: translateX(-50%) rotate(-12deg);
}

.orbit-one { width: 215px; height: 150px; }
.orbit-two { top: 39px; width: 265px; height: 110px; border-color: rgba(236,164,126,.2); transform: translateX(-50%) rotate(23deg); }

.home-spark { position: absolute; display: block; background: #9c8ee8; }
.spark-one { left: 32px; top: 62px; width: 11px; height: 11px; transform: rotate(45deg); animation: float-spark 3.6s ease-in-out infinite; }
.spark-two { right: 35px; top: 111px; width: 10px; height: 10px; border-radius: 50%; opacity: .55; animation: float-spark 3.6s .6s ease-in-out infinite; }

@keyframes float-spark { 50% { transform: translateY(-7px) rotate(8deg); opacity: .8; } }

.home-whisper {
  position: absolute;
  left: 50%;
  bottom: 3px;
  padding: 7px 12px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: #7669aa;
  font-family: var(--serif);
  font-size: 12px;
  transform: translateX(-50%);
  box-shadow: 0 9px 24px rgba(66,50,82,.07);
}

.home-hero .eyebrow { margin-top: 10px; }
.home-hero h1 { max-width: none; font-size: clamp(30px, 8.3vw, 36px); }
.home-hero .subtitle { max-width: 350px; margin-bottom: 0; }

.home-actions { display: grid; gap: 10px; padding-top: 12px; }

.home-primary, .home-secondary {
  min-height: 56px;
  border: 0;
  border-radius: 20px;
  cursor: pointer;
}

.home-primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 22px;
  background: linear-gradient(105deg, #7a64da, #4f91d8);
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  box-shadow: 0 15px 30px rgba(92,107,210,.25);
}

.home-primary span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  font-size: 20px;
}

.home-secondary {
  background: rgba(255,255,255,.7);
  color: var(--ink);
  font-size: 14px;
  box-shadow: 0 8px 22px rgba(66,50,82,.06);
}

.home-primary:active, .home-secondary:active { transform: scale(.985); }

.home-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 14px 0 3px;
  color: var(--muted);
  font-size: 11px;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .08em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 12px 12px 12px 4px;
  background: linear-gradient(140deg, #9c8ee8, #78a8db);
  color: white;
  box-shadow: 0 8px 18px rgba(122, 100, 218, .23);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 7px 22px rgba(66, 50, 82, .08);
  cursor: pointer;
}

.icon-button svg { width: 21px; height: 21px; }

.eyebrow {
  margin: 27px 0 8px;
  color: #8077a0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
}

h1 {
  margin: 0;
  max-width: 330px;
  font-family: var(--serif);
  font-size: clamp(29px, 8vw, 34px);
  line-height: 1.28;
  letter-spacing: -.02em;
}

.subtitle {
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.companion-card {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 27px;
  padding: 21px;
  text-align: left;
  background:
    radial-gradient(circle at 78% 20%, rgba(255,255,255,.94), transparent 28%),
    linear-gradient(135deg, #f1ecff, #e9f4fb 60%, #fff4ed);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.companion-card::after {
  content: "";
  position: absolute;
  right: -23px;
  top: -36px;
  width: 154px;
  height: 154px;
  border-radius: 46% 54% 57% 43%;
  background: rgba(255,255,255,.5);
  filter: blur(1px);
  animation: breathe 5.4s ease-in-out infinite;
}

@keyframes breathe {
  50% { transform: scale(1.08) rotate(7deg); opacity: .76; }
}

.card-kicker, .role-kicker {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: #716799;
  font-weight: 600;
}

.companion-card strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 8px;
  font-family: var(--serif);
  font-size: 22px;
}

.companion-card p {
  position: relative;
  z-index: 1;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.arrow {
  position: absolute;
  z-index: 2;
  right: 20px;
  bottom: 18px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  font-size: 19px;
}

.section-label {
  margin: 22px 2px 11px;
  color: var(--muted);
  font-size: 13px;
}

.role-list { display: grid; gap: 10px; }

.role-card {
  position: relative;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 36px;
  align-items: center;
  min-height: 108px;
  overflow: hidden;
  padding: 0 14px 0 0;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 23px;
  background: rgba(255,252,248,.86);
  box-shadow: 0 10px 28px rgba(66,50,82,.07);
  text-align: left;
  cursor: pointer;
}

.role-card:active, .companion-card:active { transform: scale(.985); }

.role-art {
  position: relative;
  align-self: stretch;
  width: 104px;
  overflow: hidden;
  background-color: var(--surface);
}

.role-art::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: contain;
}

.role-art.mama { background-color: #edf5fa; }
.role-art.mama::before {
  width: 94px;
  height: 136px;
  background-image: url('/assets/character-mama-cutout-v2.webp');
  transform: translateX(calc(-50% - 2px));
}
.role-art.yingjie { background-color: #f8eeeb; }
.role-art.yingjie::before {
  top: 2px;
  width: 121px;
  height: 142px;
  background-image: url('/assets/character-yingjie-cutout-v2.webp');
  transform: translateX(calc(-50% - 10px));
}
.role-art.duomi { background-color: #fceff2; }
.role-art.duomi::before {
  top: 4px;
  width: 98px;
  height: 132px;
  background-image: url('/assets/character-duomi-cutout-v2.webp');
  transform: translateX(calc(-50% - 1px));
}

.role-copy { padding: 14px 9px 14px 16px; }
.role-copy strong { display: block; margin-top: 4px; font-family: var(--serif); font-size: 17px; }
.role-copy p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.role-card.mama .role-kicker { color: #668caf; }
.role-card.yingjie .role-kicker { color: #975d5a; }
.role-card.duomi .role-kicker { color: #a86273; }
.role-card.neutral .role-kicker { color: #7669aa; }

.role-art.neutral {
  position: relative;
  background-image:
    radial-gradient(circle at 43% 38%, rgba(255,255,255,.98) 0 12%, transparent 13%),
    radial-gradient(circle at 50% 50%, #d7cbff 0 33%, #b8d9ed 58%, #f9d9d2 78%, transparent 79%);
  background-size: 28px 28px, 82px 82px;
  background-position: 50% 42%, 50% 50%;
  background-color: #f5f1ff;
  mix-blend-mode: normal;
}

.custom-entry {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 26px;
  align-items: center;
  width: 100%;
  min-height: 84px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px dashed rgba(117, 101, 176, .34);
  border-radius: 20px;
  background: rgba(244, 239, 255, .7);
  text-align: left;
  cursor: pointer;
}

.custom-entry-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: #fff;
  color: #7669aa;
  box-shadow: 0 8px 20px rgba(79, 66, 132, .08);
}
.custom-entry-icon svg { width: 21px; height: 21px; }
.custom-entry-copy { min-width: 0; padding: 0 10px; }
.custom-entry-copy strong { display: block; margin-top: 3px; font-family: var(--serif); font-size: 16px; }
.custom-entry-copy p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 15px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.64);
  color: var(--muted);
  font-size: 11px;
}

.mode-dot { width: 7px; height: 7px; border-radius: 50%; background: #8f82de; box-shadow: 0 0 0 4px rgba(143,130,222,.12); }
.mode-pill.is-live .mode-dot { background: #56a77b; box-shadow: 0 0 0 4px rgba(86,167,123,.14); }

.topbar-spacer { width: 42px; height: 42px; }

.customize-screen, .membership-screen {
  overflow-y: auto;
  padding-bottom: max(34px, env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.custom-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 238px;
  margin: 18px 0 20px;
  overflow: hidden;
  border-radius: 28px;
  box-shadow: 0 18px 42px rgba(66, 50, 82, .11);
  transition: background .25s ease;
}

.custom-bg-morning { background: linear-gradient(155deg, #fff7e8, #f5d9cf 54%, #e6e4fa); }
.custom-bg-garden { background: linear-gradient(155deg, #f7f2da, #d8eadb 54%, #d9e8f3); }
.custom-bg-night { background: linear-gradient(155deg, #e7e6f7, #c8c7e9 54%, #e7cfe1); }

.custom-preview::before,
.member-portrait::before,
.scene-art.custom .scene-backdrop::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 22%, rgba(255,255,255,.85) 0 5px, transparent 6px),
    radial-gradient(circle at 78% 30%, rgba(255,255,255,.62) 0 4px, transparent 5px),
    radial-gradient(circle at 48% 12%, rgba(255,255,255,.45), transparent 32%);
  pointer-events: none;
}

.custom-preview-orbit {
  position: absolute;
  top: 38px;
  left: 50%;
  width: 176px;
  height: 118px;
  border: 1px solid rgba(255,255,255,.74);
  border-radius: 50%;
  transform: translateX(-50%) rotate(-12deg);
}

.custom-avatar,
.custom-avatar-placeholder {
  display: block;
  overflow: hidden;
  border-radius: 50%;
  background: rgba(255,255,255,.8);
  object-fit: cover;
  box-shadow: 0 16px 34px rgba(63, 53, 92, .17);
}

.custom-avatar-placeholder { display: grid; place-items: center; }
.custom-avatar-placeholder span { font-family: var(--serif); color: #7164a9; }
.custom-avatar-large { position: relative; z-index: 1; width: 112px; height: 112px; border: 4px solid rgba(255,255,255,.82); }
.custom-avatar-large span { font-size: 34px; }
.custom-avatar-small { width: 58px; height: 58px; border: 2px solid rgba(255,255,255,.9); }
.custom-avatar-small span { font-size: 20px; }

.custom-preview-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  margin-top: -3px;
  text-align: center;
}
.custom-preview-copy strong { font-family: var(--serif); font-size: 20px; }
.custom-preview-copy span { color: #665e70; font-size: 12px; }

.custom-form { display: grid; gap: 16px; }
.custom-section {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 252, 248, .9);
  box-shadow: 0 10px 28px rgba(66, 50, 82, .065);
}
.custom-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.custom-section-heading strong { font-family: var(--serif); font-size: 17px; }
.custom-section-heading span { color: var(--muted); font-size: 10px; text-align: right; }
.field-label { display: block; margin: 13px 0 7px; color: #5f586a; font-size: 12px; }
.custom-input, .custom-textarea {
  width: 100%;
  border: 1px solid rgba(112, 96, 131, .14);
  border-radius: 14px;
  outline: 0;
  background: #faf7f4;
  color: var(--ink);
  font-size: 14px;
}
.custom-input { min-height: 48px; padding: 0 13px; }
.custom-textarea { min-height: 108px; padding: 12px 13px; line-height: 1.55; }
.custom-input:focus, .custom-textarea:focus { border-color: rgba(118,105,170,.55); box-shadow: 0 0 0 3px rgba(118,105,170,.1); }

.avatar-upload-row { display: flex; align-items: center; gap: 14px; }
.upload-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  background: #f2edf9;
  color: #665a94;
  font-size: 13px;
  cursor: pointer;
}
.upload-button svg { width: 18px; height: 18px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.background-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.background-option {
  min-width: 0;
  padding: 5px 5px 8px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: #faf7f4;
  font-size: 11px;
  cursor: pointer;
}
.background-option span { display: block; height: 48px; margin-bottom: 6px; border-radius: 10px; }
.background-option strong { font-weight: 500; }
.background-option[aria-pressed="true"] { border-color: #8f82ca; box-shadow: 0 0 0 2px rgba(143,130,202,.1); }
.background-morning span { background: linear-gradient(145deg, #fff4dd, #efcfd2); }
.background-garden span { background: linear-gradient(145deg, #f2edcb, #cfe5dc); }
.background-night span { background: linear-gradient(145deg, #d9d9f1, #d9c5df); }

.voice-preset-list { display: grid; gap: 8px; }
.voice-preset-option {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 68px;
  padding: 10px 11px;
  border: 1px solid rgba(112, 96, 131, .14);
  border-radius: 14px;
  background: #faf7f4;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}
.voice-preset-option:active { transform: scale(.985); }
.voice-preset-option.is-selected { border-color: var(--violet); background: var(--violet-soft); }
.voice-preset-option.is-loading { opacity: .62; cursor: wait; }
.voice-preset-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
}
.voice-preset-icon svg { width: 19px; height: 19px; }
.voice-preset-copy { min-width: 0; }
.voice-preset-copy strong { display: block; font-family: var(--serif); font-size: 14px; }
.voice-preset-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.voice-preset-option em { color: var(--ink); font-size: 12px; font-style: normal; white-space: nowrap; }

.voice-sample-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  margin-top: 12px;
  padding: 13px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--violet-soft);
}
.voice-sample-panel.is-selected { border-style: solid; border-color: var(--violet); background: var(--violet-soft); }
.voice-sample-copy strong { display: block; font-size: 14px; }
.voice-sample-copy p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.voice-upload-button {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
#voiceSampleState { grid-column: 1 / -1; }
.voice-sample-empty { display: block; color: var(--muted); font-size: 12px; }
.voice-sample-ready { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 9px; border-top: 1px solid rgba(112,96,131,.11); }
.voice-sample-ready > span { min-width: 0; }
.voice-sample-ready strong { display: block; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.voice-sample-ready small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.voice-sample-ready button { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 12px; cursor: pointer; }
.voice-sample-ready button svg { width: 16px; height: 16px; }
.voice-privacy-note { margin: 10px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.member-voice-summary { display: block; margin-top: 7px; color: var(--ink); font-size: 12px; font-style: normal; line-height: 1.4; }

.dialogue-reference-intro { margin: -3px 0 13px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.dialogue-upload-panel {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px dashed rgba(118,105,170,.28);
  border-radius: 14px;
  background: #faf7f4;
}
.dialogue-upload-panel.is-ready { border-style: solid; border-color: rgba(118,105,170,.42); background: var(--violet-soft); }
.dialogue-file-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: var(--surface); color: #7164a9; }
.dialogue-file-icon svg { width: 20px; height: 20px; }
.dialogue-upload-copy { min-width: 0; }
.dialogue-upload-copy strong { display: block; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.dialogue-upload-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.dialogue-upload-button { display: grid; place-items: center; min-height: 44px; padding: 0 11px; border-radius: 14px; background: var(--ink); color: white; font-size: 11px; font-weight: 600; cursor: pointer; }
.dialogue-reference-empty { display: block; margin-top: 9px; color: var(--muted); font-size: 11px; }
.dialogue-reference-ready { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 10px; padding: 11px 12px; border-radius: 14px; background: rgba(255,252,248,.86); }
.dialogue-reference-ready strong { font-size: 12px; }
.dialogue-reference-ready ul { display: grid; gap: 4px; margin: 7px 0 0; padding: 0; list-style: none; }
.dialogue-reference-ready li { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.dialogue-reference-ready button { align-self: start; min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: #776aa7; font-size: 11px; cursor: pointer; }
.dialogue-privacy-note { margin: 10px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.55; }

.voice-preset-option:focus-visible,
.voice-upload-button:focus-visible,
.voice-sample-ready button:focus-visible,
.dialogue-upload-button:focus-visible,
.dialogue-reference-ready button:focus-visible,
.custom-manage-actions button:focus-visible,
.confirm-dialog button:focus-visible { outline: 3px solid rgba(118,105,170,.18); outline-offset: 2px; }

.member-note {
  padding: 4px 2px 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}
.member-note span { display: inline-block; margin-bottom: 4px; color: #7669aa; font-weight: 600; }
.member-note p { margin: 0; }
.custom-submit, .member-primary, .member-secondary {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 17px;
  font-weight: 600;
  cursor: pointer;
}
.custom-submit { display: flex; align-items: center; justify-content: space-between; padding: 0 18px; background: var(--ink); color: #fff; }
.custom-manage-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 2px; }
.custom-manage-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.custom-manage-actions button:first-child { grid-column: 1 / -1; background: var(--surface-muted); }
.custom-manage-actions button.is-danger { color: #936170; }
.custom-manage-actions svg { width: 17px; height: 17px; }

.confirm-layer { position: fixed; z-index: 40; inset: 0; display: grid; align-items: end; width: min(100%, 430px); margin: 0 auto; padding: 20px 20px max(20px, env(safe-area-inset-bottom)); background: rgba(47,43,88,.24); backdrop-filter: blur(5px); }
.confirm-dialog { padding: 22px; border-radius: 20px; background: var(--surface); box-shadow: 0 22px 58px rgba(47,43,88,.22); }
.confirm-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--violet-soft); color: #7164a9; }
.confirm-icon svg { width: 20px; height: 20px; }
.confirm-dialog h2 { margin: 15px 0 7px; font-family: var(--serif); font-size: 21px; }
.confirm-dialog p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.confirm-dialog > div { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 19px; }
.confirm-dialog button { min-height: 50px; border: 0; border-radius: 14px; background: var(--surface-muted); color: var(--muted); font-weight: 600; cursor: pointer; }
.confirm-dialog .confirm-primary { background: var(--ink); color: white; }
.confirm-dialog .confirm-primary.is-danger { background: #6f4553; }

.member-portrait {
  position: relative;
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 16px;
  min-height: 132px;
  margin: 20px 0 26px;
  overflow: hidden;
  padding: 20px;
  border-radius: 24px;
}
.custom-avatar-member { position: relative; z-index: 1; width: 76px; height: 76px; border: 3px solid rgba(255,255,255,.85); }
.custom-avatar-member span { font-size: 25px; }
.member-portrait > div { position: relative; z-index: 1; }
.member-portrait div span { color: #6a6273; font-size: 10px; }
.member-portrait div strong { display: block; margin: 3px 0; font-family: var(--serif); font-size: 21px; }
.member-portrait div p { margin: 0; color: #6a6273; font-size: 12px; }

.member-benefits h1 { margin: 0; font-family: var(--serif); font-size: 27px; line-height: 1.3; letter-spacing: -.02em; }
.member-benefits > p { margin: 12px 0 18px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.member-benefits ul { margin: 0; padding: 0; list-style: none; }
.member-benefits li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; padding: 13px 0; border-top: 1px solid rgba(112,96,131,.1); }
.member-benefits li > span { color: #958ab5; font-family: var(--serif); font-size: 12px; }
.member-benefits li strong { font-size: 14px; }
.member-benefits li p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }

.plan-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
.plan-option {
  position: relative;
  min-height: 88px;
  padding: 12px;
  border: 1px solid rgba(112,96,131,.14);
  border-radius: 16px;
  background: rgba(255,252,248,.84);
  text-align: left;
  cursor: pointer;
}
.plan-option.is-selected { border-color: #776aa7; background: #f4f0ff; box-shadow: 0 0 0 2px rgba(119,106,167,.09); }
.plan-option > span { display: block; color: var(--muted); font-size: 11px; }
.plan-option strong { display: block; margin-top: 8px; font-family: var(--serif); font-size: 21px; }
.plan-option small { font-family: var(--sans); font-size: 10px; font-weight: 400; }
.plan-option em { position: absolute; right: 8px; top: 8px; color: #9b5f6d; font-size: 9px; font-style: normal; }
.demo-payment-note { margin: 10px 0 14px; color: #8b8490; font-size: 10px; text-align: center; }
.member-primary { background: var(--ink); color: white; }
.member-secondary { margin-top: 8px; background: transparent; color: #716a78; font-size: 12px; }

.chat-screen { display: flex; flex-direction: column; }
.chat-topbar { gap: 10px; }
.chat-title { min-width: 0; flex: 1; text-align: center; }
.chat-title strong { display: block; font-family: var(--serif); font-size: 17px; }
.chat-title span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }

.scene {
  position: relative;
  min-height: 350px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 30px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255,255,255,.98), transparent 40%),
    linear-gradient(160deg, var(--role-soft), #fffaf5 72%);
  box-shadow: var(--shadow);
}

.scene::before, .scene::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: .52;
}
.scene::before { width: 165px; height: 165px; top: -46px; right: -46px; background: white; }
.scene::after { width: 92px; height: 92px; left: -32px; bottom: 62px; background: var(--role-soft); }

.scene-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
}

.scene-art.neutral { display: none; }

.scene-backdrop {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-position: center;
  background-size: cover;
  opacity: .84;
}
.scene-art.mama .scene-backdrop { background-image: url('/assets/chat-bg-mama-v2.webp'); background-color: #eaf3f8; }
.scene-art.yingjie .scene-backdrop { background-image: url('/assets/chat-bg-yingjie-v2.webp'); background-color: #f7ece9; }
.scene-art.duomi .scene-backdrop { background-image: url('/assets/chat-bg-duomi-v2.webp'); background-color: #fcecef; }

.scene-art.custom .scene-backdrop { opacity: 1; }
.scene-art.custom.custom-bg-morning .scene-backdrop { background: linear-gradient(155deg, #fff7e8, #f5d9cf 54%, #e6e4fa); }
.scene-art.custom.custom-bg-garden .scene-backdrop { background: linear-gradient(155deg, #f7f2da, #d8eadb 54%, #d9e8f3); }
.scene-art.custom.custom-bg-night .scene-backdrop { background: linear-gradient(155deg, #e7e6f7, #c8c7e9 54%, #e7cfe1); }

.scene-art::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 35% 0 0;
  background: linear-gradient(180deg, transparent, rgba(255,250,246,.36) 58%, rgba(255,250,246,.72));
  pointer-events: none;
}

.character-cutout {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 38px;
  width: auto;
  height: 294px;
  max-height: none;
  object-fit: contain;
  object-position: center bottom;
  transform: translateX(-50%);
  filter: drop-shadow(0 18px 14px rgba(83,68,90,.14));
}
.scene-art.mama .character-cutout { left: calc(50% - 3px); }
.scene-art.yingjie .character-cutout { left: calc(50% - 21px); }
.scene-art.duomi .character-cutout { left: calc(50% - 1px); }
.custom-scene-avatar {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 52px;
  width: 180px;
  height: 180px;
  border: 6px solid rgba(255,255,255,.72);
  transform: translateX(-50%);
  box-shadow: 0 20px 44px rgba(63,53,92,.18);
}
.custom-scene-avatar span { font-size: 48px; }

.scene-accent {
  position: absolute;
  z-index: 0;
  display: block;
  border: 1.5px solid rgba(255,255,255,.7);
  border-radius: 999px;
  transform: rotate(-18deg);
  opacity: .85;
}
.accent-one { width: 30px; height: 12px; top: 52px; left: 28px; border-color: rgba(116,145,189,.32); }
.accent-two { width: 22px; height: 8px; top: 78px; right: 34px; border-color: rgba(193,125,139,.34); transform: rotate(24deg); }
.accent-three { width: 10px; height: 10px; top: 35px; right: 78px; border-color: rgba(227,169,111,.4); transform: rotate(45deg); }
.scene-art.duomi .accent-one { border-color: rgba(224,139,149,.42); }
.scene-art.duomi .accent-two { border-color: rgba(172,145,201,.4); }
.scene-art.yingjie .accent-one { border-color: rgba(84,117,171,.42); }

.neutral-orb {
  position: absolute;
  left: 50%;
  top: 62px;
  width: 170px;
  height: 170px;
  transform: translateX(-50%);
  border-radius: 46% 54% 48% 52%;
  background: radial-gradient(circle at 30% 25%, white, #e7dcff 43%, #aed7eb 78%, #ffcfc7);
  box-shadow: inset -14px -18px 40px rgba(121,107,202,.2), 0 25px 55px rgba(103,89,166,.18);
  animation: orb 5.6s ease-in-out infinite;
}
@keyframes orb { 50% { transform: translateX(-50%) translateY(-5px) scale(1.035) rotate(3deg); } }

.speech-card {
  position: absolute;
  z-index: 3;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 14px 45px 14px 16px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 20px;
  background: rgba(255,255,255,.84);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(66,50,82,.09);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
}

.typing-indicator {
  display: none;
  align-items: center;
  gap: 5px;
  min-height: 24px;
}

.speech-card.is-thinking .reply-text { display: none; }
.speech-card.is-thinking .typing-indicator { display: inline-flex; }

.typing-indicator i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  opacity: .35;
  animation: typing-dot 1.1s ease-in-out infinite;
}
.typing-indicator i:nth-child(2) { animation-delay: .14s; }
.typing-indicator i:nth-child(3) { animation-delay: .28s; }

@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .28; }
  30% { transform: translateY(-4px); opacity: .8; }
}

.play-reply {
  position: absolute;
  right: 9px;
  top: 50%;
  width: 34px;
  height: 34px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: var(--role-soft);
  cursor: pointer;
}

.heard {
  min-height: 38px;
  margin: 13px 6px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
.heard strong { color: var(--ink); font-weight: 600; }

.voice-panel {
  margin-top: auto;
  padding-top: 12px;
  text-align: center;
}

.record-state { height: 20px; color: var(--muted); font-size: 12px; }
.timer { font-variant-numeric: tabular-nums; color: #9d6b78; }

.mic-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(100%, 286px);
  min-height: 62px;
  margin-top: 8px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(105deg, #7a64da, #4f91d8);
  color: white;
  font-size: 17px;
  font-weight: 650;
  box-shadow: 0 15px 30px rgba(92,107,210,.3);
  cursor: pointer;
}

.mic-button.recording { background: linear-gradient(105deg, #c67d94, #7c70d6); }
.mic-button.recording::before {
  content: "";
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(159,112,190,.2);
  border-radius: inherit;
  animation: pulse 1.5s ease-out infinite;
}
@keyframes pulse { 75%,100% { transform: scale(1.06); opacity: 0; } }
.mic-button svg { width: 22px; height: 22px; }

.secondary-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.text-action, .switch-action {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  padding: 0 15px;
  background: rgba(255,255,255,.68);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.type-box {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 7px 7px 7px 15px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: white;
}
.type-box.open { display: flex; }
.type-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); }
.send-button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--ink); color: white; cursor: pointer; }

.help-link {
  display: inline-block;
  margin-top: 12px;
  color: #817a88;
  font-size: 11px;
  text-decoration: none;
}

.safety-sheet {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  width: min(100%, 430px);
  padding: 25px 22px max(25px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-radius: 28px 28px 0 0;
  background: #fffdf9;
  box-shadow: 0 -20px 70px rgba(48,38,64,.22);
}
.safety-sheet h2 { margin: 0; font-family: var(--serif); font-size: 22px; }
.safety-sheet p { color: var(--muted); line-height: 1.65; }
.safety-sheet button { width: 100%; min-height: 50px; margin-top: 8px; border: 0; border-radius: 16px; font-weight: 600; cursor: pointer; }
.safety-primary { background: var(--danger); color: white; }
.safety-secondary { background: var(--surface-muted); }

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(25px + env(safe-area-inset-bottom));
  max-width: 330px;
  padding: 11px 16px;
  transform: translate(-50%, 24px);
  border-radius: 14px;
  background: rgba(47,43,88,.92);
  color: white;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: .24s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

button:focus-visible, input:focus-visible { outline: 3px solid rgba(79,145,216,.38); outline-offset: 2px; }

@media (max-height: 760px) {
  .screen { padding-top: max(10px, env(safe-area-inset-top)); }
  .eyebrow { margin-top: 14px; }
  .subtitle { margin-bottom: 13px; }
  .role-card { grid-template-columns: 94px minmax(0, 1fr) 36px; min-height: 92px; }
  .role-art { width: 94px; }
  .role-art.mama::before { width: 84px; height: 122px; }
  .role-art.yingjie::before { width: 108px; height: 127px; transform: translateX(calc(-50% - 9px)); }
  .role-art.duomi::before { width: 88px; height: 118px; }
  .scene { min-height: 310px; }
  .character-cutout { width: auto; height: 264px; max-height: none; bottom: 32px; }
  .scene-art.mama .character-cutout { left: calc(50% - 3px); }
  .scene-art.yingjie .character-cutout { left: calc(50% - 19px); }
  .scene-art.duomi .character-cutout { left: calc(50% - 1px); }
}

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