:root {
  color-scheme: light;
  --ink: #1f2430;
  --muted: #606779;
  --paper: #fff8ed;
  --surface: #fffdf8;
  --line: #d9c7a8;
  --rule: rgba(42, 84, 153, 0.14);
  --ballpoint: #183f8f;
  --ballpoint-soft: rgba(24, 63, 143, 0.13);
  --green: #2f6553;
  --shadow: 0 18px 45px rgba(34, 41, 64, 0.12);
  --hand-font: "Bradley Hand", "Segoe Print", "Comic Sans MS", "Marker Felt", "Chalkboard SE", cursive;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(var(--rule) 1px, transparent 1px) 0 0 / 100% 31px,
    linear-gradient(90deg, rgba(24, 63, 143, 0.22) 1px, transparent 1px) 4.8rem 0 / 100% 100%,
    radial-gradient(circle at top left, rgba(24, 63, 143, 0.12), transparent 34rem),
    linear-gradient(180deg, #fff8ed 0%, #fffdf8 48%, #f7ead8 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 4vw, 4rem);
  background: rgba(255, 248, 237, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  display: block;
  width: 2.8rem;
  height: 2.8rem;
  object-fit: contain;
  filter: drop-shadow(1px 2px 0 rgba(24, 63, 143, 0.16));
}

.brand small {
  display: block;
}

.brand-logo {
  display: block;
  width: clamp(160px, 24vw, 280px);
  height: auto;
}

.brand small,
.eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.top-nav a {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

.top-nav a:hover {
  background: var(--ballpoint-soft);
  color: var(--ballpoint);
}

.hero,
.section {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: clamp(1.2rem, 4vw, 3rem);
  align-items: center;
  min-height: calc(100vh - 74px);
  padding: clamp(3rem, 7vw, 6rem) 0;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ballpoint);
  font-family: var(--hand-font);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.05;
}

h1 {
  max-width: 13ch;
  font-size: clamp(3rem, 7vw, 6.5rem);
  text-shadow: 0.035em 0.025em 0 rgba(24, 63, 143, 0.08);
  transform: rotate(-0.35deg);
}

h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  transform: rotate(-0.15deg);
}

h3 {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
}

p {
  margin: 0;
}

.lede {
  max-width: 62ch;
  margin-top: 1.25rem;
  color: #4f4037;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.5rem;
}

.button {
  border: 1px solid var(--ballpoint);
  border-radius: 8px 7px 9px 6px;
  padding: 0.75rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 2px 2px 0 var(--ballpoint-soft);
}

.button.primary {
  background: var(--ballpoint);
  color: #fff8ed;
}

.button.secondary,
.button.compact {
  background: transparent;
  color: var(--ballpoint);
}

.button.compact {
  padding: 0.55rem 0.75rem;
}

.roll-panel,
.generator-card,
.intro-grid article,
.resource-category {
  border: 1px solid rgba(24, 63, 143, 0.35);
  border-radius: 8px 7px 10px 6px;
  background: rgba(255, 253, 248, 0.84);
  box-shadow: var(--shadow);
}

.sketch-card {
  position: relative;
}

.sketch-card::before {
  position: absolute;
  inset: 0.45rem -0.35rem -0.35rem 0.35rem;
  z-index: -1;
  border: 1px solid rgba(24, 63, 143, 0.22);
  border-radius: 10px 6px 9px 8px;
  content: "";
  transform: rotate(-0.6deg);
}

.roll-panel {
  position: relative;
  padding: 1.25rem;
}

.pen-doodle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  gap: 0.2rem;
  opacity: 0.72;
  transform: rotate(5deg);
}

.pen-doodle span {
  display: block;
  width: 5.5rem;
  height: 0.6rem;
  border-top: 2px solid var(--ballpoint);
  border-radius: 999px;
}

.pen-doodle span:nth-child(2) {
  width: 4.4rem;
  margin-left: 0.7rem;
}

.pen-doodle span:nth-child(3) {
  width: 3.2rem;
  margin-left: 1.35rem;
}

.die {
  display: inline-grid;
  width: 4.5rem;
  height: 4.5rem;
  place-items: center;
  margin-bottom: 1rem;
  border: 2px solid var(--ballpoint);
  border-radius: 8px;
  color: var(--ballpoint);
  font-family: var(--hand-font);
  font-size: 1.6rem;
  font-weight: 700;
  transform: rotate(-4deg);
}

.roll-panel p {
  margin: 0.8rem 0 1.1rem;
  color: #4f4037;
}

.hero-copy .eyebrow,
.section-heading .eyebrow {
  color: var(--ballpoint);
}

.section {
  padding: clamp(2.5rem, 7vw, 5rem) 0;
}

.section-heading {
  max-width: 720px;
  margin-bottom: 1.5rem;
}

.library-tools {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.search-field {
  display: grid;
  gap: 0.4rem;
  color: var(--ballpoint);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-field input {
  width: 100%;
  border: 1px solid rgba(24, 63, 143, 0.45);
  border-radius: 8px 7px 9px 6px;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 253, 248, 0.86);
  color: var(--ink);
  font: inherit;
  box-shadow: 2px 2px 0 var(--ballpoint-soft);
}

.search-field input:focus {
  outline: 2px solid var(--ballpoint-soft);
  outline-offset: 2px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  border: 1px solid rgba(24, 63, 143, 0.45);
  border-radius: 999px;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 253, 248, 0.72);
  color: var(--ballpoint);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--ballpoint);
  color: #fff8ed;
}

.empty-results {
  margin-bottom: 1rem;
  color: var(--muted);
}

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

.intro-grid article,
.resource-category {
  padding: 1rem;
}

.intro-grid h2 {
  font-size: 1.65rem;
}

.resource-category h3 {
  margin-bottom: 0.8rem;
  font-size: 1.5rem;
}

.resource-category ul,
.plain-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.resource-category a {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-top: 1px solid rgba(229, 210, 184, 0.72);
  color: #26375f;
  text-decoration: none;
}

.resource-category a:hover {
  color: var(--ballpoint);
}

.resource-category a.active-generator {
  color: var(--ballpoint);
  font-weight: 800;
}

.resource-category a.active-generator strong {
  color: var(--ballpoint);
}

.resource-category strong {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.generator-workspace {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.generator-layout {
  display: grid;
  gap: 1rem;
}

.generator-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  min-height: 300px;
  padding: clamp(1rem, 3vw, 2rem);
}

.generator-card p:last-child {
  max-width: 70ch;
}

.generator-summary {
  margin-top: 1rem;
  color: #4f4037;
  font-size: 1.15rem;
}

.generator-actions {
  display: grid;
  gap: 0.7rem;
}

.permalink-note {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.permalink-note a {
  color: var(--ballpoint);
  font-weight: 800;
  text-decoration: none;
}

.copy-status {
  min-height: 1.4em;
  color: var(--ballpoint);
  font-size: 0.9rem;
  font-weight: 800;
}

.copy-status.error {
  color: #6f2830;
}

.copy-fallback {
  display: grid;
  gap: 0.4rem;
  color: var(--ballpoint);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.copy-fallback[hidden] {
  display: none;
}

.copy-fallback textarea {
  min-height: 8rem;
  resize: vertical;
  border: 1px dashed rgba(24, 63, 143, 0.45);
  border-radius: 8px 6px 9px 7px;
  padding: 0.75rem;
  background: rgba(24, 63, 143, 0.04);
  color: var(--ink);
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
}

.result-details,
.result-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin: 1.2rem 0 0;
}

.result-details {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.result-details div,
.result-notes div {
  padding: 0.75rem;
  border: 1px dashed rgba(24, 63, 143, 0.35);
  border-radius: 8px 6px 9px 7px;
  background: rgba(24, 63, 143, 0.04);
}

.result-details dt,
.result-notes dt {
  color: var(--ballpoint);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-details dd,
.result-notes dd {
  margin: 0.25rem 0 0;
  color: #3d465f;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem clamp(1rem, 4vw, 4rem);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

@media (max-width: 820px) {
  .site-header,
  .site-footer,
  .generator-card {
    align-items: stretch;
    flex-direction: column;
  }

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

  .library-tools {
    grid-template-columns: 1fr;
  }

  .intro-grid,
  .resource-grid,
  .result-details,
  .result-notes {
    grid-template-columns: 1fr;
  }

  h1 {
    max-width: 10ch;
  }
}
