/* ==============================
   星天之魔女 - Celestial Witch Theme
   Midnight blues & stardust silvers
   ============================== */

/* --- CSS Custom Properties --- */
:root {
  /* Core palette */
  --bg-deep: #06061a;
  --bg-midnight: #0a0b28;
  --bg-cosmic: #101238;
  --bg-card: #151745;
  --bg-card-hover: #1c1f55;
  --bg-input: #1a1d4a;

  /* Text */
  --text-primary: #e8e4f4;
  --text-secondary: #b8b4d8;
  --text-muted: #7a769e;
  --text-accent: #e6c74c;

  /* Celestial accents */
  --gold-star: #f0d060;
  --gold-dim: #c4a830;
  --magenta: #c060d8;
  --magenta-glow: #e080f0;
  --silver-stardust: #a8a4d0;
  --starlight: #d4d0f8;
  --constellation: #6a65a8;

  /* Borders & shadows */
  --border-subtle: rgba(192, 192, 224, 0.12);
  --border-card: rgba(192, 192, 224, 0.18);
  --border-accent: rgba(240, 208, 96, 0.3);
  --shadow-card: 0 4px 24px rgba(10, 10, 40, 0.5);
  --shadow-glow: 0 0 20px rgba(192, 96, 216, 0.2);
  --shadow-star: 0 0 12px rgba(240, 208, 96, 0.15);

  /* Layout */
  --max-width: 1100px;
  --header-height: 68px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Typography */
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-display: "Noto Serif SC", "SimSun", serif;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-deep);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(120, 80, 200, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 90%, rgba(40, 60, 160, 0.1) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 50%, rgba(192, 96, 216, 0.04) 0%, transparent 70%);
  min-height: 100vh;
  line-height: 1.75;
}

/* --- Starfield background overlay --- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 15% 12%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 22% 34%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1.5px 1.5px at 40% 8%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(1px 1px at 55% 22%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 70% 15%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 10% 55%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(1px 1px at 33% 62%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 58% 48%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1.5px 1.5px at 82% 38%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 90% 28%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 25% 78%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 48% 85%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(1.5px 1.5px at 65% 72%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 75% 58%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(1px 1px at 88% 75%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(2px 2px at 42% 50%, rgba(240, 208, 96, 0.35), transparent),
    radial-gradient(2px 2px at 18% 40%, rgba(192, 96, 216, 0.3), transparent),
    radial-gradient(2px 2px at 72% 25%, rgba(192, 96, 216, 0.25), transparent);
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--starlight);
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 0.6rem;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

h2 {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

h2::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 48px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-star), var(--magenta));
  border-radius: 1px;
}

h3 {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  margin: 1.5rem 0 0.6rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

strong {
  color: var(--gold-star);
  font-weight: 600;
}

a {
  color: var(--magenta-glow);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--gold-star);
}

/* --- Layout --- */
.site-wrapper {
  position: relative;
  z-index: 1;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==============================
   Header & Navigation
   ============================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 11, 40, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  height: var(--header-height);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--starlight);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.logo:hover {
  color: var(--gold-star);
}

.logo img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 4px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.8rem;
}

.site-nav a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  padding: 0.25rem 0;
  transition: color 0.25s;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--starlight);
}

.site-nav a.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-star), var(--magenta));
  border-radius: 1px;
}

/* CTA button in nav */
.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1.2rem;
  background: linear-gradient(135deg, var(--magenta), #9040b8);
  color: #fff !important;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 0 16px rgba(192, 96, 216, 0.25);
}

.nav-cta:hover {
  background: linear-gradient(135deg, var(--magenta-glow), var(--magenta));
  box-shadow: 0 0 24px rgba(192, 96, 216, 0.4);
  transform: translateY(-1px);
  color: #fff !important;
}

.nav-cta::after {
  content: "↗";
  font-size: 0.75rem;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px;
  z-index: 101;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--starlight);
  border-radius: 2px;
  transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ==============================
   Hero Section (Homepage)
   ============================== */
.hero {
  padding: 4rem 0 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 30%, rgba(192, 96, 216, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 60%, rgba(240, 208, 96, 0.06) 0%, transparent 45%);
  pointer-events: none;
}

.hero-logo {
  width: 120px;
  height: 120px;
  border-radius: 24px;
  object-fit: contain;
  margin-bottom: 1.5rem;
  box-shadow: 0 0 40px rgba(192, 96, 216, 0.3), 0 0 80px rgba(192, 96, 216, 0.1);
  background: var(--bg-card);
  padding: 12px;
}

.hero h1 {
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  margin-bottom: 0.3rem;
  background: linear-gradient(180deg, var(--starlight) 30%, var(--gold-star) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--silver-stardust);
  margin-bottom: 0.8rem;
  font-style: italic;
  letter-spacing: 0.05em;
}

.hero-tags {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.tag {
  display: inline-block;
  padding: 0.25rem 0.8rem;
  font-size: 0.8rem;
  border-radius: 12px;
  background: rgba(192, 192, 224, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--silver-stardust);
}

.tag-highlight {
  border-color: rgba(240, 208, 96, 0.3);
  color: var(--gold-star);
  background: rgba(240, 208, 96, 0.06);
}

.hero-desc {
  max-width: 650px;
  margin: 0 auto 2rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.8;
}

.hero-meta {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-meta span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==============================
   Page Header (Subpages)
   ============================== */
.page-header {
  padding: 3rem 0 1.5rem;
  text-align: center;
  position: relative;
}

.page-header::after {
  content: "";
  display: block;
  width: 60px;
  height: 2px;
  margin: 1rem auto 0;
  background: linear-gradient(90deg, var(--gold-star), var(--magenta));
  border-radius: 1px;
}

.page-header h1 {
  margin-bottom: 0.4rem;
}

.page-header .subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==============================
   Cards
   ============================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold-star), var(--magenta));
  opacity: 0;
  transition: opacity 0.3s;
}

.card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
  background: var(--bg-card-hover);
}

.card:hover::before {
  opacity: 1;
}

.card-icon {
  font-size: 1.8rem;
  margin-bottom: 0.8rem;
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

/* Feature card with number */
.card-num {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: rgba(192, 192, 224, 0.08);
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  line-height: 1;
  pointer-events: none;
}

/* ==============================
   Screenshot Gallery
   ============================== */
.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.screenshot-grid img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  cursor: pointer;
  transition: all 0.3s;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--bg-card);
}

.screenshot-grid img:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: scale(1.02);
}

/* ==============================
   Sections
   ============================== */
.section {
  padding: 2.5rem 0;
}

.section-alt {
  background: rgba(16, 18, 56, 0.3);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.section-cta {
  text-align: center;
  padding: 3rem 0;
  background: linear-gradient(180deg, transparent, rgba(192, 96, 216, 0.04), transparent);
}

.section-cta h2 {
  border: none;
  margin-bottom: 0.5rem;
}

.section-cta h2::after {
  display: none;
}

/* ==============================
   Buttons
   ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.8rem;
  border-radius: 24px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.3s;
  font-family: var(--font-body);
}

.btn-primary {
  background: linear-gradient(135deg, var(--magenta), #9040b8);
  color: #fff;
  box-shadow: 0 0 20px rgba(192, 96, 216, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--magenta-glow), var(--magenta));
  box-shadow: 0 0 30px rgba(192, 96, 216, 0.45);
  transform: translateY(-2px);
  color: #fff;
}

.btn-secondary {
  background: rgba(192, 192, 224, 0.08);
  color: var(--starlight);
  border: 1px solid var(--border-card);
}

.btn-secondary:hover {
  background: rgba(192, 192, 224, 0.15);
  border-color: var(--silver-stardust);
  color: var(--gold-star);
}

/* ==============================
   Content Blocks
   ============================== */
.content-block {
  margin: 2rem 0;
}

.content-block h2 {
  margin-top: 3rem;
}

.info-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.info-list li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: var(--text-secondary);
}

.info-list li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--gold-star);
  font-size: 0.7rem;
  top: 0.7rem;
}

/* ==============================
   Character Cards
   ============================== */
.character-card {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 1.5rem 0;
  transition: all 0.3s;
}

.character-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.char-avatar {
  width: 120px;
  height: 160px;
  border-radius: var(--radius-md);
  background: var(--bg-cosmic);
  border: 2px solid var(--border-card);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.char-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.char-info h3 {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.char-info .char-title {
  color: var(--gold-star);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.char-info p {
  font-size: 0.9rem;
}

.char-traits {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.char-traits .tag {
  font-size: 0.75rem;
}

/* ==============================
   Accordion / FAQ
   ============================== */
.accordion {
  margin: 2rem 0;
}

.accordion-item {
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  margin-bottom: 0.6rem;
  background: var(--bg-card);
  overflow: hidden;
}

.accordion-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.3rem;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  transition: background 0.2s;
}

.accordion-header:hover {
  background: rgba(192, 192, 224, 0.04);
}

.accordion-icon {
  font-size: 1.2rem;
  color: var(--gold-star);
  transition: transform 0.3s;
  flex-shrink: 0;
}

.accordion-item.open .accordion-icon {
  transform: rotate(45deg);
}

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

.accordion-item.open .accordion-body {
  max-height: 400px;
}

.accordion-content {
  padding: 0 1.3rem 1.2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ==============================
   Guide Steps
   ============================== */
.guide-step {
  display: flex;
  gap: 1.5rem;
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  transition: all 0.3s;
}

.guide-step:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.guide-step-num {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--gold-star);
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(240, 208, 96, 0.08);
  border-radius: 50%;
}

.guide-step-body h3 {
  margin: 0 0 0.4rem;
}

.guide-step-body p {
  font-size: 0.9rem;
  margin: 0;
}

/* ==============================
   Story Timeline
   ============================== */
.story-block {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin: 1.5rem 0;
  position: relative;
}

.story-block::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 2rem;
  bottom: 2rem;
  width: 3px;
  background: linear-gradient(180deg, var(--gold-star), var(--magenta));
  border-radius: 2px;
}

.story-block h3 {
  margin: 0 0 0.8rem;
}

/* ==============================
   Footer
   ============================== */
.site-footer {
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.site-footer p {
  color: var(--text-muted);
  margin: 0.2rem 0;
}

/* ==============================
   Lightbox
   ============================== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(6, 6, 24, 0.94);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius-md);
  box-shadow: 0 0 60px rgba(192, 96, 216, 0.3);
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  font-size: 2rem;
  color: var(--starlight);
  cursor: pointer;
  background: none;
  border: none;
  z-index: 1001;
  transition: color 0.2s;
}

.lightbox-close:hover {
  color: var(--gold-star);
}

/* ==============================
   Utility Classes
   ============================== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mx-auto { max-width: var(--max-width); margin-left: auto; margin-right: auto; }
.pt-sm { padding-top: 2rem; }
.pb-sm { padding-bottom: 2rem; }

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

/* ==============================
   Responsive
   ============================== */
@media (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .site-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 3rem 2rem;
    gap: 2rem;
    background: rgba(10, 11, 40, 0.97);
    backdrop-filter: blur(20px);
    transform: translateX(100%);
    transition: transform 0.35s ease;
    z-index: 99;
  }

  .site-nav.open {
    transform: translateX(0);
  }

  .site-nav a {
    font-size: 1.1rem;
  }

  .character-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .char-traits {
    justify-content: center;
  }

  .guide-step {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

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

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

  .hero-meta {
    gap: 1rem;
  }

  .story-block::before {
    display: none;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }

  .header-inner {
    padding: 0 1rem;
  }

  h1 {
    font-size: 1.6rem;
  }

  .hero {
    padding: 2.5rem 0 2rem;
  }

  .hero-logo {
    width: 90px;
    height: 90px;
  }
}
