@font-face {
  font-family: "DM Serif Display";
  src: url("fonts/display.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "DM Serif Display";
  src: url("fonts/display-italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
:root {
  --paper: #fffdf8;
  --ink: #432e4c;
  --muted: #72577e;
  --lilac: #e8dcef;
  --marked: #e2cde9;
  --line: #b3a0bb;
  --hand: "Bradley Hand", "Segoe Print", "Comic Sans MS", cursive;
  --display: "DM Serif Display", Georgia, serif;
  color-scheme: light;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--lilac);
  line-height: 1.5;
  scrollbar-color: var(--line) var(--lilac);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
input, textarea { caret-color: var(--ink); }
a { color: inherit; text-underline-offset: .25em; }
::selection { color: var(--ink); background: var(--marked); }
:focus-visible { outline: 3px solid var(--muted); outline-offset: 4px; }
.site-footer {
  width: min(100% - 3rem, 66rem);
  margin-inline: auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-family: var(--hand);
  font-size: .95rem;
}
.site-footer { padding-block: 1rem 2rem; font-size: .85rem; justify-content: center; }
.page { width: min(100% - 2rem, 44rem); margin: 2.5rem auto 1rem; }
.intro { text-align: center; margin-bottom: 1.75rem; }
h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.4rem, 6.3vw, 4.1rem);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -.03em;
  text-wrap: balance;
}
.intro-copy { margin: .85rem auto 0; max-width: 34rem; font-size: 1rem; }
.toolbar { display: flex; justify-content: center; flex-wrap: wrap; gap: .65rem; align-items: center; margin-bottom: 1rem; }
.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding: .55rem 1.1rem;
  border: 1px solid var(--ink);
  border-radius: .25rem;
  font-family: var(--hand);
  font-size: 1rem;
  transition: transform .15s ease-out;
}
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(0); }
.button-primary { background: var(--ink); color: var(--paper); }
.button-secondary { background: transparent; }
.button-icon { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.5; }
.card { background: var(--paper); border: 1px solid var(--line); padding: 1.7rem 2rem 1.25rem; }
.card-title { margin: 0; text-align: center; font-family: var(--display); font-size: clamp(1.6rem, 4.4vw, 2.55rem); line-height: 1.2; letter-spacing: -.02em; font-weight: 400; }
.title-heart { width: 1em; height: 1em; vertical-align: -.1em; fill: none; stroke: currentColor; stroke-width: 1.4; transform: rotate(-13deg); margin-left: .15em; }
.card-caption { font-family: var(--hand); font-size: .9rem; margin: .3rem 0 1.5rem; text-align: center; }
.names { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; margin-bottom: 1.15rem; }
.name-field { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; gap: .5rem; font-family: var(--hand); font-size: .85rem; }
.name-field input { width: 100%; min-width: 0; min-height: 2.75rem; padding: .2rem 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-size: .9rem; }
.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; padding: 2px; background: var(--ink); }
.cell {
  display: flex;
  justify-content: center;
  align-items: center;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 2.75rem;
  border: 0;
  border-radius: 0;
  padding: .5rem;
  background: var(--paper);
  text-align: center;
  font-size: .85rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.cell.long { aspect-ratio: auto; min-height: 10rem; font-size: .75rem; }
.cell:hover { background: var(--lilac); }
.cell.marked { background: var(--marked); text-decoration: line-through; text-decoration-thickness: 1px; }
.cell:focus-visible { outline-offset: -5px; }
.cell.free { flex-direction: column; gap: .1rem; background: var(--lilac); font-family: var(--hand); font-size: 1rem; }
.free-heart { width: 2.1rem; height: 2.1rem; fill: none; stroke: currentColor; stroke-width: 1.4; }
.free-caption { font-family: Georgia, serif; font-size: .6rem; }
.notes-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-top: 1.25rem; font-family: var(--hand); font-size: 1.1rem; }
.notes-input, .print-notes {
  width: 100%;
  height: 4.5rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: repeating-linear-gradient(transparent 0, transparent calc(1.5rem - 1px), var(--line) calc(1.5rem - 1px), var(--line) 1.5rem);
  font-family: var(--hand);
  font-size: .95rem;
  line-height: 1.5rem;
  resize: none;
}
.notes-input { display: block; }
.print-name { display: none; }
.print-notes { display: none; white-space: normal; overflow-wrap: anywhere; }
.print-only { display: none; }
.card-footer { justify-content: space-between; gap: 1rem; align-items: baseline; margin-top: 1.2rem; font-family: var(--hand); font-size: .75rem; }
.credit { font-family: Georgia, serif; font-size: .85rem; }
.feedback { min-height: 1.8rem; margin-top: .8rem; text-align: center; font-family: var(--hand); }
.feedback p { margin: 0; }
.win-message { font-size: 1.2rem; }
.editor { margin-top: .75rem; border-block: 1px solid var(--line); }
.editor summary { min-height: 3.5rem; padding-block: 1rem; cursor: pointer; font-family: var(--hand); font-size: 1rem; }
.summary-note { color: var(--muted); margin-left: .5rem; font-size: .8rem; }
.editor-body { padding-bottom: 1rem; }
.editor-label { font-size: .9rem; }
.editor-help, .editor-message { font-size: .8rem; line-height: 1.6; }
.editor-help { color: var(--muted); margin: .4rem 0 .8rem; }
.prompt-input { width: 100%; min-height: 15rem; border: 1px solid var(--line); border-radius: .25rem; padding: .75rem; background: var(--paper); font-size: .9rem; line-height: 1.6; resize: vertical; }
.editor-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .75rem; }
.editor-message { min-height: 1.3rem; margin-bottom: 0; }
.noscript-message { padding: 1rem; text-align: center; }
.visually-hidden, .skip-link:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { display: block; padding: 1rem; background: var(--paper); }
@media (max-width: 38rem) {
  .site-footer { width: calc(100% - 2rem); font-size: .8rem; }
  .page { display: flex; flex-direction: column; width: calc(100% - 1rem); margin-top: .5rem; }
  .controls { order: 1; margin-top: 1.75rem; }
  .feedback { order: 2; }
  .editor { order: 3; }
  .intro { padding-inline: .5rem; }
  .intro-copy { max-width: 19rem; font-size: .9rem; }
  .toolbar { gap: .5rem; }
  .toolbar .button { flex: 1; padding-inline: .6rem; font-size: .9rem; }
  .card { order: 0; display: flex; flex-direction: column; height: calc(100svh - 1rem); min-height: 32rem; padding: .7rem; }
  .card-header, .names, .notes-heading, .notes-input { flex-shrink: 0; }
  .card .grid { flex: 1; min-height: 14rem; grid-template-rows: repeat(5, minmax(0, 1fr)); }
  .card:has(.cell.long) { height: auto; }
  .card:has(.cell.long) .grid { flex: auto; grid-template-rows: repeat(5, auto); }
  .card-caption { margin: .15rem 0 .35rem; font-size: .8rem; }
  .names { gap: .7rem; margin-bottom: .35rem; }
  .name-field { grid-template-columns: 1fr; gap: 0; font-size: .8rem; }
  .name-field input { min-height: 2rem; padding-top: 0; }
  .cell { aspect-ratio: auto; padding: .15rem; font-size: clamp(.625rem, 2.65vw, .85rem); line-height: 1.2; }
  .cell.long { min-height: 13rem; font-size: .7rem; }
  .cell.free { font-size: .8rem; }
  .free-heart { width: 1.6rem; height: 1.6rem; }
  .free-caption { font-size: .5rem; }
  .notes-heading { gap: .5rem; margin-top: .4rem; font-size: .95rem; }
  .notes-input { height: 2.5rem; font-size: .9rem; line-height: 1.25rem; background: repeating-linear-gradient(transparent 0, transparent calc(1.25rem - 1px), var(--line) calc(1.25rem - 1px), var(--line) 1.25rem); }
  .card-footer { font-size: .65rem; gap: .5rem; }
  .credit { font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
  .button:hover { transform: none; }
}
@page { size: auto; margin: 12mm; }
@media print {
  :root { background: #fff; color: var(--ink); }
  .screen-only, .skip-link, .notes-input { display: none; }
  .page { display: block; width: 100%; margin: 0; }
  .card { display: block; height: auto; min-height: 0; width: 100%; max-width: 182mm; margin-inline: auto; padding: 4mm; border: 0; break-inside: avoid; }
  .card-title { font-size: 30pt; margin: 0; }
  .card-caption { font-size: 10pt; margin: 1mm 0 4mm; }
  .names { gap: 8mm; margin-bottom: 4mm; }
  .name-field { grid-template-columns: auto minmax(0, 1fr); gap: 2mm; font-size: 10pt; }
  .name-field input { display: none; }
  .print-name { display: block; min-height: 6mm; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; line-height: 1.3; }
  .grid { height: 146mm; grid-template-rows: repeat(5, minmax(0, 1fr)); }
  .cell { aspect-ratio: auto; min-height: 0; padding: 2mm; font-size: 9.5pt; }
  .cell.long { min-height: 0; font-size: 7.5pt; line-height: 1.1; }
  .cell.free { font-size: 12pt; }
  .cell.marked { background: var(--paper); }
  .free-heart { width: 8mm; height: 8mm; }
  .free-caption { font-size: 7pt; }
  .notes-heading { margin-top: 4mm; font-size: 12pt; }
  .print-notes { display: block; height: 21mm; overflow: hidden; font-size: 11pt; line-height: 7mm; background: repeating-linear-gradient(transparent 0, transparent calc(7mm - 1px), var(--line) calc(7mm - 1px), var(--line) 7mm); }
  .card-footer { display: flex; justify-content: flex-end; margin-top: 4mm; font-size: 9pt; }
  .credit { font-size: 10pt; }
  .grid, .cell.free, .print-notes { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
