/* PostcardScanner. Flat, square, hairline rules. Bright paper, one stamp color. */
:root {
  --paper: #fffaf0;
  --paper-2: #f4ead6;
  --ink: #17140f;
  --muted: #6a6254;
  --stamp: #e3411a;
  --stamp-dark: #b8300f;
  --green: #1d7a45;
  --line: #17140f;
  --hair: rgba(23, 20, 15, 0.18);
  --display: "Gambetta", Georgia, serif;
  --body: "General Sans", system-ui, sans-serif;
  --gut: 16px;
  --bar: 64px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 17px/1.5 var(--body); min-height: 100svh;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 500; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--stamp); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--gut); }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; height: 56px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 20; padding: 0 var(--gut); }
.mark { font: 500 21px/1 var(--display); white-space: nowrap; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.mark svg { width: 26px; height: 18px; }
.top nav { display: flex; gap: 18px; font-weight: 500; font-size: 16px; white-space: nowrap; }
.top nav a { text-decoration: none; padding: 16px 0; border-bottom: 2px solid transparent; }
.top nav a:hover, .top nav a[aria-current] { border-bottom-color: var(--stamp); }

/* buttons: flat rectangles */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 22px; border: 2px solid var(--ink); background: transparent; font-weight: 600; font-size: 17px; text-decoration: none; border-radius: 0; }
.btn:hover { background: var(--paper-2); }
.btn.primary { background: var(--stamp); border-color: var(--stamp); color: #fff; }
.btn.primary:hover { background: var(--stamp-dark); border-color: var(--stamp-dark); }
.btn.ink { background: var(--ink); color: var(--paper); }
.btn.ink:hover { background: #3a342a; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn.block { width: 100%; }
.textbtn { background: none; border: 0; padding: 12px 0; font-weight: 600; text-decoration: underline; text-underline-offset: 4px; min-height: 44px; }

/* landing hero */
.hero { padding: 28px 0 40px; border-bottom: 1px solid var(--line); overflow: hidden; }
.hero-grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
.hero h1 { font-size: clamp(46px, 11.5vw, 108px); line-height: 0.92; letter-spacing: -0.035em; }
.hero h1 em { font-style: italic; color: var(--stamp); }
.hero .lede { font-size: 19px; max-width: 34ch; margin-top: 16px; color: #2c261d; }
.hero .cta { display: flex; gap: 10px; margin-top: 20px; }
.hero .cta .btn { flex: 1 1 0; padding: 0 12px; min-height: 50px; }
.stage { position: relative; display: grid; gap: 18px; grid-template-columns: 1fr; align-items: start; }
.card-art { position: relative; background: #fff; border: 1px solid var(--line); aspect-ratio: 3 / 2; width: 100%; transform: rotate(-1.6deg); box-shadow: none; overflow: hidden; }
.card-art .art { position: absolute; left: 0; top: 0; bottom: 0; width: 46%; }
.card-art .copy { position: absolute; left: 50%; right: 14px; top: 12px; bottom: 10px; display: grid; align-content: space-between; font-size: clamp(9px, 2.5vw, 14px); line-height: 1.25; }
.card-art .copy > div:first-child { padding-right: 26%; }
.card-art .copy b { font-family: var(--display); font-weight: 600; font-size: 1.35em; display: block; line-height: 1.05; }
.card-art .stampbox { position: absolute; right: 8px; top: 8px; width: 13%; min-width: 34px; }
.scanline { position: absolute; left: 0; right: 0; height: 3px; background: var(--stamp); top: 0; opacity: 0; }
.fields { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.fields li { display: grid; grid-template-columns: 7.2em 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--hair); font-size: 16px; align-items: baseline; min-height: 44px; }
.fields .k { color: var(--muted); font-size: 15px; }
.fields .v { font-weight: 600; opacity: 0; overflow-wrap: anywhere; }
.fields .v.on, .reduced .fields .v { opacity: 1; }
.flyer { position: absolute; z-index: 5; pointer-events: none; font-weight: 600; font-size: 16px; white-space: nowrap; background: var(--paper); padding: 0 2px; }
.replay { margin-top: 6px; }

/* sections */
.sec { padding: 44px 0; border-bottom: 1px solid var(--line); }
.sec h2 { font-size: clamp(32px, 7vw, 56px); line-height: 1; margin-bottom: 18px; }
.sec .sub { max-width: 52ch; color: #2c261d; margin-bottom: 22px; }
.steps { display: grid; gap: 0; grid-template-columns: 1fr; border-top: 1px solid var(--line); }
.step { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 20px 0; border-bottom: 1px solid var(--hair); }
.step .n { font: 500 54px/0.9 var(--display); color: var(--stamp); }
.step h3 { font-size: 26px; margin-bottom: 4px; }
.step p { color: #2c261d; max-width: 46ch; }
.rules { display: grid; gap: 0; border-top: 1px solid var(--line); grid-template-columns: 1fr; }
.rule { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--hair); }
.rule b { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.rule .neg { color: var(--stamp-dark); }
.foot { padding: 28px var(--gut) 40px; color: var(--muted); font-size: 15px; max-width: 1180px; margin: 0 auto; }

/* board */
.boardbar { display: flex; flex-wrap: wrap; gap: 4px 22px; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.tabs { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 12px 0 9px; font-weight: 600; min-height: 48px; white-space: nowrap; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--stamp); }
.demo-note { background: var(--paper-2); padding: 10px var(--gut); font-size: 15px; margin: 0 calc(var(--gut) * -1); }
.lead { border-bottom: 1px solid var(--line); }
.lead-head { display: grid; grid-template-columns: 62px 1fr 28px; gap: 12px; align-items: center; width: 100%; text-align: left; background: none; border: 0; padding: 16px 0; min-height: 84px; }
.score { font: 500 54px/0.9 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.score small { font: 500 15px var(--body); color: var(--muted); letter-spacing: 0; }
.score.hi { color: var(--stamp); }
.lead-head .who { min-width: 0; }
.lead-head .name { font: 500 22px/1.15 var(--display); display: block; overflow-wrap: anywhere; }
.lead-head .line { display: block; color: var(--muted); font-size: 15px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-head .state { color: var(--stamp-dark); font-weight: 600; }
.chev { width: 14px; height: 14px; border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg); transition: transform 0.25s; justify-self: center; margin-top: -4px; }
.lead[data-open="true"] .chev { transform: rotate(-135deg); margin-top: 4px; }
.lead-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; }
.lead[data-open="true"] .lead-body { grid-template-rows: 1fr; }
.lead-body > div { overflow: hidden; }
.detail { padding: 4px 0 26px; display: grid; gap: 26px; }
.detail h4 { font-size: 22px; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.facts { margin: 0; display: grid; grid-template-columns: 7.6em 1fr; gap: 0; }
.facts dt, .facts dd { padding: 8px 0; border-bottom: 1px solid var(--hair); margin: 0; }
.facts dt { color: var(--muted); font-size: 15px; }
.facts dd { overflow-wrap: anywhere; font-weight: 500; }
.warn { margin-top: 10px; padding: 10px 12px; border-left: 4px solid var(--stamp); background: var(--paper-2); font-size: 15px; }
.reasons { list-style: none; margin: 0; padding: 0; }
.reasons li { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--hair); }
.reasons b { font-variant-numeric: tabular-nums; }
.reasons .pos { color: var(--green); }
.reasons .neg { color: var(--stamp-dark); }
.gradehead { display: flex; align-items: baseline; gap: 14px; margin-bottom: 6px; }
.gradehead .big { font: 500 56px/0.9 var(--display); }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--hair); font-size: 16px; }
.checks .ok { color: var(--green); font-weight: 600; }
.checks .no { color: var(--stamp-dark); font-weight: 600; }
.checks small { color: var(--muted); display: block; }
.tools { width: 100%; border-collapse: collapse; font-size: 16px; }
.tools th { text-align: left; font-weight: 500; color: var(--muted); font-size: 15px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.tools td { padding: 8px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
.tools td:last-child, .tools th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.tools .basis { display: block; color: var(--muted); font-size: 13px; }
.tools tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--line); }
.angle { padding: 12px 0; border-bottom: 1px solid var(--hair); display: grid; grid-template-columns: 34px 1fr; gap: 6px; }
.angle .n { font: 500 30px/1 var(--display); color: var(--stamp); }
.angle h5 { font: 600 17px/1.3 var(--body); margin: 0 0 3px; }
.angle p { color: #2c261d; }
.actions { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.actions .btn { min-height: 54px; }
.actions .btn.primary { grid-column: 1 / -1; }
.actions .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.when { color: var(--muted); font-size: 15px; }
.more { padding: 18px 0; text-align: center; }

/* skeleton */
.skel { background: var(--paper-2); animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }
.skel-row { display: grid; grid-template-columns: 62px 1fr; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: center; }
.skel-row .a { height: 48px; }
.skel-row .b { height: 18px; margin-bottom: 8px; width: 70%; }
.skel-row .c { height: 14px; width: 45%; }

/* empty and error */
.empty, .err { padding: 36px 0; max-width: 40ch; }
.empty h3, .err h3 { font-size: 30px; margin-bottom: 8px; line-height: 1.05; }
.empty p, .err p { color: #2c261d; margin-bottom: 16px; }
.err { border-left: 4px solid var(--stamp); padding-left: 14px; margin: 18px 0; }
.toast { position: fixed; left: var(--gut); right: var(--gut); top: 66px; z-index: 60; background: var(--ink); color: var(--paper); padding: 14px 16px; font-weight: 500; display: none; }
.toast.show { display: block; }
.toast button { background: none; border: 0; color: #fff; text-decoration: underline; font-weight: 600; margin-left: 10px; }

/* app shell */
body.app { padding-bottom: calc(var(--bar) + env(safe-area-inset-bottom) + 90px); }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--paper); border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; align-items: center; justify-content: center; gap: 10px; height: var(--bar); font-weight: 600; text-decoration: none; font-size: 18px; border-top: 4px solid transparent; margin-top: -1px; }
.tabbar a[aria-current="page"] { border-top-color: var(--stamp); }
.tabbar svg { width: 24px; height: 24px; }
.view[hidden] { display: none; }
.slots { display: grid; gap: 12px; margin: 12px 0; }
.slot { position: relative; display: block; width: 100%; aspect-ratio: 4 / 3; max-height: 27svh; background: var(--paper-2); border: 2px dashed var(--ink); overflow: hidden; cursor: pointer; }
.slot input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.slot .hint { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; padding: 12px; pointer-events: none; }
.slot .hint b { font: 500 30px/1 var(--display); }
.slot .hint span { color: var(--muted); font-size: 16px; }
.slot img { width: 100%; height: 100%; object-fit: cover; }
.slot[data-full="true"] { border-style: solid; }
.slot .tag { position: absolute; left: 0; top: 0; background: var(--ink); color: var(--paper); padding: 6px 12px; font-weight: 600; font-size: 15px; pointer-events: none; }
.app h1 { font-size: 36px; line-height: 1; margin-top: 16px; }
.app .quota { color: var(--muted); font-size: 15px; margin-top: 8px; }
.dock { position: fixed; left: 0; right: 0; bottom: calc(var(--bar) + env(safe-area-inset-bottom)); z-index: 35; padding: 10px var(--gut); background: var(--paper); border-top: 1px solid var(--hair); }
.scanning { display: grid; gap: 14px; margin-top: 18px; }
.scanning .msg { font: 500 24px/1.15 var(--display); }
.scanning .msg small { display: block; font: 400 16px var(--body); color: var(--muted); margin-top: 4px; }
.splitter { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 44svh; margin: 14px 0 6px; }
.slice { position: absolute; left: 0; right: 0; background-repeat: no-repeat; background-color: var(--paper-2); border: 1px solid var(--line); }
.lockscreen { padding: 44px 0; max-width: 40ch; }
.lockscreen h1 { margin-top: 0; }

@media (min-width: 880px) {
  :root { --gut: 32px; }
  .hero { padding: 48px 0 56px; }
  .hero-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: center; }
  .stage { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .step { border-right: 1px solid var(--hair); padding: 22px 22px 22px 0; margin-right: 22px; border-bottom: 0; }
  .step:last-child { border-right: 0; }
  .rules { grid-template-columns: 1fr 1fr; column-gap: 40px; }
  .detail { grid-template-columns: 1fr 1fr; column-gap: 40px; }
  .detail .wide { grid-column: 1 / -1; }
  .actions { grid-template-columns: 2fr 1fr 1fr; max-width: 720px; }
  .actions .btn.primary { grid-column: auto; }
  body.app { padding-bottom: 40px; }
  .app .main { max-width: 760px; }
  .tabbar { position: fixed; top: 0; bottom: auto; left: auto; right: 120px; width: 240px; height: 56px; z-index: 30; border: 0; background: transparent; padding: 0; }
  .tabbar a { height: 56px; font-size: 16px; border-top: 0; border-bottom: 4px solid transparent; margin: 0; }
  .tabbar a[aria-current="page"] { border-bottom-color: var(--stamp); }
  .dock { position: static; padding: 14px 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .lead-body, .chev { transition: none; }
  .skel { animation: none; }
}
@media print { .top, .tabbar, .dock { display: none; } }

@media (max-width: 520px) { .top nav a:first-child { display: none; } .top nav a:only-child { display: inline; } }
