/* ============================================================
   Haunting Havens — Haunted Havens Theme
   Ghostly-mist whites, haunting-purples, haunted-house motifs
   ============================================================ */

/* ========== CSS VARIABLES ========== */
:root {
  /* Ghostly whites & mists */
  --bg: #f8f5fa;
  --bg-warm: #f3eef8;
  --bg-alt: #ede5f5;
  --bg-card: #ffffff;
  --bg-mist: #ece4f2;

  /* Haunting purples */
  --purple-deep: #3d1a5e;
  --purple-dark: #4a2070;
  --purple-mid: #5b3a8c;
  --purple-bright: #7b52ab;
  --purple-light: #9b7ec4;
  --purple-mist: #c4b3dd;
  --purple-ghost: #695080;

  /* Accent colors */
  --danger-red: #c0392b;
  --accent-gold: #c9a96e;
  --accent-teal: #5a8a7a;
  --accent-rose: #b85070;

  /* Text */
  --text: #2d2040;
  --text-soft: #5c4d73;
  --text-muted: #8a7da0;
  --text-light: #b8aed0;

  /* Header */
  --header-bg: #1a0a2e;
  --header-text: #e8dff5;
  --header-accent: #7b52ab;

  /* Borders & shadows */
  --border: #d9cfe8;
  --border-light: #e8e0f0;
  --shadow-sm: 0 2px 8px rgba(61, 26, 94, 0.08);
  --shadow-md: 0 4px 16px rgba(61, 26, 94, 0.12);
  --shadow-lg: 0 8px 32px rgba(61, 26, 94, 0.15);

  /* Typography */
  --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'SimSun', 'STSong', serif;
  --font-sans: 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', 'Noto Sans SC', sans-serif;

  /* Transition */
  --transition: 0.25s ease;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  min-height: 100vh;
}

/* Ghostly mist background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(123, 82, 171, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 30%, rgba(157, 126, 196, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 70%, rgba(61, 26, 94, 0.03) 0%, transparent 55%),
    radial-gradient(ellipse at 10% 80%, rgba(123, 82, 171, 0.04) 0%, transparent 45%);
}

a {
  text-decoration: none;
  color: var(--purple-bright);
  transition: color var(--transition);
}

a:hover {
  color: var(--purple-deep);
}

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

/* ========== SCREEN READER ONLY ========== */
.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;
}

/* ========== HEADER ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--header-bg);
  border-bottom: 3px solid var(--header-accent);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--header-text);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.site-logo img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.main-nav {
  display: flex;
  gap: 6px;
}

.main-nav a {
  color: var(--text-light);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.main-nav a:hover,
.main-nav a.active {
  color: #fff;
  background: rgba(123, 82, 171, 0.3);
}

.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--purple-bright);
  color: #fff;
  padding: 8px 20px;
  border-radius: 24px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(123, 82, 171, 0.4);
}

.header-cta:hover {
  background: var(--purple-mid);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(123, 82, 171, 0.5);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--header-text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
}

/* ========== HERO SECTION ========== */
.hero {
  position: relative;
  padding: 60px 24px 80px;
  text-align: center;
  overflow: hidden;
}

/* Haunted house silhouette divider on hero */
.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40px;
  background:
    linear-gradient(to bottom, transparent 0%, var(--bg) 100%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 1000px;
  margin: 0 auto;
}

.hero-bg-img {
  max-width: 800px;
  margin: 0 auto 32px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  filter: drop-shadow(0 0 20px rgba(123, 82, 171, 0.2));
}

.hero-tagline {
  color: var(--text-soft);
  font-size: 1.05rem;
  margin: 12px 0 24px;
  line-height: 1.6;
}

/* ========== HERO TITLE WITHOUT DOUBLE H1 (index.html) ========== */
.hero-title-main {
  font-family: var(--font-serif);
  font-size: 2.8rem;
  font-weight: 900;
  color: var(--purple-deep);
  margin-bottom: 12px;
  line-height: 1.3;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 3px rgba(123, 82, 171, 0.1);
}

.hero-title-main .jp-subtitle {
  display: block;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.05em;
}

/* Hero sub-page variant */
.hero-subpage {
  padding: 40px 24px 48px;
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-dark));
}

.hero-subpage .hero-inner {
  color: #fff;
}

.hero-subpage-title {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.hero-subpage .hero-tagline {
  color: var(--purple-mist);
}

/* Haunted house pseudo-element hero decoration */
.hero-subpage::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 15% 80%, rgba(123, 82, 171, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 20%, rgba(196, 179, 221, 0.15) 0%, transparent 40%);
  z-index: 1;
}

/* ========== MAIN CONTENT ========== */
main {
  min-height: 60vh;
}

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 64px 24px;
}

.section-alt {
  background: var(--bg-alt);
}

.section-no-padding {
  padding: 0;
}

.section-title-group {
  text-align: center;
  margin-bottom: 48px;
}

.section-title-group-spaced {
  margin-top: 48px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--purple-deep);
  margin-bottom: 12px;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

.content-section h2 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

/* ========== PROSE CENTERED (index.html) ========== */
.prose-centered {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 32px;
  color: var(--text-soft);
  line-height: 1.85;
  font-size: 0.95rem;
}

.prose-centered:last-of-type {
  margin-bottom: 40px;
}

/* ========== GAME INFO CARD (index.html) ========== */
.game-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.game-info-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--purple-bright);
  transition: all var(--transition);
}

.game-info-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.game-info-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.game-info-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--purple-deep);
}

.game-info-desc {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0;
}

/* ========== FEATURE CARDS (index.html) ========== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--purple-light);
  transition: all var(--transition);
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-left-color: var(--purple-bright);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--purple-deep);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.7;
}

/* ========== SCREENSHOT GALLERY (index.html) ========== */
.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.screenshot-item {
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.screenshot-item:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.screenshot-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ========== PLAYER REVIEWS (index.html) ========== */
.reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.review-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--purple-bright);
  position: relative;
}

.review-card::before {
  content: '\201C';
  position: absolute;
  top: 12px;
  left: 16px;
  font-family: var(--font-serif);
  font-size: 3rem;
  color: var(--purple-mist);
  line-height: 1;
  opacity: 0.4;
}

.review-text {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.8;
  padding-left: 24px;
  margin-bottom: 16px;
}

.review-author {
  font-size: 0.85rem;
  color: var(--purple-bright);
  font-weight: 600;
}

/* ========== CTA BANNER (index.html) ========== */
.cta-banner {
  background: linear-gradient(135deg, var(--purple-deep), var(--purple-dark));
  padding: 48px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 50%, rgba(123, 82, 171, 0.3) 0%, transparent 60%),
    radial-gradient(circle at 70% 50%, rgba(157, 126, 196, 0.2) 0%, transparent 50%);
}

.cta-banner .section {
  position: relative;
  z-index: 2;
}

.cta-banner h2 {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: #fff;
  margin-bottom: 12px;
}

.cta-banner p {
  color: var(--purple-mist);
  margin-bottom: 28px;
  font-size: 1rem;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--purple-bright);
  color: #fff;
  padding: 14px 40px;
  border-radius: 30px;
  font-size: 1.1rem;
  font-weight: 700;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(123, 82, 171, 0.5);
}

.cta-btn:hover {
  background: #fff;
  color: var(--purple-deep);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(123, 82, 171, 0.6);
}

/* ========== GUIDE PAGE ========== */
.guide-intro {
  font-size: 1rem;
  color: var(--text-soft);
  line-height: 1.85;
  margin-bottom: 24px;
}

.guide-section {
  margin-bottom: 40px;
}

.guide-section h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--purple-deep);
  margin-bottom: 16px;
  border-left: 4px solid var(--purple-bright);
  padding-left: 16px;
}

.guide-section p {
  color: var(--text-soft);
  line-height: 1.85;
  margin-bottom: 12px;
}

.guide-tip {
  background: var(--bg-mist);
  border: 1px solid var(--purple-mist);
  border-left: 4px solid var(--purple-bright);
  border-radius: 8px;
  padding: 16px 20px;
  margin: 16px 0;
}

.guide-tip strong {
  color: var(--purple-deep);
}

.guide-steps-wrapper {
  counter-reset: guide-step;
}

.guide-step {
  padding: 16px 0;
  border-bottom: 1px solid var(--border-light);
}

.guide-step h4 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--purple-deep);
  margin-bottom: 8px;
}

.guide-step h4::before {
  counter-increment: guide-step;
  content: '#' counter(guide-step) ' ';
  color: var(--purple-bright);
  font-weight: 700;
}

.guide-step p {
  color: var(--text-soft);
  line-height: 1.8;
}

.route-heading {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--purple-deep);
  margin: 28px 0 12px;
}

.route-desc {
  color: var(--text-soft);
  line-height: 1.85;
  margin-bottom: 16px;
}

/* ========== STORY PAGE ========== */
.story-block {
  margin-bottom: 36px;
}

.story-block h3 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--purple-deep);
  margin-bottom: 12px;
  border-bottom: 2px solid var(--purple-mist);
  padding-bottom: 8px;
}

.story-block p {
  color: var(--text-soft);
  line-height: 1.9;
  margin-bottom: 12px;
}

.chapter-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--purple-mid);
  margin: 24px 0 8px;
  font-weight: 700;
}

/* ========== CHARACTERS PAGE ========== */
.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.character-card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  border-top: 4px solid var(--purple-bright);
}

.character-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.character-card-img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  background: var(--bg-alt);
}

.character-card-body {
  padding: 20px;
}

.character-card-body h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--purple-deep);
  margin-bottom: 4px;
}

.character-role {
  font-size: 0.85rem;
  color: var(--purple-bright);
  font-weight: 600;
  margin-bottom: 12px;
}

.character-card-body p {
  font-size: 0.9rem;
  color: var(--text-soft);
  line-height: 1.7;
  margin-bottom: 12px;
}

.character-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.trait-pill {
  background: var(--bg-mist);
  color: var(--purple-mid);
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 500;
}

.section-subheading {
  text-align: center;
  margin: 40px 0 24px;
}

/* ========== RELATIONSHIP TABLE ========== */
.relationship-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
}

.relationship-table th,
.relationship-table td {
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  text-align: left;
}

.relationship-table th {
  background: var(--purple-deep);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
}

.relationship-table td {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.td-highlight {
  color: var(--purple-bright);
  font-weight: 700;
}

/* ========== FAQ PAGE ========== */
.faq-intro {
  color: var(--text-soft);
  margin-bottom: 32px;
}

.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.faq-question {
  background: var(--bg-card);
  padding: 18px 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 1rem;
  color: var(--purple-deep);
  transition: all var(--transition);
  user-select: none;
}

.faq-question:hover {
  background: var(--bg-mist);
}

.faq-question::after {
  content: '+';
  font-size: 1.3rem;
  color: var(--purple-bright);
  font-weight: 400;
  transition: transform var(--transition);
}

.faq-item.open .faq-question::after {
  content: '\2212';
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}

.faq-item.open .faq-answer {
  max-height: 800px;
  padding: 0 24px 20px;
}

.faq-answer p {
  color: var(--text-soft);
  line-height: 1.85;
  margin-bottom: 12px;
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

.faq-note {
  margin-top: 16px;
  color: var(--text-muted);
}

/* ========== SYSTEM REQUIREMENTS ========== */
.sys-reqs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.sys-reqs-table th,
.sys-reqs-table td {
  padding: 10px 16px;
  border: 1px solid var(--border-light);
  text-align: left;
}

.sys-reqs-table th {
  background: var(--purple-deep);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  width: 30%;
}

.sys-reqs-table td {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.sys-reqs-h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--purple-deep);
  margin-top: 24px;
  margin-bottom: 12px;
}

.sys-reqs-h3:first-of-type {
  margin-top: 8px;
}

.sys-note {
  margin-top: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.table-scroll {
  overflow-x: auto;
}

/* ========== FOOTER ========== */
.site-footer {
  background: var(--header-bg);
  padding: 32px 24px;
  text-align: center;
  border-top: 3px solid var(--header-accent);
}

.site-footer p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ========== CONTENT LIST CLASSES ========== */
.content-list {
  list-style: disc;
  padding-left: 20px;
}

.content-list-num {
  list-style: decimal;
  padding-left: 24px;
}

.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);
}

/* ========== COLORED STRONG ========== */
.strong-purple { color: var(--purple-bright); }
.strong-red { color: var(--danger-red); }
.strong-gold { color: var(--accent-gold); }
.strong-muted { color: var(--text-muted); }
.strong-ghost { color: var(--purple-ghost); }

/* ========== LIGHTBOX ========== */
.lightbox {
  display: none;
  position: fixed;
  z-index: 2000;
  inset: 0;
  background: rgba(10, 4, 20, 0.92);
  justify-content: center;
  align-items: center;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  transition: opacity var(--transition);
}

.lightbox-close:hover {
  opacity: 0.7;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  html {
    font-size: 15px;
  }

  .header-inner {
    height: 56px;
    padding: 0 16px;
  }

  .main-nav {
    display: none;
  }

  .main-nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    width: 100%;
    background: var(--header-bg);
    padding: 12px 16px;
    border-top: 1px solid var(--header-accent);
  }

  .nav-toggle {
    display: block;
  }

  .site-logo {
    font-size: 1rem;
  }

  .hero {
    padding: 40px 16px 56px;
  }

  .hero-title-main {
    font-size: 2rem;
  }

  .section {
    padding: 40px 16px;
  }

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

  .content-section h2 {
    font-size: 1.8rem;
  }

  .features-grid,
  .reviews-grid {
    grid-template-columns: 1fr;
  }

  .game-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .hero-subpage-title {
    font-size: 1.5rem;
  }

  .cta-banner h2 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .hero-title-main {
    font-size: 1.6rem;
  }

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

  .header-cta {
    padding: 6px 14px;
    font-size: 0.8rem;
  }
}
