@font-face {
  font-family: Caveat;
  src: url(./specimen.woff2) format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
:root {
  color-scheme: light;
  --ink: #292434;
  --muted: #686071;
  --purple: #7861bf;
  --accent: #6249a5;
  --cream: #fffcf8;
  --line: #71608230;
  --tint: #eee8f8;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
[hidden], .icons { display: none !important; }
body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background: radial-gradient(ellipse at 5% 21%, #e5defb 0, transparent 46%),
    radial-gradient(ellipse at 92% 3%, #f5dbe8 0, transparent 43%),
    radial-gradient(ellipse at 66% 96%, #f7e5d5 0, transparent 52%),
    linear-gradient(145deg, #f6f0f8, #f9f3ee 66%, #f8f2ea);
}
h1, h2, h3, p, figure { margin: 0; }
button, input, select, summary { font: inherit; }
button, summary, select, input[type=checkbox], input[type=range] { cursor: pointer; }
button, summary, label, input[type=checkbox] { touch-action: manipulation; }
button { color: inherit; border: 1px solid transparent; background: none; }
button:disabled { cursor: default; opacity: .48; }
:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; }
button svg, .under-pad svg {
  width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round;
}
.flip { transform: scaleX(-1); }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.skip:focus { position: absolute; left: 16px; top: 10px; z-index: 5; background: white; padding: 8px; }
.studio-header, main { width: min(100%, 1740px, calc(100svh + 840px)); margin-inline: auto; padding-inline: clamp(14px, 1.6vw, 28px); }
.studio-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; padding-block: 9px; }
.studio-brand, .wordmark { display: flex; align-items: center; }
.studio-brand { gap: 14px; }
.wordmark { color: var(--ink); text-decoration: none; font-size: 21px; font-weight: 750; letter-spacing: -.07em; }
.wordmark img { width: 18px; height: 22px; margin-right: 5px; }
.wordmark span, h1 i, h1 span { color: var(--purple); }
h1, h2, .generator-head h3, .doc-heading { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; }
h1 { border-left: 1px solid var(--line); padding-left: 14px; font-size: 31px; line-height: 1; letter-spacing: -.065em; }
.tools-menu { position: relative; justify-self: end; z-index: 2; }
.tools-menu summary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px;
  padding-inline: 13px; border: 1px solid var(--line); border-radius: 24px; background: #fffaf8b8;
  color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1; list-style: none;
}
.tools-menu summary:hover, .tools-menu[open] summary { background: var(--cream); border-color: #b6a7bd; }
.tools-menu summary svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tools-menu[open] summary svg { transform: rotate(180deg); }
.tools-menu summary::-webkit-details-marker { display: none; }
.tools-menu nav { position: absolute; right: 0; top: calc(100% + 5px); min-width: 165px; padding: 5px; background: var(--cream); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 5px 16px #0001; }
.tools-menu a { display: block; padding: 9px; border-radius: 6px; color: var(--ink); text-decoration: none; font-size: 13px; }
.tools-menu a:hover, .tools-menu a[aria-current=page] { background: var(--tint); }
main { padding-bottom: 16px; }
.card-head, .proof-head, .strip-heading, .generator-head, .variation-head, .download-row {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
.studios { display: inline-flex; border: 1px solid var(--line); padding: 4px; gap: 3px; border-radius: 32px; background: #ffffff65; }
.studios button, .primary, .secondary, .text-btn, .icon-btn, .strip-arrow {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600;
}
.studios button { min-height: 36px; padding: 4px 15px; border-radius: 24px; font-size: 13px; }
.studios button[aria-pressed=true] { background: #42324e; color: #fff; box-shadow: 0 2px 5px #36213b21; }
.studios button:not([aria-pressed=true]):hover, .text-btn:hover, .history button:not(:disabled):hover { background: var(--tint); }
#workspace {
  display: grid; grid-template-columns: clamp(210px, 18vw, 285px) minmax(0, 1.65fr) minmax(0, 1fr);
  grid-template-areas: "tools editor review"; align-items: start; gap: 14px;
}
.tools-column, .review-column { display: grid; gap: 14px; min-width: 0; }
.tools-column { grid-area: tools; }
.editor { grid-area: editor; }
.review-column { grid-area: review; }
.feedback { grid-column: 1 / -1; }
.feedback:empty { display: none; }
#workspace:has(.tools-column[hidden]) { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); grid-template-areas: "editor review"; max-width: 1280px; margin-inline: auto; }
.card {
  min-width: 0; padding: clamp(15px, 1.3vw, 22px); border: 1px solid #ffffffdc;
  border-radius: 17px; background: #fffcf8f2;
  box-shadow: 0 1px 3px #5140590a, 0 8px 28px -16px #63497438;
}
h2 { font-size: clamp(23px, 1.85vw, 29px); line-height: 1.14; letter-spacing: -.055em; }
.kicker { font: 600 10px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: #796582; margin-bottom: 4px; }
.style-trigger, .style-done { display: none; }
.history { display: flex; align-items: center; gap: 1px; }
.history button { min-width: 33px; min-height: 33px; padding: 5px; font-size: 12px; border-radius: 7px; }
.history .clear { margin-left: 5px; color: var(--muted); }
.paper-pad {
  touch-action: none; -webkit-touch-callout: none; overscroll-behavior: none; user-select: none; -webkit-user-select: none;
  overflow: hidden; margin-top: 12px; border: 1px solid #d9cfdf; border-radius: 12px;
  background: radial-gradient(circle, #ac9fb954 .8px, transparent 1px) 0 0/14px 14px, #fffdfe;
}
#pad { display: block; width: 100%; height: auto; aspect-ratio: 2/1; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.rules path { stroke: #c4baca; stroke-width: .65; }
.rules .baseline { stroke: #ac97b9; }
.rules .dashed { stroke-dasharray: 3 5; }
.rules text { font: 6px var(--mono); fill: #82748c; letter-spacing: .08em; text-transform: uppercase; }
.trace { font: 182px Georgia, serif; fill: #74528d19; pointer-events: none; }
#generated-ink { fill: #9379ae80; pointer-events: none; }
#ink, #wet-ink { fill: var(--ink); }
.under-pad, .pad-options, #ink-hint, .under-pad label, .check, .strip {
  display: flex; align-items: center; gap: 7px;
}
.under-pad { justify-content: space-between; flex-wrap: wrap; color: var(--muted); font-size: 11px; margin: 10px 0 17px; }
.under-pad svg { width: 14px; height: 14px; }
.pad-options { flex-wrap: wrap; gap: 4px 10px; }
.pad-options label { gap: 3px; white-space: nowrap; }
.trackpad-hint { display: none; }
@media (any-pointer: fine) { .trackpad-hint { display: block; } }
input[type=checkbox], input[type=range], progress { accent-color: var(--purple); }
.step, .range-pair, .variation-settings { padding-top: 15px; border-top: 1px solid var(--line); }
.strip-heading { margin-bottom: 9px; }
.strip-heading h3, .variation-settings summary { font-size: 13px; font-weight: 650; }
#position, .count { font: 11px var(--mono); color: var(--muted); }
.strip { gap: 6px; }
.strip-arrow { flex: none; width: 34px; height: 46px; color: var(--accent); border-radius: 9px; }
.strip-arrow:not(:disabled):hover { background: var(--tint); }
#upcoming {
  --tile-gap: 6px;
  flex: 1; min-width: 0; display: flex; gap: var(--tile-gap);
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  scrollbar-width: none; user-select: none; -webkit-user-select: none;
}
#upcoming::-webkit-scrollbar { display: none; }
#upcoming button, .glyph-grid button {
  position: relative; border: 1px solid var(--line); border-radius: 9px; background: #fffefa; font: 21px/1 Georgia, serif;
}
#upcoming button { flex: 0 0 calc((100% - 5 * var(--tile-gap)) / 6); min-width: 0; height: 47px; }
#upcoming button:focus-visible { outline-offset: -3px; }
#upcoming button[aria-pressed=true], .glyph-grid button[aria-pressed=true] { background: #e9e2f6; color: #5d428f; border-color: #a58cc9; }
#upcoming button:hover, .glyph-grid button:hover { border-color: var(--purple); }
.glyph-miniature { display: block; width: 100%; height: 100%; fill: currentColor; stroke: none; pointer-events: none; }
#upcoming button, .glyph-grid button { padding: 2px 5px; }
.drawn::after, .generated::after, .grid-key span {
  content: ''; width: 5px; height: 5px; border-radius: 50%; box-sizing: border-box;
}
.drawn::after, .generated::after { position: absolute; right: 5px; bottom: 5px; }
.drawn::after, .drawn-dot { background: var(--accent); }
.generated::after, .generated-dot { border: 1px solid var(--accent); }
.proof-card { background: #fffafaf5; }
#proof-block { position: relative; display: flex; flex: 1; flex-direction: column; }
.text-btn { border-radius: 7px; font-size: 12px; min-height: 34px; padding: 4px 7px; color: var(--accent); }
.text-btn svg { width: 14px; height: 14px; }
.proof-sheet {
  --ruling: clamp(42px,3.5vw,55px);
  display: flex; align-items: center; flex: 1; margin: 12px 0 0; min-height: 155px;
  padding: 20px clamp(20px, 2.2vw, 34px); border: 1px solid #e6d7df; border-radius: 4px 13px 13px 4px;
  background: linear-gradient(90deg, transparent 14px, #e8c5cd 14px 15px, transparent 15px),
    repeating-linear-gradient(to bottom, transparent 0 calc(var(--ruling) - 1px), #d9cde08c calc(var(--ruling) - 1px) var(--ruling)), #fffbf4;
  background-position: 0 0, 0 -8px; box-shadow: 0 3px 6px #624c5b08;
}
.proof {
  width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; color: #55377f;
  font: clamp(35px,3.2vw,51px)/1.12 Caveat, cursive; font-feature-settings: 'calt';
}
.fallback { color: #807780; }
.note { font-size: 12px; line-height: 1.5; color: var(--muted); }
#fallback-note { margin-top: 9px; }
.generate-area { border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; padding-top: 14px; margin-top: 16px; }
.generator-head h3 { font-size: 20px; letter-spacing: -.04em; }
#sample-progress { display: flex; gap: 3px; }
#sample-progress i { width: 16px; height: 4px; background: #e2d9e6; border-radius: 10px; }
#sample-progress .filled { background: var(--purple); }
.primary, .secondary { min-height: 40px; padding: 8px 14px; border-radius: 10px; font-size: 13px; }
.primary { background: var(--accent); color: #fff; }
.primary:disabled { background: #eae4f1; color: #726280; opacity: 1; }
.primary:not(:disabled):hover { background: #50388d; }
.secondary { border-color: var(--line); }
.secondary:not(:disabled):hover { background: var(--tint); }
#font-export { width: 100%; }
#generate { justify-content: space-between; }
#sentence-editor {
  position: absolute; inset: 0 62px auto 0; display: flex; align-items: center; gap: 5px;
  height: 34px;
}
#proof-block:has(#sentence-editor:not([hidden])) .proof-head h2 { visibility: hidden; }
#sentence-editor .text-btn { flex: none; padding-inline: 4px; }
label, .variation-settings summary { font-size: 12px; }
input[type=text], select {
  display: block; width: 100%; border: 1px solid #d7cedb; border-radius: 8px; color: var(--ink);
  background: #fffdfc; padding: 9px 11px; font-size: 15px; margin: 4px 0 11px;
}
#sentence-editor input { min-width: 0; height: 32px; margin: 0; }
progress { display: block; width: 100%; height: 4px; border: 0; border-radius: 6px; overflow: hidden; appearance: none; margin: 10px 0; background: #e7e0e8; }
progress::-webkit-progress-bar { background: #e7e0e8; }
progress::-webkit-progress-value { background: var(--purple); }
progress::-moz-progress-bar { background: var(--purple); }
.group-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.group-row button { min-height: 34px; padding: 5px 10px; border-radius: 8px; color: var(--muted); font-size: 12px; }
.group-row button[aria-pressed=true] { background: var(--tint); color: var(--accent); font-weight: 650; }
.glyph-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(38px,1fr)); gap: 5px; }
.glyph-grid button { height: 38px; font-size: 18px; }
.grid-key { display: flex; align-items: center; gap: 6px; font-size: 11px; margin-top: 8px; color: var(--muted); }
.grid-key span + span, .grid-key .generated-dot { margin-left: 8px; }
.export-card { display: flex; flex-direction: column; }
.export-card h2 { margin-bottom: 10px; }
.export-card label { line-height: 1.4; }
.export-card input[type=text], .export-card select { margin: 3px 0 8px; padding-block: 7px; font-size: 14px; }
#export-note, #alternates-note { margin-top: 8px; }
.variation-settings { margin-top: 10px; padding-top: 10px; }
.variation-head { margin: 14px 0 5px; }
.variation-head output, .range-pair output, .variant-caption { font: 11px var(--mono); color: var(--muted); }
input[type=range] { width: 100%; margin: 4px 0; }
.variants { display: flex; gap: 8px; margin-top: 10px; }
.variants:empty { display: none; }
.variants figure { flex: 1; background: #f3edf6; border-radius: 8px; padding: 5px; text-align: center; }
.variants svg { width: 100%; height: 48px; display: block; }
.range-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.range-pair output { float: right; }
.document { max-width: 270px; margin: 18px auto; background: #fffefa; border: 1px solid var(--line); box-shadow: 0 3px 12px #604d6514; padding: 23px; }
.doc-heading { font-size: 22px; }
.doc-lines { height: 49px; margin-top: 13px; background: repeating-linear-gradient(transparent 0 9px, #e5dfe7 9px 11px); }
.sig-proof { height: 68px; display: flex; align-items: flex-end; padding: 4px 0; border-bottom: 1px solid #95899a; }
.sig-proof svg { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.document small { color: var(--muted); font: italic 12px Georgia; }
.check { margin: 12px 0; }
.download-row { justify-content: flex-start; flex-wrap: wrap; }
.feedback { margin-top: 10px; font-size: 13px; color: var(--accent); }
/* A finished stroke may change every letter in the specimen. Keep its metrics
   independent of the grid and give long custom sentences their own scroll. */
#pad * { pointer-events: none; }
.proof-sheet { flex: none; flex-direction: column; align-items: stretch; contain: size; block-size: clamp(152px, 23vh, 232px); min-block-size: 0; overflow: auto; }
.proof { margin-block: auto; flex: none; }
#fallback-note, #export-note { min-block-size: 3em; }
#character-card { container-type: inline-size; }
.glyph-grid { grid-template-columns: repeat(8,minmax(0,1fr)); grid-template-rows: repeat(4,38px); }
@container (min-width: 480px) {
  .glyph-grid { grid-template-columns: repeat(11,minmax(0,1fr)); grid-template-rows: repeat(3,38px); }
}
.variants, .variants:empty { display: flex; min-height: 76px; }
#alternates-note[hidden] { display: block !important; visibility: hidden; }
#generate, #set-status { block-size: 40px; }
#set-status { display: flex; gap: 9px; align-items: center; justify-content: center; border-radius: 10px; color: #57447d; background: var(--tint); font-size: 13px; font-weight: 600; }
.set-indicator { display: grid; place-items: center; width: 16px; height: 16px; border: 2px solid #9580b6; border-radius: 50%; }
.set-indicator::after { content: ''; width: 6px; height: 3px; margin-top: -2px; border: solid var(--accent); border-width: 0 0 1.5px 1.5px; transform: rotate(-45deg); }
.updating .set-indicator { border-color: #cdbde1; border-top-color: var(--accent); animation: set-spin .6s linear infinite; }
.updating .set-indicator::after { visibility: hidden; }
@keyframes set-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .updating .set-indicator { animation: none; } }
/* Highlight paint adds no width to the glyphs or their lines. */
::highlight(fingerfont-letter) { color: #4c2d72; background: #e6d4fc; }
.proof mark, .letter-swatch { color: #4c2d72; background: #e6d4fc; border-radius: 3px; }
.letter-swatch { font-size: 1.45em; line-height: 1; padding-inline: .18em; }
.style-header, .emphasis-controls { display: flex; align-items: center; gap: 8px; }
.style-header { justify-content: space-between; flex-wrap: wrap; margin-bottom: 9px; }
.emphasis-controls { gap: 4px; }
.emphasis-controls button { width: 30px; height: 34px; border: 1px solid var(--line); border-radius: 7px; font: 19px Georgia, serif; }
.emphasis-controls button[aria-pressed=true] { background: var(--tint); border-color: var(--purple); color: var(--accent); }
#style-options { display: grid; grid-template-columns: 1fr; gap: 6px; }
#style-options button {
  position: relative; display: grid; grid-template-columns: 47px 1fr; align-content: center; gap: 1px 8px;
  text-align: left; line-height: 1.3; min-height: 47px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 11px; background: #fffdf9;
}
#style-options button:hover { border-color: #af9bc3; }
#style-options button[aria-pressed=true] { border-color: var(--purple); background: #f3eefb; color: #513976; }
#style-options button[aria-pressed=true]::after { content: '✓'; position: absolute; right: 6px; top: 4px; font-size: 11px; color: var(--accent); }
#style-options svg { grid-row: span 2; align-self: center; width: 100%; height: 34px; fill: currentColor; stroke: none; }
#style-options strong { font-size: 13px; }
#style-options small { color: var(--muted); font-size: 11px; }
.generator-head { justify-content: start; gap: 8px; }
#generate-note { grid-column: 1; margin: 0; min-block-size: 3em; }
#generate, #set-status { grid-column: 2; grid-row: 1 / span 2; width: auto; padding-inline: 12px; }
@media (max-width: 1199px) {
  #workspace { gap: 10px; }
  .tools-column, .review-column { gap: 10px; }
  .group-row { gap: 2px; }
  .group-row button { padding-inline: 6px; }
  .generate-area { grid-template-columns: 1fr; }
  #generate, #set-status { grid-column: 1; grid-row: auto; }
}
@media (min-width: 741px) and (max-width: 999px) {
  #workspace { grid-template-columns: minmax(200px, .54fr) minmax(0, 1.46fr); grid-template-areas: "tools editor" "tools review"; }
}
@media (max-width: 999px) {
  #proof-card { display: none; }
  #mobile-proof-slot { margin: 12px 0 14px; }
  #mobile-proof-slot h2 { font: 650 13px/1.4 Inter, -apple-system, sans-serif; letter-spacing: 0; }
  #mobile-proof-slot .proof-sheet { --ruling: 36px; block-size: 116px; padding: 12px 20px; margin-top: 1px; }
  #mobile-proof-slot .proof { font-size: 32px; }
  #mobile-proof-slot .text-btn { min-height: 32px; }
  #mobile-proof-slot .note { min-block-size: 1.5em; font-size: 11px; }
}
@media (max-width: 740px) {
  .studio-header { grid-template-columns: 1fr auto; gap: 8px; padding-block: 9px; }
  .studio-brand { gap: 9px; }
  h1 { font-size: 26px; padding-left: 9px; }
  .studios { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .studios button { min-height: 32px; padding: 4px 10px; font-size: 12px; }
  .tools-menu { grid-column: 2; grid-row: 1; }
  #workspace, #workspace:has(.tools-column[hidden]) { display: flex; flex-direction: column; align-items: stretch; }
  .tools-column, .review-column { display: contents; }
  #editor { order: 0; }
  :where(#workspace:has(.tools-column:not([hidden]) #font-styles[popover])) .history .style-trigger {
    display: inline-flex; align-items: center; padding-inline: 10px; margin-right: 4px;
    border-color: var(--line); color: var(--ink); font-weight: 600;
  }
  .history .style-trigger:not(:disabled):hover { background: var(--cream); }
  #workspace:has(#font-styles:popover-open) .style-trigger { background: var(--tint); color: var(--accent); }
  #font-styles[popover] { width: min(360px, calc(100% - 24px)); max-height: calc(100svh - 24px); overflow-y: auto; margin: auto; color: var(--ink); background: var(--cream); box-shadow: 0 14px 56px #3b254338; }
  #font-styles[popover]::backdrop { background: #34233d38; }
  #font-styles[popover] .style-done { display: block; width: auto; margin-left: 4px; padding-inline: 9px; font-family: inherit; font-weight: 600; font-size: 12px; color: var(--accent); }
  #font-styles, #signature-card { order: 1; }
  #character-card { order: 2; }
  .export-card { order: 3; }
  .feedback { order: 4; }
  #style-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #style-options button { grid-template-columns: 1fr; }
  #style-options svg { grid-row: auto; }
  #generate-note { min-block-size: 1.5em; }
}
@media (max-width: 370px) {
  .studio-brand { gap: 5px; }
  .wordmark { font-size: 18px; }
  h1 { padding-left: 6px; font-size: 24px; }
  .tools-menu summary { padding-inline: 10px; }
  .studios button svg { width: 14px; }
  .studios button { padding-inline: 6px; font-size: 11px; gap: 4px; }
}
@media (max-width: 430px) {
  .studio-header, main { padding-inline: 10px; }
  .history button { min-width: 28px; }
  .strip-arrow { width: 25px; }
  .strip { gap: 4px; }
  #upcoming { --tile-gap: 4px; }
  #upcoming button { height: 38px; }
  .paper-pad { margin-top: 12px; }
}
