:root {
  --canvas: #f5f5f3;
  --white: #fff;
  --ink: #161616;
  --secondary: #595959;
  --line: #d8d8d5;
  --tint: #ebebe8;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100svh; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button, select, summary { cursor: pointer; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, .tbl:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 4px;
}
h1, p, figure, dl { margin: 0; }
h1:focus { outline: none; }
.mast, main { width: min(calc(100% - 8vw), 1232px); margin-inline: auto; }
.mast { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.brand, .headRight { display: inline-flex; align-items: center; }
.brand { gap: 9px; font-size: 21px; font-weight: 680; letter-spacing: -.065em; }
.mark { width: 24px; height: 24px; flex: 0 0 24px; fill: currentColor; }
.headRight { gap: 17px; position: relative; }
.headBack, .sample-info > summary { min-height: 42px; display: inline-flex; align-items: center; border: 0; background: none; font-size: 12px; font-weight: 520; color: var(--secondary); gap: 6px; padding: 0 2px; }
.sample-info > summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
.info-glyph { font: 600 11px/14px var(--sans); border: 1px solid currentColor; border-radius: 50%; width: 16px; height: 16px; text-align: center; }
.sample-info > p { position: absolute; z-index: 5; right: 0; top: 44px; width: min(240px,80vw); padding: 14px 16px; border: 1px solid var(--line); background: var(--white); border-radius: 12px; box-shadow: 0 6px 20px #0000000d; font-size: 13px; line-height: 1.48; }
main { display: grid; grid-template-columns: minmax(0,1.13fr) minmax(310px,.8fr); gap: clamp(36px,6vw,104px); align-items: center; padding: 40px clamp(4px,3vw,48px) 112px; }
body[data-route="entry"] main { grid-template-columns: minmax(315px,.86fr) minmax(0,1.12fr); min-height: calc(100svh - 72px); padding-block: 34px 50px; }
.panels { min-width: 0; }
body[data-route="entry"] .panels { grid-column: 1; grid-row: 1; }
body[data-route="entry"] .preview { grid-column: 2; grid-row: 1; }
.preview { margin: 0; display: grid; justify-items: center; align-content: center; min-width: 0; }
.frame { background: var(--white); border-radius: 13px; overflow: hidden; width: fit-content; max-width: 100%; line-height: 0; box-shadow: 0 0 0 1px #00000014, 0 13px 34px -20px #00000030; }
.frame canvas { max-width: 100%; width: auto; height: auto; display: block; max-height: min(68svh, 700px); }
body[data-route="entry"] .frame canvas { max-height: min(72svh, 720px); }
.preview figcaption { margin-top: 12px; font: 11px/1.45 var(--mono); color: var(--secondary); text-align: center; letter-spacing: -.025em; }
.eyebrow, .micro { font: 500 11px/1.4 var(--mono); color: var(--secondary); margin-bottom: 13px; }
h1 { font-size: clamp(36px,3.7vw,63px); line-height: .99; font-weight: 570; letter-spacing: -.068em; text-wrap: balance; }
.entry-heading h1 { font-size: clamp(56px,6.5vw,103px); line-height: .94; font-weight: 600; letter-spacing: -.078em; }
p { font-size: 15px; line-height: 1.48; color: var(--secondary); }
.lead { margin-top: 12px; max-width: 41ch; }
.entry-heading .lead { font-size: clamp(16px,1.3vw,20px); margin-top: 20px; max-width: 26ch; }
.group { margin-top: 23px; }
.formlabel, legend { display: block; font-size: 13px; font-weight: 590; margin-bottom: 8px; }
#lookup { max-width: 415px; margin-top: 32px; }
.inputrow { display: flex; align-items: center; gap: 4px; background: var(--white); min-width: 0; border: 1px solid #c9c9c7; border-radius: 11px; padding: 0 13px; }
.inputrow:focus-within { outline: 2px solid var(--ink); outline-offset: 1px; }
.inputrow > span { color: var(--secondary); }
input[type="text"] { min-width: 0; width: 100%; min-height: 46px; border: none; background: transparent; outline: 0; padding: 0 3px; }
.inputrow input:focus-visible { outline: none; }
.lookupbar { display: flex; min-width: 0; gap: 6px; align-items: center; background: var(--white); padding: 5px; border: 1px solid #c9c9c7; border-radius: 14px; }
.lookupbar:focus-within { border-color: var(--ink); }
.lookupbar .inputrow { flex: 1; border: 0; padding: 0 6px; background: none; }
.lookupbar .inputrow:focus-within { outline: 0; }
.lookupbar .primary { width: auto; min-width: 118px; justify-content: center; gap: 8px; min-height: 43px; padding: 10px 14px; border-radius: 10px; }
.pick, .qualities { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.pick button, .small { font-size: 12px; line-height: 1.1; background: transparent; border: 1px solid var(--line); min-height: 42px; padding: 5px 12px; border-radius: 10px; }
.pick button[aria-pressed="true"], .small[aria-pressed="true"] { border-color: #8d8d8b; background: var(--tint); }
.primary, .secondary { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 47px; border-radius: 11px; text-align: left; font-weight: 590; font-size: 14px; padding: 10px 15px; }
.primary { border: 1px solid var(--ink); background: var(--ink); color: var(--white); }
.secondary { background: transparent; border: 1px solid #c6c6c4; margin-top: 8px; }
.primary:hover { background: #393939; }
.secondary:hover, .theme:hover, .small:hover, .pick button:hover { background: var(--tint); }
.actions { margin-top: 22px; }
.disclosure, .status, .error { margin-top: 8px; font-size: 12px; line-height: 1.45; }
.error:not(:empty) { color: var(--ink); font-weight: 580; }
.disclosure:empty, .status:empty, .error:empty { margin: 0; }
.monthChart { margin: 20px 0 16px; padding: 8px 0 0; border-bottom: 1px solid var(--line); }
.monthChart canvas { display: block; width: 100%; height: auto; }
.statHeading { margin-top: 18px; }
.gridStats { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.stat { position: relative; min-width: 0; text-align: left; background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 14px 12px; }
.stat strong { font: 570 clamp(23px,2vw,34px)/1.05 var(--sans); letter-spacing: -.061em; display: block; font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 4px; font-size: 12px; color: var(--secondary); }
.stat::after { content: ''; position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; border: 1px solid #a5a5a2; }
.stat[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.stat[aria-pressed="true"]::after { background: var(--ink); border-color: var(--ink); }
.stat:not(:disabled):hover { background: var(--tint); }
.stat:disabled { background: transparent; color: var(--secondary); }
.stat:disabled::after { display: none; }
#projectsList { border-bottom: 1px solid var(--line); }
#projectNames { padding: 0 0 10px; margin: 0; list-style: none; max-height: 175px; overflow-y: auto; }
#projectNames a { display: block; overflow-wrap: anywhere; padding: 7px 1px; color: var(--ink); text-underline-offset: 3px; font: 12px/1.4 var(--mono); }
.panel details { margin-top: 12px; }
.panel summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; font-size: 13px; font-weight: 550; }
.panel summary::after { content: "+"; color: var(--secondary); }
.panel details[open] > summary::after { content: "−"; }
.panel details p { font-size: 13px; margin-bottom: 8px; }
.tbl { max-height: 150px; overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; font-variant-numeric: tabular-nums; }
td, th { border-bottom: 1px solid var(--line); padding: 6px 4px; }
.themes { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.theme { display: flex; align-items: center; gap: 10px; text-align: left; min-height: 48px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); font-size: 13px; font-weight: 570; }
.theme canvas { width: 33px; height: 33px; border-radius: 6px; flex: none; }
.theme[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.flexinputs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
select { width: 100%; min-height: 44px; background: var(--white); border: 1px solid #c6c6c4; border-radius: 10px; font-size: 13px; padding: 6px 8px; }
.inlineToggle { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; }
.inlineToggle input { width: 17px; height: 17px; accent-color: var(--ink); }
.noteBox { margin-top: 12px; display: block; }
#markOptions { border-block: 1px solid var(--line); margin: 0; }
#markOptions[open] { padding-bottom: 12px; }
.formats { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: var(--tint); }
.formats button { flex: 1; min-height: 41px; padding: 4px; font-size: 13px; border: none; border-radius: 8px; background: transparent; }
.formats button[aria-pressed="true"] { background: var(--white); color: var(--ink); font-weight: 610; box-shadow: 0 1px 3px #00000016; }
.receipt { margin-top: 18px; border-top: 1px solid var(--line); }
.receipt div { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.receipt dt { color: var(--secondary); }
.receipt dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
#recipientNote { margin-top: 17px; padding-block: 13px; border-block: 1px solid var(--line); }
#recipientNote .micro { margin-bottom: 5px; }
.notequote { color: var(--ink); line-height: 1.36; }
.dock { position: fixed; z-index: 4; bottom: calc(14px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 3px; padding: 5px; border: 1px solid #cececc; border-radius: 17px; background: var(--white); box-shadow: 0 7px 24px #0000000c; }
.dock button { min-height: 44px; min-width: 88px; padding-inline: 12px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 12px; background: transparent; font-size: 13px; font-weight: 580; gap: 7px; }
.dock button[aria-current="page"] { background: var(--ink); color: white; }
.dock svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.storySteps { display: flex; gap: 5px; }
.storySteps button { position: relative; flex: 1; min-height: 40px; background: transparent; border: none; padding: 0; }
.storySteps button::after { content: ""; position: absolute; inset: 18px 0 auto; height: 3px; border-radius: 3px; background: var(--line); }
.storySteps button[aria-current="step"]::after { background: var(--ink); }
@media (min-width: 801px) {
  body[data-route="studio"] main { align-items: start; }
  body[data-route="studio"] .preview { position: sticky; top: 22px; }
  body[data-route="studio"] .panel { padding-top: 12px; }
}
@media (max-width: 800px) {
  .mast { width: calc(100% - 36px); height: 56px; }
  .brand { font-size: 19px; }
  .mark { width: 21px; height: 21px; flex-basis: 21px; }
  main, body[data-route="entry"] main { width: min(calc(100% - 36px), 540px); min-height: auto; grid-template-columns: minmax(0,1fr); padding: 20px 0 calc(91px + env(safe-area-inset-bottom)); gap: 21px; }
  body[data-route="entry"] main { grid-template-areas: "heading" "art" "lookup"; padding: 21px 0 28px; gap: 18px; }
  body[data-route="entry"] .panels, body[data-route="entry"] .panel[data-panel="entry"] { display: contents; }
  .entry-heading { grid-area: heading; }
  .entry-heading h1 { font-size: clamp(43px,9.5vw,60px); letter-spacing: -.071em; }
  .entry-heading h1 br { display: none; }
  .entry-heading .lead { font-size: 14px; margin-top: 8px; max-width: 37ch; }
  body[data-route="entry"] .preview { grid-area: art; }
  #lookup { grid-area: lookup; width: 100%; max-width: none; margin: 0; }
  .frame { border-radius: 9px; }
  .frame canvas { max-height: min(39svh,380px); }
  body[data-route="entry"] .frame canvas { max-height: min(40svh,390px); }
  body[data-route="studio"] .frame canvas, body[data-route="share"] .frame canvas, body[data-route="confirm"] .frame canvas { max-height: min(30svh,295px); }
  .preview figcaption { margin-top: 8px; font-size: 10px; }
  .headRight { gap: 9px; }
  .headBack, .sample-info > summary { font-size: 11px; }
  .eyebrow { margin-bottom: 7px; }
  h1 { font-size: clamp(36px,9vw,48px); }
  .lead { font-size: 14px; margin-top: 8px; }
  .group { margin-top: 15px; }
  .actions { margin-top: 16px; }
  .dock { bottom: calc(8px + env(safe-area-inset-bottom)); }
  body[data-route="studio"] main { gap: 13px; }
  body[data-route="year"] .panels { grid-row: 1; }
  .monthChart { margin-block: 14px; }
  .stat { padding: 11px; }
  .stat strong { font-size: clamp(23px,6vw,30px); }
}
@media (max-width: 360px) {
  .mast, main, body[data-route="entry"] main { width: calc(100% - 26px); }
  .entry-heading h1 { font-size: 41px; }
  .lookupbar .primary { min-width: 102px; padding-inline: 10px; font-size: 13px; }
  .dock button { min-width: 76px; }
}
@media (prefers-reduced-motion: no-preference) {
  .panel:not([hidden]) { animation: arrive .14s ease-out; }
  @keyframes arrive { from { opacity: .7; } to { opacity: 1; } }
  button { transition: background .13s; }
}
.frame { cursor: zoom-in; }
.print-caption { display: flex; align-items: center; justify-content: center; column-gap: 12px; flex-wrap: wrap; }
.print-actions { display: inline-flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.print-caption button { border: 0; padding: 7px 2px; background: transparent; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
#print-viewer { border: 1px solid var(--line); border-radius: 15px; padding: 0; width: min(900px, calc(100vw - 32px)); max-height: 94svh; max-width: 100%; color: var(--ink); background: var(--white); }
#print-viewer::backdrop { background: rgb(14 14 14 / 62%); }
.viewer-tools { display: flex; align-items: center; justify-content: space-between; padding: 7px 12px; border-bottom: 1px solid var(--line); }
.viewer-tools button { font-size: 13px; min-height: 41px; border: 0; background: none; padding: 0 8px; }
.viewer-viewport { overflow: auto; max-height: 80svh; background: #f4f4f3; }
.viewer-viewport canvas { display: block; margin: 0 auto; max-width: 100%; height: auto; max-height: 80svh; }
.viewer-viewport[data-native="true"] canvas { max-width: none; max-height: none; }
@media (max-width: 600px) { #print-viewer { width: calc(100vw - 10px); } .print-caption button { min-height: 32px; } }
.brand { color: var(--ink); text-decoration: none; }
.brand:focus-visible, a:focus-visible, .linktools button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .6; }
.formlabelrow, .copybar, .linktools { display: flex; align-items: center; gap: 9px; }
.formlabelrow { justify-content: space-between; margin-bottom: 7px; }
.formlabelrow .formlabel { margin: 0; }
.yearpick select { width: auto; min-height: 36px; background-color: transparent; font: 12px/1.3 var(--mono); padding: 4px 6px; }
.field { display: block; }
.sr-only { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.copybar { padding: 5px; background: var(--white); border-radius: 12px; border: 1px solid var(--line); }
.copybar input { width: 100%; min-width: 0; padding: 8px; background: transparent; border: none; font: 12px/1.4 var(--mono); }
.copybar button { flex: 0 0 auto; min-height: 36px; }
.linktools { justify-content: space-between; }
.linktools a, .linktools button { font: 13px/1.4 var(--sans); text-underline-offset: 3px; text-decoration: underline; color: var(--ink); background: transparent; padding: 9px 1px; border: 0; }
body:not([data-loaded]) #frame { cursor: default; width: min(100%, 350px); aspect-ratio: 4/5; }
body:not([data-loaded]) #frame canvas { visibility: hidden; }
body[data-route="recipient"] .actions:has(#recipientSave[hidden]) { margin-top: 16px; }
@media (max-width: 800px) { body[data-route="entry"] main { grid-template-areas: "heading" "lookup" "art"; } body:not([data-loaded]) #frame { max-height: 39svh; } }
@media (max-width: 800px) {
  body[data-route="studio"] .frame canvas { max-height: min(26.5svh, 280px); }
}
