body {
  background:
    linear-gradient(rgba(247, 245, 250, 0.96), rgba(247, 245, 250, 1)),
    url("/assets/backgrounds/liuli-reading-room.webp") center 70% / cover fixed;
}

[hidden] {
  display: none !important;
}

body.settings-pending [data-settings-text] {
  visibility: hidden;
}

.site-header {
  position: relative;
  z-index: 20;
  height: var(--header-height);
  border-bottom: 1px solid var(--line);
  background: rgba(250, 248, 252, 0.92);
  backdrop-filter: blur(18px);
  animation: header-enter 540ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.site-header.is-overlay {
  position: absolute;
  inset: 0 0 auto;
  border-bottom-color: rgba(65, 62, 95, 0.1);
  background: rgba(250, 248, 252, 0.82);
}

.header-inner {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  font-family: "Noto Serif SC", "Songti SC", "Microsoft YaHei UI", serif;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(101, 118, 222, 0.22);
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.brand-mark img {
  width: 18px;
  height: 18px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  position: relative;
  padding: 12px 14px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 14px;
  transition:
    color 160ms ease,
    background-color 160ms ease;
}

.nav-link::before {
  position: absolute;
  right: 50%;
  bottom: 4px;
  left: 50%;
  height: 2px;
  border-radius: 99px;
  background: var(--blue);
  opacity: 0;
  content: "";
  transition:
    right 180ms ease,
    left 180ms ease,
    opacity 180ms ease;
}

.nav-link:hover::before {
  right: 14px;
  left: 14px;
  opacity: 0.55;
}

.nav-link:hover {
  color: var(--ink);
}

.nav-link[aria-current="page"] {
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
}

.nav-link[aria-current="page"]::after {
  position: absolute;
  right: 14px;
  bottom: 5px;
  left: 14px;
  height: 2px;
  border-radius: 99px;
  background: var(--blue);
  content: "";
}

.header-action {
  margin-left: 14px;
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  margin-left: auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.menu-toggle img {
  width: 20px;
  height: 20px;
}

.hero {
  position: relative;
  min-height: min(840px, calc(100vh - 34px));
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  animation: hero-breathe 1100ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.hero::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(249, 248, 252, 0.98) 0%,
    rgba(249, 248, 252, 0.9) 31%,
    rgba(249, 248, 252, 0.48) 50%,
    rgba(249, 248, 252, 0.04) 72%
  );
  content: "";
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: min(840px, calc(100vh - 34px));
  align-items: center;
  padding: 80px 0;
}

.hero-copy {
  width: min(570px, 48%);
}

.hero-copy > * {
  animation: rise-in 620ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.hero-copy > :nth-child(1) {
  animation-delay: 90ms;
}

.hero-copy > :nth-child(2) {
  animation-delay: 180ms;
}

.hero-copy > :nth-child(3) {
  animation-delay: 270ms;
}

.hero h1 {
  font-family: "Noto Serif SC", "Songti SC", "Microsoft YaHei UI", serif;
  font-size: clamp(56px, 5.6vw, 82px);
  font-weight: 520;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.hero-title {
  max-width: 480px;
  margin-top: 26px;
  font-size: clamp(24px, 2.5vw, 38px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.35;
}

.hero-intro {
  max-width: 550px;
  margin-top: 22px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.85;
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.hero-character {
  position: absolute;
  right: 7%;
  bottom: 0;
  z-index: 3;
  width: min(38vw, 560px);
  max-height: 88%;
  object-fit: contain;
  object-position: bottom;
  pointer-events: none;
}

.hero-note {
  position: absolute;
  right: 32px;
  bottom: 24px;
  z-index: 4;
  max-width: 310px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 12px;
  background: rgba(45, 45, 66, 0.56);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  line-height: 1.65;
  backdrop-filter: blur(12px);
}

.page-shell {
  padding: 116px 0 96px;
}

.page-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 410px);
  gap: 64px;
  align-items: end;
  padding-bottom: 54px;
  border-bottom: 1px solid var(--line);
}

.page-intro h1 {
  font-family: "Noto Serif SC", "Songti SC", "Microsoft YaHei UI", serif;
  font-size: clamp(48px, 6vw, 78px);
  font-weight: 520;
  letter-spacing: -0.045em;
  line-height: 1;
}

.page-intro p {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.9;
}

.section {
  padding: 92px 0;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
}

.section-heading h2 {
  font-family: "Noto Serif SC", "Songti SC", "Microsoft YaHei UI", serif;
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 540;
  letter-spacing: -0.035em;
}

.section-heading p {
  max-width: 430px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
}

.resource-list {
  border-top: 1px solid var(--line);
}

.resource-row {
  display: grid;
  grid-template-columns: 60px minmax(180px, 0.8fr) minmax(240px, 1.4fr) auto;
  gap: 24px;
  align-items: center;
  min-height: 112px;
  padding: 22px 4px;
  border-bottom: 1px solid var(--line);
}

.resource-mark,
.feature-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid rgba(101, 118, 222, 0.2);
  border-radius: 50%;
  background: rgba(229, 231, 251, 0.64);
  color: var(--blue-deep);
}

.resource-mark img,
.feature-icon img {
  width: 21px;
  height: 21px;
}

.resource-mark.has-preview {
  width: 92px;
  height: 64px;
  overflow: hidden;
  border-radius: 14px;
}

.resource-mark .resource-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resource-row:has(.resource-mark.has-preview) {
  grid-template-columns: 92px minmax(180px, 0.8fr) minmax(240px, 1.4fr) auto;
}

.resource-title {
  font-size: 18px;
  font-weight: 650;
}

.resource-meta {
  display: flex;
  gap: 14px;
  margin-top: 7px;
  color: var(--ink-faint);
  font-size: 12px;
}

.resource-summary {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.resource-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.75fr);
  gap: 72px;
}

.game-feature {
  position: relative;
  min-height: 340px;
  overflow: hidden;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #e8e7f4;
}

.game-feature-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-feature::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 253, 251, 0.96) 0%,
    rgba(255, 253, 251, 0.82) 48%,
    rgba(255, 253, 251, 0.08) 100%
  );
  content: "";
}

.game-feature::after {
  position: absolute;
  right: -70px;
  bottom: -90px;
  width: 300px;
  height: 300px;
  border: 1px solid rgba(101, 118, 222, 0.2);
  border-radius: 50%;
  content: "";
}

.game-feature .feature-icon,
.game-feature h3 {
  position: relative;
  z-index: 1;
  margin-top: 26px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 38px;
  font-weight: 540;
}

.game-feature p {
  position: relative;
  z-index: 1;
  max-width: 300px;
  margin-top: 14px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.8;
}

.game-feature .feature-icon {
  position: relative;
  z-index: 1;
}

.game-feature .button {
  position: absolute;
  bottom: 32px;
  left: 34px;
  z-index: 2;
}

.announcement {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  animation: rise-in 560ms 360ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.announcement img {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 34px;
}

.search-box {
  position: relative;
  flex: 1 1 310px;
}

.search-box img {
  position: absolute;
  top: 50%;
  left: 18px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  opacity: 0.52;
}

.search-box input {
  width: 100%;
  height: 50px;
  padding: 0 54px 0 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 251, 0.7);
  outline: 0;
}

.search-box input:focus {
  border-color: rgba(101, 118, 222, 0.6);
  box-shadow: 0 0 0 4px rgba(101, 118, 222, 0.1);
}

.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 251, 0.62);
  color: var(--ink-soft);
  font-size: 13px;
}

.filter-button:hover,
.filter-button.is-active {
  border-color: rgba(101, 118, 222, 0.4);
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.game-grid:has(> .game-card:only-child) {
  grid-template-columns: minmax(0, 900px);
  justify-content: center;
}

.game-card {
  position: relative;
  display: grid;
  min-height: 300px;
  align-content: end;
  overflow: hidden;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-strong);
}

.game-card-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(28, 29, 47, 0.78), rgba(28, 29, 47, 0) 72%);
  content: "";
}

.game-card:not(.has-image) {
  border-color: rgba(101, 118, 222, 0.2);
  background: rgba(255, 253, 251, 0.76);
  color: var(--ink);
}

.game-card:not(.has-image)::after {
  display: none;
}

.game-card.has-image {
  color: #fff;
}

.game-card-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.game-card h2 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 32px;
  font-weight: 540;
}

.game-card p {
  max-width: 430px;
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.game-card.has-image p {
  color: rgba(255, 255, 255, 0.9);
}

.game-card .button {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

.game-card:not(.has-image) .button {
  background: var(--blue);
  color: #fff;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}

.gallery-grid:has(> .gallery-item:only-child) {
  grid-template-columns: minmax(0, 860px);
  justify-content: center;
}

.gallery-grid:has(> .gallery-item:only-child) .gallery-item {
  grid-column: auto;
  min-height: 430px;
}

.gallery-loading,
.gallery-empty {
  display: grid;
  grid-column: 1 / -1;
  min-height: 240px;
  place-items: center;
  color: var(--ink-faint);
}

.gallery-item {
  position: relative;
  grid-column: span 4;
  min-height: 280px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--paper-muted);
}

.gallery-item:nth-child(4n + 2),
.gallery-item:nth-child(4n + 4) {
  grid-column: span 3;
}

.gallery-item:nth-child(4n + 1) {
  grid-column: span 5;
}

.gallery-item:nth-child(3n + 1) {
  min-height: 360px;
}

.gallery-item button {
  width: 100%;
  height: 100%;
  color: inherit;
  text-align: left;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  transition: transform 300ms ease;
}

.gallery-item:hover .progressive-main {
  transform: scale(1.025);
}

[data-progressive] {
  position: relative;
}

.progressive-blur,
.progressive-main {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.progressive-blur {
  filter: blur(14px);
  transform: scale(1.08);
  transition: opacity 240ms ease;
}

.progressive-main {
  opacity: 0;
  transition:
    opacity 280ms ease,
    transform 300ms ease;
}

[data-progressive].is-loaded .progressive-main {
  opacity: 1;
}

[data-progressive].is-loaded .progressive-blur {
  opacity: 0;
}

[data-progressive].is-failed .progressive-main {
  display: none;
}

.gallery-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 50px 20px 18px;
  background: linear-gradient(transparent, rgba(24, 25, 41, 0.75));
  color: #fff;
}

.gallery-caption strong {
  display: block;
  font-size: 16px;
}

.gallery-caption span {
  display: block;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.about-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.3fr);
  gap: 96px;
  padding-top: 42px;
}

body[data-page="about"] .page-intro {
  grid-template-columns: 1fr;
}

.about-aside {
  display: grid;
  align-content: start;
  gap: 14px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.8;
}

.about-stat {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 251, 0.68);
}

.about-stat span {
  display: block;
  color: var(--ink-faint);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.about-stat strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 520;
  line-height: 1;
}

.about-body {
  max-width: 720px;
}

.about-body h2 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(30px, 4vw, 52px);
  font-weight: 540;
  line-height: 1.3;
}

.about-body p {
  margin-top: 28px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 2;
}

.about-links {
  display: grid;
  gap: 0;
  margin-top: 54px;
  border-top: 1px solid var(--line);
}

.about-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.tool-section {
  padding-top: 12px;
}

.tool-grid {
  display: grid;
  border-top: 1px solid var(--line);
}

.tool-card {
  display: grid;
  grid-template-columns: 48px 52px minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 26px 4px;
  border-bottom: 1px solid var(--line);
}

.tool-index {
  color: var(--ink-faint);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 13px;
  letter-spacing: 0.12em;
}

.tool-card-copy h2 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 25px;
  font-weight: 540;
}

.tool-card-copy p {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.tool-card .button {
  white-space: nowrap;
}

.builtin-tools {
  padding-top: 28px;
}

.builtin-tools .section-heading {
  align-items: end;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.tool-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-top: 38px;
}

.tool-upload-card {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 253, 251, 0.78);
  box-shadow: 0 18px 44px rgba(50, 47, 86, 0.07);
  backdrop-filter: blur(14px);
}

.tool-upload-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tool-upload-head .feature-icon {
  flex: 0 0 auto;
}

.tool-upload-head h3 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 27px;
  font-weight: 540;
}

.tool-upload-head p {
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.65;
}

.tool-dropzone {
  display: grid;
  min-height: 164px;
  place-items: center;
  align-content: center;
  gap: 13px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: rgba(238, 236, 245, 0.42);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.tool-dropzone img {
  width: 28px;
  height: 28px;
  opacity: 0.62;
}

.tool-dropzone:hover,
.tool-dropzone:focus-visible,
.tool-dropzone.is-dragging {
  border-color: rgba(101, 118, 222, 0.55);
  background: rgba(229, 231, 251, 0.72);
}

.tool-dropzone.is-dragging {
  transform: translateY(-2px);
}

.tool-dropzone:disabled {
  cursor: wait;
  opacity: 0.72;
}

.tool-progress {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(101, 118, 222, 0.12);
}

.tool-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 180ms ease;
}

.tool-progress.is-indeterminate span {
  width: 38% !important;
  animation: tool-progress-slide 1.15s ease-in-out infinite;
}

.tool-upload-card.is-processing .tool-progress {
  background: rgba(101, 118, 222, 0.16);
}

@keyframes tool-progress-slide {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(285%);
  }
}

.tool-status {
  min-height: 22px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.tool-status[data-tone="error"] {
  color: var(--danger);
}

.tool-status[data-tone="success"] {
  color: var(--success);
}

.tool-download {
  justify-self: start;
  margin-top: 8px;
}

.nav-auth {
  flex: 0 0 auto;
  max-width: 180px;
  padding: 9px 14px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 253, 251, 0.76);
  color: var(--ink-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-auth.is-authenticated {
  border-color: rgba(101, 118, 222, 0.3);
  background: var(--blue-soft);
  color: var(--blue-deep);
}

.user-auth-dialog {
  width: min(520px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.user-auth-dialog::backdrop {
  background: rgba(32, 32, 52, 0.58);
  backdrop-filter: blur(5px);
}

.user-auth-card {
  position: relative;
  padding: 32px;
}

.user-auth-card > .dialog-close {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 18px;
}

.user-auth-card h2 {
  margin-top: 8px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(28px, 6vw, 40px);
  font-weight: 540;
}

.eyebrow {
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-copy,
.auth-note {
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.8;
}

.auth-note {
  color: var(--ink-faint);
  font-size: 12px;
}

.auth-welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.auth-form .field,
.guestbook-form .field {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
}

.auth-form input,
.guestbook-form textarea,
.chat-composer textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
  outline: none;
}

.auth-form input:focus,
.guestbook-form textarea:focus,
.chat-composer textarea:focus {
  border-color: rgba(101, 118, 222, 0.55);
  box-shadow: 0 0 0 3px rgba(101, 118, 222, 0.1);
}

.auth-form .button {
  width: 100%;
}

.auth-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 12px;
}

.auth-switch {
  margin-top: 18px;
}

.auth-account-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}

.auth-account-head h2 {
  margin-top: 4px;
  font-size: 30px;
}

.auth-avatar {
  display: grid;
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(101, 118, 222, 0.24);
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 26px;
}

.level-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border: 1px solid rgba(101, 118, 222, 0.2);
  border-radius: 999px;
  background: rgba(229, 231, 251, 0.72);
  color: var(--blue-deep);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.level-4,
.level-5 {
  border-color: rgba(166, 127, 68, 0.26);
  background: rgba(235, 218, 188, 0.48);
  color: #75552b;
}

.level-6 {
  border-color: rgba(124, 92, 184, 0.32);
  background: linear-gradient(135deg, #ece6fb, #f5e9dc);
  color: #5d438e;
}

.auth-progress {
  margin: 24px 0;
}

.auth-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-faint);
  font-size: 11px;
}

.auth-progress-bar {
  height: 7px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.auth-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #a69bdd);
  transition: width 260ms ease;
}

.chat-layout,
.guestbook-layout {
  display: grid;
  gap: 24px;
  align-items: start;
}

.chat-layout {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.3fr);
}

.chat-panel,
.chat-sidebar,
.guestbook-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 253, 251, 0.72);
  backdrop-filter: blur(14px);
}

.chat-panel {
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.chat-head h2 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 26px;
  font-weight: 540;
}

.chat-presence {
  color: var(--ink-faint);
  font-size: 12px;
}

.chat-feed {
  display: flex;
  min-height: 500px;
  max-height: 62vh;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  padding: 24px;
}

.chat-message {
  display: grid;
  max-width: min(78%, 620px);
  gap: 7px;
  align-self: flex-start;
}

.chat-message.is-own {
  align-self: flex-end;
}

.chat-message-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-faint);
  font-size: 11px;
}

.chat-message.is-own .chat-message-head {
  justify-content: flex-end;
}

.chat-bubble {
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 5px 16px 16px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-message.is-own .chat-bubble {
  border-color: rgba(101, 118, 222, 0.18);
  border-radius: 16px 5px 16px 16px;
  background: var(--blue-soft);
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 18px 20px;
  border-top: 1px solid var(--line);
}

.chat-composer textarea {
  min-height: 52px;
  max-height: 160px;
  resize: vertical;
}

.chat-composer-meta {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-faint);
  font-size: 11px;
}

.chat-sidebar {
  padding: 24px;
}

.chat-sidebar h3 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 20px;
  font-weight: 540;
}

.chat-sidebar p {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.8;
}

.chat-current-user {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.chat-locked,
.guestbook-locked {
  display: grid;
  min-height: 300px;
  place-items: center;
  padding: 34px;
  text-align: center;
}

.chat-locked p,
.guestbook-locked p {
  max-width: 460px;
  margin: 12px auto 20px;
  color: var(--ink-soft);
  line-height: 1.8;
}

.guestbook-layout {
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.55fr);
}

.guestbook-panel {
  padding: 24px;
}

.guestbook-list {
  display: grid;
  gap: 0;
}

.guestbook-message {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.guestbook-message:last-child {
  border-bottom: 0;
}

.guestbook-message-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  color: var(--ink-faint);
  font-size: 11px;
}

.guestbook-message-head strong {
  color: var(--ink);
  font-size: 14px;
}

.guestbook-message p {
  margin-top: 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.guestbook-form {
  display: grid;
  gap: 14px;
}

.guestbook-form textarea {
  min-height: 150px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(250, 248, 252, 0.88);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  padding: 42px 0;
}

.footer-brand {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 20px;
  letter-spacing: 0.08em;
}

.footer-note {
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: 13px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 13px;
}

.footer-links a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 4px 0;
}

.resource-dialog,
.gallery-dialog {
  width: min(720px, calc(100% - 32px));
  max-height: min(84vh, 880px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

.resource-dialog::backdrop,
.gallery-dialog::backdrop {
  background: rgba(32, 32, 52, 0.58);
  backdrop-filter: blur(5px);
}

.resource-dialog-preview {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
}

.resource-dialog-preview[hidden] {
  display: none;
}

.dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 32px 24px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 32px;
  font-weight: 540;
}

.dialog-close {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.dialog-close img {
  width: 18px;
  height: 18px;
}

.dialog-body {
  padding: 28px 32px 34px;
}

.dialog-summary {
  color: var(--ink-soft);
  line-height: 1.75;
}

.dialog-content {
  margin-top: 22px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-wrap;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}

.gallery-dialog {
  width: min(1100px, calc(100% - 28px));
  overflow: hidden;
  background: #171824;
  color: #fff;
}

.gallery-dialog img {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
}

.gallery-dialog-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
}

.gallery-dialog-caption span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.game-page {
  display: grid;
  min-height: calc(100vh - var(--header-height));
  place-items: center;
  padding: 46px 16px;
  background:
    linear-gradient(rgba(232, 232, 248, 0.72), rgba(247, 245, 250, 0.9)),
    url("/assets/backgrounds/liuli-reading-room.webp") center / cover fixed;
}

.memory-game {
  width: min(760px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 253, 251, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.memory-game-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.memory-game h1 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(34px, 6vw, 54px);
  font-weight: 540;
}

.memory-stats {
  display: flex;
  gap: 18px;
  color: var(--ink-soft);
  font-size: 13px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.memory-card {
  position: relative;
  min-height: 110px;
  border: 1px solid rgba(101, 118, 222, 0.24);
  border-radius: 16px;
  background: var(--blue-soft);
  transform-style: preserve-3d;
  transition:
    transform 220ms ease,
    background-color 220ms ease;
}

.memory-card::before,
.memory-card::after {
  position: absolute;
  display: grid;
  inset: 0;
  place-items: center;
  border-radius: inherit;
  backface-visibility: hidden;
  content: "";
}

.memory-card::before {
  background: rgba(101, 118, 222, 0.12);
  content: "·";
}

.memory-card::after {
  background: var(--paper-strong);
  transform: rotateY(180deg);
}

.memory-card img {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  opacity: 0;
  transform: translate(-50%, -50%) rotateY(180deg);
  transition: opacity 140ms ease 120ms;
}

.memory-card.is-flipped,
.memory-card.is-matched {
  transform: rotateY(180deg);
}

.memory-card.is-flipped img,
.memory-card.is-matched img {
  opacity: 1;
}

.memory-card.is-matched {
  border-color: rgba(52, 120, 95, 0.35);
}

.memory-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}

.memory-status {
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.7;
}

.puzzle-game {
  width: min(720px, 100%);
}

.puzzle-grid {
  display: grid;
  aspect-ratio: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  overflow: hidden;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(226, 227, 243, 0.7);
}

.puzzle-tile {
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 8px;
  background-color: var(--paper-strong);
  background-repeat: no-repeat;
  background-size: 300% 300%;
  box-shadow: 0 1px 0 rgba(34, 33, 52, 0.08);
  transition:
    transform 160ms ease,
    opacity 160ms ease;
}

.puzzle-tile:not(.is-blank):hover {
  transform: scale(0.985);
}

.puzzle-tile.is-blank {
  border: 1px dashed rgba(101, 118, 222, 0.4);
  background: rgba(244, 243, 250, 0.9);
  cursor: default;
}

.puzzle-grid.is-solved {
  box-shadow: 0 0 0 6px rgba(101, 118, 222, 0.09);
}

.rain-game {
  width: min(860px, 100%);
}

.rain-playfield {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: url("/assets/games/rain-bean-v2.webp") center / cover;
  touch-action: manipulation;
}

.rain-playfield::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(248, 247, 252, 0.06), rgba(47, 44, 72, 0.12));
  content: "";
  pointer-events: none;
}

.rain-start {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  min-width: 170px;
  transform: translate(-50%, -50%);
  box-shadow: 0 14px 34px rgba(46, 42, 92, 0.2);
}

.rain-bean {
  position: absolute;
  z-index: 2;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 250, 244, 0.76);
  box-shadow:
    0 0 0 7px rgba(255, 244, 218, 0.25),
    0 0 24px rgba(255, 219, 141, 0.7);
  transform: translate(-50%, -50%);
  animation: bean-in 180ms ease-out both;
}

.rain-bean-shape {
  width: 24px;
  height: 32px;
  border-radius: 50% 45% 48% 50%;
  background: linear-gradient(135deg, #8f5a3c, #553122);
  box-shadow: inset 4px 3px 7px rgba(255, 229, 206, 0.24);
  transform: rotate(28deg);
}

.rain-bean-shape::after {
  display: block;
  width: 2px;
  height: 24px;
  margin: 4px auto 0;
  border-radius: 2px;
  background: rgba(51, 26, 17, 0.7);
  content: "";
  transform: rotate(-7deg);
}

@keyframes bean-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.55);
  }
}

@media (max-width: 1120px) {
  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-panel {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    width: min(540px, 56%);
  }

  .home-grid {
    grid-template-columns: 1fr;
    gap: 56px;
  }

  .game-feature {
    min-height: 360px;
  }

  .gallery-item,
  .gallery-item:nth-child(n) {
    grid-column: span 6;
  }
}

@media (max-width: 820px) {
  :root {
    --header-height: 68px;
  }

  .site-header.is-overlay {
    position: absolute;
  }

  .site-nav {
    position: absolute;
    top: calc(var(--header-height) - 1px);
    right: 16px;
    left: 16px;
    display: none;
    align-items: stretch;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 253, 251, 0.98);
    box-shadow: var(--shadow);
  }

  .site-nav.is-open {
    display: grid;
  }

  .nav-link {
    padding: 14px;
    border-radius: 10px;
  }

  .nav-link[aria-current="page"] {
    background: var(--blue-soft);
  }

  .nav-link[aria-current="page"]::after {
    display: none;
  }

  .header-action {
    display: inline-flex;
    width: 100%;
    margin: 4px 0 0;
  }

  .menu-toggle {
    display: grid;
  }

  .hero {
    min-height: 760px;
  }

  .hero::before {
    background: linear-gradient(
      180deg,
      rgba(249, 248, 252, 0.98) 0%,
      rgba(249, 248, 252, 0.92) 48%,
      rgba(249, 248, 252, 0.3) 80%
    );
  }

  .hero-inner {
    min-height: 760px;
    align-items: start;
    padding-top: 88px;
  }

  .hero-copy {
    width: 100%;
  }

  .hero h1 {
    font-size: clamp(48px, 12vw, 72px);
  }

  .hero-title {
    font-size: 25px;
  }

  .hero-character {
    right: 0;
    width: min(72vw, 440px);
    max-height: 52%;
  }

  .hero-note {
    right: 16px;
    bottom: 16px;
    left: 16px;
    max-width: none;
  }

  .page-shell {
    padding-top: 82px;
  }

  .ai-panel {
    padding: 28px;
  }

  .page-intro {
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
  }

  .section {
    padding: 68px 0;
  }

  .section-heading {
    display: grid;
  }

  .resource-row {
    grid-template-columns: 52px 1fr auto;
    gap: 16px;
    padding: 20px 2px;
  }

  .resource-row:has(.resource-mark.has-preview) {
    grid-template-columns: 84px 1fr auto;
  }

  .resource-mark.has-preview {
    width: 84px;
    height: 60px;
  }

  .resource-summary {
    grid-column: 2 / -1;
  }

  .resource-actions {
    grid-column: 2 / -1;
  }

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

  .gallery-grid {
    gap: 14px;
  }

  .gallery-item,
  .gallery-item:nth-child(n) {
    grid-column: span 12;
    min-height: 300px;
  }

  .about-layout {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .tool-card {
    grid-template-columns: 40px 1fr auto;
  }

  .tool-card .feature-icon {
    display: none;
  }

  .tool-card-copy {
    grid-column: 2 / -1;
  }

  .tool-card .button {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .chat-layout,
  .guestbook-layout {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    order: -1;
  }

  .footer-inner {
    grid-template-columns: 1fr;
  }

  .memory-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .brand {
    font-size: 17px;
  }

  .hero,
  .hero-inner {
    min-height: 720px;
  }

  .hero-actions {
    display: grid;
    width: 100%;
  }

  .hero-actions .button {
    width: 100%;
  }

  .ai-section {
    padding-top: 34px;
  }

  .ai-panel {
    grid-template-columns: 1fr;
    padding: 24px 18px;
    border-radius: 20px;
  }

  .ai-panel-copy {
    grid-template-columns: 1fr;
  }

  .ai-form {
    grid-template-columns: 1fr;
  }

  .ai-submit {
    width: 100%;
  }

  .section-heading h2 {
    font-size: 32px;
  }

  .resource-row {
    grid-template-columns: 46px 1fr;
  }

  .resource-mark {
    width: 44px;
    height: 44px;
  }

  .resource-actions {
    grid-column: 1 / -1;
  }

  .game-feature {
    min-height: 380px;
    padding: 26px;
  }

  .game-feature .button {
    bottom: 26px;
    left: 26px;
  }

  .game-card {
    min-height: 330px;
    padding: 24px;
  }

  .game-card-content {
    display: grid;
  }

  .dialog-head,
  .dialog-body {
    padding-inline: 22px;
  }

  .memory-game {
    padding: 22px;
  }

  .memory-game-head {
    display: grid;
  }

  .memory-grid {
    gap: 8px;
  }

  .memory-card {
    min-height: 82px;
  }

  .rain-playfield {
    aspect-ratio: 4 / 5;
  }

  .user-auth-card {
    padding: 28px 20px 22px;
  }

  .auth-progress-head {
    display: grid;
  }

  .chat-feed {
    min-height: 420px;
    padding: 18px;
  }

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

  .chat-composer {
    grid-template-columns: 1fr;
  }

  .chat-composer .button {
    width: 100%;
  }

  .guestbook-panel {
    padding: 20px;
  }
}
.ai-section {
  padding-top: 56px;
  padding-bottom: 64px;
}

.ai-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(0, 1.25fr);
  gap: 34px;
  padding: 38px;
  overflow: hidden;
  border: 1px solid rgba(101, 118, 222, 0.2);
  border-radius: 24px;
  background: rgba(255, 253, 251, 0.78);
  box-shadow: 0 22px 60px rgba(57, 53, 95, 0.07);
  backdrop-filter: blur(14px);
}

.ai-panel-copy {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: start;
}

.ai-orb {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(101, 118, 222, 0.22);
  border-radius: 50%;
  background: var(--blue-soft);
  box-shadow: 0 0 0 0 rgba(101, 118, 222, 0);
  animation: soft-pulse 4s ease-in-out infinite;
}

.ai-orb img {
  width: 23px;
  height: 23px;
}

.ai-panel-copy h2 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 540;
  letter-spacing: -0.035em;
  line-height: 1.25;
  text-wrap: balance;
}

.ai-panel-copy p {
  max-width: 380px;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
}

.ai-form {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-self: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.ai-form:focus-within {
  border-color: rgba(101, 118, 222, 0.55);
  box-shadow:
    0 0 0 4px rgba(101, 118, 222, 0.09),
    0 14px 38px rgba(72, 68, 116, 0.08);
}

.ai-input-wrap {
  display: flex;
  min-width: 0;
  align-items: center;
}

.ai-form textarea {
  width: 100%;
  max-height: 150px;
  min-height: 46px;
  padding: 12px 15px;
  overflow-y: auto;
  border: 0;
  background: transparent;
  outline: 0;
  resize: none;
  font-size: 14px;
  line-height: 1.6;
}

.ai-form textarea::placeholder {
  color: var(--ink-faint);
}

.ai-submit {
  align-self: end;
  min-width: 92px;
}

.ai-submit:disabled {
  cursor: wait;
  opacity: 0.62;
}

.ai-feedback {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  margin: 1px 8px 0;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
  animation: rise-in 300ms ease both;
}

.ai-feedback[data-tone="error"] {
  color: var(--danger);
}

.reveal-on-scroll {
  opacity: 0;
  transform: translateY(24px);
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
  animation: section-reveal 640ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.resource-row,
.gallery-item,
.game-card {
  animation: item-enter 500ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.resource-row:nth-child(2),
.gallery-item:nth-child(2),
.game-card:nth-child(2) {
  animation-delay: 60ms;
}

.resource-row:nth-child(3),
.gallery-item:nth-child(3),
.game-card:nth-child(3) {
  animation-delay: 120ms;
}

.resource-row:nth-child(4),
.gallery-item:nth-child(4),
.game-card:nth-child(4) {
  animation-delay: 180ms;
}

.site-nav.is-open {
  animation: menu-enter 240ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

@keyframes header-enter {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes hero-breathe {
  from {
    opacity: 0.55;
    transform: scale(1.04);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes section-reveal {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes item-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes menu-enter {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes soft-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(101, 118, 222, 0);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(101, 118, 222, 0.07);
  }
}


@media (prefers-reduced-motion: reduce) {
  .site-header,
  .hero-background,
  .hero-copy > *,
  .announcement,
  .resource-row,
  .gallery-item,
  .game-card,
  .rain-bean,
  .ai-feedback,
  .ai-orb,
  .site-nav.is-open {
    animation: none !important;
  }

  .reveal-on-scroll,
  .reveal-on-scroll.is-visible {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 1120px) {
  .ai-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .ai-section {
    padding-top: 34px;
  }

  .ai-panel {
    grid-template-columns: 1fr;
    padding: 24px 18px;
    border-radius: 20px;
  }

  .ai-panel-copy {
    grid-template-columns: 1fr;
  }

  .ai-form {
    grid-template-columns: 1fr;
  }

  .ai-submit {
    width: 100%;
  }
}

.ai-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 470px);
  min-height: calc(100vh - var(--header-height));
  background: var(--paper-strong);
}

.ai-stage {
  position: relative;
  min-height: calc(100vh - var(--header-height));
  overflow: hidden;
  background: var(--paper-muted);
}

.ai-stage::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(
    90deg,
    rgba(249, 248, 252, 0.96) 0%,
    rgba(249, 248, 252, 0.68) 42%,
    rgba(249, 248, 252, 0.08) 78%
  );
  content: "";
  pointer-events: none;
}

.ai-stage-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  animation: hero-breathe 1000ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.ai-stage-copy {
  position: absolute;
  z-index: 2;
  top: clamp(54px, 10vh, 110px);
  left: clamp(28px, 5vw, 76px);
  width: min(560px, calc(100% - 56px));
  animation: rise-in 640ms 90ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.ai-stage-copy h1 {
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(60px, 7vw, 96px);
  font-weight: 520;
  letter-spacing: -0.05em;
  line-height: 1;
}

.ai-stage-copy p {
  max-width: 430px;
  margin-top: 26px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.9;
}

.ai-character {
  position: absolute;
  right: 2%;
  bottom: 0;
  z-index: 2;
  width: min(68%, 650px);
  max-height: 84%;
  object-fit: contain;
  object-position: bottom;
  pointer-events: none;
  animation: rise-in 700ms 180ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.chat-panel {
  position: relative;
  z-index: 3;
  display: grid;
  min-height: calc(100vh - var(--header-height));
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-left: 1px solid var(--line);
  background: rgba(255, 253, 251, 0.96);
  box-shadow: -24px 0 60px rgba(49, 46, 82, 0.07);
  animation: chat-panel-enter 560ms 120ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 84px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}

.chat-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(101, 118, 222, 0.2);
  border-radius: 50%;
  background: var(--blue-soft);
}

.chat-avatar img {
  width: 18px;
  height: 18px;
}

.chat-head h2 {
  font-size: 16px;
  font-weight: 650;
}

.chat-head p {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 11px;
}

.chat-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tea);
  box-shadow: 0 0 0 3px var(--tea-soft);
}

.chat-log {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 16px;
  padding: 26px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chat-message {
  width: fit-content;
  max-width: 88%;
  padding: 13px 15px 14px;
  border: 1px solid var(--line);
  border-radius: 4px 16px 16px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.72;
  animation: chat-message-in 280ms cubic-bezier(0.2, 0.72, 0.2, 1) both;
}

.chat-message.is-user {
  align-self: end;
  border-color: transparent;
  border-radius: 16px 4px 16px 16px;
  background: var(--blue);
  color: #fff;
}

.chat-message.is-assistant {
  align-self: start;
}

.chat-message.is-notice {
  width: 100%;
  max-width: none;
  border-style: dashed;
  background: rgba(244, 227, 215, 0.34);
  text-align: center;
}

.chat-message-author {
  display: block;
  margin-bottom: 5px;
  color: var(--blue-deep);
  font-size: 11px;
  font-weight: 700;
}

.chat-message.is-user .chat-message-author {
  color: rgba(255, 255, 255, 0.72);
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: -4px;
}

.chat-suggestions button {
  min-height: 31px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  font-size: 11px;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.chat-suggestions button:hover {
  border-color: rgba(101, 118, 222, 0.45);
  color: var(--blue-deep);
  transform: translateY(-1px);
}

.chat-compose-area {
  padding: 15px 18px 16px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 251, 0.9);
}

.chat-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.chat-composer:focus-within {
  border-color: rgba(101, 118, 222, 0.56);
  box-shadow: 0 0 0 4px rgba(101, 118, 222, 0.09);
}

.chat-input-wrap {
  display: flex;
  min-width: 0;
  align-items: center;
}

.chat-input-wrap textarea {
  width: 100%;
  min-height: 42px;
  max-height: 124px;
  padding: 10px 12px;
  overflow-y: auto;
  border: 0;
  background: transparent;
  outline: 0;
  resize: none;
  font-size: 13px;
  line-height: 1.6;
}

.chat-input-wrap textarea::placeholder {
  color: var(--ink-faint);
}

.chat-send {
  align-self: end;
  min-height: 42px;
  padding-inline: 16px;
}

.chat-caption {
  margin-top: 8px;
  color: var(--ink-faint);
  font-size: 10px;
  text-align: center;
}

@keyframes chat-panel-enter {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 820px) {
  .tool-upload-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .tool-upload-card {
    padding: 22px;
  }

  .tool-dropzone {
    min-height: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tool-dropzone,
  .tool-progress span {
    transition: none;
    animation: none;
  }
}

@keyframes chat-message-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1040px) {
  .ai-workspace {
    grid-template-columns: 1fr;
  }

  .ai-stage {
    min-height: 560px;
  }

  .chat-panel {
    min-height: 650px;
    border-top: 1px solid var(--line);
    border-left: 0;
    box-shadow: none;
  }
}

@media (max-width: 560px) {
  .ai-stage {
    min-height: 440px;
  }

  .ai-stage::after {
    background: linear-gradient(
      180deg,
      rgba(249, 248, 252, 0.96) 0%,
      rgba(249, 248, 252, 0.78) 60%,
      rgba(249, 248, 252, 0.24) 100%
    );
  }

  .ai-stage-copy {
    top: 38px;
    left: 22px;
    width: calc(100% - 44px);
  }

  .ai-stage-copy h1 {
    font-size: clamp(48px, 15vw, 66px);
  }

  .ai-stage-copy p {
    max-width: 330px;
    margin-top: 18px;
    font-size: 13px;
  }

  .ai-character {
    right: -8%;
    width: 84%;
    max-height: 72%;
  }

  .chat-panel {
    min-height: 620px;
  }

  .chat-head {
    min-height: 72px;
    padding: 15px 18px;
  }

  .chat-log {
    padding: 20px 16px;
  }

  .chat-compose-area {
    padding: 12px;
  }

  .chat-composer {
    grid-template-columns: 1fr;
  }

  .chat-send {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-stage-background,
  .ai-stage-copy,
  .ai-character,
  .chat-panel,
  .chat-message {
    animation: none !important;
  }
}
