

:root {
  --color-ink: #11131d;
  --color-ink-soft: #3a3d4a;
  --color-ink-muted: #6b6e7a;
  --color-ink-dim: #9e9e9e;
  --color-bg: #ffffff;
  --color-bg-rgb: 255, 255, 255;
  --color-bg-soft: #f5f5f5;
  --color-bg-elev: #ffffff;
  --color-border: #e7e7e7;
  --color-border-strong: #d0d0d0;
  --color-accent: #9064f5;
  --color-accent-secondary: #e8a4d4;
  --color-accent-soft: rgba(144, 100, 245, 0.08);
  --gradient-accent: #9064f5;

  --font-display: 'Nunito', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --font-body: 'Nunito', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
}

html.dark {
  --color-ink: #f0f0f5;
  --color-ink-soft: #c0c2cd;
  --color-ink-muted: #8a8d99;
  --color-ink-dim: #5a5d68;
  --color-bg: #11131d;
  --color-bg-rgb: 17, 19, 29;
  --color-bg-soft: #161a21;
  --color-bg-elev: #1c2030;
  --color-border: #252629;
  --color-border-strong: #353740;
  --color-accent: #a987ff;
  --color-accent-secondary: #e8a4d4;
  --color-accent-soft: rgba(144, 100, 245, 0.16);
  --gradient-accent: #a987ff;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
  background-color: var(--color-bg);
}

html.dark {
  color-scheme: dark;
}

body {
  font-family: var(--font-body);
  color: var(--color-ink);
  background-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
}

.site-video-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.site-video-bg-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 1;
  transform: translateZ(0);
}

.site-header,
main,
.site-footer,
.site-assistant {
  position: relative;
}

.site-header,
main,
.site-footer {
  z-index: 1;
}

::selection {
  background-color: var(--color-accent);
  color: #fff;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  vertical-align: middle;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
}

.text-span {
  color: var(--color-accent);
  margin-right: -0.05em;
  padding-right: 0.15em;
  font-style: italic;
  display: inline-block;
}

.phrase-highlight {
  color: var(--color-ink);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  background-image: linear-gradient(#0000 60%, rgba(144, 100, 245, 0.18) 60%, rgba(144, 100, 245, 0.18));
  background-repeat: no-repeat;
  background-size: 100% 100%;
  padding: 0 0.1em;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 0;
  box-shadow: none;
}

html.dark .site-header {
  background: transparent;
}

.header-inner {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 1.5rem 0 0.25rem;
  height: 5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 64rem) {
  .header-inner {
    padding: 0 2rem 0 0.333rem;
  }
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.875rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  color: var(--color-accent);
  padding-right: 0.1em;
  text-shadow: 0 2px 18px rgba(255, 255, 255, 0.92), 0 1px 2px rgba(17, 19, 29, 0.1);
}

.nav-links {
  display: none;
}

@media (min-width: 48rem) {
  .nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }
}

.nav-link {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 900;
  color: rgba(17, 19, 29, 0.9);
  border-radius: 999px;
  text-shadow: 0 1px 14px rgba(255, 255, 255, 0.95), 0 1px 2px rgba(255, 255, 255, 0.72);
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}

.nav-link:hover {
  color: var(--color-accent);
  background: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.26);
}

.nav-link[data-nav-idx="0"]:hover,
.nav-link[data-nav-idx="1"]:hover,
.nav-link[data-nav-idx="2"]:hover,
.nav-link[data-nav-idx="4"]:hover,
.nav-link[data-nav-idx="5"]:hover {
  color: var(--color-accent);
}

html.dark .nav-link {
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.56), 0 1px 2px rgba(0, 0, 0, 0.5);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.portfolio-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.625rem;
  padding: 0.375rem 0.875rem;
  border: 1px solid rgba(255, 255, 255, 0.42);
  color: var(--color-accent) !important;
  background: rgba(255, 255, 255, 0.34) !important;
  border-color: rgba(255, 255, 255, 0.42) !important;
  border-radius: 999px !important;
  font-size: 0.875rem;
  box-shadow: 0 8px 22px -18px rgba(17, 19, 29, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  font-weight: 900 !important;
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.9);
  transition: background 0.15s;
}

.portfolio-link:hover {
  background: rgba(255, 255, 255, 0.5) !important;
}

.theme-toggle {
  padding: 0.5rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.36);
  color: rgba(17, 19, 29, 0.82);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px -18px rgba(17, 19, 29, 0.45);
}

.theme-toggle:hover {
  color: var(--color-accent);
  background: rgba(255, 255, 255, 0.5);
}

html.dark .theme-toggle,
html.dark .portfolio-link {
  background: rgba(17, 19, 29, 0.34) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: rgba(255, 255, 255, 0.88) !important;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.dark-show {
  display: none;
}

html.dark .dark-hide {
  display: none;
}

html.dark .dark-show {
  display: block !important;
}

.container {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 1.5rem 0 0.25rem;
}

@media (min-width: 64rem) {
  .container {
    padding: 0 2rem 0 0.333rem;
  }
}

.section-hero {
  padding-top: 4rem;
  padding-bottom: 3rem;
}

@media (min-width: 64rem) {
  .section-hero {
    padding-top: 6rem;
    padding-bottom: 4.8rem;
  }
}

.section {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

@media (min-width: 64rem) {
  .section {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }
}

.hero-grid {
  display: grid;
  gap: 3rem;
  align-items: center;
}

@media (min-width: 64rem) {
  .hero-grid {
    grid-template-columns: 1.3fr 1fr;
    gap: 5rem;
  }
}

.hero-text {
  order: 2;
  padding: 1.75rem;
  background-color: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  position: relative;
  overflow: hidden;
}

@media (min-width: 64rem) {
  .hero-text {
    order: 1;
  }
}

.hero-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  line-height: 1.1;
  color: var(--color-ink);
  margin-bottom: 2rem;
  text-shadow: none;
}

@media (min-width: 64rem) {
  .hero-title {
    font-size: 3.75rem;
  }
}

@media (min-width: 80rem) {
  .hero-title {
    font-size: 4.5rem;
  }
}

.hero-bio {
  font-size: 1.125rem;
  color: var(--color-ink-soft);
  line-height: 1.625;
  max-width: 36rem;
  margin-bottom: 1.75rem;
  font-weight: 400;
  text-shadow: none;
}

@media (min-width: 64rem) {
  .hero-bio {
    font-size: 1.25rem;
  }
}

.hero-bio p {
  margin-bottom: 0.75rem;
}

.hero-bio p:last-child {
  margin-bottom: 0;
}

.tech-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  margin-bottom: 1.5rem;
  max-width: 36rem;
}

.tech-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.375rem 0.75rem;
  background-color: var(--color-bg-elev);
  color: var(--color-ink);
  border: 1px solid var(--color-border);
  border-radius: 9999px;
  box-shadow: none;
}

.tech-arrow {
  color: var(--color-ink-dim);
  font-size: 0.875rem;
  text-shadow: none;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  max-width: 36rem;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.375rem 0.75rem;
  background-color: var(--color-accent-soft);
  color: var(--color-accent);
  border-radius: 9999px;
  text-shadow: none;
}

.circle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  color: var(--color-ink);
  text-shadow: none;
  transition: color 0.3s;
}

.circle-btn:hover {
  color: var(--color-accent);
}

.circle-btn-icon {
  background: var(--gradient-accent);
  color: #fff;
  border-radius: 50%;
  width: 3.25rem;
  height: 3.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), filter 0.3s;
}

.circle-btn:hover .circle-btn-icon {
  filter: brightness(1.1);
  transform: rotate(-45deg);
}

.circle-btn-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.hero-image {
  order: 1;
  display: flex;
  justify-content: center;
}

@media (min-width: 64rem) {
  .hero-image {
    order: 2;
    justify-content: flex-end;
  }
}

.avatar-float {
  width: 18rem;
  height: 18rem;
  display: block;
  border-radius: 1.5rem;
  border: 1px solid rgba(144, 100, 245, 0.14);
  object-fit: cover;
  object-position: center center;
  box-shadow: 0 12px 28px -16px rgba(17, 19, 29, 0.18), 0 28px 64px -28px rgba(144, 100, 245, 0.22), 0 0 0 8px rgba(144, 100, 245, 0.04);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.5s;
  animation: avatarFloat 6s ease-in-out infinite;
}

.avatar-link {
  display: inline-block;
  position: relative;
  border-radius: 1.5rem;
  cursor: pointer;
}

.avatar-link:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 0.375rem;
}

.avatar-float:hover {
  animation-play-state: paused;
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 18px 36px -18px rgba(17, 19, 29, 0.24), 0 36px 84px -30px rgba(232, 164, 212, 0.24), 0 0 0 8px rgba(232, 164, 212, 0.06);
}

html.dark .avatar-float {
  border-color: rgba(232, 164, 212, 0.18);
  box-shadow: 0 18px 38px -18px rgba(0, 0, 0, 0.45), 0 30px 76px -30px rgba(144, 100, 245, 0.3), 0 0 0 8px rgba(232, 164, 212, 0.05);
}

@media (min-width: 64rem) {
  .avatar-float {
    width: 24rem;
    height: 24rem;
  }
}

@keyframes avatarFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@media (prefers-reduced-motion: reduce) {
  .avatar-float {
    animation: none;
  }
}

.section-title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--color-ink);
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
}

@media (min-width: 64rem) {
  .section-title {
    font-size: 3rem;
  }
}

.section-subtitle {
  color: var(--color-ink-muted);
  max-width: 36rem;
  line-height: 1.625;
}

.card-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 48rem) {
  .card-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  .card-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.capability-card {
  padding: 1.75rem;
  background-color: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s;
}

.capability-card:hover {
  transform: translateY(-4px);
}

.capability-num {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.capability-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-ink);
  margin-bottom: 0.5rem;
}

.capability-desc {
  font-size: 0.875rem;
  color: var(--color-ink-soft);
  line-height: 1.625;
}

.section-project-index {
  padding-top: 0;
  padding-bottom: 0.75rem;
}

.project-index {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.875rem 1rem;
  background-color: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
}

.project-index-label {
  color: var(--color-accent);
  font-size: 0.875rem;
  font-weight: 900;
}

.project-index-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-index-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  color: var(--color-ink);
  background: var(--color-bg-elev);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 800;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.project-index-list a:hover {
  color: var(--color-accent);
  border-color: rgba(144, 100, 245, 0.32);
  transform: translateY(-1px);
}

.project-index-list span {
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 900;
}

#experience {
  padding-top: 0.25rem;
}

#projects {
  padding-bottom: 0.5rem;
}

@media (min-width: 64rem) {
  .section-project-index {
    padding-bottom: 1rem;
  }

  #experience {
    padding-top: 0.5rem;
  }

  #projects {
    padding-bottom: 0.75rem;
  }
}

.project-card {
  padding: 1.75rem;
  background-color: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s;
}

.project-card:hover {
  transform: translateY(-4px);
}

.project-kicker {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 1rem;
}

.project-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-ink);
  margin-bottom: 0.75rem;
}

.project-desc {
  font-size: 0.875rem;
  color: var(--color-ink-soft);
  line-height: 1.625;
  margin-bottom: 0.75rem;
}

.project-features {
  list-style: none;
  padding: 0;
  margin: 0;
}

.project-features li {
  position: relative;
  padding-left: 1.25rem;
  font-size: 0.8125rem;
  color: var(--color-ink-muted);
  line-height: 1.6;
  margin-bottom: 0.25rem;
}

.project-features li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--color-accent);
}

.timeline {
  padding: 1.75rem;
  background-color: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1.75rem;
  padding: 0 0 2rem 1.75rem;
  border-left: 2px solid var(--color-border);
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid var(--color-bg-soft);
  box-shadow: 0 0 0 2px rgba(144, 100, 245, 0.22);
}

.timeline-date {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1.7;
}

.timeline-content h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--color-ink);
  margin-bottom: 0.5rem;
}

.timeline-content p {
  font-size: 0.875rem;
  color: var(--color-ink-soft);
  line-height: 1.625;
}

.contact-card {
  padding: 2rem 1.75rem;
  background-color: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
}

@media (min-width: 48rem) {
  .contact-card {
    padding: 3rem;
  }
}

.contact-title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--color-ink);
  margin-bottom: 1rem;
}

.contact-desc {
  font-size: 1.0625rem;
  color: var(--color-ink-soft);
  line-height: 1.625;
  max-width: 48rem;
  margin-bottom: 1.75rem;
}

.contact-info {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  min-width: 10rem;
}

.contact-item-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-ink-muted);
}

.contact-item-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--color-ink);
  word-break: break-all;
}

.site-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.42);
  padding: 2rem 1.5rem;
  color: rgba(17, 19, 29, 0.82);
  font-size: 0.875rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-shadow: 0 1px 10px rgba(255, 255, 255, 0.72);
}

html.dark .site-footer {
  border-top-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.78);
  background: rgba(17, 19, 29, 0.46);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.42);
}

@media (min-width: 64rem) {
  .site-footer {
    padding: 2rem;
  }
}

.footer-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  font-weight: 800;
}

html.js-anim .reveal {
  opacity: 0;
  will-change: opacity, transform;
  transition: opacity 1.4s cubic-bezier(0.22, 1, 0.36, 1), transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
  transform: translateY(36px);
}

html.js-anim .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html.js-anim .reveal,
  .avatar-float {
    opacity: 1 !important;
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
}

@media (max-width: 47.99rem) {
  .hero-title {
    font-size: 2.5rem;
  }

  .avatar-float {
    width: 14rem;
    height: 14rem;
  }

  .section-title {
    font-size: 1.875rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .contact-info {
    flex-direction: column;
  }
}

@media (min-width: 48rem) and (max-width: 63.99rem) {
  .card-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.site-assistant {
  position: fixed;
  right: 2rem;
  top: clamp(5.125rem, 13vh, 6rem);
  z-index: 1000;
  font-family: var(--font-body);
  --assistant-icon-size: 110px;
  --assistant-frame-size: 100px;
  --assistant-sprite-width: 9200px;
  --assistant-sprite-end: -9100px;
}

.assistant-resident {
  position: relative;
  width: min(21.75rem, calc(100vw - 2rem));
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.75rem;
  pointer-events: none;
}

.assistant-launcher {
  position: relative;
  width: var(--assistant-icon-size);
  height: var(--assistant-icon-size);
  flex: 0 0 var(--assistant-icon-size);
  border: 0;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.assistant-launcher:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.04);
}

.assistant-sprite-shell {
  position: relative;
  width: var(--assistant-frame-size);
  height: var(--assistant-frame-size);
  display: block;
  overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.95), rgba(232, 164, 212, 0.18) 64%, rgba(144, 100, 245, 0.16) 100%);
  box-shadow: 0 18px 42px -22px rgba(232, 164, 212, 0.72), 0 12px 26px -20px rgba(17, 19, 29, 0.68);
}

.assistant-sprite-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: inherit;
  pointer-events: none;
}

.assistant-sprite-image {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--assistant-sprite-width);
  height: var(--assistant-frame-size);
  max-width: none;
  display: block;
  animation: xiaojunWalk 4s steps(91) infinite;
  will-change: transform;
}

.assistant-sprite-shadow {
  position: absolute;
  left: 50%;
  bottom: -0.125rem;
  width: 3.125rem;
  height: 0.625rem;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(17, 19, 29, 0.28), rgba(17, 19, 29, 0) 72%);
  opacity: 0.6;
  transform: translateX(-50%);
  pointer-events: none;
}

@keyframes xiaojunWalk {
  0% { transform: translateX(0); }
  100% { transform: translateX(var(--assistant-sprite-end)); }
}

.assistant-callout {
  position: relative;
  width: 14rem;
  min-height: 3.35rem;
  margin-top: 0.125rem;
  border: 1px solid rgba(255, 255, 255, 0.44);
  border-radius: 1.125rem 1.125rem 0.45rem 1.125rem;
  padding: 0.65rem 0.95rem;
  color: rgba(255, 255, 255, 0.96);
  background: #ff9a3d;
  box-shadow: 0 18px 46px -24px rgba(255, 154, 61, 0.76), 0 10px 24px -18px rgba(17, 19, 29, 0.52);
  font-size: 0.8125rem;
  font-weight: 900;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  animation: assistantCalloutBlink 2.5s linear infinite;
  transition: opacity 0.18s ease, transform 0.18s ease, filter 0.18s ease;
}

.assistant-callout::after {
  content: "";
  position: absolute;
  right: -0.36rem;
  top: 1.35rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 0.15rem;
  background: #ff9a3d;
  transform: rotate(45deg);
}

.assistant-callout:hover {
  filter: brightness(1.04);
}

@keyframes assistantCalloutBlink {
  0%, 59.99% {
    opacity: 1;
    transform: translateY(0);
  }
  60%, 100% {
    opacity: 0;
    transform: translateY(0);
  }
}

.assistant-hide {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  width: 1.85rem;
  height: 1.85rem;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(17, 19, 29, 0.78);
  box-shadow: 0 12px 26px -18px rgba(17, 19, 29, 0.7);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s ease, background 0.15s ease;
}

.assistant-hide:hover {
  transform: scale(1.05);
  background: rgba(144, 100, 245, 0.88);
}

.assistant-hide svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assistant-recall {
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(250, 100, 0, 0.26);
  border-radius: 999px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 16px 38px -22px rgba(250, 100, 0, 0.68), 0 10px 24px -18px rgba(17, 19, 29, 0.45);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.assistant-recall:hover {
  transform: translateX(-2px);
  filter: brightness(1.04);
}

.assistant-recall img {
  width: 31px;
  height: 31px;
  display: block;
}

.site-assistant.is-open .assistant-callout {
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
  animation: none;
}

.site-assistant.is-hidden .assistant-resident,
.site-assistant.is-hidden .assistant-panel {
  display: none;
}

.site-assistant.is-hidden .assistant-recall {
  display: inline-flex;
}

.assistant-panel {
  position: absolute;
  right: calc(var(--assistant-icon-size) + 0.85rem);
  top: 0;
  width: min(24rem, calc(100vw - 2rem));
  height: min(36rem, calc(100vh - 8rem));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(144, 100, 245, 0.18);
  border-radius: 1.25rem;
  background: color-mix(in srgb, var(--color-bg-elev) 94%, #ffffff);
  box-shadow: 0 28px 80px -36px rgba(17, 19, 29, 0.55), 0 18px 60px -34px rgba(144, 100, 245, 0.48);
  opacity: 0;
  transform: translate(8px, 0) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

html.dark .assistant-panel {
  background: color-mix(in srgb, var(--color-bg-elev) 92%, #11131d);
  box-shadow: 0 28px 80px -34px rgba(0, 0, 0, 0.72), 0 18px 60px -34px rgba(144, 100, 245, 0.54);
}

.site-assistant.is-open .assistant-panel {
  opacity: 1;
  transform: translate(0, 0) scale(1);
  pointer-events: auto;
}

.assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.875rem;
  border-bottom: 1px solid var(--color-border);
}

.assistant-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
}

.assistant-brand-icon {
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 2.35rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(255, 154, 61, 0.1);
}

.assistant-brand-icon img {
  width: 112%;
  height: 112%;
  display: block;
  object-fit: contain;
}

.assistant-title {
  color: var(--color-ink);
  font-size: 1.125rem;
  line-height: 1.2;
  white-space: nowrap;
}

.assistant-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.assistant-clear,
.assistant-icon-btn {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-ink-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.assistant-clear {
  min-width: 3rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
}

.assistant-icon-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.assistant-icon-btn svg,
.assistant-send svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.assistant-clear:hover,
.assistant-icon-btn:hover {
  color: var(--color-accent);
  border-color: rgba(144, 100, 245, 0.35);
  background: var(--color-accent-soft);
}

.assistant-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}

.assistant-message {
  display: flex;
  flex-direction: column;
  max-width: 84%;
  gap: 0.25rem;
}

.assistant-message.is-user {
  align-self: flex-end;
  align-items: flex-end;
}

.assistant-message.is-bot {
  align-self: flex-start;
  align-items: flex-start;
}

.assistant-bubble {
  border-radius: 1rem;
  padding: 0.75rem 0.875rem;
  font-size: 0.875rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: normal;
}

.assistant-message.is-user .assistant-bubble {
  color: #fff;
  background: var(--gradient-accent);
  border-bottom-right-radius: 0.25rem;
  white-space: pre-wrap;
}

.assistant-message.is-bot .assistant-bubble {
  color: var(--color-ink-soft);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 0.25rem;
  overflow-x: hidden;
}

.assistant-bubble.is-markdown :first-child {
  margin-top: 0;
}

.assistant-bubble.is-markdown :last-child {
  margin-bottom: 0;
}

.assistant-bubble.is-markdown p {
  margin: 0 0 0.75rem;
}

.assistant-bubble.is-markdown h3,
.assistant-bubble.is-markdown h4,
.assistant-bubble.is-markdown h5 {
  margin: 0.9rem 0 0.4rem;
  color: var(--color-ink);
  font-size: 0.95rem;
  line-height: 1.35;
}

.assistant-bubble.is-markdown a {
  color: #2563eb;
  font-weight: 800;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  word-break: break-all;
}

.assistant-bubble.is-markdown a:hover {
  color: #1d4ed8;
}

html.dark .assistant-bubble.is-markdown a {
  color: #8ab4ff;
}

.assistant-bubble.is-markdown ul,
.assistant-bubble.is-markdown ol {
  margin: 0.35rem 0 0.75rem;
  padding-left: 1.25rem;
}

.assistant-bubble.is-markdown li {
  margin: 0.18rem 0;
}

.assistant-bubble.is-markdown strong {
  color: var(--color-ink);
}

.assistant-bubble.is-markdown code {
  border-radius: 0.35rem;
  padding: 0.08rem 0.28rem;
  color: var(--color-accent);
  background: rgba(144, 100, 245, 0.1);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.82em;
}

.assistant-bubble.is-markdown pre {
  margin: 0.55rem 0 0.85rem;
  overflow-x: auto;
  border-radius: 0.75rem;
  padding: 0.75rem;
  background: rgba(17, 19, 29, 0.06);
}

.assistant-bubble.is-markdown pre code {
  padding: 0;
  color: inherit;
  background: transparent;
}

.assistant-table-wrap {
  max-width: 100%;
  margin: 0.55rem 0 0.85rem;
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
}

.assistant-bubble.is-markdown table {
  width: 100%;
  min-width: 18rem;
  border-collapse: collapse;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.assistant-bubble.is-markdown th,
.assistant-bubble.is-markdown td {
  border-bottom: 1px solid var(--color-border);
  padding: 0.5rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

.assistant-bubble.is-markdown tr:last-child td {
  border-bottom: 0;
}

.assistant-bubble.is-markdown th {
  color: var(--color-ink);
  background: rgba(144, 100, 245, 0.08);
  font-weight: 900;
}

.assistant-bubble.is-markdown blockquote {
  margin: 0.55rem 0 0.85rem;
  border-left: 3px solid rgba(144, 100, 245, 0.45);
  padding-left: 0.75rem;
  color: var(--color-ink-muted);
}

.assistant-meta {
  padding: 0 0.375rem;
  color: var(--color-ink-dim);
  font-size: 0.6875rem;
  font-weight: 700;
}

.assistant-prompts {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0 1rem 0.875rem;
  border-top: 1px solid var(--color-border);
  scrollbar-width: none;
}

.assistant-prompts::-webkit-scrollbar {
  display: none;
}

.assistant-chip {
  flex: 0 0 auto;
  height: 2rem;
  border: 1px solid rgba(144, 100, 245, 0.2);
  border-radius: 999px;
  padding: 0 0.75rem;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.assistant-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(144, 100, 245, 0.4);
}

.assistant-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.875rem 1rem 1rem;
  background: var(--color-bg-elev);
  border-top: 1px solid var(--color-border);
}

.assistant-input {
  flex: 1;
  min-height: 2.625rem;
  max-height: 7.5rem;
  resize: none;
  border: 1px solid var(--color-border);
  border-radius: 0.875rem;
  padding: 0.75rem 0.875rem;
  color: var(--color-ink);
  background: var(--color-bg);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.35;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.assistant-input:focus {
  border-color: rgba(144, 100, 245, 0.5);
  box-shadow: 0 0 0 3px rgba(144, 100, 245, 0.12);
}

.assistant-send {
  width: 2.625rem;
  height: 2.625rem;
  flex: 0 0 auto;
  border: none;
  border-radius: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--gradient-accent);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.assistant-send:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.assistant-send:disabled {
  cursor: not-allowed;
  filter: grayscale(0.35);
  opacity: 0.56;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .assistant-sprite-image,
  .assistant-callout {
    animation: none;
  }
}

@media (max-width: 35rem) {
  .site-assistant {
    right: 1rem;
    bottom: 1rem;
    left: 1rem;
    top: auto;
    transform: none;
    --assistant-icon-size: 76px;
    --assistant-frame-size: 68px;
    --assistant-sprite-width: 6256px;
    --assistant-sprite-end: -6188px;
  }

  .site-assistant.is-hidden {
    left: auto;
  }

  .assistant-resident {
    width: 100%;
    align-items: flex-end;
    gap: 0.625rem;
  }

  .assistant-callout {
    flex: 1;
    width: auto;
    min-height: 2.75rem;
    margin: 0 0 0.45rem;
    padding: 0.55rem 0.75rem;
    border-radius: 1rem 1rem 0.35rem 1rem;
    font-size: 0.75rem;
    line-height: 1.32;
  }

  .assistant-launcher {
    width: var(--assistant-icon-size);
    height: var(--assistant-icon-size);
    flex-basis: var(--assistant-icon-size);
  }

  .assistant-hide {
    top: -0.35rem;
    right: -0.2rem;
    width: 1.75rem;
    height: 1.75rem;
  }

  .assistant-panel {
    right: 0;
    left: 0;
    top: auto;
    bottom: 5.65rem;
    width: 100%;
    height: min(34rem, calc(100vh - 7rem));
    border-radius: 1rem;
    transform: translateY(16px) scale(0.98);
  }

  .site-assistant.is-open .assistant-panel {
    transform: translateY(0) scale(1);
  }

  .assistant-message {
    max-width: 90%;
  }
}
