:root {
  color-scheme: light;
  --ink: #211a2d;
  --muted: #756d80;
  --bg: #f7f4fb;
  --surface: #ffffff;
  --surface-soft: #f1ecf8;
  --line: rgba(48, 34, 68, 0.12);
  --purple: #7146ee;
  --purple-dark: #5530c8;
  --pink: #f25fa4;
  --green: #8bcf39;
  --shadow: 0 20px 55px rgba(56, 37, 84, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 84% 4%, rgba(242, 95, 164, 0.14), transparent 27rem),
    radial-gradient(circle at 4% 36%, rgba(113, 70, 238, 0.11), transparent 30rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, "Noto Sans TC", ui-sans-serif, system-ui, sans-serif;
}

button,
input { font: inherit; }

button,
a,
input { -webkit-tap-highlight-color: transparent; }

:where(button, input, [tabindex]):focus-visible {
  outline: 3px solid rgba(113, 70, 238, 0.48);
  outline-offset: 3px;
}

.site-header,
main,
footer {
  width: min(1240px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  color: var(--ink);
  font-weight: 850;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 0.7rem 0.7rem 0.7rem 0.2rem;
  background: linear-gradient(145deg, var(--purple), var(--pink));
  box-shadow: 0 8px 20px rgba(113, 70, 238, 0.24);
  color: white;
}

.event-badge,
.section-chip {
  padding: 0.42rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.intro {
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1.5rem, 3vw, 2.4rem) 0 1.15rem;
}

.intro-copy { max-width: 52rem; }

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--purple);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 19ch;
  margin-bottom: 0.7rem;
  font-size: clamp(2.2rem, 3.6vw, 3.65rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

h1 span {
  display: inline-block;
  color: var(--purple);
  white-space: nowrap;
}

.lede {
  max-width: 42rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.intro-stats {
  display: grid;
  min-width: 20rem;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 34px rgba(56, 37, 84, 0.07);
}

.intro-stats p {
  margin: 0;
  padding: 0.9rem 0.75rem;
  text-align: center;
}

.intro-stats p + p { border-left: 1px solid var(--line); }
.intro-stats strong,
.intro-stats span { display: block; }
.intro-stats strong { color: var(--purple); font-size: 1.35rem; line-height: 1; }
.intro-stats span { margin-top: 0.35rem; color: var(--muted); font-size: 0.66rem; }

.experience-card {
  min-width: 0;
  margin-bottom: 4.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.section-heading p,
.conversation-heading p {
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.section-chip { flex: none; }
.section-chip.accent {
  border-color: rgba(113, 70, 238, 0.18);
  background: #eee8ff;
  color: var(--purple-dark);
}

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

.experience-badges {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.shared-stage {
  position: relative;
  height: clamp(36rem, 50vw, 40rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  background:
    radial-gradient(circle at 84% 24%, rgba(242, 95, 164, 0.15), transparent 22rem),
    radial-gradient(circle at 66% 74%, rgba(113, 70, 238, 0.13), transparent 27rem),
    linear-gradient(135deg, #f9f7fc 0%, #eee9f8 100%);
}

.shared-stage::after {
  position: absolute;
  z-index: 0;
  right: -8rem;
  bottom: -12rem;
  width: 30rem;
  height: 30rem;
  border: 1px solid rgba(113, 70, 238, 0.1);
  border-radius: 50%;
  content: "";
}

.avatar-layer {
  position: absolute;
  z-index: 1;
  inset: 0.75rem 0.75rem 0.75rem 34%;
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-end;
}

.conversation-layer {
  position: absolute;
  z-index: 3;
  inset: 0 auto 0 0;
  display: flex;
  width: 44%;
  min-width: 0;
  flex-direction: column;
  margin: 0;
  padding: 1rem 2.4rem 1rem 1rem;
  background: linear-gradient(
    90deg,
    rgba(249, 247, 252, 0.99) 0%,
    rgba(249, 247, 252, 0.97) 78%,
    rgba(249, 247, 252, 0) 100%
  );
}

.conversation-heading {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.65rem;
}

.conversation-heading p {
  margin-bottom: 0.05rem;
  text-transform: uppercase;
}

.conversation-heading h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.bot-mark {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  flex: none;
  place-items: center;
  border-radius: 0.75rem 0.75rem 0.75rem 0.2rem;
  background: linear-gradient(145deg, var(--purple), var(--pink));
  color: white;
  font-size: 0.7rem;
  font-weight: 900;
}

.composer {
  padding: 0.65rem;
  border: 1px solid rgba(48, 34, 68, 0.13);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 35px rgba(56, 37, 84, 0.11);
  backdrop-filter: blur(14px);
}

.chat-log {
  display: flex;
  min-height: 14rem;
  max-height: 18rem;
  flex: none;
  flex-direction: column;
  gap: 0.6rem;
  overflow-y: auto;
  margin-bottom: 0.55rem;
  padding: 0.35rem 0.45rem 0.35rem 0.15rem;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

.chat-bubble {
  position: relative;
  max-width: 92%;
  padding: 0.75rem 0.9rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.chat-bubble.user {
  align-self: flex-start;
  border-bottom-left-radius: 0.25rem;
  background: var(--purple);
  box-shadow: 0 7px 18px rgba(113, 70, 238, 0.18);
  color: white;
}

.chat-bubble.assistant {
  align-self: flex-end;
  border: 1px solid var(--line);
  border-bottom-right-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(56, 37, 84, 0.07);
}

.chat-bubble.assistant::after {
  position: absolute;
  right: -0.42rem;
  bottom: 0.25rem;
  width: 0;
  height: 0;
  border-top: 0.42rem solid transparent;
  border-bottom: 0.12rem solid transparent;
  border-left: 0.48rem solid rgba(255, 255, 255, 0.94);
  content: "";
}

.chat-bubble.error {
  align-self: center;
  color: #bd3d52;
  font-size: 0.78rem;
}

#clear-chat-btn,
#stop-btn {
  min-height: 2.75rem;
  padding-inline: 0.75rem;
  border: 0;
  background: transparent;
  cursor: pointer;
}

#clear-chat-btn { margin-left: auto; color: var(--muted); font-size: 0.72rem; }
#clear-chat-btn:hover { color: var(--ink); }

.prompt-row { display: flex; gap: 0.5rem; }

.prompt-row input {
  min-width: 0;
  flex: 1;
  padding: 0.82rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  outline: none;
  background: white;
  color: var(--ink);
}

.prompt-row input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(113, 70, 238, 0.1);
}

.prompt-row button {
  padding: 0.78rem 1rem;
  border: 0;
  border-radius: 0.8rem;
  background: var(--purple);
  color: white;
  font-weight: 850;
  cursor: pointer;
}

.prompt-row button:hover:not(:disabled) { background: var(--purple-dark); }
button:disabled { cursor: not-allowed; opacity: 0.45; }

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.quick-prompts button {
  min-height: 2.75rem;
  padding: 0.38rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.74rem;
}

.quick-prompts button:hover:not(:disabled) {
  border-color: rgba(113, 70, 238, 0.45);
  color: var(--purple-dark);
}

.reference-float {
  position: absolute;
  z-index: 4;
  top: 1rem;
  left: calc(44% + 0.2rem);
  width: clamp(9.5rem, 15vw, 11.5rem);
  padding: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 16px 38px rgba(56, 37, 84, 0.14);
  backdrop-filter: blur(16px);
}

.reference-heading {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  padding: 0.05rem 0.05rem 0.45rem;
}

.reference-heading > span {
  display: grid;
  min-width: 2.6rem;
  height: 1.5rem;
  place-items: center;
  border-radius: 999px;
  background: #eee8ff;
  color: var(--purple);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.reference-heading strong { font-size: 0.72rem; }

.reference-frame,
.stage {
  position: relative;
  overflow: hidden;
  border-radius: 0.8rem;
}

.reference-frame {
  aspect-ratio: 1 / 1;
  background:
    radial-gradient(circle at 50% 30%, rgba(113, 70, 238, 0.12), transparent 45%),
    #eae4f3;
}

.reference-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #17131d;
}

.reference-frame img[hidden] { display: none; }

.stage {
  isolation: isolate;
  width: auto;
  height: calc(100% - 2.7rem);
  max-width: 100%;
  min-height: 0;
  flex: none;
  margin-left: auto;
  aspect-ratio: 4 / 5;
  background: linear-gradient(145deg, rgba(239, 233, 249, 0.88), rgba(255, 255, 255, 0.88));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.placeholder {
  display: grid;
  height: 100%;
  place-content: center;
  padding: 1rem;
  color: var(--muted);
  text-align: center;
}

.placeholder[hidden] { display: none; }
.placeholder span { color: var(--purple); font-size: 4.5rem; font-weight: 900; line-height: 1; }
.placeholder p { margin: 0.55rem 0 0; font-size: 0.75rem; line-height: 1.4; }

.reference-float .placeholder { padding: 0.5rem; }
.reference-float .placeholder span { font-size: 2.6rem; }
.reference-float .placeholder p { margin-top: 0.25rem; font-size: 0.64rem; }

.selection-meta {
  display: flex;
  min-height: 2.8rem;
  flex-direction: column;
  gap: 0.2rem;
  align-items: flex-start;
  justify-content: center;
  padding: 0.55rem 0.1rem 0;
}

.selection-meta strong { font-size: 0.74rem; }
.selection-meta span { color: var(--muted); font-size: 0.6rem; line-height: 1.35; }

sv-presenter {
  position: relative;
  z-index: 1;
  display: block;
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
}

.stage-poster {
  position: absolute;
  z-index: 0;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform-origin: 50% 80%;
}

.stage-poster[hidden] { display: none; }

.stage-poster.react {
  animation: poster-reaction 1.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.stage-overlay {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(145deg, #eee8f8, #fbf9fd);
  color: var(--muted);
  text-align: center;
}

.stage-overlay[hidden] { display: none; }

.loader {
  width: 2rem;
  height: 2rem;
  border: 2px solid rgba(113, 70, 238, 0.16);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@keyframes poster-reaction {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  28% { transform: translateY(-0.7rem) rotate(-2deg) scale(1.025); }
  58% { transform: translateY(0.1rem) rotate(2deg) scale(1.01); }
}

.presenter-status {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  min-height: 2.7rem;
  padding: 0.7rem 0.1rem 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.avatar-layer .presenter-status { width: min(100%, 31rem); }

.status-dot { width: 0.5rem; height: 0.5rem; flex: none; border-radius: 50%; background: #aaa2b3; }
.status-dot.ready { background: var(--green); box-shadow: 0 0 12px rgba(139, 207, 57, 0.4); }
.status-dot.thinking { background: var(--purple); }
.status-dot.performing { background: var(--pink); }
.status-dot.error { background: #df4054; }
#stop-btn { margin-left: auto; color: #c73f53; }

.contract {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  gap: clamp(1.5rem, 5vw, 5rem);
  align-items: center;
  padding: 3.5rem 0;
  border-top: 1px solid var(--line);
}

.contract h2 {
  max-width: 12ch;
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.contract-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.contract-grid p {
  min-height: 8rem;
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.76);
}

.contract-grid strong,
.contract-grid span { display: block; }
.contract-grid strong { margin-bottom: 0.55rem; color: var(--purple); font-size: 0.78rem; }
.contract-grid span { color: var(--muted); font-size: 0.84rem; line-height: 1.55; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.6rem 0 2.4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.7rem;
}

@media (max-width: 980px) {
  .intro { align-items: start; }
  .intro-stats { min-width: 17rem; }
  .conversation-layer { width: 48%; }
  .reference-float { left: calc(48% - 0.4rem); }
}

@media (max-width: 760px) {
  .site-header,
  main,
  footer { width: min(100% - 22px, 1240px); }

  .site-header { min-height: 58px; }
  .event-badge { display: none; }

  .intro {
    display: block;
    padding: 2.1rem 0 1.25rem;
  }

  h1 { max-width: 12ch; font-size: clamp(2.55rem, 12vw, 3.75rem); }
  .lede { font-size: 0.92rem; line-height: 1.6; }
  .intro-stats { min-width: 0; margin-top: 1.25rem; }
  .intro-stats p { padding: 0.75rem 0.35rem; }

  .experience-card { margin-bottom: 2.8rem; padding: 0.75rem; border-radius: 1.1rem; }
  .experience-heading { align-items: flex-start; }
  .experience-badges { display: none; }

  .shared-stage {
    display: flex;
    height: auto;
    min-height: 0;
    flex-direction: column;
  }

  .avatar-layer {
    position: relative;
    inset: auto;
    width: 100%;
    height: clamp(22rem, 55dvh, 28rem);
    flex: none;
    align-items: center;
    padding: 0.75rem;
  }

  .stage {
    width: auto;
    margin-inline: auto;
  }

  .avatar-layer .presenter-status {
    width: min(100%, 21rem);
    margin-inline: auto;
  }

  .conversation-layer {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 23rem;
    margin-top: -2rem;
    padding: 3rem 1rem 1rem;
    background: linear-gradient(
      180deg,
      rgba(249, 247, 252, 0) 0%,
      rgba(249, 247, 252, 0.98) 2.8rem,
      rgba(249, 247, 252, 0.99) 100%
    );
  }

  .chat-log {
    min-height: 8.5rem;
    max-height: 12rem;
    flex: none;
  }

  .quick-prompts {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .quick-prompts button { flex: none; }

  .reference-float {
    top: 0.7rem;
    left: 0.7rem;
    width: 7.5rem;
    padding: 0.4rem;
  }

  .reference-heading { padding-bottom: 0.3rem; }
  .reference-heading strong { display: none; }
  .reference-float .selection-meta span { display: none; }
  .reference-float .selection-meta { min-height: 1.7rem; padding-top: 0.35rem; }

  .contract { grid-template-columns: 1fr; gap: 1.25rem; padding: 2.8rem 0; }
  .contract h2 { max-width: 14ch; }
  .contract-grid { grid-template-columns: 1fr; }
  .contract-grid p { min-height: 0; }

  footer { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 430px) {
  .section-chip { display: none; }
  .conversation-layer { padding-inline: 0.75rem; }
  .prompt-row input { font-size: 1rem; }
  .prompt-row button { flex: none; width: auto; }
  .chat-log { min-height: 8rem; max-height: 11rem; }
}

@media (prefers-reduced-motion: reduce) {
  html,
  .chat-log { scroll-behavior: auto; }
  .loader { animation: none; }
}
