:root {
  color-scheme: light;
  --ink: #16211f;
  --muted: #66736f;
  --paper: #fbf8f2;
  --panel: #ffffff;
  --line: #dedbd2;
  --teal: #087f8c;
  --teal-dark: #075d66;
  --coral: #f45d48;
  --gold: #f4b942;
  --mint: #d8f3dc;
  --blue: #2f6fdf;
  --shadow: 0 22px 70px rgba(20, 33, 31, 0.13);
}

* {
  box-sizing: border-box;
}

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

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(8, 127, 140, 0.12), transparent 34rem),
    linear-gradient(315deg, rgba(244, 93, 72, 0.12), transparent 38rem),
  var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  transform: translateY(-180%);
  border: 2px solid var(--ink);
  background: var(--gold);
  color: var(--ink);
  padding: 0.7rem 0.9rem;
  font-weight: 900;
  box-shadow: 0.22rem 0.22rem 0 var(--ink);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid rgba(22, 33, 31, 0.08);
  background: rgba(251, 248, 242, 0.86);
  backdrop-filter: blur(16px);
}

@supports not (backdrop-filter: blur(16px)) {
  .topbar {
    background: rgba(251, 248, 242, 0.98);
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 850;
}

.brand-mark {
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--gold);
  box-shadow: 0.22rem 0.22rem 0 var(--ink);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(0.75rem, 3vw, 2rem);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
  gap: clamp(1.2rem, 4vw, 3rem);
  align-items: center;
  min-height: min(760px, calc(100vh - 88px));
  padding: clamp(1.5rem, 4vw, 3.5rem) 0 1.5rem;
}

.hero > *,
.workspace > *,
.feature-band > *,
.seo-section > * {
  min-width: 0;
}

.hero-copy h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.6rem, 6.4vw, 5.25rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-text {
  max-width: 39rem;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.7;
}

.eyebrow {
  margin: 0 0 0.6rem;
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.hero-stats span {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
  padding: 0.75rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.hero-stats strong {
  display: block;
  font-size: 1.35rem;
  color: var(--coral);
}

.solver-panel,
.results-shell,
.mini-panel {
  border: 1px solid rgba(22, 33, 31, 0.11);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.solver-panel {
  padding: clamp(1rem, 3vw, 1.5rem);
}

.input-row,
.tool-row,
.section-heading,
.length-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.input-row label,
.filter-grid label {
  color: var(--ink);
  font-weight: 850;
}

#letterCounter,
.hint,
.panel-copy,
.feature-grid p,
.seo-copy,
.faq-section p,
footer {
  color: var(--muted);
}

.letter-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  margin-top: 0.6rem;
}

input,
select {
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  padding: 0 0.9rem;
  outline: none;
}

input,
textarea,
select,
button {
  font-size: 16px;
}

.noscript-notice {
  margin: 1rem 0;
  border: 2px solid var(--ink);
  background: var(--gold);
  color: var(--ink);
  padding: 1rem;
  box-shadow: 0.25rem 0.25rem 0 var(--ink);
}

.noscript-notice h2,
.noscript-notice p {
  margin: 0.25rem 0;
}

#letters {
  min-height: 4.4rem;
  border: 2px solid var(--ink);
  font-size: clamp(1.5rem, 4vw, 2.6rem);
  font-weight: 900;
}

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(8, 127, 140, 0.13);
}

.primary-button,
.ghost-button,
.icon-button,
.word-card button {
  border: 2px solid var(--ink);
  border-radius: 0;
  color: var(--ink);
  font-weight: 900;
}

.primary-button {
  min-width: 9rem;
  background: var(--coral);
  box-shadow: 0.25rem 0.25rem 0 var(--ink);
}

.ghost-button,
.icon-button {
  min-height: 2.75rem;
  background: #fff;
  padding: 0 0.85rem;
}

.icon-button {
  width: 2.75rem;
  padding: 0;
}

.hint {
  margin: 0.85rem 0 1.2rem;
  line-height: 1.5;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.filter-grid label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.tool-row {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-top: 1rem;
}

.tool-row select {
  max-width: 12rem;
  margin-left: auto;
}

.ad-slot {
  display: grid;
  place-items: center;
  min-height: 5.75rem;
  margin: 1rem 0 2rem;
  border: 1px dashed rgba(22, 33, 31, 0.34);
  background: repeating-linear-gradient(45deg, rgba(8, 127, 140, 0.06), rgba(8, 127, 140, 0.06) 8px, rgba(244, 185, 66, 0.08) 8px, rgba(244, 185, 66, 0.08) 16px);
  color: var(--muted);
  font-weight: 800;
}

.feature-band,
.seo-section,
.faq-section,
.link-cluster,
.content-grid,
.policy-copy {
  content-visibility: auto;
  contain-intrinsic-block-size: 420px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1rem;
  align-items: start;
  padding-bottom: 2rem;
}

.results-shell,
.mini-panel {
  padding: clamp(1rem, 3vw, 1.35rem);
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.15rem);
}

.section-heading.compact h2 {
  font-size: 1.25rem;
}

.length-tabs {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.length-tabs button {
  min-height: 2.45rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 850;
  padding: 0 0.8rem;
}

.length-tabs button.active {
  border-color: var(--ink);
  background: var(--mint);
  color: var(--ink);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
  min-height: 19rem;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  min-height: 19rem;
  place-content: center;
  border: 1px dashed var(--line);
  text-align: center;
  padding: 1rem;
}

.empty-state h3,
.empty-state p {
  margin: 0.25rem;
}

.word-card {
  display: grid;
  gap: 0.65rem;
  min-height: 8.8rem;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.85rem;
}

.word-card strong {
  overflow-wrap: anywhere;
  font-size: 1.35rem;
}

.word-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.word-meta span {
  background: #f2f4f1;
  padding: 0.3rem 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.word-card button {
  align-self: end;
  min-height: 2.3rem;
  background: var(--gold);
}

.insight-rail {
  display: grid;
  gap: 1rem;
}

.mini-panel {
  box-shadow: 0 12px 34px rgba(20, 33, 31, 0.08);
}

.quest-meter {
  height: 0.75rem;
  margin-top: 1rem;
  background: #ece8dd;
}

.quest-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--gold), var(--coral));
  transition: width 180ms ease;
}

.dna-bars {
  display: grid;
  gap: 0.55rem;
}

.dna-row {
  display: grid;
  grid-template-columns: 1.3rem minmax(0, 1fr) 2rem;
  gap: 0.55rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.dna-track {
  height: 0.7rem;
  background: #ece8dd;
}

.dna-fill {
  height: 100%;
  background: var(--blue);
}

.saved-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-height: 4rem;
}

.saved-list button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0.45rem 0.6rem;
  font-weight: 850;
}

.ad-box {
  min-height: 17rem;
  margin: 0;
}

.feature-band {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 1rem;
  align-items: start;
  padding: clamp(2rem, 6vw, 4rem) 0;
}

.feature-band h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.feature-grid {
  display: grid;
  gap: 0.75rem;
}

.feature-grid article {
  border-top: 2px solid var(--ink);
  padding-top: 1rem;
}

.feature-grid h3 {
  margin: 0;
  font-size: 1.25rem;
}

.seo-section,
.faq-section {
  border-top: 1px solid var(--line);
  padding: clamp(2rem, 6vw, 4rem) 0;
}

.seo-section {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 1rem;
}

.seo-section h2,
.faq-section h2 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1;
}

.seo-copy {
  display: grid;
  gap: 0.8rem;
  line-height: 1.75;
}

.seo-copy p {
  margin: 0;
}

.faq-section {
  max-width: 900px;
}

.faq-section details {
  border-top: 1px solid var(--line);
  padding: 1rem 0;
}

.faq-section details:last-child {
  border-bottom: 1px solid var(--line);
}

.faq-section summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 900;
}

.faq-section p {
  line-height: 1.7;
}

.link-cluster {
  border-top: 1px solid var(--line);
  padding: clamp(2rem, 6vw, 4rem) 0;
}

.link-cluster h2 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1;
}

.link-cluster div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.link-cluster a,
.inline-cta {
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  padding: 0.72rem 0.9rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0.18rem 0.18rem 0 var(--ink);
}

.link-cluster a:hover,
.inline-cta:hover {
  background: var(--mint);
  text-decoration: none;
}

.seo-landing .content-hero {
  padding-bottom: 1rem;
}

.seo-card-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  font-weight: 750;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.content-page {
  min-height: calc(100vh - 220px);
}

.content-hero {
  max-width: 820px;
  padding: clamp(2.4rem, 8vw, 6rem) 0 clamp(1rem, 3vw, 2rem);
}

.content-hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 5.4rem);
  line-height: 0.98;
}

.content-hero p {
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.75;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding-bottom: clamp(2rem, 6vw, 4rem);
}

.content-grid article,
.policy-copy {
  border: 1px solid rgba(22, 33, 31, 0.11);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 12px 34px rgba(20, 33, 31, 0.08);
}

.content-grid article {
  padding: clamp(1rem, 3vw, 1.35rem);
}

.content-grid h2,
.policy-copy h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}

.content-grid p,
.policy-copy p {
  color: var(--muted);
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.policy-copy {
  max-width: 880px;
  margin-bottom: clamp(2rem, 6vw, 4rem);
  padding: clamp(1rem, 4vw, 2rem);
}

.policy-copy h2 {
  margin-top: 1.7rem;
}

.policy-copy h2:first-child {
  margin-top: 0;
}

.policy-copy a,
.content-grid a {
  color: var(--teal-dark);
  font-weight: 850;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

@media (max-width: 900px) {
  .hero,
  .workspace,
  .feature-band,
  .seo-section,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero-copy h1 {
    max-width: 12ch;
  }
}

@media (max-width: 640px) {
  .topbar,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    width: 100%;
    justify-content: space-between;
  }

  .letter-entry,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .primary-button {
    min-height: 3.3rem;
  }

  .tool-row select {
    max-width: none;
    margin-left: 0;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  #copyBtn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  main {
    width: min(100% - 1.5rem, 1180px);
  }

  .topbar {
    gap: 0.7rem;
    padding: 0.85rem 1rem;
  }

  .brand-mark {
    width: 2rem;
    height: 2rem;
    font-size: 0.85rem;
  }

  nav {
    gap: 0.55rem 1.2rem;
    font-size: 0.9rem;
  }

  .hero {
    gap: 1.1rem;
    padding-top: 1.35rem;
  }

  .hero-copy h1 {
    max-width: 13ch;
    font-size: clamp(2.35rem, 11vw, 3.2rem);
  }

  .hero-text {
    line-height: 1.55;
  }

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

  .hero-stats span {
    padding: 0.7rem 0.55rem;
    font-size: 0.82rem;
  }

  .hero-stats strong {
    font-size: 1.15rem;
  }

  .solver-panel,
  .results-shell,
  .mini-panel {
    box-shadow: 0 12px 34px rgba(20, 33, 31, 0.1);
  }

  #letters {
    min-height: 4rem;
  }

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

@media print {
  .topbar,
  .ad-slot,
  .tool-row,
  .footer-links,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  main,
  footer {
    width: 100%;
  }
}
