:root {
  color-scheme: dark;
  --background: #0a0a0a;
  --surface: #121212;
  --surface-raised: #181818;
  --border: #2a2a2a;
  --text: #f6f6f3;
  --muted: #9a9a96;
  --accent: #f06a15;
  --accent-hover: #ff7b24;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.page-header,
.chapter-nav,
main {
  width: min(100% - 40px, 980px);
  margin-inline: auto;
}

.page-header {
  padding: 84px 0 52px;
}

.page-header p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-header h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(3rem, 8vw, 6.4rem);
  line-height: 0.95;
  letter-spacing: -0.065em;
}

.page-header h1 span {
  color: var(--accent);
}

.chapter-nav {
  padding-bottom: 84px;
}

.chapter-nav ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.chapter-nav li {
  border-bottom: 1px solid var(--border);
}

.chapter-nav li:nth-child(odd) {
  border-right: 1px solid var(--border);
}

.chapter-nav a {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  min-height: 84px;
  padding: 20px 24px;
  color: var(--text);
  text-decoration: none;
  align-items: start;
}

.chapter-nav a:hover,
.chapter-nav a:focus-visible {
  background: var(--surface);
}

.chapter-nav a:focus-visible,
.copy-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.chapter-nav a span {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.chapter {
  padding: 72px 0 96px;
  border-top: 1px solid var(--border);
  scroll-margin-top: 24px;
}

.chapter-heading {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 20px;
  margin-bottom: 36px;
  align-items: start;
}

.chapter-heading > span {
  padding-top: 7px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.1em;
}

.chapter h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.75rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.prompt-card {
  overflow: hidden;
  margin: 24px 0 0 84px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}

.prompt-toolbar {
  display: flex;
  min-height: 64px;
  padding: 12px 14px 12px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.prompt-toolbar h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.copy-button {
  display: inline-flex;
  min-width: 126px;
  min-height: 40px;
  padding: 9px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #080808;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.copy-button:hover {
  background: var(--accent-hover);
}

.copy-button[data-state="copied"] {
  background: #f6f6f3;
}

.copy-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

pre {
  margin: 0;
  padding: 24px;
  overflow: visible;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

code {
  color: #deded9;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.68;
  tab-size: 2;
}

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

@media (max-width: 700px) {
  .page-header,
  .chapter-nav,
  main {
    width: min(100% - 28px, 980px);
  }

  .page-header {
    padding: 56px 0 40px;
  }

  .chapter-nav {
    padding-bottom: 56px;
  }

  .chapter-nav ol {
    grid-template-columns: 1fr;
  }

  .chapter-nav li:nth-child(odd) {
    border-right: 0;
  }

  .chapter-nav a {
    min-height: 70px;
    padding: 16px 12px;
  }

  .chapter {
    padding: 52px 0 72px;
  }

  .chapter-heading {
    grid-template-columns: 42px 1fr;
    gap: 10px;
    margin-bottom: 28px;
  }

  .prompt-card {
    margin-left: 0;
    border-radius: 12px;
  }

  .prompt-toolbar {
    padding: 10px 10px 10px 16px;
  }

  .prompt-toolbar h3 {
    max-width: 52%;
    font-size: 0.68rem;
  }

  .copy-button {
    min-width: 116px;
  }

  pre {
    padding: 18px;
  }

  code {
    font-size: 0.84rem;
    line-height: 1.62;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
