:root {
  color-scheme: dark;
  --background: #120f13;
  --text: #f8f0e8;
  --muted: #c7b9bd;
  --pink: #ff9eb7;
  --lime: #e5f792;
  --line: #705d6e70;
  --plum: #292029;
  --gutter-left: max(18px, env(safe-area-inset-left, 0px));
  --gutter-right: max(18px, env(safe-area-inset-right, 0px));
  --body: "Geist", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-block: 24px; }

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font: 400 16px/1.65 var(--body);
}

button, input, textarea, select { color: inherit; font: inherit; }
button, summary { cursor: pointer; }
button { touch-action: manipulation; }
button:disabled { cursor: default; opacity: .55; }
img { display: block; max-width: 100%; }
a { color: var(--pink); text-underline-offset: 4px; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
::selection { background: var(--pink); color: var(--background); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.shell { width: min(100%, 1440px); margin-inline: auto; }
.topbar {
  display: flex;
  min-height: calc(60px + env(safe-area-inset-top, 0px));
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: env(safe-area-inset-top, 0px) var(--gutter-right) 0 var(--gutter-left);
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-word { font: 850 1.55rem/.9 "Geist", Arial, sans-serif; letter-spacing: -.07em; }
.brand-word span { color: var(--lime); }
.brand-label { color: var(--muted); font-size: .78rem; white-space: nowrap; }

.voice-toggle, .text-button {
  min-height: 44px;
  padding: 7px 12px;
  border: 0;
  border-radius: 99px;
  color: var(--muted);
  background: transparent;
  font-size: .83rem;
}

.voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline: 14px;
  border: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
}

.voice-toggle::before {
  content: "";
  width: 13px;
  height: 16px;
  background: linear-gradient(0deg, #ff9eb7, #ffe0dc) 0 55% / 2px 7px,
    linear-gradient(0deg, #ff9eb7, #ffe0dc) 50% 55% / 2px 14px,
    linear-gradient(0deg, #ff9eb7, #ffe0dc) 100% 55% / 2px 9px;
  background-repeat: no-repeat;
}

.voice-toggle[aria-pressed="true"], .voice-toggle:hover { background: var(--plum); }
.voice-compare {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.voice-compare-label {
  margin-inline-end: 3px;
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
}

.voice-sample {
  display: inline-grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 24px 25px 27px 19px;
  color: var(--text);
  background: #24202a;
  font-size: .85rem;
  font-weight: 710;
}

.voice-sample:hover { border-color: var(--pink); }
.voice-sample[aria-pressed="true"] {
  color: #2f2028;
  border-color: var(--pink);
  background: var(--pink);
}
.voice-compare-status:empty { display: none; }
.text-button:hover, .service-menu summary:hover { color: var(--text); }
.text-button { text-decoration: underline; text-decoration-color: #c7b9bd65; text-underline-offset: 4px; }

.workshop { display: grid; position: relative; isolation: isolate; }
.hero-art {
  position: relative;
  isolation: isolate;
  height: clamp(150px, 49vw, 294px);
  overflow: hidden;
  pointer-events: none;
}

.bench-light, .bench-image, .hero-art::after { position: absolute; inset: 0; }
.bench-light {
  background:
    radial-gradient(ellipse at 76% 31%, #412031, transparent 58%),
    radial-gradient(ellipse at 40% 103%, #66412b, transparent 56%),
    var(--background);
}

.bench-image { width: 100%; height: 100%; object-fit: cover; object-position: center 85%; }
.hero-art::after {
  z-index: 1;
  content: "";
  background:
    linear-gradient(0deg, var(--background) 2%, #120f1300 35%),
    linear-gradient(90deg, #120f1344, #120f1300 75%),
    linear-gradient(180deg, var(--background), #120f1300 24%);
}

.capri {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 2%;
  width: 76%;
  height: 96%;
  object-fit: contain;
  object-position: right bottom;
  filter: drop-shadow(0 8px 20px #f83c8664);
  transform-origin: 68% 77%;
  animation: arrive .55s ease-out both;
}

.capri-default { width: 83%; height: 132%; bottom: -36%; }
.capri-fallback {
  position: absolute;
  z-index: 2;
  inset: 8% 2% 10% auto;
  width: 38%;
  background: radial-gradient(ellipse at 61% 54%, #cf4a8b46, transparent 61%);
}

.workshop:has(.has-talk) .capri { animation: none; }
.hero-art.pulse .capri { animation: respond .52s ease-out both; }
.hero-art.talking .capri { animation: talking 1.6s ease-in-out infinite alternate; }

@keyframes arrive {
  from { opacity: 0; transform: translateX(9%) rotate(2deg); }
  to { opacity: 1; transform: none; }
}

@keyframes respond {
  0%, 100% { transform: none; }
  44% { transform: translate(-6px, -4px) rotate(-1.6deg); }
}

@keyframes talking {
  from { transform: translateY(1px); }
  to { transform: translateY(-6px) rotate(-1deg); }
}

.conversation {
  position: relative;
  min-width: 0;
  padding: 0 var(--gutter-right) 28px var(--gutter-left);
  overflow-wrap: anywhere;
}

.welcome { margin: -8px 0 15px; }
.welcome-speaker, .speaker {
  margin: 0 0 8px;
  color: var(--pink);
  font-size: .78rem;
  font-weight: 720;
  letter-spacing: .06em;
}

.welcome-speaker { display: flex; align-items: center; gap: 9px; }
.welcome-speaker::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 14px #ff6c9d85;
  content: "";
}

h1 {
  margin: 0;
  font-size: clamp(2.125rem, 9.6vw, 5.3rem);
  font-weight: 820;
  line-height: 1.04;
  letter-spacing: -.045em;
}

h1 span { color: #ffd5db; }
.intro { margin: 8px 0 0; color: var(--muted); font-size: clamp(.95rem, 1.4vw, 1.08rem); }
.subtitle { margin: 0 0 18px; padding: 8px 12px; border-inline-start: 2px solid var(--pink); color: var(--muted); }

.messages { display: grid; gap: 19px; }
.messages:empty { display: none; }
.chat-turn { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.chat-turn.user { align-items: flex-end; }
.chat-turn.user .speaker { color: var(--lime); }
.chat-turn p { margin-block: 0; }
.chat-turn .speaker { margin-bottom: 4px; }

.bubble {
  max-width: 94%;
  padding: 11px 16px;
  border-radius: 5px 19px 19px 19px;
  background: #302432f2;
  box-shadow: 0 3px 14px #100a1226;
  white-space: pre-wrap;
}

.user .bubble { border-radius: 19px 5px 19px 19px; background: #313620; color: #f3f7df; }
.chat-turn .text-button { margin: 0 4px 0 8px; padding: 4px 7px; }
.chat-turn .bubble .text-button { margin-block: -5px; }
.chat-turn:last-child { animation: turn-in .2s ease-out both; }
@keyframes turn-in { from { opacity: .45; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.composer { margin-top: 12px; }
.composer-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .85rem; }
label.composer-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.opening-form { margin-top: 15px; }
.opening-form label.composer-label {
  position: static;
  width: auto;
  height: auto;
  margin-bottom: 6px;
  clip-path: none;
}
.quick-replies + .composer-form { margin-top: 15px; }
.opening-form input {
  padding-inline: 2px 4px;
  border: 0;
  border-bottom: 1px solid #9b7e91;
  border-radius: 0;
  background: transparent;
}
.input-row { display: flex; align-items: stretch; gap: 7px; min-width: 0; }
.input-row :is(input, textarea) { flex: 1; width: 0; }
.input-row .button { flex: 0 0 auto; }
.quick-replies, .flow-actions, .ticket-actions, .ticket-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-block: 11px 0;
}

.button, .reply {
  display: inline-flex;
  min-height: 44px;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #261e29;
  color: var(--text);
  font-size: .89rem;
  font-weight: 590;
  line-height: 1.35;
  text-align: left;
  transition: color .18s, background .18s, border-color .18s;
}

.button:hover, .reply:hover { border-color: #b893a6; background: #3d2a3a; }
.button.primary { background: var(--lime); border-color: var(--lime); color: #272913; font-weight: 740; }
.button.primary:hover { background: #f1ffc4; border-color: #f1ffc4; }
.button.secondary { background: transparent; }
.reply { padding-inline: 13px; color: #f3e5ed; }

.opening-replies {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
  margin-block: 0;
}

.opening-replies .reply {
  --pick: #ffa5bd;
  --pick-background: #3e2732;
  justify-content: flex-start;
  min-height: 48px;
  gap: 9px;
  padding: 9px 11px;
  border-color: color-mix(in srgb, var(--pick), transparent 76%);
  border-radius: 26px 31px 34px 20px / 23px 23px 28px 24px;
  background: linear-gradient(129deg, var(--pick-background), #24202a);
  box-shadow: inset 0 1px #fff1, 0 2px 11px #0f0a1052;
  font-size: clamp(.88rem, 3.65vw, 1rem);
  overflow-wrap: normal;
}

.opening-replies [data-issue="buzz"] { --pick: #ffd18f; --pick-background: #3e302a; }
.opening-replies [data-issue="refret"] { --pick: #dbefa0; --pick-background: #303729; }
.opening-replies [data-issue="unknown"] { --pick: #d7bff1; --pick-background: #332a41; }

.opening-replies .reply::before, .service-options button::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 58% 48% 85% 80% / 50% 51% 91% 95%;
  background: linear-gradient(152deg, #fff8e7, var(--pick, #e7bbd3) 67%);
  transform: rotate(-23deg);
}

.opening-replies .reply::before { flex: 0 0 16px; }
.opening-replies .reply-title { min-width: 0; }
.opening-replies .reply:hover, .opening-replies .reply:focus-visible {
  border-color: var(--pick);
  background: var(--pick-background);
}
.opening-replies .reply:active { transform: translateY(1px); }
.quick-replies .reply[aria-pressed="true"] { border-color: var(--pick, var(--lime)); }
.quick-replies .reply[aria-pressed="true"]::after {
  content: "";
  flex: 0 0 5px;
  height: 9px;
  margin-inline-start: auto;
  border: solid var(--pick, var(--lime));
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input, select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 47px;
  padding: 10px 13px;
  border: 1px solid #8167779c;
  border-radius: 15px;
  background: #211a25;
  color: var(--text);
  font-size: 16px;
}

input::placeholder, textarea::placeholder { color: #cbb8c3; opacity: 1; }
input[type="file"] { padding-block: 8px; }
input[type="file"]::file-selector-button {
  min-height: 33px;
  margin-right: 7px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--plum);
}

textarea { resize: vertical; }
.form-status { margin: 7px 0 0; color: var(--pink); font-size: .83rem; }
.form-status:empty { margin: 0; }

.workshop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: start;
  margin-top: 11px;
}

.service-menu { min-width: 0; }
.service-menu[open] { width: 100%; }
.service-menu summary, .media-tools summary { width: fit-content; min-height: 44px; padding: 10px 0; color: var(--muted); font-size: .84rem; }
.service-options { display: grid; gap: 6px; padding: 4px 0; }
.service-options button {
  --pick: #e0b6c8;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 2px 11px;
  min-height: 49px;
  padding: 9px 15px;
  border: 0;
  border-radius: 22px;
  background: #241b268c;
  text-align: left;
}

.service-options button::before { grid-row: 1 / 3; }
.service-options button:hover { background: var(--plum); }
.service-options b { color: var(--text); font-size: .9rem; }
.service-options span { color: var(--muted); font-size: .78rem; }
#resetChat { padding-inline: 0; }

.photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 84px), 1fr));
  gap: 9px;
  max-width: 340px;
  margin-top: 12px;
}

.photos:empty { display: none; }
.photo-tile { overflow: hidden; border-radius: 10px; background: var(--plum); }
.photo-tile img { width: 100%; aspect-ratio: 1.3; object-fit: cover; }
.photo-tile .text-button { display: block; margin-inline: auto; }

.ticket {
  display: block;
  margin-top: 2px;
  padding: clamp(19px, 4vw, 29px);
  border-radius: 7px 20px 20px 7px;
  border-inline-start: 5px solid #9a735b;
  background: #f3e6d3;
  color: #30231e;
  box-shadow: 3px 10px 27px #0805096b;
}

.ticket h2 { margin: 0; font-size: clamp(1.3rem, 4vw, 1.8rem); line-height: 1.25; letter-spacing: -.04em; }
.ticket dl { margin: 17px 0; display: grid; grid-template-columns: minmax(65px, auto) minmax(0, 1fr); gap: 6px 15px; }
.ticket dt { color: #685047; font-size: .84rem; font-weight: 650; }
.ticket dd { margin: 0; white-space: pre-wrap; }
.ticket-note { margin: 0; color: #5e4740; font-size: .84rem; }
.ticket .button.primary { border-color: #36232d; background: #36232d; color: #fff5f3; }
.ticket .button.primary:hover { background: #513648; }
.ticket .text-button, .ticket .form-status { color: #6c3c51; }
.ticket textarea { margin-top: 8px; background: #fff5e8; color: #30231e; }

.footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  padding: 0 var(--gutter-right) calc(20px + env(safe-area-inset-bottom, 0px)) var(--gutter-left);
  color: var(--muted);
  font-size: .78rem;
}

.footer > span { padding-block: 9px; }
.media-tools[open] { flex: 1 1 100%; }
.media-tools p { margin: 5px 0 10px; }
.media-tools a { display: inline-block; margin-right: 14px; padding: 8px 0; }
.media-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.media-fields input { margin-top: 3px; }

@media (min-width: 780px) and (min-height: 520px) {
  .topbar { min-height: 76px; padding-inline: clamp(21px, 5vw, 76px); }
  .workshop { grid-template-columns: 1fr; min-height: clamp(615px, 59vw, 754px); }
  .hero-art {
    grid-area: 1 / 1;
    position: sticky;
    top: 0;
    align-self: start;
    height: clamp(615px, 59vw, 754px);
  }
  .bench-image { object-position: center bottom; }
  .hero-art::after {
    background:
      linear-gradient(90deg, #120f13f4, #120f13a8 31%, #120f1300 70%, #120f1360),
      linear-gradient(0deg, var(--background) 0%, #120f1324 32%, #120f1300 80%, var(--background));
  }
  .capri { right: 4%; width: 48%; height: 88%; bottom: 8%; }
  .capri-default { right: 2%; width: 53%; height: 135%; bottom: -40%; }
  .conversation {
    grid-area: 1 / 1;
    align-self: start;
    width: min(57%, 710px);
    padding: clamp(53px, 9vw, 129px) 16px 62px clamp(34px, 5vw, 76px);
  }
  .welcome { margin: 0 0 31px; }
  .welcome-speaker { margin-bottom: 16px; }
  .intro { margin-top: 13px; }
  .opening-replies { max-width: 440px; }
  .opening-replies .reply { padding-inline: 16px; }
  .has-talk .welcome { margin-bottom: 22px; }
  .conversation.has-talk { padding-top: clamp(34px, 5vw, 73px); }
  .has-talk h1 { font-size: clamp(2.4rem, 4.5vw, 4.4rem); }
  .footer { padding-inline: clamp(22px, 5vw, 76px); }
}

@media (orientation: landscape) and (max-height: 519px) {
  .hero-art { height: clamp(112px, 36vh, 174px); }
}

@media (max-width: 350px) {
  .brand { gap: 6px; }
  .brand-word { font-size: 1.34rem; }
  .voice-compare-label { font-size: .73rem; }
}

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