:root {
  color-scheme: dark;
  background: #171916;
  color: #edece4;
  font-family: system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { max-width: 70rem; margin: 0 auto; padding: 1.5rem clamp(1rem, 5vw, 4rem) 3rem; }
header span { color: #bfc3b5; font-size: .8rem; letter-spacing: .16em; }
h1 { font-size: clamp(2rem, 6vw, 3.75rem); font-weight: 450; margin: .25rem 0 1.1rem; }
#preview {
  display: grid;
  place-items: center;
  aspect-ratio: 1.55;
  overflow: hidden;
  background: radial-gradient(ellipse, #383b32, #21241f 74%);
  border: 1px solid #52584b;
  touch-action: pan-y;
  cursor: grab;
}
#preview:active { cursor: grabbing; }
#stack { position: relative; width: 69%; aspect-ratio: 1969 / 1386; transform-style: preserve-3d; }
#stack img { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }
#stack .layer { transform-origin: center bottom; }
#stack #paper { opacity: 1; transform: translateY(50%) rotateX(90deg); }
#controls { display: flex; gap: .6rem; margin-top: 1rem; }
button { border: 1px solid #707869; border-radius: .2rem; padding: .65rem 1.05rem; min-height: 44px; font: inherit; cursor: pointer; background: #242821; color: inherit; }
#scan { color: #142212; background: #c8eeac; border-color: #c8eeac; }
#status, details { color: #d1d3c8; }
summary { width: fit-content; cursor: pointer; }
a { color: #c8eeac; }
input { display: block; max-width: 100%; margin-top: .4rem; }
:focus-visible { outline: 2px solid #c8eeac; outline-offset: 3px; }
[hidden] { display: none !important; }
#camera-view { position: fixed; inset: 0; z-index: 10; background: #121310; }
#camera { position: absolute; inset: 0; overflow: hidden; isolation: isolate; }
#camera-controls { position: absolute; top: max(1rem, env(safe-area-inset-top)); left: max(1rem, env(safe-area-inset-left)); right: 1rem; pointer-events: none; }
#camera-controls button { pointer-events: auto; }
#camera-status { width: fit-content; background: rgb(21 23 19 / 88%); padding: .5rem .75rem; border-radius: .2rem; }
