:root {
  --ink: #17151a;
  --muted: #635f6b;
  --line: #ded6cc;
  --line-strong: #bdaec0;
  --page: #fffdf8;
  --surface: #ffffff;
  --paper: #fffbf2;
  --plum: #71375d;
  --plum-dark: #562745;
  --plum-soft: #f6edf3;
  --sage: #59745d;
  --sage-soft: #eef5ee;
  --shadow: 0 16px 34px rgba(38, 28, 34, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: radial-gradient(circle at top left, #fff8ea 0, var(--page) 34%, #fdf8f3 100%);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(113, 55, 93, 0.22);
  outline-offset: 2px;
}

h1,
h2,
h3,
p,
li,
output {
  overflow-wrap: anywhere;
}

.page-shell {
  width: min(100vw, 1500px);
  margin: 0 auto;
  padding: 28px 36px 46px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 460px);
  gap: 28px;
  align-items: start;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--plum-dark);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(42px, 4.2vw, 68px);
  line-height: 1.02;
  font-weight: 800;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 780px;
  margin: 12px 0 0;
  color: #37323c;
  font-size: 18px;
  line-height: 1.55;
}

.keyword-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.keyword-pills span {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--plum-dark);
  font-size: 14px;
  font-weight: 700;
}

.trust-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid #cbd8c9;
  border-radius: var(--radius);
  background: var(--sage-soft);
}

.trust-note p {
  margin: 0;
  color: #324536;
  font-size: 15px;
  line-height: 1.55;
}

.note-mark {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 2px solid var(--sage);
  border-radius: 50%;
  color: var(--sage);
  font-weight: 800;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(380px, 0.92fr) minmax(520px, 1.08fr);
  gap: 22px;
  align-items: stretch;
}

.panel,
.info-card,
.faq-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

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

.step-label {
  margin: 0 0 4px;
  color: var(--plum);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 20px;
  font-weight: 800;
}

.panel-heading h2,
.info-card h2,
.section-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.panel-heading p:not(.step-label),
.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

#character-count,
.status-pill {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-pill {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #cbd8c9;
  border-radius: var(--radius);
  background: var(--sage-soft);
  color: #2f5738;
}

.field-block {
  display: block;
  margin-top: 18px;
}

.field-label,
.controls-grid label > span,
.segmented-control legend {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
}

textarea,
select {
  inline-size: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

textarea {
  display: block;
  min-height: 235px;
  padding: 16px;
  resize: vertical;
  font-size: 18px;
  line-height: 1.55;
}

select {
  min-height: 44px;
  padding: 0 12px;
}

.controls-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.92fr);
  gap: 16px;
  margin-top: 18px;
}

.segmented-control {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

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

.segmented-control legend {
  grid-column: 1 / -1;
}

.segmented-control label {
  min-width: 0;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: grid;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: #403946;
  font-weight: 700;
}

.segmented-control label:first-of-type span {
  border-radius: 6px 0 0 6px;
}

.segmented-control label:last-of-type span {
  border-radius: 0 6px 6px 0;
}

.segmented-control input:checked + span {
  border-color: var(--plum);
  background: var(--plum);
  color: #fff;
}

.sample-card {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.sample-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

#sample-preview {
  display: block;
  color: #2f2a31;
  font-size: 28px;
  line-height: 1.35;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

button {
  min-height: 44px;
  border-radius: 6px;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.ghost-button,
.copy-button {
  padding: 0 16px;
}

.primary-button {
  border: 1px solid var(--plum);
  background: var(--plum);
  color: #fff;
}

.secondary-button,
.copy-button {
  border: 1px solid var(--plum);
  background: #fff;
  color: var(--plum-dark);
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: #4a444e;
}

.tip {
  margin: 14px 0 0;
  color: #506b54;
  font-size: 14px;
  font-weight: 700;
}

.result-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(160px, 0.55fr) minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.result-row[hidden] {
  display: none;
}

.result-meta h3 {
  margin: 0;
  font-size: 15px;
}

.result-meta p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.result-output {
  display: block;
  min-width: 0;
  color: #1e1b20;
  font-size: 26px;
  line-height: 1.35;
}

.result-list[data-size="small"] .result-output {
  font-size: 20px;
}

.result-list[data-size="large"] .result-output {
  font-size: 34px;
}

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

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.info-card,
.faq-section {
  padding: 20px;
}

.info-card p,
.info-card li,
.faq-grid p {
  color: #403b45;
  font-size: 16px;
  line-height: 1.65;
}

.info-card p {
  margin: 12px 0 0;
}

.info-card ol,
.info-card ul {
  margin: 12px 0 0;
  padding-left: 22px;
}

.wide-card {
  grid-column: 1 / -1;
}

.example-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.example-list p {
  margin: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.example-list p:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.faq-section {
  margin-top: 18px;
}

.section-heading {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.faq-grid article {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.faq-grid h3 {
  margin: 0;
  font-size: 17px;
}

.faq-grid p {
  margin: 8px 0 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--plum);
  border-radius: var(--radius);
  background: var(--plum);
  color: #fff;
  font-weight: 800;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .page-shell {
    padding: 22px 18px 36px;
  }

  .hero,
  .tool-grid,
  .content-grid,
  .faq-grid {
    grid-template-columns: 1fr;
  }

  .controls-grid,
  .result-row {
    grid-template-columns: 1fr;
  }

  .copy-button {
    width: 100%;
  }

  .section-heading {
    display: block;
  }
}

@media (max-width: 520px) {
  .page-shell {
    padding: 18px 12px 30px;
  }

  h1 {
    font-size: 40px;
  }

  .hero-copy > p:not(.eyebrow) {
    font-size: 16px;
  }

  .panel,
  .info-card,
  .faq-section {
    padding: 14px;
  }

  textarea {
    min-height: 190px;
    font-size: 16px;
  }

  #sample-preview {
    font-size: 22px;
  }

  .result-output {
    font-size: 24px;
  }

  .result-list[data-size="large"] .result-output {
    font-size: 28px;
  }

  .action-row > button {
    flex: 1 1 150px;
  }
}
