/* HappyJack personalizer. Colors are sampled from her tooth fairy PDFs; --deep is a darker terra so small text passes contrast. */
@font-face { font-family: "Plex Mono"; src: url("/assets/fonts/IBMPlexMono-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("/assets/fonts/IBMPlexMono-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }

:root {
  --ink: #341d19;
  --terra: #bf8069;
  --deep: #9e5f4a;
  --deep-hover: #7d4636;
  --blush: #f0d9c6;
  --cream: #fbf6f2;
  --mute: #6e5148;
  --edge: #a07c6e;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--cream); color: var(--ink); font: 400 16px/1.5 "Plex Mono", ui-monospace, Menlo, monospace; }
h1, h2, p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* top bar + demo strip */
.bar { height: 56px; flex: none; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border-bottom: 1px solid var(--blush); }
.bar a { display: block; }
.bar img { display: block; height: 17px; }
.bar span { font-size: 12px; letter-spacing: 0.12em; color: var(--mute); }
.strip { padding: 10px 20px; background: var(--ink); color: #fff; font-size: 13px; line-height: 1.45; text-align: center; }
.strip button { min-height: 0; padding: 0; border: 0; background: none; color: #fff; font: inherit; text-decoration: underline; cursor: pointer; }

/* buttons and fields */
.btn { width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: center; padding: 0 20px; border: 0; border-radius: 28px; background: var(--deep); color: #fff; font: 500 17px/1.2 "Plex Mono", monospace; letter-spacing: 0.1em; text-align: center; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--deep-hover); }
.btn:disabled { opacity: 0.65; cursor: progress; }
.btn.ghost { background: transparent; color: var(--deep); box-shadow: inset 0 0 0 1.5px var(--deep); }
.btn.ghost:hover { background: #fff; }
.link { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--deep); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; }
.label { font-size: 13px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; }
.help { font-size: 13px; color: var(--mute); }
.error { font-size: 14px; color: #8c2f1f; }
input[type="text"], input[type="date"], textarea { display: block; width: 100%; min-height: 52px; padding: 0 16px; border: 1px solid var(--edge); border-radius: 12px; background: #fff; color: var(--ink); font: 400 17px/1.4 "Plex Mono", monospace; -webkit-appearance: none; appearance: none; }
textarea { min-height: 124px; padding: 12px 16px; font-size: 16px; line-height: 1.45; resize: vertical; }
textarea:disabled { background: #f6efea; color: var(--mute); }
:focus-visible { outline: 3px solid var(--terra); outline-offset: 2px; }
main { flex: 1 0 auto; }
footer { padding: 22px 20px 28px; border-top: 1px solid var(--blush); text-align: center; font-size: 13px; color: var(--mute); }
footer a { color: var(--deep); }
canvas { display: block; }

/* start: enter the code */
.start { width: 100%; max-width: 480px; margin: 0 auto; }
.hero { padding: 28px 20px 14px; display: flex; align-items: center; gap: 14px; background: linear-gradient(180deg, #f8eee7, var(--cream)); }
.hero > div { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.hero .script { height: 30px; align-self: flex-start; }
/* the two title lines share one letter height: TOOTH's image is 57% as wide as FIRST LOST's */
.hero h1 { width: min(100%, 216px); display: flex; flex-direction: column; gap: 6px; }
.hero h1 img { display: block; height: auto; }
.hero h1 .line1 { width: 100%; }
.hero h1 .line2 { width: 57.1%; }
.hero p { margin-top: 4px; font-size: 15px; color: var(--mute); }
.hero canvas { flex: none; width: 130px; transform: rotate(4deg); box-shadow: 0 12px 24px rgba(70, 45, 30, 0.22), 0 3px 8px rgba(70, 45, 30, 0.12); }
.panel { margin: 20px 20px 0; padding: 22px 20px; display: flex; flex-direction: column; gap: 12px; background: #fff; border: 1px solid var(--blush); border-radius: 18px; }
.panel input { min-height: 58px; font-size: 24px; font-weight: 500; letter-spacing: 0.3em; text-transform: uppercase; }
.panel .btn { margin-top: 4px; }
.try { display: block; margin: 12px auto 24px; font-size: 16px; text-decoration: none; }

/* edit: preview + form */
.stage { padding: 24px 20px 26px; display: flex; flex-direction: column; align-items: center; gap: 12px; background: linear-gradient(180deg, #f8eee7, #efdfd3); }
.stage .script { height: 32px; }
.stage canvas { width: min(280px, 100%); box-shadow: 0 16px 32px rgba(70, 45, 30, 0.2), 0 4px 10px rgba(70, 45, 30, 0.1); }
.form { padding: 28px 20px 32px; display: flex; flex-direction: column; gap: 26px; }
.form fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 8px; }
.ages { display: flex; flex-wrap: wrap; gap: 10px; }
.ages button { width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--edge); background: #fff; color: var(--ink); font: 500 17px/1 "Plex Mono", monospace; cursor: pointer; }
.ages button[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: #fff; }
.chart { position: relative; width: min(300px, 100%); margin: 10px auto 0; overflow: hidden; background: #fff; border: 1px solid var(--blush); border-radius: 16px; }
.chart canvas { width: 100%; }
.chart button { position: absolute; padding: 0; border: 0; border-radius: 12px; background: transparent; cursor: pointer; }
.chart button:hover { background: rgba(191, 128, 105, 0.12); }
.chart-caption { min-height: 44px; margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 14px; }
.note-row { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.check { min-height: 44px; display: flex; align-items: center; gap: 12px; font-size: 15px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--deep); }
.go { display: flex; flex-direction: column; gap: 10px; text-align: center; }

/* done: download and print */
.done { width: 100%; max-width: 480px; margin: 0 auto; padding: 28px 20px 32px; display: flex; flex-direction: column; gap: 20px; }
.done-head { display: flex; align-items: center; gap: 14px; }
.tick { flex: none; width: 52px; height: 52px; border-radius: 50%; background: var(--deep); display: flex; align-items: center; justify-content: center; }
.done-head h1 img { display: block; height: 32px; }
.done-head .script { display: block; height: 26px; margin-top: 4px; }
.file { padding: 14px 16px; display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--blush); border-radius: 16px; }
.file div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.file b { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.file span { font-size: 13px; color: var(--mute); }
.done canvas { width: min(320px, 100%); align-self: center; box-shadow: 0 12px 26px rgba(70, 45, 30, 0.18), 0 3px 8px rgba(70, 45, 30, 0.1); }
.done ul { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 15px; line-height: 1.45; }
.done .help a { color: var(--deep); }

/* computers: preview stays put beside the form */
@media (min-width: 820px) {
  .edit { width: 100%; max-width: 1000px; margin: 0 auto; padding: 32px 24px; display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 460px); justify-content: center; align-items: start; gap: 48px; }
  .stage { position: sticky; top: 24px; padding: 28px; border-radius: 24px; }
  .stage canvas { width: 320px; }
  .form { padding: 8px 0 32px; }
}
