:root{color-scheme:light;font-family:ui-monospace,"SFMono-Regular",Menlo,Consolas,"Liberation Mono",monospace;font-size:16px;color:#111;background:#fff;--hairline:#d4d4d4;--muted:#777}
*{box-sizing:border-box;margin:0}
[hidden]{display:none!important}
body{background:#fff;min-height:100dvh;-webkit-font-smoothing:antialiased}
button,input{font:inherit;color:inherit;background:none;border:0;border-radius:0;padding:0}
button{cursor:pointer}
a{color:inherit;text-decoration:none}
.head{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:58px;padding:env(safe-area-inset-top) max(16px,env(safe-area-inset-right)) 0 max(16px,env(safe-area-inset-left));border-bottom:1px solid var(--hairline);font-size:.68rem;letter-spacing:.03em}
.head nav{display:flex;gap:18px}
.head nav a:hover,.head .brand:hover{text-decoration:underline;text-underline-offset:4px}
main{max-width:560px;margin:0 auto;padding:0 16px 40px}
.desktop-note{margin-top:16px;padding:12px 14px;border:1px solid var(--hairline);font-size:.62rem;line-height:1.6;color:var(--muted)}
.desktop-note strong{font-weight:400;color:#111}

/* The square is both the view and the region the scanner reads. */
.viewport{position:relative;width:100%;aspect-ratio:1;margin-top:16px;background:#f4f4f4;overflow:hidden}
.viewport video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity .4s}
.viewport.live video{opacity:1}
.viewport canvas{position:absolute;inset:0;width:100%;height:100%;display:block}
.ticks i{position:absolute;width:22px;height:22px;border-color:#111;border-style:solid;border-width:0;transition:border-color .3s}
.viewport.live .ticks i{border-color:#fff}
.ticks i:nth-child(1){top:14px;left:14px;border-top-width:1px;border-left-width:1px}
.ticks i:nth-child(2){top:14px;right:14px;border-top-width:1px;border-right-width:1px}
.ticks i:nth-child(3){bottom:14px;left:14px;border-bottom-width:1px;border-left-width:1px}
.ticks i:nth-child(4){bottom:14px;right:14px;border-bottom-width:1px;border-right-width:1px}
.viewport.locked .ticks i{border-color:#111}
.readout{display:flex;justify-content:space-between;gap:12px;padding:12px 0;border-bottom:1px solid #111;font-size:.68rem}
.readout span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.readout #detail{flex:none}
.readout #detail{color:var(--muted)}

.primary{width:100%;min-height:58px;margin-top:16px;padding:0 17px;display:flex;justify-content:space-between;align-items:center;background:#111;color:#fff;font-size:.74rem;text-align:left}
.primary:disabled{background:#eee;color:#888;cursor:default}
.primary:not(:disabled):active{background:#333}
.secondary{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;padding-top:12px}
.hint{font-size:.62rem;line-height:1.6;color:var(--muted);max-width:30ch}
.quiet{font-size:.62rem;white-space:nowrap;text-decoration:underline;text-underline-offset:4px}
.manual{display:grid;grid-template-columns:auto 1fr auto;align-items:center;border:1px solid #111;margin-top:14px;font-size:.68rem}
.manual label{padding:0 12px;color:var(--muted)}
.manual input{min-height:48px;padding:0 4px;font-size:1rem;outline:none;min-width:0}
.manual button{min-height:48px;padding:0 14px;border-left:1px solid #111}

.result{padding-top:26px;animation:rise .45s cubic-bezier(.2,.8,.2,1)}
@keyframes rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
.result-head{display:flex;justify-content:space-between;padding-bottom:12px;border-bottom:1px solid #111;font-size:.68rem}
.result-head #r-how{color:var(--muted)}
.result-top{display:grid;grid-template-columns:44% 1fr;gap:16px;align-items:end;padding:16px 0;border-bottom:1px solid var(--hairline)}
.result-art{aspect-ratio:1;border:1px solid var(--hairline)}
.result-art svg{display:block;width:100%;height:100%}
.result-id h1{font-size:clamp(2rem,10vw,2.9rem);font-weight:400;letter-spacing:-.06em;line-height:1}
.result-id p{margin-top:10px;font-size:.62rem;line-height:1.6}
.muted{color:var(--muted)}
.stats{display:grid;grid-template-columns:repeat(3,1fr);border-bottom:1px solid var(--hairline)}
.stats div{padding:14px 0 16px}
.stats div+div{padding-left:12px;border-left:1px solid var(--hairline)}
.stats dt{font-size:.58rem;color:var(--muted)}
.stats dd{margin-top:8px;font-size:.95rem;overflow-wrap:anywhere}
.facts{font-size:.64rem}
.fact{display:grid;grid-template-columns:1fr auto 64px;gap:12px;padding:11px 0;border-bottom:1px solid var(--hairline)}
.fact span:first-child{color:var(--muted)}
.fact span:last-child{text-align:right;color:var(--muted)}
.actions{display:grid;grid-template-columns:repeat(3,1fr);border:1px solid #111;margin-top:18px}
.actions a{min-height:52px;display:flex;align-items:center;padding:0 12px;font-size:.66rem}
.actions a+a{border-left:1px solid #111}
.actions a:active{background:#f4f4f4}
.actions a.for-sale{background:#111;color:#fff}
.source{margin-top:14px;font-size:.56rem;line-height:1.7;color:var(--muted)}
.source a{color:#111}
footer{margin-top:40px;padding-top:14px;border-top:1px solid var(--hairline);font-size:.56rem;line-height:1.7;color:var(--muted)}
@media(min-width:700px){main{padding-bottom:60px}.head{padding-inline:max(24px,calc((100vw - 560px)/2))}}
@media(prefers-reduced-motion:reduce){.result{animation:none}.viewport video{transition:none}}
/* With a result showing, the square stays as its snapshot and the controls step aside. */
body.has-result #start,body.has-result .secondary,body.has-result .manual{display:none}

/* After a match the square becomes a white stage for the Credit in 3D. */
.viewport.staged{background:#fff;outline:1px solid var(--hairline);outline-offset:-1px}
.viewport #stage{touch-action:none;cursor:grab;animation:stage-in .5s ease both}
.viewport #stage:active{cursor:grabbing}
@keyframes stage-in{from{opacity:0}to{opacity:1}}
.viewport.staged .ticks{display:none}
.splay{position:absolute;right:10px;top:50%;height:84%;transform:translateY(-50%);display:flex;flex-direction:column;align-items:center;gap:10px;font-size:.52rem;color:var(--muted);letter-spacing:.06em}
.splay-track{position:relative;width:28px;flex:1;min-height:120px;cursor:pointer;touch-action:none}
.splay-track::before{content:"";position:absolute;left:50%;top:0;bottom:0;width:1px;background:#111}
.splay-track i{position:absolute;left:50%;width:14px;height:14px;margin:-7px 0 0 -7px;background:#111;top:100%}
.splay-track:focus-visible{outline:1px solid #111;outline-offset:4px}
/* Stats never wrap: numbers shrink with the screen instead. */
.stats dd{white-space:nowrap;overflow-wrap:normal;font-size:clamp(.72rem,3.9vw,.95rem)}
.actions a{white-space:nowrap}

.project-link{display:inline-flex;align-items:center;gap:7px}
.project-link svg{display:block;width:15px;height:15px;flex:none}
/* Phones: the name on one row, the other two projects on the next. */
@media(max-width:650px){.head{display:block;padding-bottom:0}.head .brand{display:flex;align-items:center;min-height:58px}
  .head nav{display:flex;justify-content:space-between;align-items:center;min-height:44px;border-top:1px solid var(--hairline);font-size:.64rem}}

/* Footer credits: one line on wide screens, stacked on phones. */
.credit-lines{display:inline-flex;flex-wrap:wrap;column-gap:.5em}
.credit-lines>*+*::before{content:"· "}
.credit-lines a:hover{text-decoration:underline;text-underline-offset:4px}
@media(max-width:650px){.credit-lines{display:flex;flex-direction:column;row-gap:4px}.credit-lines>*+*::before{content:none}}
