@font-face { font-family: "Fraunces"; src: url("/Fraunces.ttf"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("/DMSans.ttf"); font-weight: 100 1000; font-display: swap; }

:root {
  --forest: #2D4A22; --orange: #C4622D; --rust: #8B3A1F; --cream: #F2E8D5;
  --parchment: #EDE0C8; --red: #B3261E; --ink: #1D1D24;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--cream); color: var(--forest); font: 16px/1.5 "DM Sans", system-ui, sans-serif; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
       padding: 10px 16px; border-bottom: 1px solid rgba(45, 74, 34, .15); }
.brand { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none;
         font: 600 18px/1 "Fraunces", Georgia, serif; }
.brand img { width: 34px; height: 34px; }
.mode { font: 700 11px/1 "DM Sans", sans-serif; letter-spacing: .12em; text-transform: uppercase;
        background: var(--parchment); padding: 7px 11px; border-radius: 999px; white-space: nowrap; }
.mode.owned { background: var(--forest); color: var(--cream); }

.stage { position: sticky; top: 0; z-index: 2; background: var(--cream);
         padding: 10px 16px 8px; border-bottom: 1px solid rgba(45, 74, 34, .12); }
.canvas-wrap { height: min(46vh, 520px); display: flex; justify-content: center; }
canvas { height: 100%; width: auto; aspect-ratio: 2857 / 4000; background: #fff; border-radius: 3px;
         box-shadow: 0 6px 18px rgba(45, 74, 34, .18); touch-action: manipulation; cursor: pointer; }
.stage-note { margin: 6px 0 0; text-align: center; font-size: 12.5px; color: var(--rust); }

.panel { max-width: 560px; margin: 0 auto; padding: 18px 16px 150px; }
h1 { font: 600 26px/1.15 "Fraunces", Georgia, serif; margin: 4px 0 6px; }
.intro { margin: 0 0 16px; color: var(--rust); font-size: 14.5px; }
fieldset { border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
legend { font: 600 19px/1.2 "Fraunces", Georgia, serif; padding: 0; margin-bottom: 8px; }
.field { margin-bottom: 12px; }
label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
input[type="text"], input[type="password"] {
  width: 100%; font: 500 17px/1.2 "DM Sans", sans-serif; color: var(--ink); background: #fff;
  padding: 11px 12px; border: 1.5px solid rgba(45, 74, 34, .35); border-radius: 10px; }
.field input { text-transform: uppercase; }
input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(196, 98, 45, .2); }
input[aria-invalid="true"] { border-color: var(--red); }
.hint { margin: 4px 0 0; font-size: 12.5px; color: var(--rust); }
.field[hidden] { display: none; }
/* Keep a field clear of the sticky preview when tapping the card scrolls to it. */
.field, .option { scroll-margin-top: calc(min(46vh, 520px) + 70px); }
.option { margin-bottom: 14px; padding: 12px 14px; background: var(--parchment); border-radius: 12px; }
.toggle { display: flex; align-items: center; gap: 12px; margin: 0; cursor: pointer; font-size: 15px; }
.toggle input { appearance: none; flex: none; width: 46px; height: 28px; margin: 0; border-radius: 999px;
                background: rgba(45, 74, 34, .25); position: relative; cursor: pointer; transition: background .15s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
                       border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .15s; }
.toggle input:checked { background: var(--forest); }
.toggle input:checked::after { left: 21px; }
.toggle input:focus-visible { outline: 3px solid rgba(196, 98, 45, .45); outline-offset: 2px; }
.msg { margin: 4px 0 0; font-size: 13px; font-weight: 600; }
.msg:empty { display: none; }
.msg.error { color: var(--red); }
.msg.info { color: var(--rust); font-weight: 500; }

.actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; background: var(--cream);
           border-top: 1px solid rgba(45, 74, 34, .15); display: flex; flex-direction: column;
           align-items: center; gap: 6px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
.actions small { font-size: 12.5px; color: var(--rust); text-align: center; }
.btn { appearance: none; border: 0; border-radius: 999px; background: var(--forest); color: var(--cream);
       font: 700 16px/1 "DM Sans", sans-serif; padding: 15px 22px; width: 100%; max-width: 520px; cursor: pointer; }
.btn.secondary { background: transparent; color: var(--forest); border: 1.5px solid var(--forest); }
.btn:disabled { opacity: .45; cursor: default; }

dialog { border: 0; border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 24px));
         max-height: calc(100vh - 40px); background: var(--cream); color: var(--forest); }
dialog::backdrop { background: rgba(29, 29, 36, .5); }
.sheet-body { padding: 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.sheet-body h2 { font: 600 24px/1.15 "Fraunces", Georgia, serif; margin: 0; }
.sheet-body h3 { font: 600 18px/1.2 "Fraunces", Georgia, serif; margin: 8px 0 0; }
.sheet-body p { margin: 0; }
.proof { width: 62%; align-self: center; box-shadow: 0 6px 18px rgba(45, 74, 34, .2); }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 15px; margin: 0; }
.check input { width: 22px; height: 22px; accent-color: var(--forest); flex: none; }
.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 12px; background: #fff;
        color: var(--forest); text-decoration: none; border: 1.5px solid rgba(45, 74, 34, .2); }
.file b { font-size: 15.5px; }
.file span { font-size: 13px; color: var(--rust); }

@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 36px;
            max-width: 1180px; margin: 0 auto; padding: 24px 24px 0; }
  .stage { top: 24px; align-self: start; border: 0; padding: 0; }
  .canvas-wrap { height: auto; }
  canvas { height: auto; width: min(100%, calc((100vh - 150px) * 0.71425)); }
  .panel { margin: 0; padding: 0 0 150px; }
  .field, .option { scroll-margin-top: 24px; }
}

.preview-btn { margin: 0 0 18px; padding: 11px 18px; font-size: 14.5px; width: auto; }
.print-page { margin: 0; text-align: center; }
.print-page canvas { display: block; margin: 0 auto; height: auto; aspect-ratio: auto; cursor: default;
                     background: #fff; border: 1px solid rgba(45, 74, 34, .2); border-radius: 2px;
                     box-shadow: 0 6px 18px rgba(45, 74, 34, .18); }
.print-page.portrait canvas { width: 72%; }
.print-page.landscape canvas { width: 100%; }
.print-page figcaption { font-size: 13px; color: var(--rust); margin-top: 8px; }
.print-page figcaption b { color: var(--forest); }
.sheet-body h2:focus { outline: none; }

.adjust { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.adj-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.adj-label { font-size: 12px; font-weight: 700; color: var(--rust); margin: 0 2px 0 4px; }
.adj-label:first-child { margin-left: 0; }
.adj-btn, .adj-reset { appearance: none; border: 1.5px solid rgba(45, 74, 34, .25); background: #fff;
  color: var(--forest); border-radius: 9px; min-width: 40px; height: 36px; padding: 0 8px;
  font: 700 16px/1 "DM Sans", sans-serif; cursor: pointer; touch-action: none; user-select: none; }
.adj-btn:active { background: var(--parchment); }
.adj-reset { font-size: 13px; margin-left: auto; color: var(--rust); }
.adj-btn[aria-pressed="true"] { background: var(--forest); border-color: var(--forest); color: var(--cream); }
.align-ico { display: flex; flex-direction: column; gap: 3px; width: 18px; }
.align-ico i { display: block; height: 2.5px; border-radius: 2px; background: currentColor; }
.align-ico i:nth-child(1) { width: 100%; }
.align-ico i:nth-child(2) { width: 58%; }
.align-ico i:nth-child(3) { width: 80%; }
.align.l .align-ico { align-items: flex-start; }
.align.c .align-ico { align-items: center; }
.align.r .align-ico { align-items: flex-end; }
.style-hint { margin: -2px 0 10px; }
.style-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.style-pick { position: relative; display: flex; flex-direction: column; gap: 7px; margin: 0; padding: 8px;
              background: #fff; border: 2px solid rgba(45, 74, 34, .18); border-radius: 12px; cursor: pointer;
              font-size: 14px; font-weight: 700; text-align: center; }
.style-pick input { position: absolute; opacity: 0; pointer-events: none; }
.style-pick img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; }
.style-pick:has(input:checked) { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(45, 74, 34, .15); }
.style-pick:has(input:focus-visible) { outline: 3px solid rgba(196, 98, 45, .45); outline-offset: 2px; }
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 8px; }
.swatch { appearance: none; width: 28px; height: 28px; padding: 0; border-radius: 50%; cursor: pointer;
          background: var(--swatch); border: 2px solid #fff; box-shadow: 0 0 0 1.5px rgba(45, 74, 34, .3); }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2.5px var(--forest); }
.swatch:focus-visible { outline: 3px solid rgba(196, 98, 45, .45); outline-offset: 2px; }
/* Printing the page prints only the card (the free one with its dark watermark). */
@media print {
  .top, .panel, .actions, .stage-note, dialog { display: none !important; }
  .stage { position: static; border: 0; }
  canvas { box-shadow: none; }
}
.style-picks.many { grid-template-columns: repeat(4, 1fr); gap: 7px; }
.style-picks.many .style-pick { padding: 5px; gap: 4px; font-size: 12.5px; border-radius: 10px; }
.swatch[hidden] { display: none; }
