:root {
  --bg-deep: #04131f;
  --bg-mid: #0c2a3a;
  --card: rgba(6, 26, 38, 0.78);
  --card-strong: rgba(8, 34, 49, 0.95);
  --line: rgba(179, 219, 230, 0.18);
  --text: #ecf9fb;
  --muted: #b6d6dd;
  --accent: #f2c14e;
  --accent-soft: #7bd3ea;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  --radius: 24px;
  --font-title: "Palatino Linotype", "Book Antiqua", serif;
  --font-body: "Trebuchet MS", "Lucida Sans Unicode", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(78, 171, 197, 0.26), transparent 30%),
    radial-gradient(circle at right 20%, rgba(242, 193, 78, 0.14), transparent 26%),
    linear-gradient(180deg, #051824 0%, #082031 42%, #030f19 100%);
  color: var(--text);
  font-family: var(--font-body);
}

.page-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent);
}

a {
  color: inherit;
}

.site-header,
.page-content,
.site-footer {
  position: relative;
  z-index: 1;
}

.nav-shell,
.page-content,
.site-footer {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand strong,
h1,
h2,
h3 {
  font-family: var(--font-title);
}

.brand small {
  display: block;
  color: var(--muted);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(123, 211, 234, 0.32), rgba(242, 193, 78, 0.2));
  border: 1px solid var(--line);
}

.nav-links {
  display: flex;
  gap: 18px;
}

.nav-links a,
.back-link {
  color: var(--muted);
  text-decoration: none;
}

.page-content {
  padding: 24px 0 72px;
}

.hero,
.section-block,
.speech-card,
.code-card,
.stat-card,
.trail-card,
.map-step,
.chapter-card,
.activity-card,
.meta-panel {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero,
.section-block {
  border-radius: calc(var(--radius) + 8px);
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  padding: 36px;
  overflow: hidden;
}

.hero-home {
  background:
    radial-gradient(circle at top right, rgba(123, 211, 234, 0.3), transparent 30%),
    linear-gradient(135deg, rgba(10, 44, 60, 0.96), rgba(4, 19, 31, 0.92));
}

.solo-hero {
  grid-template-columns: 1fr;
}

.trail-hero {
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--trail-accent) 38%, transparent), transparent 28%),
    linear-gradient(135deg, color-mix(in srgb, var(--trail-primary) 58%, #02131c 42%), rgba(4, 19, 31, 0.96));
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--accent-soft);
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  line-height: 0.95;
}

h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

h3 {
  margin-top: 0;
}

.hero-copy,
.hero-quote {
  max-width: 65ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-quote {
  border-left: 3px solid rgba(242, 193, 78, 0.6);
  padding-left: 16px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}

.stat-grid,
.trail-grid,
.map-grid,
.split-layout,
.chapter-copy {
  display: grid;
  gap: 18px;
}

.stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: start;
}

.stat-card,
.trail-card,
.speech-card,
.map-step,
.meta-panel,
.activity-card,
.code-card {
  border-radius: var(--radius);
}

.stat-card {
  padding: 22px;
}

.stat-card strong {
  display: block;
  font-size: 2rem;
  font-family: var(--font-title);
}

.stat-card span,
.trail-card p,
.map-step span,
.meta-panel span,
tbody td,
tbody th,
.speech-card p,
.code-card p,
.activity-question,
.plain-list,
.chapter-subtitle {
  color: var(--muted);
}

.section-block {
  margin-top: 26px;
  padding: 28px;
  background: linear-gradient(180deg, rgba(7, 29, 42, 0.94), rgba(4, 19, 31, 0.9));
}

.section-heading {
  margin-bottom: 18px;
}

.trail-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.trail-card {
  padding: 26px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--trail-primary) 32%, rgba(7, 27, 38, 0.96)), rgba(4, 19, 31, 0.92)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.chapter-preview-grid,
.reward-grid {
  display: grid;
  gap: 18px;
}

.chapter-preview-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.chapter-preview-card,
.reward-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 34, 49, 0.88);
  box-shadow: var(--shadow);
}

.chapter-preview-card {
  padding: 22px;
}

.chapter-preview-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.chapter-preview-head span,
.chapter-preview-meta span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.88rem;
}

.chapter-preview-copy,
.chapter-preview-note {
  color: var(--muted);
  line-height: 1.7;
}

.chapter-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.chapter-highlight-list {
  margin-top: 16px;
}

.chapter-preview-note {
  margin: 18px 0 0;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chapter-story,
.chapter-note {
  color: var(--muted);
  line-height: 1.75;
}

.reward-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.reward-card {
  padding: 22px;
}

.reward-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.trail-kicker,
.activity-type,
.chapter-title {
  margin: 0 0 8px;
  color: var(--accent);
}

.trail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 20px;
}

.trail-meta span,
.activity-top span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.92rem;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  color: #07202d;
  background: linear-gradient(135deg, var(--accent), #ffe09c);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  background: rgba(6, 26, 38, 0.84);
}

thead {
  background: rgba(255, 255, 255, 0.05);
}

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

code,
.json-preview {
  font-family: "Courier New", monospace;
}

.split-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.code-card,
.speech-card {
  padding: 24px;
  height: 100%;
}

.mission-card .table-wrap {
  margin-top: 18px;
}

.map-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.map-step {
  padding: 20px;
}

.meta-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 24px;
  align-self: start;
  background: rgba(0, 0, 0, 0.26);
}

.meta-panel strong {
  display: block;
  font-size: 1.2rem;
}

.chapter-list {
  display: grid;
  gap: 16px;
}

.chapter-card {
  overflow: hidden;
}

.chapter-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  list-style: none;
  cursor: pointer;
}

.chapter-card summary::-webkit-details-marker {
  display: none;
}

.chapter-card[open] summary {
  border-bottom: 1px solid var(--line);
}

.chapter-body {
  padding: 24px;
}

.callout {
  margin-bottom: 20px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(123, 211, 234, 0.09);
  border: 1px solid rgba(123, 211, 234, 0.18);
}

.chapter-copy {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 22px;
}

.activity-list {
  display: grid;
  gap: 16px;
}

.activity-card {
  padding: 20px;
  background: var(--card-strong);
}

.activity-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.activity-title {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

.activity-interaction {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.activity-choice-row,
.activity-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.activity-controls {
  margin-top: 12px;
}

.activity-choice,
.activity-hint-toggle {
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.activity-choice:hover,
.activity-hint-toggle:hover,
.activity-choice.is-selected {
  background: rgba(123, 211, 234, 0.16);
  border-color: rgba(123, 211, 234, 0.4);
  transform: translateY(-1px);
}

.activity-response,
.activity-hints {
  margin-top: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(123, 211, 234, 0.09);
  border: 1px solid rgba(123, 211, 234, 0.18);
}

.activity-response-title {
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 700;
}

.activity-response-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.plain-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
}

.json-preview {
  margin: 0;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(2, 12, 19, 0.92);
  overflow-x: auto;
  white-space: pre-wrap;
}

.site-footer {
  padding: 0 0 32px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 880px) {
  .hero,
  .split-layout,
  .chapter-copy {
    grid-template-columns: 1fr;
  }

  .nav-shell {
    flex-direction: column;
    align-items: start;
    gap: 14px;
  }

  .meta-panel,
  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .page-content,
  .nav-shell,
  .site-footer {
    width: min(100% - 20px, 1160px);
  }

  .hero,
  .section-block {
    padding: 22px;
  }

  .meta-panel,
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .chapter-card summary,
  .activity-top,
  .chapter-preview-head,
  .hero-actions,
  .activity-choice-row,
  .activity-controls {
    flex-direction: column;
    align-items: start;
  }
}
