[hidden] {
  display: none !important;
}

:root {
  --bg: #f5f0e8;
  --surface: #fffdf7;
  --ink: #2b2118;
  --muted: #6b6258;
  --line: #ddd5c4;
  --soft: #eaf0f4;
  --accent: #1a5c7a;
  --accent-dark: #124059;
  --danger: #943325;
  --shadow: 0 22px 50px rgba(43, 33, 24, 0.09);
  --shadow-sm: 0 4px 16px rgba(43, 33, 24, 0.07);
  --parchment-line: rgba(180, 160, 120, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, white);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 18px;
  top: 12px;
  z-index: 100;
  transform: translateY(-140%);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 9px 12px;
  text-decoration: none;
  transition: transform 160ms ease;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 50px);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 240, 232, 0.93);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.brand > span:last-child {
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 700;
  font-size: 18px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 22px;
  font-style: italic;
  box-shadow: 0 2px 6px rgba(43, 33, 24, 0.08);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 13.5px;
}

.site-nav a {
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 7px;
  transition: background 140ms ease, color 140ms ease;
}

.site-nav a:hover {
  background: color-mix(in srgb, var(--soft) 70%, var(--bg));
  color: var(--ink);
}

main {
  width: min(1240px, calc(100% - 34px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

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

body:not([data-page="home"]) .tool-hero {
  position: relative;
  align-items: center;
  margin-bottom: 10px;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 253, 247, 0.94), rgba(234, 240, 244, 0.52)),
    var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
body:not([data-page="home"]) .tool-hero > * {
  position: relative;
  z-index: 1;
}

body:not([data-page="home"]) .tool-hero h1 {
  max-width: 760px;
  font-size: clamp(36px, 4.4vw, 58px);
}

body:not([data-page="home"]) .tool-hero .secondary-button.primary {
  justify-self: end;
  white-space: nowrap;
}
.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 830px;
  margin-bottom: 14px;
  font-size: clamp(38px, 5vw, 70px);
  line-height: 0.96;
  font-weight: 700;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  letter-spacing: -0.01em;
}

.lede {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.quick-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 250px;
}

.quick-stats span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, var(--bg));
  color: var(--muted);
  padding: 7px 13px;
  font-size: 12px;
  letter-spacing: 0.03em;
}
.home-hero {
  align-items: start;
}

.home-hero .hero-actions {
  margin-top: 22px;
}

.value-strip {
  align-self: end;
  max-width: 520px;
}

.value-strip span {
  background: rgba(255, 253, 247, 0.74);
  color: color-mix(in srgb, var(--muted) 82%, var(--ink));
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
  align-items: start;
}

.workspace,
.settings {
  min-width: 0;
}

.input-card,
.panel,
.result-card,
.worksheet-preview {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.input-card {
  padding: 16px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
}
.input-card > * {
  position: relative;
  z-index: 1;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.field-head label {
  margin-bottom: 8px;
}

.field-head span {
  margin-bottom: 8px;
  white-space: nowrap;
}

.field-head span.warning {
  color: var(--danger);
  font-weight: 760;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.input-guidance,
.style-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.preset-row button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 60%, var(--surface));
  color: var(--muted);
  padding: 0 12px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.02em;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.preset-row button:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent);
  background: color-mix(in srgb, var(--soft) 80%, var(--surface));
}

#sourceText {
  width: 100%;
  min-height: 56px;
  border: 1px solid transparent;
  border-bottom: 2px solid var(--line);
  border-radius: 7px 7px 0 0;
  outline: 0;
  padding: 8px 14px;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  font-family: Georgia, serif;
  font-style: italic;
  transition: border-color 160ms ease, background 160ms ease;
}

#sourceText:focus {
  border-bottom-color: var(--accent);
  background: rgba(255, 253, 247, 0.7);
}

.icon-button,
.mode,
.secondary-button,
.small-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  min-height: 54px;
  color: var(--muted);
}

.modebar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 18px 0 14px;
  padding: 5px;
  background: color-mix(in srgb, var(--bg) 70%, var(--line));
  border: 1px solid var(--line);
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
}

.mode {
  padding: 0 16px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.mode:hover:not(.active) {
  color: var(--ink);
  background: rgba(255, 253, 247, 0.6);
}

.mode.active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(43, 33, 24, 0.08);
}

.mode-note {
  min-height: 20px;
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.style-summary {
  margin: -8px 0 14px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-height: 282px;
}

.result-card {
  min-height: 282px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  cursor: pointer;
  border-radius: 10px;
  content-visibility: auto;
  contain-intrinsic-size: auto 210px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.result-card.active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 16px 38px rgba(26, 92, 122, 0.12);
}

.result-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}

.result-head,
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
}

.result-head {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.result-stage {
  position: relative;
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 120px;
  padding: 24px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) 85%, var(--bg));
}

.result-text {
  position: relative;
  z-index: 1;
  color: var(--ink);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.result-text::after,
.result-type-label::after,
.result-caption::after {
  content: attr(data-label);
}

.result-text::after {
  content: attr(data-output);
}

.result-caption {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.mode-image {
  background-image:
    linear-gradient(45deg, #ecebe4 25%, transparent 25%),
    linear-gradient(-45deg, #ecebe4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ecebe4 75%),
    linear-gradient(-45deg, transparent 75%, #ecebe4 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

body[data-export-background="white"] .mode-image,
body[data-export-background="white"] .mode-signature {
  background: #fff;
}

body[data-export-background="paper"] .mode-image,
body[data-export-background="paper"] .mode-signature {
  background: #f5f0e8;
}

body[data-export-size="wide"] .mode-image,
body[data-export-size="wide"] .mode-signature {
  min-height: 132px;
}

body[data-export-size="square"] .mode-image,
body[data-export-size="square"] .mode-signature {
  min-height: 178px;
}

.mode-signature::after {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 42px;
  height: 2px;
  background: color-mix(in srgb, var(--ink) 32%, transparent);
}

.mode-signature .result-caption {
  padding-left: 2px;
}

.mode-tattoo {
  background:
    linear-gradient(110deg, rgba(184, 126, 91, 0.2), rgba(239, 204, 176, 0.72)),
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.48), transparent 28%);
}

.mode-tattoo::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  height: 1px;
  background: repeating-linear-gradient(90deg, rgba(22, 23, 22, 0.42) 0 1px, transparent 1px 14px);
}

.mode-worksheet {
  background:
    repeating-linear-gradient(var(--surface) 0 35px, var(--parchment-line) 35px 36.5px),
    var(--surface);
}

.mode-worksheet .result-caption,
.mode-tattoo .result-caption,
.mode-signature .result-caption {
  font-weight: 700;
}

.font-script {
  font-family: "Brush Script MT", "Segoe Script", "Apple Chancery", cursive;
}

.font-formal {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}

.font-bold {
  font-family: "Lucida Handwriting", "Segoe Script", cursive;
  font-weight: 800;
}

.font-social {
  font-family: "Trebuchet MS", ui-sans-serif, sans-serif;
  font-style: italic;
}

.font-mono-script {
  font-family: "Courier New", monospace;
  font-style: italic;
}

.result-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  background: color-mix(in srgb, var(--bg) 40%, var(--surface));
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  border-radius: 6px;
  transition: color 140ms ease, border-color 140ms ease;
}

.result-action-label::after {
  content: attr(data-label);
}

.small-button.primary,
.secondary-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.settings {
  display: grid;
  gap: 14px;
}

.advanced-settings {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
  overflow: hidden;
}

.advanced-settings > summary {
  min-height: 48px;
  padding: 14px 16px;
  color: var(--accent);
  background: color-mix(in srgb, var(--surface) 88%, var(--soft));
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.advanced-settings > .panel {
  margin: 0 12px 12px;
}

.advanced-settings > .panel:first-of-type {
  margin-top: 12px;
}

.quick-actions-panel {
  border-top: 3px solid color-mix(in srgb, var(--accent) 45%, var(--line));
}

.panel {
  padding: 18px;
}

.panel h2 {
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.panel select,
.panel input[type="range"] {
  width: 100%;
  margin-bottom: 14px;
}

select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 90%, var(--bg));
  color: var(--ink);
  padding: 0 10px;
  font-size: 14px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  width: 31px;
  height: 31px;
  border: 2px solid var(--surface);
  border-radius: 999px;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
}

.swatch.active {
  box-shadow: 0 0 0 2px var(--accent);
}

.export-actions,
.favorites {
  display: grid;
  gap: 8px;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  text-align: left;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}

.secondary-button.subtle {
  margin-top: 12px;
  background: color-mix(in srgb, var(--bg) 70%, var(--surface));
  color: var(--muted);
}

a.secondary-button {
  width: auto;
  min-width: 148px;
  padding: 0 16px;
  text-align: center;
}

.secondary-button:hover,
.small-button:hover,
.icon-button:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent);
}

.secondary-button.primary:hover,
.secondary-button.primary:focus-visible,
.small-button.primary:hover,
.small-button.primary:focus-visible {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #fff;
  box-shadow: 0 8px 20px rgba(26, 92, 122, 0.16);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:disabled:hover {
  border-color: var(--line);
  color: var(--muted);
}

.note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.export-summary {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.favorite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 13px;
}

.worksheet-preview {
  margin-top: 14px;
  padding: 18px;
  scroll-margin-top: 84px;
}

.worksheet-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.worksheet-toolbar h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.letter-worksheet-form {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  min-width: 0;
}

.letter-worksheet-form label {
  font-size: 14px;
  font-weight: 600;
}

.letter-worksheet-form input[type="text"] {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
}

.letter-worksheet-form .secondary-button {
  min-height: 44px;
}

.legal-page .content-section > p,
.legal-page .content-section > ul,
.legal-page .hero-copy > p:not(.eyebrow) {
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.legal-page .content-section > p + p {
  margin-top: 14px;
}

.legal-page .content-section > ul {
  padding-left: 22px;
}

.legal-page .content-section > ul li + li {
  margin-top: 8px;
}

.legal-table-wrap {
  margin: 22px 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.legal-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
  line-height: 1.55;
}

.legal-table th,
.legal-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.legal-table thead th {
  background: var(--soft);
  font-weight: 700;
  color: var(--ink);
}

.legal-table tbody tr:last-child th,
.legal-table tbody tr:last-child td {
  border-bottom: 0;
}

.legal-table tbody th {
  font-weight: 700;
  color: var(--ink);
}

.legal-faq-list {
  margin: 20px 0 24px;
  display: grid;
  gap: 16px;
}

.legal-faq-item {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.legal-faq-item h3 {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.4;
}

.legal-faq-item p {
  margin: 0;
}

.worksheet-line {
  min-height: 58px;
  border-bottom: 1px dashed #b8b4a9;
  display: flex;
  align-items: center;
  color: color-mix(in srgb, var(--ink) 62%, transparent);
}

.worksheet-line span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: 38px;
}
.trust-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.trust-strip div {
  border: 1px solid var(--line);
  border-top: 3px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 84%, var(--soft));
  padding: 18px 16px;
}
.trust-strip strong {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  color: var(--ink);
}

.trust-strip span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.trust-strip a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.seo-band {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 32px;
  margin-top: 42px;
  padding: 34px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.seo-band h2 {
  font-size: 26px;
  line-height: 1.1;
  margin-bottom: 12px;
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 700;
}

.seo-band p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 15px;
}

.section-lede {
  max-width: 760px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.section-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.task-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.task-card {
  min-height: 188px;
  display: grid;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.96), rgba(255, 253, 247, 0.82)),
    var(--surface);
  padding: 20px;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(43, 33, 24, 0.05);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.task-card:hover,
.task-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 16px 34px rgba(26, 92, 122, 0.1);
  transform: translateY(-2px);
}

.task-card > span {
  width: fit-content;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--soft) 70%, var(--surface));
  color: var(--accent);
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.task-card strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-style: italic;
  line-height: 1.1;
}

.task-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.58;
}

.home-alphabet-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.home-alphabet-grid a {
  display: grid;
  min-height: 92px;
  place-items: center;
  gap: 5px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 9px;
  background:
    repeating-linear-gradient(to bottom, rgba(255, 253, 247, 0) 0 27px, var(--parchment-line) 28px),
    color-mix(in srgb, var(--surface) 88%, var(--bg));
  padding: 10px 6px;
  text-align: center;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.home-alphabet-grid a:hover,
.home-alphabet-grid a:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 12px 28px rgba(26, 92, 122, 0.1);
  transform: translateY(-1px);
}

.home-alphabet-grid strong {
  color: var(--accent);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 400;
  line-height: 0.9;
}

.home-alphabet-grid span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.worksheet-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.worksheet-card,
.design-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 18px;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.worksheet-card:hover,
.worksheet-card:focus-visible,
.design-card:hover,
.design-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.worksheet-card strong,
.design-card strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-style: italic;
  line-height: 1.15;
}

.worksheet-card p,
.design-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.58;
}

.mini-worksheet {
  min-height: 116px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    repeating-linear-gradient(to bottom, #fff 0 28px, #ebe3d3 29px),
    #fff;
  padding: 12px;
}

.mini-worksheet span {
  color: var(--accent);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: 30px;
  line-height: 1;
}

.mini-worksheet i {
  display: block;
  border-bottom: 1px dashed #b8b1a4;
}

.alphabet-mini {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
}

.line-mini,
.blank-mini {
  align-content: end;
}

.name-mini {
  align-content: center;
}

.learning-path {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.learning-path a {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 8px;
  min-height: 170px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 90%, var(--soft));
  padding: 16px;
  text-decoration: none;
}

.learning-path span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.learning-path strong {
  color: var(--ink);
  font-size: 14px;
}

.learning-path em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.design-scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.script-sample {
  min-height: 82px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.72), transparent 28%),
    color-mix(in srgb, var(--soft) 56%, var(--surface));
  color: var(--accent);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.two-column-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.output-explainer ul,
.content-card ul,
.content-card ol {
  margin: 10px 0 0;
  padding-left: 18px;
}

.privacy-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.feature {
  display: grid;
  gap: 8px;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 18px;
  text-decoration: none;
  align-content: start;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

body:not([data-page="home"]) .feature,
body:not([data-page="home"]) .content-card,
body:not([data-page="home"]) details {
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(255, 253, 247, 0.9)),
    var(--surface);
}

a.feature:hover,
a.feature:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  box-shadow: 0 10px 28px rgba(26, 92, 122, 0.1);
  transform: translateY(-2px);
}

.feature strong {
  font-size: 15px;
  font-weight: 700;
  font-family: Georgia, serif;
  font-style: italic;
  color: var(--ink);
}

.feature span {
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.faq-grid {
  display: grid;
  gap: 8px;
}

details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 0;
  overflow: hidden;
  transition: box-shadow 160ms ease, border-color 160ms ease;
}

details[open] {
  box-shadow: var(--shadow-sm);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
}

summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  padding: 16px 18px;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  user-select: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "";
  display: inline-block;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 220ms ease;
  margin-top: -3px;
}

details[open] summary::after {
  transform: rotate(-135deg);
  margin-top: 3px;
  border-color: var(--accent);
}

details p {
  margin: 0;
  padding: 0 18px 16px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

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

.content-card {
  border: 1px solid var(--line);
  border-left: 3px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  padding: 18px 18px 18px 16px;
  transition: border-left-color 160ms ease, box-shadow 160ms ease;
}

.content-card:hover {
  border-left-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: var(--shadow-sm);
}

.content-card h3 {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.content-card p,
.content-card li {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.text-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 760;
  text-decoration: none;
}

.text-link:hover,
.text-link:focus-visible {
  color: var(--accent-dark);
  text-decoration: underline;
}

.tool-widget {
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.94), rgba(255, 253, 247, 0.84)),
    var(--surface);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.tool-widget h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.tool-widget p {
  color: var(--muted);
  line-height: 1.6;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.mini-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.mini-form input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.variant-output {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.troubleshooter-result {
  min-height: 54px;
  margin-top: 14px;
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  background: color-mix(in srgb, var(--soft) 60%, var(--surface));
  color: var(--muted);
  line-height: 1.55;
}

.transparent-preview-stage {
  min-height: 180px;
  display: grid;
  place-items: center;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.transparent-preview-stage[data-preview-bg="checker"] {
  background-image:
    linear-gradient(45deg, #ecebe4 25%, transparent 25%),
    linear-gradient(-45deg, #ecebe4 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ecebe4 75%),
    linear-gradient(-45deg, transparent 75%, #ecebe4 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.transparent-preview-stage[data-preview-bg="dark"] {
  background: #1d2428;
}

.transparent-preview-stage[data-preview-bg="paper"] {
  background:
    repeating-linear-gradient(to bottom, transparent 0 31px, var(--parchment-line) 31px 32px),
    var(--bg);
}

.transparent-preview-sample {
  color: var(--accent);
  font-family: "Brush Script MT", "Segoe Script", cursive;
  font-size: clamp(42px, 7vw, 86px);
  line-height: 1;
  text-align: center;
  padding: 24px;
}

.stroke-demo-card {
  display: grid;
  gap: 16px;
  margin: 16px 0 0;
  padding: clamp(12px, 2.5vw, 24px);
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stroke-demo-image {
  display: block;
  width: 100%;
  height: auto;
}

.stroke-demo-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 32px;
  padding-inline-start: 1.4rem;
  margin: 0;
}

.stroke-demo-steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

.stroke-demo-card figcaption {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

.practice-example-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.practice-example-compare {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.practice-example-compare,
.practice-join-examples {
  margin: 16px 0;
}

.practice-example-grid > * {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 2px;
  padding: 10px 12px 12px;
  overflow-wrap: anywhere;
  background: var(--surface);
  border: 1px solid var(--line-soft, var(--line));
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
}

.practice-script {
  display: block;
  text-align: center;
  font: 300 clamp(32px, 8vw, 58px)/1.55 "Playwrite US Trad", "Segoe Script", cursive;
  color: var(--accent);
}

@media (max-width: 560px) {
  .stroke-demo-steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .practice-example-compare {
    gap: 8px;
  }

  .practice-example-compare > * {
    padding-inline: 8px;
  }
}

.transparent-preview-stage[data-preview-bg="dark"] .transparent-preview-sample {
  color: #fffaf0;
}

.font-library-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.comparison-table {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.comparison-table [role="row"] {
  display: grid;
  grid-template-columns: 0.85fr 1.35fr 1.2fr;
}

.comparison-table [role="row"] > * {
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.comparison-table [role="row"]:last-child > * {
  border-bottom: 0;
}

.font-library {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.font-library-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 24px;
}

.font-preview-field,
.font-search-field,
.font-use-field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.font-preview-field { flex: 0 1 320px; }

.font-search-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.font-library-toolbar :is(input:not([type="checkbox"]), select) {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  font-size: 17px;
}

.font-library-results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  flex-wrap: wrap;
  scroll-margin-top: 80px;
}

.font-library-pagination {
  display: grid;
  grid-template-columns: 1fr minmax(0, auto) 1fr;
  align-items: center;
  gap: 8px;
  justify-self: center;
}

.font-library-pagination[hidden] { display: none; }
.font-library-pagination :is(button, select) { min-height: 44px; }
.font-library-pagination > button { justify-content: center; }

.font-library-pagination > select {
  min-width: 0;
  max-width: 100%;
  padding: 0 8px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.font-library-page .result-card {
  content-visibility: auto;
  contain-intrinsic-block-size: auto 108px;
}

.font-library-filters {
  display: flex;
  flex: 1 1 520px;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  min-width: 0;
}

.font-search-field { flex: 1 1 150px; }
.font-use-field { flex: 1 1 170px; }

.font-commercial-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.font-commercial-filter input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

@media (max-width: 760px) {
  .font-preview-field { flex-basis: 100%; }
  .font-library-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 4px;
  }
  .font-commercial-filter { grid-column: 1 / -1; }
  .font-library-pagination { width: 100%; }
  .font-library-page .result-card { contain-intrinsic-block-size: auto 160px; }
}

.font-library-count,
.font-library-selection,
.font-library-download-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.font-library-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.font-library-steps span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, var(--soft));
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.font-library-selection {
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--soft) 48%, var(--surface));
  padding: 10px 12px;
}

.font-library-download-note {
  max-width: 900px;
}

.font-card {
  display: grid;
  align-content: space-between;
  gap: 10px;
  min-height: 132px;
  min-width: 0;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.font-card strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}

.font-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.result-caption.has-notice {
  display: block;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.font-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.font-sample {
  margin-top: 14px;
  color: var(--accent);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.font-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.font-card-actions .small-button {
  justify-content: center;
  text-align: center;
}

.font-card-actions .font-practice-button {
  grid-column: 1 / -1;
}

.name-studio {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(300px, 1.2fr);
  gap: 18px;
  align-items: stretch;
}

.name-generator-page > *,
.name-studio > * {
  min-width: 0;
}

.name-studio .mini-form {
  grid-template-columns: minmax(0, 1fr);
}

.name-studio .mini-form input {
  width: 100%;
  min-width: 0;
}

.name-generator-page .worksheet-line span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.name-studio-preview,
.signature-preview-panel,
.worksheet-preview-panel {
  display: grid;
  align-content: center;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 38px, var(--parchment-line) 38px 39px),
    var(--surface);
  padding: clamp(20px, 4vw, 38px);
  box-shadow: var(--shadow);
}

.name-studio-output,
.signature-studio-output {
  color: var(--accent);
  font-family: "Great Vibes", "Segoe Script", cursive;
  font-size: clamp(64px, 10vw, 132px);
  line-height: 0.9;
  text-align: center;
  word-break: break-word;
}

.name-studio-preview textarea.name-studio-output {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 220px;
  padding: 20px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 96px;
  line-height: 1.15;
  resize: none;
  overflow: hidden;
  cursor: text;
}

.name-studio-preview textarea.name-studio-output:hover {
  border-color: var(--line);
}

.name-studio-preview textarea.name-studio-output:focus {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 600px) {
  .name-studio-preview textarea.name-studio-output {
    font-size: 64px;
  }
}

.name-studio-label,
.signature-studio-label,
.worksheet-studio-label {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.signature-workbench,
.worksheet-workbench {
  display: grid;
  grid-template-columns: minmax(300px, 1.1fr) minmax(260px, 0.9fr);
  gap: 18px;
}

.signature-preview-panel {
  min-height: 220px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.92), rgba(255, 253, 247, 0.82)),
    conic-gradient(from 140deg at 30% 20%, rgba(26, 92, 122, 0.12), transparent 28%, rgba(180, 160, 120, 0.18), transparent 60%),
    var(--surface);
}
@media (max-width: 860px) {
  .font-library-grid,
  .name-studio,
  .signature-workbench,
  .worksheet-workbench {
    grid-template-columns: 1fr;
  }

  .name-studio-preview,
  .signature-preview-panel,
  .worksheet-preview-panel {
    min-height: 220px;
  }
}

.content-card ul,
.content-card ol {
  margin: 0;
  padding-left: 18px;
}

.content-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

/* Site navigation stays outside the generator, worksheets, and print areas. */
.site-breadcrumbs {
  box-sizing: border-box;
  width: min(1320px, calc(100% - 64px));
  margin: 16px auto 0;
  color: var(--muted, #53616b);
  font: 14px/1.5 system-ui, sans-serif;
}
.site-breadcrumbs--reading { max-width: 960px; }
.site-breadcrumbs--worksheet { width: min(1280px, calc(100% - 48px)); }
.site-breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-breadcrumbs li { display: flex; align-items: baseline; min-width: 0; max-width: 100%; }
.site-breadcrumbs li + li::before {
  content: "";
  align-self: center;
  flex: 0 0 5px;
  height: 5px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
  margin: 0 12px 0 10px;
}
.site-breadcrumbs a, .site-breadcrumbs span { overflow-wrap: anywhere; }
.site-breadcrumbs a { color: var(--accent, #0b6770); text-underline-offset: 3px; }
.site-breadcrumbs a:hover { text-decoration: underline; }
.site-breadcrumbs a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 2px; }
.site-breadcrumbs [aria-current="page"] { color: var(--ink, #202a2e); }
@media (max-width: 760px) {
  .site-breadcrumbs { width: calc(100% - 32px); margin-top: 12px; font-size: 13px; }
  .site-breadcrumbs--worksheet { width: calc(100% - 24px); }
}
@media print { .site-breadcrumbs { display: none !important; } }

/* Article content starts immediately after its introduction; no speculative ad spacers. */

.content-section {
  border-top: 1px solid var(--line);
  padding-top: 32px;
  margin-top: 32px;
}

.content-section > h2 {
  font-size: 24px;
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}

.focus-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(180px, 0.65fr) minmax(220px, 0.7fr);
  align-items: center;
  gap: 24px;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 12px;
  background:
    radial-gradient(circle at 72% 22%, rgba(26, 92, 122, 0.13), transparent 32%),
    linear-gradient(135deg, rgba(255, 253, 247, 0.98), rgba(234, 240, 244, 0.68));
  box-shadow: var(--shadow-sm);
}

.focus-feature h2 {
  margin-bottom: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 3.4vw, 42px);
  font-style: italic;
  line-height: 1.05;
}

.focus-feature p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
.letter-top-workspace {
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 0.85fr);
  align-items: center;
  gap: clamp(24px, 5vw, 56px);
  padding: clamp(26px, 5vw, 42px);
}

/* Letter pages: the one-page tracing sheet sits beside the intro */
.letter-top-workspace--sheet {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 480px);
  align-items: start;
}

.letter-sheet-card {
  display: grid;
  gap: 10px;
  margin: 0;
}

.letter-sheet-card > a {
  display: block;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.letter-sheet-card img {
  display: block;
  width: 100%;
  height: auto;
}

.letter-sheet-card figcaption {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.letter-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Phones: show the sheet right after the intro, before the custom-sheet form */
@media (max-width: 980px) {
  .utility-ui .letter-top-workspace--sheet { gap: 14px; }
  .letter-top-workspace--sheet .letter-top-copy { display: contents; }
  .letter-top-workspace--sheet .letter-sheet-card { order: 1; margin: 6px 0 10px; }
  .letter-top-workspace--sheet :is(.letter-worksheet-form, .letter-top-actions, .letter-top-notes) { order: 2; }
}

.utility-ui .letter-jump-strip { padding: 0; margin-top: 0; }
.utility-ui .letter-jump-strip .letter-jump-panel { padding: 0; border: 0; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.utility-ui .letter-jump-strip .letter-jump-head { display: flex; gap: 10px; align-items: baseline; }
.utility-ui .letter-jump-strip .letter-jump-head span { display: none; }
.utility-ui .letter-jump-strip .letter-jump-grid { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; padding: 4px 4px 8px; max-width: 100%; scrollbar-width: thin; }
.utility-ui .letter-jump-strip .letter-jump-grid a { flex: 0 0 auto; min-width: 44px; font-size: 22px; padding-block: 4px; }
.lv-pair-section .lv-card { max-width: 720px; }

.letter-top-copy {
  display: grid;
  gap: 14px;
  max-width: 650px;
}

.letter-top-copy h1 {
  margin: 0;
}

.letter-top-copy .lede {
  max-width: 620px;
  margin: 0;
}

.letter-top-sample {
  color: var(--accent);
  font-family: var(--letter-focus-font-family, "Playwrite US Trad", "Segoe Script", cursive);
  font-size: clamp(76px, 10vw, 132px);
  line-height: 0.85;
  letter-spacing: 0;
  text-shadow: 0 16px 38px rgba(26, 92, 122, 0.12);
}

.letter-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.letter-top-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.letter-top-notes li {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.72);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  padding: 7px 10px;
}

.letter-jump-panel {
  display: grid;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.92), rgba(255, 253, 247, 0.76)),
    var(--surface);
  padding: 16px;
  box-shadow: 0 18px 42px rgba(34, 28, 21, 0.06);
}

.letter-jump-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.letter-jump-head .eyebrow {
  margin: 0;
}

.letter-jump-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-align: right;
}

.letter-jump-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.letter-jump-grid a {
  display: grid;
  place-items: center;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font-family: var(--letter-focus-font-family, "Playwrite US Trad", "Segoe Script", cursive);
  font-size: clamp(34px, 4vw, 48px);
  line-height: 0.9;
  padding-inline: max(8px, var(--cursive-ink-left, 0px)) max(8px, var(--cursive-ink-right, 0px));
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

.letter-jump-grid a:hover,
.letter-jump-grid a:focus-visible,
.letter-jump-grid a.active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background:
    linear-gradient(180deg, rgba(234, 240, 244, 0.68), rgba(255, 253, 247, 0.96)),
    var(--surface);
  box-shadow: 0 12px 26px rgba(26, 92, 122, 0.1);
  transform: translateY(-1px);
}

.focus-style-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.45fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 253, 247, 0.96), rgba(234, 240, 244, 0.58)),
    var(--surface);
}

.focus-style-panel h2 {
  margin-bottom: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 3vw, 34px);
  font-style: italic;
  line-height: 1.1;
}

.focus-style-panel p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.focus-style-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.focus-style-card {
  display: grid;
  gap: 6px;
  min-height: 92px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  padding: 10px;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.focus-style-card strong {
  color: var(--accent);
  font-family: var(--sample-font-family, var(--letter-focus-font-family, "Playwrite US Trad", "Segoe Script", cursive));
  font-size: clamp(28px, 3.5vw, 46px);
  font-weight: 400;
  line-height: 0.9;
  white-space: nowrap;
  overflow: hidden;
}

.focus-style-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.focus-style-card:hover,
.focus-style-card:focus-visible,
.focus-style-card.active {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  box-shadow: 0 12px 28px rgba(26, 92, 122, 0.1);
  transform: translateY(-1px);
}

.focus-style-card.active {
  background:
    linear-gradient(180deg, rgba(234, 240, 244, 0.7), rgba(255, 253, 247, 0.94)),
    var(--surface);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin-bottom: 10px;
  font-size: 24px;
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.section-head .lede {
  max-width: 720px;
  font-size: 15px;
}

.letter-grid {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 8px;
}
.word-practice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.name-generator-page .letter-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

.word-practice-card {
  container-type: inline-size;
  display: grid;
  gap: 10px;
  min-height: 112px;
  align-content: center;
  border: 1px solid var(--line);
  border-left: 3px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.word-practice-card:hover,
.word-practice-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.word-practice-card strong {
  color: var(--ink);
  font-family: var(--letter-focus-font-family, "Playwrite US Trad", "Segoe Script", cursive);
  font-size: min(clamp(34px, 4.5vw, 52px), var(--cursive-fit-size, 21cqi));
  font-weight: 400;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.word-practice-card strong,
.letter-example > span {
  min-width: 0;
  padding-block: var(--cursive-ink-top, .05em) var(--cursive-ink-bottom, .32em);
  padding-inline: var(--cursive-ink-left, .2em) var(--cursive-ink-right, .2em);
}

.word-practice-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.letter-tile {
  display: grid;
  place-items: center;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  font-family: var(--letter-focus-font-family, "Playwrite US Trad", "Segoe Script", cursive);
  font-size: 34px;
  line-height: 1.35;
  padding: 6px 8px 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

a.letter-tile:hover,
a.letter-tile:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 12px 26px rgba(26, 92, 122, 0.1);
  transform: translateY(-1px);
}

.letter-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.capital-letter-section {
  scroll-margin-top: 90px;
}

.compact-letter-examples {
  margin-bottom: 12px;
}

.compact-letter-examples .letter-example {
  min-height: 136px;
  font-size: clamp(52px, 8vw, 94px);
}

.compact-letter-examples .letter-example > span {
  font-size: min(1em, 24cqi, var(--cursive-fit-size, 100vw));
}

.letter-example {
  min-width: 0;
  min-height: 160px;
  container-type: inline-size;
  display: grid;
  gap: 8px;
  place-items: center;
  align-content: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-family: var(--letter-focus-font-family, "Playwrite US Trad", "Segoe Script", cursive);
  font-size: clamp(68px, 12vw, 132px);
  line-height: 1.4;
  text-align: center;
  color: var(--accent);
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.letter-example > span {
  max-inline-size: 100%;
  font-size: min(1em, 42cqi, var(--cursive-fit-size, 100vw));
  line-height: inherit;
  overflow-wrap: anywhere;
}

.letter-example small {
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

a.letter-example:hover,
a.letter-example:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 16px 34px rgba(26, 92, 122, 0.12);
  transform: translateY(-1px);
}

.letter-practice-section {
  scroll-margin-top: 90px;
}

.worksheet-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.75fr) minmax(320px, 0.9fr);
  align-items: start;
  gap: clamp(22px, 5vw, 56px);
}

.worksheet-copy {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 18px;
}

.worksheet-copy h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 3.4vw, 40px);
  font-style: italic;
  line-height: 1.08;
}

.worksheet-copy .lede {
  font-size: 15px;
}

.compact-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}

.a4-sheet {
  width: min(100%, 760px);
  aspect-ratio: 210 / 297;
  margin: 0 auto;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: 10px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 253, 247, 0) 0,
      rgba(255, 253, 247, 0) 33px,
      rgba(180, 160, 120, 0.18) 34px
    ),
    var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3.2vw, 34px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(14px, 2vw, 22px);
}

.worksheet-layout .a4-sheet {
  max-width: 560px;
}

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

.sheet-kicker,
.sheet-size {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.sheet-header h3 {
  margin: 6px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 5vw, 50px);
  font-style: italic;
  line-height: 1;
}

.alphabet-practice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  align-content: start;
}

.alphabet-practice-grid div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  column-gap: 18px;
  align-items: end;
  min-height: 33px;
  border-bottom: 1px dashed color-mix(in srgb, var(--muted) 40%, var(--line));
  overflow: hidden;
}

.alphabet-practice-grid strong {
  color: var(--accent);
  font-family: var(--letter-focus-font-family, "Playwrite US Trad", "Segoe Script", cursive);
  font-size: clamp(24px, 3.4vw, 34px);
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  border-right: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  padding-right: 10px;
}

.alphabet-practice-grid span {
  color: color-mix(in srgb, var(--ink) 38%, transparent);
  font-family: var(--letter-focus-font-family, "Playwrite US Trad", "Segoe Script", cursive);
  font-size: clamp(18px, 2.4vw, 27px);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  padding-left: 2px;
}

.sheet-lines {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.sheet-lines span {
  min-height: 28px;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 35%, var(--line));
}

.focus-practice-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(43, 33, 24, 0.34);
  backdrop-filter: blur(14px);
}

.focus-practice-overlay[hidden] {
  display: none;
}

.focus-practice-card {
  width: min(720px, 100%);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  border-radius: 14px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 253, 247, 0) 0,
      rgba(255, 253, 247, 0) 39px,
      var(--parchment-line) 40px
    ),
    var(--surface);
  box-shadow: 0 30px 90px rgba(43, 33, 24, 0.28);
  padding: clamp(24px, 5vw, 52px);
  text-align: center;
}

.focus-practice-minimal {
  width: min(860px, 92vw);
  min-height: min(560px, 78vh);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  place-items: center;
  gap: 14px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.focus-practice-card h2 {
  margin-bottom: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 5vw, 48px);
  font-style: italic;
}

.focus-letter {
  margin: 18px auto;
  color: var(--accent);
  font-family: var(--letter-focus-font-family, "Playwrite US Trad", "Segoe Script", cursive);
  font-size: clamp(150px, 28vw, 300px);
  line-height: 0.9;
  text-shadow: 0 12px 34px rgba(26, 92, 122, 0.12);
}

.focus-practice-overlay:not([hidden]) .focus-letter {
  animation:
    focusLetterReveal 1400ms ease-out both,
    focusLetterBreathe 6400ms ease-in-out 1400ms infinite;
}

.focus-stage {
  position: relative;
  width: min(760px, 100%);
  min-height: min(360px, 54vh);
  display: grid;
  place-items: center;
  margin: 0 auto;
  pointer-events: none;
}

.focus-stage .focus-letter {
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.practice-lines {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 50%;
  height: clamp(118px, 18vw, 172px);
  transform: translateY(-48%);
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  pointer-events: none;
  opacity: 0.38;
}

.practice-lines span {
  border-top: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
}

.practice-lines span:nth-child(2) {
  border-top-style: dashed;
}

.practice-lines span:last-child {
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}

.focus-controls {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  pointer-events: auto;
}

.focus-pair-toggle,
.focus-alpha-nav,
.focus-auto-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--surface) 62%, var(--line));
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.16);
  backdrop-filter: blur(10px);
}

.focus-auto-control {
  gap: 10px;
  padding-inline: 10px;
}

.focus-style-select,
.focus-sound-select {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 5px 7px 5px 10px;
  border: 1px solid color-mix(in srgb, var(--surface) 62%, var(--line));
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.16);
  backdrop-filter: blur(10px);
  color: color-mix(in srgb, var(--surface) 78%, var(--ink));
  font-size: 13px;
  font-weight: 700;
}

.focus-style-select select,
.focus-sound-select select {
  width: 118px;
  min-height: 30px;
  margin: 0;
  border: 1px solid rgba(255, 253, 247, 0.48);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.86);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.focus-auto-toggle,
.focus-interval-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: color-mix(in srgb, var(--surface) 78%, var(--ink));
  font-size: 13px;
  font-weight: 700;
}

.focus-auto-toggle input {
  accent-color: var(--accent);
}

.focus-interval-label input {
  width: 54px;
  min-height: 30px;
  border: 1px solid rgba(255, 253, 247, 0.48);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.86);
  color: var(--accent);
  text-align: center;
  font-weight: 800;
}

.focus-chip,
.focus-nav-button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: color-mix(in srgb, var(--surface) 78%, var(--ink));
  padding: 0 12px;
  cursor: pointer;
}

.focus-chip.active {
  background: rgba(255, 253, 247, 0.86);
  color: var(--accent);
  font-weight: 800;
}

.focus-current-letter {
  min-width: 34px;
  color: var(--surface);
  font-weight: 800;
  text-align: center;
}

.focus-exit-hint {
  position: relative;
  z-index: 3;
  margin: 0;
  color: color-mix(in srgb, var(--surface) 66%, transparent);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.focus-practice-card p:not(.eyebrow) {
  max-width: 520px;
  margin: 0 auto 22px;
  color: var(--muted);
  line-height: 1.65;
}

.changelog-list {
  display: grid;
  gap: 18px;
}

.changelog-card {
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.92), rgba(255, 253, 247, 0.78));
  box-shadow: var(--shadow-soft);
}

.changelog-head {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.changelog-head h3 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: clamp(20px, 2.6vw, 26px);
  line-height: 1.15;
}

.changelog-head time {
  color: var(--muted);
  font-weight: 700;
}

.changelog-card ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 20px;
}

.changelog-card li {
  padding-left: 2px;
  line-height: 1.55;
}

.change-badge {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fffdf7;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.change-badge.added {
  background: #0b6f65;
}

.change-badge.improved {
  background: #7b3fb2;
}

.change-badge.fixed {
  background: #188038;
}

@keyframes focusLetterReveal {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.94);
    filter: blur(9px);
  }

  55% {
    opacity: 0.72;
    filter: blur(2px);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes focusLetterBreathe {
  0%,
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  50% {
    transform: translateY(-4px) scale(1.018);
    opacity: 0.92;
  }
}

.site-footer {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 24px clamp(18px, 4vw, 50px);
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 60%, var(--surface));
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0;
}

.footer-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 24px;
  width: 100%;
  max-width: 1200px;
  min-width: 0;
}

.footer-primary {
  color: color-mix(in srgb, var(--muted) 84%, var(--ink));
}
.site-footer .footer-label {
  flex-basis: 100%;
  text-align: center;
  margin-bottom: 4px;
  color: color-mix(in srgb, var(--muted) 78%, var(--ink));
  font-weight: 700;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  max-width: 100%;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-decoration: none;
  transition: color 140ms ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

@font-face {
  font-family: "Playwrite US Trad";
  src: url("/assets/fonts/worksheet/playwrite-us-trad.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 400;
  font-display: swap;
}

body[data-page="alphabet"] {
  --alphabet-font-family: "Playwrite US Trad", "Segoe Script", cursive;
}

.alphabet-style-control {
  display: grid;
  max-width: 420px;
  gap: 8px;
  margin-top: 18px;
}

.alphabet-style-control label {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.alphabet-style-control p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.alphabet-hero {
  grid-template-columns: minmax(0, 0.78fr) minmax(320px, 0.7fr);
}

/* Printable tracing chart as the first thing on /cursive-alphabet/ */
.alphabet-hero--sheet {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 500px);
  grid-template-areas: "copy sheet" "extra sheet";
  grid-template-rows: min-content 1fr;
  align-content: start;
  align-items: start;
}

.alphabet-hero--sheet .hero-copy { grid-area: copy; align-self: start; }
.alphabet-hero--sheet .alphabet-sheet { grid-area: sheet; }
.alphabet-hero--sheet .alphabet-hero-extra { grid-area: extra; align-self: start; }

@media (max-width: 980px) {
  .alphabet-hero--sheet {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "copy" "sheet" "extra";
  }
}

.alphabet-sheet {
  margin: 0;
}

.alphabet-sheet a {
  display: block;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.alphabet-sheet img {
  display: block;
  width: 100%;
  height: auto;
}

.alphabet-steps {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 22px;
  max-width: 560px;
  line-height: 1.5;
}

.alphabet-hero--sheet .note {
  max-width: 560px;
  margin-top: 12px;
}

.alphabet-hero-chart {
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 29px, var(--parchment-line) 30px),
    rgba(255, 253, 247, 0.72);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.alphabet-chart-mini,
.alphabet-chart-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.alphabet-chart-mini a,
.alphabet-chart-grid a {
  display: grid;
  place-items: center;
  min-height: 58px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  text-decoration: none;
}

.alphabet-chart-mini a,
.alphabet-chart-grid strong {
  color: var(--accent);
  font-family: var(--alphabet-font-family);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 400;
  line-height: 0.9;
}

.alphabet-chart-mini a {
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

.alphabet-chart-mini a:hover,
.alphabet-chart-mini a:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--surface);
  box-shadow: 0 12px 26px rgba(26, 92, 122, 0.1);
  transform: translateY(-1px);
}

.alphabet-chart-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.alphabet-chart-grid a {
  gap: 6px;
  min-height: 108px;
  padding: 12px 8px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.alphabet-chart-grid a:hover,
.alphabet-chart-grid a:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 12px 28px rgba(26, 92, 122, 0.1);
  transform: translateY(-1px);
}

.alphabet-chart-grid span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.alphabet-print-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(240px, 0.55fr);
  gap: 18px;
  align-items: start;
}

.alphabet-template-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.alphabet-style-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}

.alphabet-style-card {
  display: grid;
  container-type: inline-size;
  gap: 7px;
  min-height: 104px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 92%, #fff);
  color: var(--ink);
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.alphabet-style-card strong {
  color: var(--accent);
  font-family: var(--sample-font-family, var(--alphabet-font-family));
  font-size: min(clamp(27px, 3.4vw, 44px), 16cqi);
  font-weight: 400;
  line-height: 1.35;
  white-space: nowrap;
}

.alphabet-style-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.alphabet-style-card:hover,
.alphabet-style-card:focus-visible,
.alphabet-style-card.active {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
  box-shadow: 0 12px 28px rgba(26, 92, 122, 0.1);
  transform: translateY(-1px);
}

.alphabet-style-card.active {
  background:
    linear-gradient(180deg, rgba(234, 240, 244, 0.68), rgba(255, 253, 247, 0.96)),
    var(--surface);
}

.alphabet-print-area {
  width: min(100%, 720px);
  background: #fff;
  color: #1f1a14;
  box-shadow: var(--shadow);
}

.alphabet-print-area .sheet-header {
  color: #1f1a14;
}

.alphabet-print-area .sheet-header p {
  margin: 6px 0 0;
  color: #5f574d;
  font-size: 13px;
  line-height: 1.45;
}

.alphabet-sheet-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 14px;
  align-content: start;
}

.alphabet-sheet-row,
.alphabet-practice-row,
.custom-sheet-row {
  display: grid;
  align-items: end;
  border-bottom: 1px dashed #b9b1a4;
}

.alphabet-sheet-row,
.alphabet-practice-row {
  container-type: inline-size;
  align-items: baseline;
  padding-block: 6px 11px;
}

.alphabet-sheet-row {
  grid-template-columns: min(70px, 28%) minmax(0, 1fr);
  column-gap: 14px;
  min-height: 35px;
  padding-block: 3px 4px;
  --model-fit: min(29px, 9cqi);
  --trace-fit: min(25px, 7.5cqi);
}

.alphabet-sheet-row strong,
.alphabet-practice-row strong {
  color: var(--accent);
  font-family: var(--alphabet-font-family);
  font-size: min(var(--alphabet-model-size, 33px), var(--model-fit));
  font-weight: 400;
  line-height: 1.55;
  padding-inline-start: .85em;
}

.alphabet-sheet-row span,
.alphabet-practice-row span,
.custom-sheet-row span {
  color: rgba(43, 33, 24, 0.34);
  font-family: var(--alphabet-font-family);
  font-size: min(var(--alphabet-trace-size, 27px), var(--trace-fit, 27px));
  line-height: 1.6;
  padding-inline-start: .65em;
}

.alphabet-sheet-row :is(strong, span),
.alphabet-practice-row :is(strong, span) {
  white-space: nowrap;
}

.alphabet-sheet-row :is(strong, span) {
  padding-inline-start: .3em;
}

[data-alphabet-style="classic"] {
  --alphabet-model-size: 25px;
  --alphabet-trace-size: 20px;
}

/* Match the compact school chart and allow its descenders to cross the guide line. */
[data-alphabet-style="classic"] .alphabet-sheet-row {
  align-items: end;
  padding-block: 0;
}

[data-alphabet-style="classic"] .alphabet-sheet-row :is(strong, span) {
  padding-inline-start: 0;
}

[data-alphabet-style="classic"] .alphabet-sheet-row strong {
  line-height: 1.5;
}

/* Ballet's lowercase f has a long leading flourish before its baseline origin. */
[data-alphabet-style="ballet"] .alphabet-practice-row[data-letter="f"] :is(strong, span),
[data-alphabet-style="ballet"] .custom-sheet-row span {
  padding-inline-start: 1.55em;
}

body[data-page="alphabet"] .alphabet-chart-grid strong {
  font-size: clamp(26px, 3.2vw, 38px);
  line-height: 1.25;
  padding-bottom: 0.35em; /* room for the g, j, y, z tails above the label */
}

.alphabet-case-practice,
.custom-sheet-lines,
.alphabet-blank-paper {
  display: grid;
  gap: 11px;
  align-content: start;
}

.alphabet-practice-row {
  grid-template-columns: 16% 37% minmax(0, 1fr);
  gap: 0 10px;
  --model-fit: 5cqi;
  --trace-fit: 4.4cqi;
}

.alphabet-practice-row i {
  align-self: end;
}

.alphabet-practice-row i,
.alphabet-blank-line,
.custom-sheet-row.blank span {
  min-height: 30px;
  border-bottom: 1px solid #b9b1a4;
}

.alphabet-blank-line {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: end;
  min-height: 42px;
}

.alphabet-blank-line span {
  color: #8c8275;
  font-size: 12px;
}

.custom-worksheet-builder {
  display: grid;
  grid-template-columns: minmax(260px, 0.45fr) minmax(320px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.custom-worksheet-controls {
  display: grid;
  gap: 10px;
}

.custom-worksheet-controls input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
}

.custom-worksheet-preview {
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.custom-worksheet-preview .sheet-header h3 {
  font-size: clamp(24px, 3.5vw, 36px);
}

.custom-worksheet-preview .sheet-header {
  padding-bottom: 8px;
}

.custom-worksheet-preview .sheet-header p {
  margin-top: 4px;
}

.custom-worksheet-preview .custom-sheet-target {
  min-height: 62px;
  font-size: clamp(42px, 7vw, 68px);
}

.custom-sheet-target {
  display: grid;
  place-items: center;
  min-height: 78px;
  margin: 2px 0 4px;
  color: var(--accent);
  font-family: var(--alphabet-font-family);
  font-size: clamp(46px, 8vw, 82px);
  line-height: 1.45;
  text-align: center;
  overflow-wrap: anywhere;
  padding-inline: .65em;
}

.custom-sheet-row {
  grid-template-columns: minmax(42px, 16%) minmax(0, 1fr);
  gap: 8px;
  min-height: 48px;
}

.custom-sheet-row span {
  overflow-wrap: anywhere;
}

.custom-sheet-row strong {
  color: #5f574d;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.custom-sheet-row.trace span {
  opacity: 0.45;
}

.custom-sheet-row.copy span {
  opacity: 0.24;
}

.alphabet-sheet-footer {
  align-self: end;
  border-top: 1px solid #ddd5c4;
  padding-top: 10px;
  color: #5f574d;
  font-size: 12px;
}

.letter-type-grid a {
  color: var(--accent);
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  body.print-alphabet-worksheet > :not(main),
  body.print-alphabet-worksheet main > :not(.alphabet-print-zone),
  body.print-alphabet-worksheet .alphabet-print-zone > :not(.alphabet-print-layout),
  body.print-alphabet-worksheet .alphabet-print-layout > :not(.alphabet-print-area) {
    display: none !important;
  }

  body.print-alphabet-worksheet,
  body.print-alphabet-worksheet :is(main, .alphabet-print-zone, .alphabet-print-layout, .alphabet-print-area) {
    display: block;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    background: #fff;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  body.print-alphabet-worksheet .alphabet-print-area {
    aspect-ratio: auto;
    --accent: #1d3fd8;
    --line: #14142b;
    font: 16px/1.6 Inter, ui-sans-serif, system-ui, sans-serif;
  }

  body.print-alphabet-worksheet .alphabet-sheet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 22px 0;
  }

  body.print-alphabet-worksheet :is(.alphabet-case-practice, .alphabet-blank-paper, .custom-sheet-lines) {
    display: block;
    margin: 12px 0;
  }

  body.print-alphabet-worksheet :is(.alphabet-sheet-row, .alphabet-practice-row, .alphabet-blank-line, .custom-sheet-row) {
    break-inside: avoid;
  }

  body.print-alphabet-worksheet :is(.alphabet-practice-row, .alphabet-blank-line, .custom-sheet-row) {
    margin-bottom: 6px;
  }

  body.print-alphabet-worksheet .alphabet-practice-row {
    grid-template-columns: 16% 37% minmax(0, 1fr);
    --model-fit: min(30px, 5cqi);
    --trace-fit: min(25px, 4.4cqi);
    margin-bottom: 3px;
  }

  body.print-alphabet-worksheet .alphabet-practice-row i {
    grid-column: auto;
  }

  body.print-alphabet-worksheet .custom-sheet-target {
    min-height: 58px !important;
    margin: 6px 0 8px !important;
    font-size: 44px !important;
  }

  body.print-alphabet-worksheet .sheet-header :is(.sheet-kicker, .sheet-size) {
    letter-spacing: 0;
  }

  body.print-alphabet-worksheet .sheet-header h3 {
    color: var(--line);
    font-size: 18px;
    line-height: 1.45;
    letter-spacing: -.01em;
  }

  .site-header,
  .tool-hero,
  .modebar,
  .result-grid,
  .settings,
  .seo-band,
  .site-footer,
  .input-card {
    display: none !important;
  }

  main {
    width: auto;
    padding: 0;
  }

  .app-shell {
    display: block;
  }

  .worksheet-preview {
    display: block !important;
    border: 0;
  }

  /* Print the live worksheet, not the surrounding guides or sample sheets. */
  body[data-generator-mode="worksheet"] > :not(main),
  body[data-generator-mode="worksheet"] main > :not(.app-shell),
  body[data-generator-mode="worksheet"] .app-shell > :not(.workspace),
  body[data-generator-mode="worksheet"] .workspace > :not(.worksheet-preview) {
    display: none !important;
  }

  body[data-generator-mode="worksheet"],
  body[data-generator-mode="worksheet"] main,
  body[data-generator-mode="worksheet"] .app-shell,
  body[data-generator-mode="worksheet"] .workspace,
  body[data-generator-mode="worksheet"] .worksheet-preview {
    display: block;
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0;
    background: #fff;
    border: 0;
    box-shadow: none;
  }

  body[data-generator-mode="worksheet"] .worksheet-line {
    break-inside: avoid;
  }

  .worksheet-toolbar {
    display: none !important;
  }
}

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

}

@media (max-width: 980px) {
  .tool-hero,
  .app-shell,
  .seo-band,
  .trust-strip,
  .task-grid,
  .worksheet-card-grid,
  .learning-path,
  .privacy-grid,
  .letter-top-workspace,
  .focus-feature,
  .focus-style-panel,
  .worksheet-layout,
  .alphabet-hero,
  .alphabet-print-layout,
  .custom-worksheet-builder {
    grid-template-columns: 1fr;
  }

  .comparison-table [role="row"] {
    grid-template-columns: 1fr;
  }
  .worksheet-copy {
    position: static;
  }
  .letter-jump-head {
    align-items: start;
  }

  .letter-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .section-head {
    display: grid;
    align-items: start;
  }

  body:not([data-page="home"]) .tool-hero .secondary-button.primary {
    justify-self: start;
  }

  .quick-stats {
    justify-content: flex-start;
  }

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

  .modebar {
    width: 100%;
  }

  .home-alphabet-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .design-scenario-grid,
  .two-column-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-header {
    display: grid;
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 12px;
  }

  .site-nav {
    display: flex;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .site-nav a {
    flex: 0 0 auto;
  }
  .letter-jump-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .letter-jump-head {
    display: grid;
  }

  .letter-jump-head span {
    text-align: left;
  }

  main {
    width: min(calc(100% - 24px), 1240px);
    padding-top: 24px;
  }

  h1 {
    font-size: 40px;
    letter-spacing: -0.005em;
  }

  .input-card {
    position: sticky;
    top: 96px;
    z-index: 8;
  }

  body[data-generator-mode="worksheet"] .input-card {
    position: relative;
    top: auto;
  }

  .worksheet-preview {
    scroll-margin-top: 126px;
  }
  .result-grid,
  .settings,
  .feature-grid,
  .content-grid,
  .task-grid,
  .worksheet-card-grid,
  .learning-path,
  .design-scenario-grid,
  .two-column-grid,
  .privacy-grid,
  .word-practice-grid,
  .letter-pair {
    grid-template-columns: 1fr;
  }

  .result-grid {
    min-height: 578px;
  }

  .panel {
    padding: 14px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .icon-button {
    width: 100%;
  }

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

  .a4-sheet {
    padding: 16px;
    border-radius: 8px;
  }

  .alphabet-practice-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

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

  .alphabet-chart-mini {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .alphabet-style-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .focus-style-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .alphabet-sheet-grid {
    grid-template-columns: 1fr;
  }

  .alphabet-practice-row {
    grid-template-columns: 28% minmax(0, 1fr);
    --model-fit: 8.75cqi;
    --trace-fit: 7.75cqi;
  }

  .alphabet-practice-row i {
    grid-column: 2;
  }

  .alphabet-practice-grid div {
    grid-template-columns: 64px minmax(0, 1fr);
    min-height: 34px;
  }

  .modebar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    border-radius: 10px;
    width: 100%;
  }

  .modebar::-webkit-scrollbar {
    display: none;
  }

  .home-hero .hero-actions,
  .section-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .home-hero .hero-actions .secondary-button,
  .section-actions .secondary-button {
    width: 100%;
  }

  .value-strip {
    max-width: none;
  }

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

  .home-alphabet-grid a {
    min-height: 82px;
  }

  .task-card,
  .worksheet-card,
  .design-card,
  .learning-path a {
    min-height: auto;
  }

  .site-footer {
    justify-items: start;
  }

  .footer-group {
    justify-content: flex-start;
    gap: 4px 18px;
  }
  .site-footer .footer-label {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* /cursive-alphabet/: one-letter tracing sheet dialog */
.letter-sheet-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  overflow: auto;
  padding: 0 16px 16px;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--paper, #fff);
  box-shadow: var(--shadow);
}

.letter-sheet-dialog::backdrop {
  background: rgba(20, 20, 43, 0.45);
}

.letter-sheet-dialog-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 -16px 12px;
  padding: 10px 12px;
  background: var(--paper, #fff);
  border-bottom: 2px solid var(--ink);
}

.letter-sheet-dialog-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.letter-sheet-dialog-x {
  flex: none;
  width: 36px;
  height: 36px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--surface, #fff);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.letter-sheet-dialog img {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
}

.letter-sheet-dialog .letter-sheet-actions {
  margin-top: 12px;
}
