:root {
  --bg: #f5eee5;
  --surface: rgba(255, 252, 247, 0.94);
  --surface-strong: rgba(255, 248, 241, 0.99);
  --border: rgba(92, 57, 38, 0.18);
  --ink: #241813;
  --muted: #665247;
  --accent: #8d2c1e;
  --accent-dark: #722214;
  --success: #215b40;
  --success-bg: rgba(33, 91, 64, 0.1);
  --error: #972c1c;
  --error-bg: rgba(151, 44, 28, 0.11);
  --shadow: 0 22px 60px rgba(68, 32, 16, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(214, 124, 87, 0.15), transparent 32rem),
    linear-gradient(180deg, #f8f2ea 0%, var(--bg) 55%, #efe1d0 100%);
  font-family: "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 20px;
  line-height: 1.9;
}

a {
  color: inherit;
}

.page-backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 18% 18%, rgba(160, 48, 30, 0.06), transparent 20rem),
    radial-gradient(circle at 82% 12%, rgba(122, 61, 38, 0.08), transparent 18rem);
  pointer-events: none;
}

.site-header,
.page-shell {
  position: relative;
  z-index: 1;
}

.site-header {
  padding: 1.25rem 1.5rem 0;
}

.site-header-inner,
.page-shell {
  width: min(1120px, calc(100vw - 2rem));
  margin: 0 auto;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 249, 242, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(68, 32, 16, 0.08);
}

.site-brand {
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.site-nav-link,
.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1rem;
  border: 1px solid rgba(102, 63, 41, 0.16);
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.9);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 700;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.page-shell {
  display: grid;
  gap: 1.4rem;
  padding: 1.5rem 0 3rem;
}

.hero-card,
.panel,
.detail-panel {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.9rem);
}

h2 {
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
}

h3 {
  font-size: 1.18rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading p,
.section-text,
.release-body p,
.book-copy p,
.chapter-copy p,
.detail-subtitle {
  margin: 0;
  color: var(--muted);
}

.foldable-panel {
  display: grid;
  gap: 1rem;
}

.fold-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.fold-toggle .eyebrow {
  display: block;
}

.fold-title {
  display: block;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  font-weight: 700;
  line-height: 1.25;
}

.fold-arrow {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid rgba(102, 63, 41, 0.16);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--accent);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1;
  transform: rotate(-90deg);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.foldable-panel.is-collapsed .fold-arrow {
  transform: rotate(0deg);
}

.foldable-content[hidden] {
  display: none;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.2rem;
}

.portal-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  padding: 1rem 1.2rem;
  border: 1px solid rgba(102, 63, 41, 0.14);
  border-radius: 20px;
  background: var(--surface-strong);
  text-decoration: none;
  font-size: 1.08rem;
  font-weight: 700;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.release-grid,
.bookshelf-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.release-card,
.book-card,
.chapter-card {
  display: grid;
  gap: 1rem;
  border: 1px solid rgba(102, 63, 41, 0.12);
  border-radius: 24px;
  background: var(--surface-strong);
  overflow: hidden;
}

.release-image,
.book-cover,
.chapter-image,
.detail-image {
  width: 100%;
  display: block;
  object-fit: contain;
  object-position: center top;
  aspect-ratio: 4 / 5;
  background: linear-gradient(180deg, #fefcf7, #e8d6c3);
}

.release-image-placeholder,
.book-cover-placeholder,
.chapter-image-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.release-body,
.book-copy,
.chapter-copy {
  display: grid;
  gap: 0.75rem;
  padding: 0 1.1rem 1.1rem;
}

.release-body {
  gap: 0.55rem;
}

.release-body h3 {
  font-size: 1rem;
  line-height: 1.45;
}

.release-body p {
  font-size: 0.94rem;
  line-height: 1.55;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.18rem 0.58rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.badge-latest {
  color: #8d2c1e;
  background: rgba(141, 44, 30, 0.12);
}

.badge-hot {
  color: #8a6200;
  background: rgba(255, 210, 77, 0.22);
}

.meta-line {
  font-size: 0.98rem;
  color: var(--accent);
  font-weight: 700;
}

.chapter-list {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 249, 242, 0.82);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.dual-back-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.mini-portal {
  min-height: 64px;
  font-size: 1rem;
}

.detail-panel {
  width: min(900px, 100%);
  justify-self: center;
}

.detail-stack {
  display: grid;
  gap: 1.3rem;
}

.detail-image {
  border-radius: 24px;
  border: 1px solid rgba(102, 63, 41, 0.12);
  max-height: 900px;
}

.detail-title {
  font-size: clamp(1.55rem, 2.2vw, 2rem);
  line-height: 1.35;
}

.inner-panel {
  padding: 1.25rem;
  background: rgba(255, 253, 249, 0.85);
  box-shadow: none;
}

.purchase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.9rem;
}

.purchase-card {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border: 1px solid rgba(102, 63, 41, 0.12);
  border-radius: 20px;
  background: var(--surface-strong);
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.purchase-card strong {
  font-size: 1rem;
}

.purchase-label {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 700;
}

.redeem-form {
  display: grid;
  gap: 0.65rem;
}

.form-label {
  font-weight: 700;
  font-size: 1.08rem;
}

.redeem-row {
  display: flex;
  gap: 0.75rem;
}

.redeem-row input {
  flex: 1;
  min-width: 0;
  padding: 1rem 1.05rem;
  border: 1px solid rgba(102, 63, 41, 0.18);
  border-radius: 16px;
  background: #fffefb;
  color: var(--ink);
  font: inherit;
}

.redeem-row input:focus,
.redeem-row button:focus {
  outline: 2px solid rgba(143, 45, 30, 0.25);
  outline-offset: 2px;
}

.redeem-row button {
  padding: 1rem 1.3rem;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff7f1;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.message-box {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  border: 1px solid transparent;
  word-break: break-word;
}

.message-box a {
  color: inherit;
  font-weight: 700;
}

.message-box.is-success {
  color: var(--success);
  background: var(--success-bg);
  border-color: rgba(31, 92, 63, 0.18);
}

.message-box.is-error {
  color: var(--error);
  background: var(--error-bg);
  border-color: rgba(152, 45, 29, 0.18);
}

.preview-content {
  font-size: 1.22rem;
  line-height: 2;
  letter-spacing: 0.01em;
}

.preview-content p {
  margin: 0;
  text-indent: 2em;
}

.preview-content p + p {
  margin-top: 1.45rem;
}

.portal-card:hover,
.portal-card:focus-visible,
.site-nav-link:hover,
.site-nav-link:focus-visible,
.action-link:hover,
.action-link:focus-visible,
.back-link:hover,
.back-link:focus-visible,
.purchase-card:hover,
.purchase-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(143, 45, 30, 0.35);
  box-shadow: 0 14px 28px rgba(68, 32, 16, 0.1);
}

@media (max-width: 860px) {
  .site-header-inner,
  .section-heading,
  .redeem-row,
  .dual-back-row {
    flex-direction: column;
    align-items: stretch;
  }

  .portal-grid,
  .release-grid,
  .bookshelf-grid,
  .action-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .release-grid,
  .bookshelf-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .site-header {
    padding: 1rem 1rem 0;
  }

  .site-header-inner,
  .page-shell {
    width: min(100vw - 1rem, 1120px);
  }

  .hero-card,
  .panel,
  .detail-panel {
    padding: 1.15rem;
    border-radius: 22px;
  }

  .portal-grid,
  .release-grid,
  .bookshelf-grid,
  .action-row {
    grid-template-columns: 1fr;
  }

  body {
    font-size: 19px;
  }
}
