:root {
  color-scheme: light;
  --paper: #f7f4ee;
  --ink: #21172a;
  --muted: #645b69;
  --line: #dcd5dc;
  --white: #fffcf8;
  --lilac: #f4effc;
  --purple: #5124a1;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans) }
a { color: inherit; text-underline-offset: .22em }
a:hover { color: var(--purple) }
button, input, select, textarea { font: inherit; color: inherit; max-width: 100% }
button, select { cursor: pointer }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px }
.wrap { width: min(1100px, calc(100% - 72px)); margin-inline: auto }
.site-header { border-bottom: 1px solid var(--line) }
.site-header .wrap, .site-footer .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding-block: 12px;
  min-height: 67px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 820; letter-spacing: -.045em; text-decoration: none }
.brand-mark {
  display: grid;
  place-items: center;
  width: 29px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font: 19px/1 var(--serif);
}
.site-header nav, .site-footer nav { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 22px; color: var(--muted); font-size: 13px; font-weight: 650 }
.site-header nav a, .site-footer nav a { text-decoration: none }
nav [aria-current="page"] { color: var(--purple); text-decoration: underline }
.site-footer { margin-top: 54px; border-top: 1px solid var(--line) }
.hero { padding-block: 44px 24px }
h1, h2 { margin: 0; font-family: var(--serif); font-weight: 400; line-height: 1.07; letter-spacing: -.047em }
h1 { font-size: clamp(39px, 7vw, 78px) }
h2 { font-size: clamp(27px, 4vw, 37px) }
.hero p, .prose p, .help { color: var(--muted); max-width: 68ch }
.hero p { margin-block: 13px 0 }
.prose { max-width: 760px; padding-bottom: 10px }
.prose h2 { margin-top: 27px }
.prose p { margin-block: 9px 17px }
.prose .page-links { margin-top: 19px }
.page-links { display: flex; flex-wrap: wrap; gap: 7px 18px; color: var(--purple); font-weight: 650 }

.studio { display: grid; grid-template-columns: minmax(245px, .8fr) minmax(0, 1.7fr); border: 1px solid #d3c9d4; border-radius: 17px; background: var(--white); overflow: hidden; box-shadow: 0 13px 36px #2e163a0b }
.studio-controls, .studio-preview { padding: 21px; min-width: 0 }
.studio-preview { display: flex; flex-direction: column; justify-content: center; gap: 13px; border-left: 1px solid var(--line); background: var(--lilac) }
.studio-controls { display: flex; flex-direction: column; gap: 16px }
.field-label { display: block; margin-bottom: 6px; font: 700 11px/1.4 var(--mono); letter-spacing: .065em; text-transform: uppercase }
.field input:not([type="range"]), .field select, textarea.preview-text { display: block; width: 100%; min-height: 42px; padding: 8px 10px; background: var(--white); border: 1px solid var(--line); border-radius: 7px }
.range-field { display: flex; align-items: center; gap: 10px }
.range-field input { flex: 1; min-width: 0; accent-color: var(--purple) }
.range-field output { min-width: 4ch; text-align: right; color: var(--purple); font: 700 13px var(--mono) }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px }
.primary, .secondary { min-height: 40px; padding: 6px 12px; font-size: 13px; font-weight: 760; border-radius: 7px }
.primary { background: var(--purple); color: #fff; border: 1px solid var(--purple) }
.primary:hover { background: #401683 }
.secondary { background: var(--white); border: 1px solid #bdb1c6 }
button:disabled { opacity: .5; cursor: default }
.help { margin: 0; font-size: 13px }
.status { min-height: 1.5em; margin: 0; color: var(--purple); font-size: 13px }
.canvas-frame {
  overflow: hidden;
  border: 1px solid #d3c9d4;
  border-radius: 8px;
  background: repeating-conic-gradient(#eee9f1 0 25%, #fcfafe 0 50%) 50% / 18px 18px;
}
canvas { display: block; width: 100%; height: auto }
textarea.preview-text { resize: vertical; min-height: 110px; color: #381765; font: 29px/1.6 var(--serif); overflow-wrap: anywhere }
.worksheet {
  margin-top: 24px;
  padding: clamp(18px, 4vw, 36px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.worksheet h2 { margin-bottom: 20px }
.practice-row {
  min-height: 69px;
  padding-inline: 9px;
  border-block: 1px solid #a59ca7;
  margin: 0 0 15px;
  display: flex;
  align-items: center;
  color: #21172a;
  font: 35px/1.18 var(--serif);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  background: repeating-linear-gradient(90deg,#9f96a5 0 5px, transparent 5px 11px) center / 100% 1px no-repeat;
}
.practice-row.tracing { color: #706779 }
.practice-row:last-child { margin-bottom: 0 }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap }
@media (max-width: 690px) {
  .wrap { width: calc(100% - 28px) }
  .site-header .wrap, .site-footer .wrap { gap: 8px 16px }
  .site-header nav, .site-footer nav { gap: 6px 13px; font-size: 12px }
  .hero { padding-block: 28px 20px }
  .studio { grid-template-columns: minmax(0, 1fr) }
  .studio-controls, .studio-preview { padding: 15px }
  .studio-preview { border-left: 0; border-top: 1px solid var(--line) }
  .practice-row { font-size: 26px }
}
@media print {
  @page { margin: 16mm }
  body.cursive-page { background: #fff }
  .cursive-page .site-header, .cursive-page .site-footer, .cursive-page main > :not(.worksheet) { display: none }
  .cursive-page .worksheet { width: 100%; margin: 0; border: 0; padding: 0; color: #000; print-color-adjust: exact; -webkit-print-color-adjust: exact }
  .practice-row { min-height: 74px; break-inside: avoid; margin-bottom: 19px }
}
