/* ============================================================
   疯狂岛 (Mad Island) — Mad Survival Island Theme
   Tropical-fever yellows, jungle-overgrowth greens,
   washed-up-driftwood browns on light sandy background
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Core palette */
  --yellow-hot: #E89800;
  --yellow-warm: #F4A300;
  --yellow-glow: #FFC940;
  --green-deep: #1A3A0F;
  --green-mid: #2D5A1E;
  --green-leaf: #3B7A2D;
  --green-moss: #4A7C3F;
  --brown-drift: #6B4E3D;
  --brown-sand: #8B6B4A;
  --brown-light: #A0845C;
  --sand-bg: #F5F0E6;
  --sand-warm: #EDE5D6;
  --sand-dark: #D4C9B5;
  --white: #FFFFFF;
  --dark: #1A1410;
  --dark-green: #0D1B08;

  /* Semantic */
  --bg: var(--sand-bg);
  --bg-card: var(--white);
  --text: #2D2418;
  --text-muted: #6B5E4E;
  --text-light: #8C7E6E;
  --accent: var(--yellow-hot);
  --accent-hover: var(--yellow-warm);
  --accent-glow: var(--yellow-glow);
  --header-bg: var(--dark-green);
  --header-text: var(--sand-warm);
  --border: var(--sand-dark);
  --card-border: #E8DDCD;
  --success: var(--green-leaf);
  --danger: #C0392B;
  --info: #2980B9;

  /* Typography */
  --font-heading: 'Georgia', 'Noto Serif SC', 'SimSun', serif;
  --font-body: 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
  --font-mono: 'Courier New', 'Source Code Pro', monospace;

  /* Spacing */
  --max-width: 1100px;
  --header-height: 64px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(26, 20, 16, 0.08);
  --shadow-md: 0 4px 12px rgba(26, 20, 16, 0.12);
  --shadow-lg: 0 8px 30px rgba(26, 20, 16, 0.15);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

/* Body background pattern — subtle sand texture via pseudo-element */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(232, 152, 0, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(45, 90, 30, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(107, 78, 61, 0.03) 0%, transparent 50%);
}

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

a:hover {
  color: var(--accent-hover);
}

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

ul, ol {
  list-style: none;
}

/* ---------- Accessibility ---------- */
.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(--accent);
  box-shadow: var(--shadow-md);
}

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

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
}

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

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

.site-nav a {
  display: block;
  padding: 0.4rem 1rem;
  color: var(--sand-dark);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--accent);
  background: rgba(232, 152, 0, 0.1);
}

.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.4rem;
  background: linear-gradient(135deg, var(--yellow-hot), var(--yellow-warm));
  color: var(--dark) !important;
  font-weight: 700;
  font-size: 0.95rem;
  border-radius: 6px;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(232, 152, 0, 0.3);
}

.header-cta:hover {
  background: linear-gradient(135deg, var(--yellow-warm), var(--yellow-glow));
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(232, 152, 0, 0.45);
}

/* ---------- Main Content ---------- */
.site-main {
  flex: 1;
  position: relative;
  z-index: 1;
}

/* ---------- Hero Section ---------- */
.hero {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    180deg,
    rgba(13, 27, 8, 0.7) 0%,
    rgba(13, 27, 8, 0.45) 50%,
    rgba(26, 20, 16, 0.6) 100%
  );
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 700px;
}

.hero-content h1 {
  font-family: var(--font-heading);
  font-size: 3rem;
  color: var(--accent);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--sand-warm);
  margin-bottom: 0.5rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.hero-tags span {
  padding: 0.3rem 0.85rem;
  background: rgba(232, 152, 0, 0.2);
  border: 1px solid rgba(232, 152, 0, 0.35);
  color: var(--yellow-glow);
  font-size: 0.85rem;
  border-radius: 20px;
  font-weight: 500;
}

/* Decorative divider after hero */
.hero + .section-divider {
  height: 4px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--accent) 20%,
    var(--green-mid) 50%,
    var(--accent) 80%,
    transparent 100%
  );
}

/* ---------- Sections ---------- */
.section {
  padding: 3.5rem 1.5rem;
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--dark);
  margin-bottom: 2rem;
  padding-bottom: 0.75rem;
  position: relative;
  text-align: center;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--accent);
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-left-color: var(--green-mid);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.card h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

/* ---------- Screenshot Gallery ---------- */
.gallery {
  background: var(--sand-warm);
  padding: 3.5rem 1.5rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.gallery-grid a {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  cursor: pointer;
}

.gallery-grid a:hover {
  box-shadow: var(--shadow-lg);
  transform: scale(1.02);
}

.gallery-grid img {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
}

/* ---------- Review Cards ---------- */
.reviews {
  background: var(--bg);
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.review-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
  padding: 1.5rem;
  position: relative;
}

.review-card::before {
  content: '"';
  position: absolute;
  top: 0.5rem;
  left: 1rem;
  font-family: var(--font-heading);
  font-size: 3rem;
  color: var(--accent);
  opacity: 0.2;
  line-height: 1;
}

.review-card p {
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-top: 0.5rem;
}

.review-author {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
}

/* ---------- CTA Banner ---------- */
.cta-banner {
  background: linear-gradient(135deg, var(--green-deep), var(--dark-green));
  padding: 3.5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at center, rgba(232, 152, 0, 0.1) 0%, transparent 60%);
  animation: cta-pulse 4s ease-in-out infinite;
}

@keyframes cta-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.cta-banner h2 {
  font-family: var(--font-heading);
  font-size: 2rem;
  color: var(--accent);
  position: relative;
  z-index: 1;
  margin-bottom: 0.75rem;
}

.cta-banner p {
  color: var(--sand-warm);
  font-size: 1.1rem;
  position: relative;
  z-index: 1;
  margin-bottom: 1.5rem;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2.5rem;
  background: linear-gradient(135deg, var(--yellow-hot), var(--yellow-warm));
  color: var(--dark);
  font-weight: 700;
  font-size: 1.15rem;
  border-radius: 8px;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(232, 152, 0, 0.4);
}

.cta-button:hover {
  background: linear-gradient(135deg, var(--yellow-warm), var(--yellow-glow));
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(232, 152, 0, 0.55);
  color: var(--dark);
}

/* ---------- Guide Page ---------- */
.guide-section {
  background: var(--bg);
}

.guide-steps {
  max-width: 800px;
  margin: 0 auto;
}

.guide-step {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 2rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--accent);
  padding: 1.5rem;
  transition: all 0.3s ease;
}

.guide-step:hover {
  box-shadow: var(--shadow-md);
  border-left-color: var(--green-mid);
}

.step-number {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent), var(--yellow-warm));
  color: var(--dark);
  font-weight: 700;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.step-content h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--dark);
  margin-bottom: 0.4rem;
}

.step-content p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.tip-box {
  background: rgba(232, 152, 0, 0.08);
  border: 1px solid rgba(232, 152, 0, 0.2);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
}

.tip-box strong {
  color: var(--accent);
}

.tip-box.warning {
  background: rgba(192, 57, 43, 0.06);
  border-color: rgba(192, 57, 43, 0.2);
  border-left-color: var(--danger);
}

.tip-box.warning strong {
  color: var(--danger);
}

/* ---------- Story Page ---------- */
.story-section {
  background: var(--bg);
}

.story-block {
  max-width: 800px;
  margin: 0 auto 2.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
  padding: 2rem;
}

.story-block h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--dark);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}

.story-block h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: var(--accent);
  margin: 1.25rem 0 0.5rem;
}

.story-block p {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  text-indent: 2em;
}

/* ---------- Characters Page ---------- */
.characters-section {
  background: var(--bg);
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.char-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
  overflow: hidden;
  transition: all 0.3s ease;
}

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

.char-card-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.char-card-body {
  padding: 1.25rem;
}

.char-card-body h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--dark);
  margin-bottom: 0.25rem;
}

.char-role {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: rgba(232, 152, 0, 0.12);
  color: var(--accent);
  font-size: 0.8rem;
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.char-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.char-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.char-traits span {
  padding: 0.2rem 0.5rem;
  background: var(--sand-warm);
  color: var(--brown-drift);
  font-size: 0.8rem;
  border-radius: 4px;
}

/* ---------- FAQ Page ---------- */
.faq-section {
  background: var(--bg);
}

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

.faq-item {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--card-border);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.faq-question {
  width: 100%;
  padding: 1rem 1.25rem;
  background: none;
  border: none;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--dark);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.faq-question::after {
  content: '+';
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 700;
  transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"]::after {
  content: '−';
  transform: rotate(180deg);
}

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

.faq-answer.open {
  max-height: 500px;
}

.faq-answer-inner {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* System requirements table */
.specs-table {
  width: 100%;
  max-width: 800px;
  margin: 2rem auto 0;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.specs-table thead {
  background: var(--green-deep);
  color: var(--sand-warm);
}

.specs-table th {
  padding: 0.85rem 1.25rem;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
}

.specs-table td {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--card-border);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.specs-table tr:nth-child(even) {
  background: var(--sand-warm);
}

/* ---------- Lightbox ---------- */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 27, 8, 0.92);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90%;
  max-height: 85%;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  background: rgba(232, 152, 0, 0.2);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lightbox-close:hover {
  background: var(--accent);
  color: var(--dark);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--dark-green);
  color: var(--text-light);
  text-align: center;
  padding: 1.5rem;
  font-size: 0.85rem;
  border-top: 3px solid var(--accent);
}

.site-footer p {
  margin: 0;
}

/* ---------- Page Header (non-index) ---------- */
.page-hero {
  background: linear-gradient(135deg, var(--green-deep), var(--dark-green));
  padding: 3rem 1.5rem;
  text-align: center;
  position: relative;
}

.page-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--accent) 20%,
    var(--green-mid) 50%,
    var(--accent) 80%,
    transparent 100%
  );
}

.page-hero h1 {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.page-hero p {
  color: var(--sand-dark);
  font-size: 1.05rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .site-nav a {
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
  }

  .header-cta {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
  }

  .hero-content h1 {
    font-size: 2.2rem;
  }

  .hero {
    min-height: 300px;
  }

  .section {
    padding: 2.5rem 1rem;
  }

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

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

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

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

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

  .page-hero h1 {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0 0.75rem;
  }

  .site-nav {
    gap: 0;
  }

  .site-nav a {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
  }

  .header-cta {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
    border-radius: 4px;
  }

  .hero-content h1 {
    font-size: 1.7rem;
  }

  .hero {
    min-height: 240px;
  }

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

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

  .cta-button {
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
  }

  .page-hero h1 {
    font-size: 1.6rem;
  }

  .specs-table {
    font-size: 0.8rem;
  }

  .specs-table th,
  .specs-table td {
    padding: 0.5rem 0.75rem;
  }
}
