/* ========== CSS VARIABLES ========== */
:root {
  --font-serif: 'Noto Serif SC', 'SimSun', 'STSong', serif;
  --font-sans: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;

  /* Death Mansion Palette — bone-whites, decay-blacks, candelabra-gloom */
  --bg: #faf5f0;
  --bg-warm: #f5ede2;
  --bg-card: #fffdf8;
  --bg-alt: #efe7da;

  --text: #1a1110;
  --text-soft: #5c4f47;
  --text-muted: #8a7b70;

  --header-bg: #1a1110;
  --header-text: #efe3d3;

  --accent-gold: #b8963e;
  --accent-gold-light: #d4b96a;
  --accent-red: #7a1015;
  --accent-red-light: #a03535;
  --accent-shadow: #3d3022;

  --bone: #e8dcc8;
  --bone-light: #f2ece0;
  --decay: #3e3322;
  --candle: #c49a40;

  --border: #d9cbb5;
  --border-light: #e8ddd0;

  --shadow-sm: 0 1px 3px rgba(61, 48, 34, 0.08);
  --shadow-md: 0 4px 12px rgba(61, 48, 34, 0.12);
  --shadow-lg: 0 8px 30px rgba(61, 48, 34, 0.16);

  --radius: 8px;
  --radius-lg: 12px;
  --max-width: 1100px;
  --header-height: 64px;
}

/* ========== RESET ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  min-height: 100vh;
}

/* Subtle haunted wallpaper effect — very faint grunge texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(122, 16, 21, 0.015) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 30%, rgba(196, 154, 64, 0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(61, 48, 34, 0.02) 0%, transparent 50%);
  pointer-events: none;
}

a { color: var(--accent-red); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-red-light); }
img { max-width: 100%; height: auto; display: block; }

/* ========== HEADER ========== */
header {
  position: sticky; top: 0; z-index: 100;
  background: var(--header-bg);
  border-bottom: 3px solid var(--accent-red);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 24px;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--header-text);
  text-decoration: none;
}
.header-logo img {
  height: 36px;
  width: auto;
}
.header-logo:hover { color: var(--accent-gold-light); }

/* Navigation */
nav ul {
  display: flex;
  list-style: none;
  gap: 4px;
}
nav a {
  display: block;
  padding: 8px 16px;
  color: var(--header-text);
  font-size: 0.95rem;
  border-radius: var(--radius);
  transition: background 0.2s, color 0.2s;
}
nav a:hover, nav a.active {
  background: rgba(255,255,255,0.1);
  color: var(--accent-gold-light);
}

/* Header CTA Button */
.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 22px;
  background: linear-gradient(135deg, var(--accent-red), #941215);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: var(--radius);
  transition: background 0.3s, transform 0.15s;
  white-space: nowrap;
}
.btn-cta:hover {
  background: linear-gradient(135deg, #941215, var(--accent-red));
  color: #fff;
  transform: translateY(-1px);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--header-text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

/* ========== HERO ========== */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 420px;
  overflow: hidden;
  padding: 60px 24px;
  color: #fff;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 0;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(26,17,16,0.75) 0%, rgba(26,17,16,0.6) 50%, rgba(26,17,16,0.85) 100%);
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 700px;
}
.hero-tagline {
  font-family: var(--font-serif);
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.hero-subtitle {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.7;
  margin-bottom: 24px;
}
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}
.hero-meta span {
  background: rgba(255,255,255,0.12);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  border: 1px solid rgba(255,255,255,0.15);
}

/* Candelabra decorative divider */
.hero::before {
  content: '🕯️';
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.5rem;
  z-index: 3;
  filter: drop-shadow(0 0 6px rgba(196,154,64,0.6));
}

/* Page-specific hero backgrounds */
.hero-home .hero-bg { background-image: url('../img/header.webp'); }
.hero-guide .hero-bg { background-image: url('../img/screenshot-01.webp'); }
.hero-story .hero-bg { background-image: url('../img/screenshot-02.webp'); }
.hero-characters .hero-bg { background-image: url('../img/screenshot-03.webp'); }
.hero-faq .hero-bg { background-image: url('../img/header.webp'); }

/* Sub-page hero (compact) */
.hero-subpage { min-height: 240px; padding: 40px 24px 48px; }
.hero-subpage-title { font-size: 2rem; font-weight: 700; }

/* ========== SECTION LAYOUT ========== */
.section {
  padding: 64px 24px;
}
.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}
.section-alt {
  background: var(--bg-alt);
}
.section-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
  color: var(--text);
}
.section-subtitle {
  text-align: center;
  color: var(--text-soft);
  font-size: 1rem;
  margin-bottom: 40px;
}

/* Decorative candle divider between sections */
.section-divider {
  text-align: center;
  font-size: 1.2rem;
  color: var(--candle);
  margin: 48px 0;
  letter-spacing: 8px;
  user-select: none;
}

/* ========== CARDS ========== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--accent-red);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s, transform 0.2s;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}
.card h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  margin-bottom: 8px;
  color: var(--text);
}
.card p {
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ========== SCREENSHOT GALLERY ========== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.gallery-item {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s, box-shadow 0.3s;
  aspect-ratio: 16/9;
}
.gallery-item:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-lg);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: linear-gradient(transparent, rgba(26,17,16,0.85));
  color: #fff;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s;
}
.gallery-item:hover .gallery-caption { opacity: 1; }

/* ========== LIGHTBOX ========== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius);
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  z-index: 1000;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.25); }

/* ========== CTA BANNER ========== */
.cta-banner {
  background: linear-gradient(135deg, var(--decay), #2a1f14);
  text-align: center;
  padding: 56px 24px;
  color: #fff;
}
.cta-banner h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  margin-bottom: 12px;
}
.cta-banner p {
  color: var(--bone);
  margin-bottom: 24px;
  font-size: 1.05rem;
}
.btn-cta-large {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  background: linear-gradient(135deg, var(--accent-red), #8a1118);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: var(--radius);
  transition: background 0.3s, transform 0.15s;
}
.btn-cta-large:hover {
  background: linear-gradient(135deg, #8a1118, var(--accent-red));
  color: #fff;
  transform: translateY(-2px);
}

/* ========== REVIEWS ========== */
.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}
.review-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--accent-gold);
}
.review-card p {
  color: var(--text-soft);
  font-style: italic;
  line-height: 1.8;
  margin-bottom: 12px;
}
.review-card .review-author {
  font-weight: 700;
  color: var(--text);
  font-style: normal;
  font-size: 0.9rem;
}

/* ========== GUIDE PAGE ========== */
.guide-step {
  display: flex;
  gap: 20px;
  margin-bottom: 32px;
  padding: 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--accent-red);
}
.guide-step-num {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--accent-red);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  font-family: var(--font-serif);
}
.guide-step-content h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  margin-bottom: 6px;
}
.guide-step-content p {
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.8;
}
.guide-intro {
  color: var(--text-soft);
  font-size: 1.05rem;
  line-height: 1.9;
  margin-bottom: 20px;
}
.route-heading {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--accent-red);
  margin: 16px 0 6px;
}
.route-desc {
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 8px;
}

/* Tips box */
.tip-box {
  background: var(--bone-light);
  border-left: 4px solid var(--accent-gold);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0;
}
.tip-box strong {
  color: var(--decay);
}

/* Save point list */
.save-points {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
}
.save-points h3 {
  font-family: var(--font-serif);
  margin-bottom: 16px;
  color: var(--accent-red);
}
.save-points ul {
  padding-left: 20px;
  color: var(--text-soft);
  line-height: 2;
}

/* ========== STORY PAGE ========== */
.story-block {
  margin-bottom: 32px;
}
.story-block h2 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--accent-red);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-light);
}
.story-block p {
  color: var(--text-soft);
  line-height: 1.9;
  margin-bottom: 12px;
  font-size: 1rem;
}
.chapter-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text);
  margin: 16px 0 6px;
}
.ending-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  border-left: 4px solid var(--accent-gold);
}
.ending-card h3 {
  font-family: var(--font-serif);
  color: var(--decay);
  margin-bottom: 6px;
}
.ending-card p {
  color: var(--text-soft);
  font-size: 0.95rem;
}

/* ========== CHARACTERS PAGE ========== */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 24px;
}
.char-card {
  display: flex;
  gap: 20px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--accent-red);
  transition: box-shadow 0.3s;
}
.char-card:hover { box-shadow: var(--shadow-md); }
.char-card-header {
  flex-shrink: 0;
  width: 100px;
  text-align: center;
}
.char-card-header .char-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin: 0 auto 8px;
  border: 2px solid var(--border);
}
.char-card-body h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 2px;
}
.char-card-body .char-role {
  font-size: 0.85rem;
  color: var(--accent-red);
  font-weight: 600;
  margin-bottom: 8px;
}
.char-card-body p {
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.7;
}
.char-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.char-tag {
  font-size: 0.78rem;
  padding: 2px 10px;
  border-radius: 12px;
  background: var(--bone-light);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
}

/* Section sub-heading */
.section-subheading {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--decay);
  margin: 40px 0 24px;
}

/* ========== RELATIONSHIP TABLE ========== */
.rel-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.rel-table th, .rel-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
}
.rel-table th {
  background: var(--decay);
  color: var(--bone);
  font-family: var(--font-serif);
  font-weight: 700;
}
.rel-table td { color: var(--text-soft); }
.rel-table tr:last-child td { border-bottom: none; }

/* ========== FAQ PAGE ========== */
.faq-list { max-width: 800px; margin: 0 auto; }
.faq-item {
  border-bottom: 1px solid var(--border-light);
}
.faq-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: left;
  color: var(--text);
  font-family: var(--font-sans);
  transition: color 0.2s;
}
.faq-question:hover { color: var(--accent-red); }
.faq-question::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--accent-red);
  transition: transform 0.3s;
  flex-shrink: 0;
  margin-left: 12px;
}
.faq-item.active .faq-question::after {
  content: '−';
  transform: rotate(180deg);
}
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s;
}
.faq-item.active .faq-answer {
  max-height: 500px;
  padding: 0 16px 20px;
}
.faq-answer p {
  color: var(--text-soft);
  line-height: 1.8;
  font-size: 0.95rem;
}

/* ========== SYSTEM REQUIREMENTS TABLE ========== */
.sys-req-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.sys-req-table th, .sys-req-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.92rem;
}
.sys-req-table th {
  background: var(--decay);
  color: var(--bone);
  font-family: var(--font-serif);
  font-weight: 700;
  width: 30%;
}
.sys-req-table td { color: var(--text-soft); }
.sys-req-table tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

.sys-reqs-h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--accent-red);
  margin: 28px 0 12px;
}
.sys-reqs-h3:first-of-type { margin-top: 8px; }

/* ========== UTILITY CLASSES ========== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.content-section h2 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.content-list {
  list-style: disc;
  padding-left: 24px;
  color: var(--text-soft);
  line-height: 2;
}
.content-list-num {
  list-style: decimal;
  padding-left: 24px;
  color: var(--text-soft);
  line-height: 2;
}
.content-li { margin-bottom: 5px; color: var(--text-soft); }
.content-li-sm { margin-bottom: 4px; color: var(--text-soft); }
.content-li-md { margin-bottom: 8px; color: var(--text-soft); }
.content-li-lg { margin-bottom: 10px; color: var(--text-soft); }
.strong-red { color: var(--accent-red); }
.strong-gold { color: var(--accent-gold); }
.strong-muted { color: var(--text-muted); }
.strong-navy { color: var(--decay); }
.td-highlight { color: var(--accent-red); font-weight: 700; }
.intro-centered { max-width: 800px; margin: 0 auto 40px; text-align: center; }

/* ========== FOOTER ========== */
footer {
  text-align: center;
  padding: 24px;
  background: var(--header-bg);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .hero-tagline { font-size: 2rem; }
  .hero-subpage-title { font-size: 1.6rem; }
  .hero { min-height: 320px; }
  .section { padding: 40px 16px; }
  .card-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr; }
  .char-grid { grid-template-columns: 1fr; }
  .char-card { flex-direction: column; align-items: center; text-align: center; }
  .review-grid { grid-template-columns: 1fr; }

  nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--header-bg);
    flex-direction: column;
    padding: 20px;
    display: none;
    z-index: 99;
  }
  nav.active { display: flex; }
  nav ul { flex-direction: column; gap: 4px; }
  nav a { font-size: 1.1rem; padding: 14px 16px; }

  .hamburger { display: flex; }
  .header-inner nav { display: none; }
  .header-inner nav.active { display: block; }

  .guide-step { flex-direction: column; }
  .section-title { font-size: 1.6rem; }
}

@media (max-width: 480px) {
  .hero-tagline { font-size: 1.6rem; }
  .hero { min-height: 260px; padding: 40px 16px; }
  .hero-meta span { font-size: 0.8rem; padding: 4px 10px; }
  .btn-cta { padding: 7px 16px; font-size: 0.88rem; }
}
