:root {
  --bg: #f7faf8;
  --paper: #ffffff;
  --ink: #132326;
  --muted: #53666a;
  --soft: #e7efeb;
  --line: #c9d7d1;
  --teal: #106c6f;
  --teal-dark: #073f45;
  --coral: #d86749;
  --gold: #f0b84a;
  --leaf: #3f7b4c;
  --night: #102a33;
  --shadow: 0 18px 45px rgba(15, 42, 51, 0.14);
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  overflow-x: clip;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: var(--teal);
}

img,
iframe {
  max-width: 100%;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 50;
  background: var(--ink);
  color: white;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(247, 250, 248, 0.94);
  border-bottom: 1px solid rgba(201, 215, 209, 0.8);
  backdrop-filter: blur(18px);
}

.site-header-inner {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(from 130deg, var(--coral), var(--gold), var(--teal), var(--leaf), var(--coral));
  color: white;
  box-shadow: 0 8px 18px rgba(16, 108, 111, 0.24);
}

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

.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius);
}

.site-nav a:hover,
.site-nav a:focus,
.site-nav a.active {
  background: var(--soft);
  color: var(--teal-dark);
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-weight: 800;
}

.hero {
  min-height: min(760px, 78vh);
  position: relative;
  display: grid;
  align-items: end;
  overflow: hidden;
  color: white;
  background-color: var(--night);
  background-size: cover;
  background-position: center;
}

.hero:before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 26, 31, 0.9) 0%, rgba(5, 26, 31, 0.58) 44%, rgba(5, 26, 31, 0.2) 100%),
    linear-gradient(0deg, rgba(5, 26, 31, 0.76) 0%, rgba(5, 26, 31, 0.02) 48%);
}

.hero-body {
  position: relative;
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 7rem 0 5.5rem;
}

.hero h1,
.page-hero h1 {
  margin: 0;
  max-width: 850px;
  font-size: clamp(2.8rem, 6vw, 6.5rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero p,
.page-hero p {
  max-width: 720px;
  margin: 1.35rem 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1.08rem, 2vw, 1.35rem);
}

.hero-actions,
.button-row,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.hero-actions {
  margin-top: 1.8rem;
}

.button,
button.button,
.hero-actions a {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.78rem 1rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  text-decoration: none;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.button.primary,
.hero-actions a:first-child {
  background: var(--gold);
  color: #172123;
}

.button.secondary,
.hero-actions a {
  background: rgba(255, 255, 255, 0.13);
  color: white;
  border-color: rgba(255, 255, 255, 0.45);
}

.button.ghost {
  background: var(--paper);
  color: var(--teal-dark);
  border-color: var(--line);
}

.button.primary:hover,
.hero-actions a:first-child:hover {
  background: #ffd36f;
}

.button.secondary:hover,
.hero-actions a:hover {
  background: rgba(255, 255, 255, 0.24);
}

.page-hero {
  background: var(--night);
  color: white;
}

.page-hero.with-image {
  position: relative;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.page-hero.with-image:before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5, 26, 31, 0.9), rgba(5, 26, 31, 0.4));
}

.page-hero-inner {
  position: relative;
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 5.5rem 0;
}

.page-hero.compact .page-hero-inner {
  padding: 4rem 0;
}

.page-shell {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
}

.section {
  padding: clamp(3rem, 7vw, 6rem) 0;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.band {
  background: var(--paper);
}

.full-band {
  position: relative;
  box-shadow: 0 0 0 100vmax var(--paper);
  clip-path: inset(0 -100vmax);
}

.section-label {
  margin: 0 0 0.65rem;
  color: var(--coral);
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  letter-spacing: 0;
}

p {
  margin: 0.7rem 0 0;
}

.lede {
  max-width: 760px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.three-col,
.action-grid,
.builder-grid,
.recognition-grid,
.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.two-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.panel,
.action-card,
.builder-card,
.note-card,
.source-card,
.recognition-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: 0 8px 22px rgba(15, 42, 51, 0.06);
}

.action-card,
.builder-card {
  min-height: 100%;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.action-card:hover,
.builder-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
  transition: transform 160ms ease, border-color 160ms ease;
}

.card-meta,
.small {
  color: var(--muted);
  font-size: 0.92rem;
}

.steps {
  display: grid;
  gap: 0.9rem;
  counter-reset: step;
  margin-top: 2rem;
}

.step {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.step:before {
  counter-increment: step;
  content: counter(step);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: white;
  font-weight: 900;
}

.terrain-map-figure {
  margin: 2rem 0 0;
  overflow: hidden;
  background: var(--night);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}

.terrain-map-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.terrain-map-figure figcaption {
  margin: 0;
  padding: 0.9rem 1.1rem;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.94rem;
}

.terrain-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.terrain-stop {
  min-height: 100%;
  padding: 1.1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(15, 42, 51, 0.06);
}

.terrain-stop span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--coral);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.media-frame {
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--paper);
}

.media-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.phone-shell {
  width: min(310px, 82vw);
  margin: 0 auto;
  padding: 0.7rem;
  border-radius: 34px;
  background: #101517;
  box-shadow: 0 22px 55px rgba(15, 42, 51, 0.28);
}

.phone-screen {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 24px;
  overflow: hidden;
  background: #000;
}

.phone-screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.mini-list,
.check-list {
  list-style: none;
  padding: 0;
  margin: 1.2rem 0 0;
  display: grid;
  gap: 0.7rem;
}

.mini-list li,
.check-list li {
  padding-left: 1.5rem;
  position: relative;
}

.mini-list li:before,
.check-list li:before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68rem;
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 50%;
  background: var(--coral);
}

.check-list li:before {
  background: var(--leaf);
}

.prompt-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.4rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: table;
}

.prompt-table th,
.prompt-table td {
  text-align: left;
  padding: 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.prompt-table th {
  background: var(--soft);
}

.quote-panel {
  border-left: 5px solid var(--gold);
  padding: 1rem 0 1rem 1.1rem;
  margin-top: 1.4rem;
  color: var(--teal-dark);
  font-size: 1.2rem;
  font-weight: 750;
}

.builder-index-hero {
  padding: 4rem 0 2rem;
}

.builder-shell {
  width: min(1320px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
}

.builder-sidebar {
  position: sticky;
  top: 90px;
  display: grid;
  gap: 1rem;
}

.side-nav {
  display: grid;
  gap: 0.45rem;
}

.side-nav a {
  display: block;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.72rem;
  background: var(--paper);
}

.side-nav a.active {
  border-color: var(--teal);
  background: #edf8f5;
}

.builder-main {
  display: grid;
  gap: 1rem;
}

.builder-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1rem;
  align-items: stretch;
}

.builder-hero-text {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 3vw, 2rem);
}

.builder-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1.05;
}

.builder-hero .media-frame {
  min-height: 230px;
}

.builder-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.95fr);
  gap: 1rem;
  align-items: start;
}

.form-panel,
.preview-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field.full {
  grid-column: 1 / -1;
}

label,
.label {
  font-weight: 800;
  color: var(--teal-dark);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.8rem;
  background: #fcfffd;
  color: var(--ink);
  font: inherit;
  min-height: 44px;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 0.8rem;
}

.filename {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.84rem;
  color: var(--muted);
  word-break: break-word;
}

.markdown-preview {
  width: 100%;
  min-height: 620px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre;
}

.status-line {
  min-height: 1.3rem;
  color: var(--leaf);
  font-weight: 700;
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.footer-nav a {
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

.footer-nav a:last-child {
  text-align: right;
}

.site-footer {
  background: var(--night);
  color: rgba(255, 255, 255, 0.82);
  padding: 3rem 0;
}

.site-footer-inner {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2rem;
  align-items: start;
}

.site-footer a {
  color: white;
}

.footer-nav-wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, auto));
  gap: 2rem;
}

.footer-link-list {
  display: grid;
  gap: 0.42rem;
}

.footer-link-list strong {
  color: white;
  margin-bottom: 0.2rem;
}

.footer-link-list a {
  text-align: right;
}

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: var(--teal-dark);
  color: white;
  font-size: 1.2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 980px) {
  .site-nav {
    display: none;
    position: fixed;
    inset: 74px 0 auto 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 1rem;
    grid-template-columns: 1fr;
  }

  body.nav-open .site-nav {
    display: grid;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .two-col,
  .builder-shell,
  .builder-workbench,
  .builder-hero {
    grid-template-columns: 1fr;
  }

  .builder-sidebar {
    position: static;
  }

  .three-col,
  .action-grid,
  .builder-grid,
  .recognition-grid,
  .source-grid,
  .two-card-grid {
    grid-template-columns: 1fr 1fr;
  }

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

@media (max-width: 680px) {
  body {
    font-size: 16px;
  }

  .hero {
    min-height: 84vh;
  }

  .hero-body {
    padding: 5rem 0 3rem;
  }

  .hero h1,
  .page-hero h1 {
    font-size: clamp(2.1rem, 11vw, 3rem);
    overflow-wrap: anywhere;
  }

  .hero-actions a {
    width: 100%;
  }

  .three-col,
  .action-grid,
  .builder-grid,
  .recognition-grid,
  .source-grid,
  .two-card-grid,
  .terrain-grid,
  .form-grid,
  .footer-nav,
  .site-footer-inner {
    grid-template-columns: 1fr;
  }

  .footer-nav-wrap {
    grid-template-columns: 1fr;
    gap: 1.4rem;
  }

  .footer-link-list a,
  .footer-link-list strong {
    text-align: left;
  }

  .prompt-table,
  .prompt-table tbody,
  .prompt-table tr,
  .prompt-table th,
  .prompt-table td {
    display: block;
  }

  .prompt-table th {
    border-bottom: 0;
  }

  .prompt-table td {
    border-bottom: 1px solid var(--line);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
