/* Contact Sheet. A darkroom, not a light room.

   One accent: Kodak yellow-orange, the colour a safelight and a film box share.
   One drawn idea: the film edge, in real 135 geometry, which is the launcher icon,
   the header, the counter chrome, the rule between sections and the empty state.
   One corner language: 3px on controls, 1px on anything that is meant to be film.
   The only other colours in the app are printed on a film box, and a film box is an
   object rather than a control. Light leak orange appears inside drawn film and
   nowhere else. */

:root {
  color-scheme: dark;

  /* near black, warmed towards the safelight; never #000 */
  --bg: #121010;
  --bg2: #1A1613;
  --bg3: #221D18;
  --filmblack: #0C0A09;           /* under the film: darker than the room */

  --fg: #F5EEE2;
  --fg2: #ABA091;
  --fg3: #8C8374;
  --hair: #2E2A23;
  --hair2: #3B342B;

  --accent: #F2A62B;              /* the one accent */
  --accent-deep: #C4761B;
  --accent-wash: rgba(242, 166, 43, .10);
  --leak: #E4552B;                /* only ever inside drawn film */
  --danger: #E0806A;

  --r: 3px;
  --r-film: 1px;
  --sans: Archivo, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --topbar: calc(54px + var(--sat, 0px));

  /* layered surfaces: a warm gradient, a lit top edge, a tinted shadow */
  --surface: linear-gradient(163deg, #1F1A16 0%, #171412 62%, #141110 100%);
  --lift: 0 1px 0 rgba(245, 238, 226, .05) inset, 0 -1px 0 rgba(0, 0, 0, .35) inset;
  --drop: 0 14px 30px -18px rgba(0, 0, 0, .95), 0 3px 10px -6px rgba(28, 14, 2, .7);
  --ease: cubic-bezier(.2, .7, .25, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--fg);
  font-family: var(--sans);
  font-size: 16px; line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  user-select: none; -webkit-user-select: none;
}

/* The room is not flat: a low safelight wash from the top left, the way one bulb
   over a bench actually falls. */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(120% 62% at 12% -8%, rgba(242, 166, 43, .07), rgba(242, 166, 43, 0) 62%),
    radial-gradient(90% 55% at 92% 104%, rgba(228, 85, 43, .05), rgba(228, 85, 43, 0) 60%);
}

/* Real grain over the paper surfaces. Generated in code, never an asset, and kept off
   the camera screen where the viewfinder does its own. */
.grainfield {
  position: fixed; inset: 0; z-index: 65; pointer-events: none;
  opacity: .055; mix-blend-mode: overlay; background-size: 128px 128px;
}
body.on-camera .grainfield { display: none; }

#stage { position: fixed; inset: 0; z-index: 1; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.screen:not([hidden]) { animation: screen-in .26s var(--ease) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(7px) } }

.scroller {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 20px 20px calc(40px + var(--sab, 0px));
}
.pad { flex: 1; overflow-y: auto; padding: calc(28px + var(--sat, 0px)) 24px calc(28px + var(--sab, 0px)); }

/* --- type --- */
.k, .bar-t, .strip-btn, .counter-stock, .counter-cap, .modal-k, .lab-k, .sh-stock, .kept, .ctl-lab {
  font-size: 11px; letter-spacing: .15em; text-transform: uppercase; font-weight: 600;
  font-stretch: 100%;
}
.h2 { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700;
      color: var(--fg3); margin: 32px 0 10px; display: flex; align-items: center; gap: 12px; }
/* the rule beside a heading is a run of perforations, not a plain line */
.h2::after {
  content: ''; flex: 1; height: 5px; opacity: .75;
  background: repeating-linear-gradient(90deg, var(--hair) 0 5px, transparent 5px 9px);
  -webkit-mask-image: linear-gradient(90deg, #000 0 72%, transparent);
          mask-image: linear-gradient(90deg, #000 0 72%, transparent);
}
.help { font-size: 13.5px; line-height: 1.55; color: var(--fg3); margin: 7px 0 0; }
.rule { border: 0; height: 5px; margin: 32px 0;
        background: repeating-linear-gradient(90deg, var(--hair) 0 5px, transparent 5px 9px); }
.colophon { font-size: 12.5px; color: var(--fg3); line-height: 1.7; margin: 22px 0 8px; }

/* --- the drawn icon set: one stroke width, one corner language --- */
.ctl-ico { display: inline-flex; width: 22px; height: 22px; flex: none; }
.ctl-ico svg { width: 100%; height: 100%; display: block; }

/* --- buttons --- */
.btn {
  font: inherit; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  font-stretch: 100%;
  background: linear-gradient(178deg, #F7B846, var(--accent) 58%, var(--accent-deep));
  color: #1B1206; border: 1px solid var(--accent-deep);
  border-radius: var(--r); padding: 12px 20px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: 0 1px 0 rgba(255, 236, 199, .45) inset, 0 8px 18px -10px rgba(242, 166, 43, .6);
  transition: transform .1s var(--ease), filter .14s var(--ease);
}
.btn .ctl-ico { width: 17px; height: 17px; }
.btn:active { transform: scale(.982) translateY(1px); filter: brightness(.94); }
.btn.big { display: flex; width: 100%; padding: 16px; margin-top: 26px; }
.btn.small { padding: 9px 13px; font-size: 11.5px; gap: 7px; }
.btn.ghost {
  background: var(--bg2); color: var(--fg); border-color: var(--hair2);
  box-shadow: var(--lift);
}
.btn.ghost:active { filter: brightness(1.25); }
.btn.ghost.quiet { background: transparent; border-color: transparent; color: var(--fg3); box-shadow: none; }
.btn.ghost.danger { color: var(--danger); border-color: #402922; }
.btn.ghost.danger.armed { color: #1B1206; background: var(--danger); border-color: var(--danger); }
.btn.ghost.on { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }
.btn.spent { opacity: .72; }
.btn[disabled] { opacity: .4; transform: none; filter: none; cursor: default; }
.btn.busy { position: relative; color: transparent; }
.btn.busy .ctl-ico { opacity: 0; }
.btn.busy::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px;
  border: 2px solid rgba(27, 18, 6, .3); border-top-color: #1B1206; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn.ghost.busy::after { border-color: rgba(245, 238, 226, .22); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg) } }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.segs { display: flex; gap: 6px; margin-top: 10px; }
.segs button {
  flex: 1; font: inherit; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  padding: 11px 4px; background: var(--bg2); color: var(--fg2);
  border: 1px solid var(--hair); border-radius: var(--r); cursor: pointer;
  box-shadow: var(--lift);
  transition: transform .1s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
}
.segs button:active { transform: scale(.97); }
.segs button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }
.segs.wide button { padding: 13px 4px; }

select {
  font: inherit; font-size: 15px; background: var(--bg2); color: var(--fg);
  border: 1px solid var(--hair2); border-radius: var(--r); padding: 11px 12px; width: 100%; margin-top: 9px;
  box-shadow: var(--lift);
}
input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); }
.field { margin-bottom: 26px; }
.field label { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--fg2); }
.field.row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.field.row .help { margin-top: 4px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r);
}

/* --- bars --- */
.bar {
  display: grid; grid-template-columns: 50px 1fr auto; align-items: center;
  height: var(--topbar); padding: 0 16px 0 0; padding-top: var(--sat, 0px);
  background: linear-gradient(180deg, #191512, #141110);
  flex: none; position: relative;
}
/* the bar hangs on a run of perforations */
.bar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: repeating-linear-gradient(90deg, #29241E 0 5px, transparent 5px 9px);
}
.bar-t { margin: 0; color: var(--fg); }
.bar-back {
  width: 50px; height: 100%; background: none; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--fg2);
  transition: transform .1s var(--ease), color .14s var(--ease);
}
.bar-back:active { transform: translateX(-2px); color: var(--fg); }
.bar-act {
  font: inherit; font-size: 11px; letter-spacing: .15em; text-transform: uppercase; font-weight: 700;
  background: none; border: 0; color: var(--accent); cursor: pointer; padding: 8px 0;
  display: inline-flex; align-items: center; gap: 7px;
}
.bar-act .ctl-ico { width: 17px; height: 17px; }
.bar-act:active { opacity: .7; }
.bar-act.ghosted { color: var(--fg3); }

/* --- the mark: a length of 135 film --- */
.mk { display: block; width: 100%; height: auto; filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .7)); }
.mk-no { font-family: var(--sans); font-size: 2.6px; font-weight: 700; letter-spacing: .06em;
         fill: var(--accent); opacity: .82; }

/* --- covenant --- */
.cov { display: flex; flex-direction: column; justify-content: center; min-height: 100%; }
.cov-mark { margin: 0 0 34px; max-width: 300px; }
.cov-h { font-size: clamp(30px, 8.6vw, 38px); line-height: 1.04; letter-spacing: -.028em; font-weight: 700;
         font-stretch: 100%; margin: 0 0 28px; text-wrap: balance; }
.cov-list { list-style: none; padding: 0; margin: 0; }
.cov-list li {
  font-size: 14.5px; color: var(--fg2); line-height: 1.5; padding: 15px 0 15px 0;
  border-top: 1px solid var(--hair); position: relative;
}
.cov-list li:last-child { border-bottom: 1px solid var(--hair); }
.cov-list b { color: var(--fg); font-weight: 700; }
.cov-foot { font-size: 13px; color: var(--fg3); margin: 20px 0 0; }

/* --- camera --- */
.vf-shell {
  position: absolute; left: 0; right: 0;
  top: calc(84px + var(--sat, 0px)); bottom: calc(126px + var(--sab, 0px));
}
.vf-wrap {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  overflow: hidden; background: #080706; border-radius: var(--r-film);
  width: 100%; aspect-ratio: 2 / 3;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 1);
}
#vf { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.vf-hint { position: absolute; inset: 0; pointer-events: none; }
.vf-grain {
  position: absolute; inset: 0; pointer-events: none; opacity: .16;
  background-size: 128px 128px; mix-blend-mode: overlay;
}
/* the gate the film sits behind: corner marks, not a border */
.vf-mask {
  position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(245, 238, 226, .09), inset 0 0 100px rgba(0, 0, 0, .6);
}
.vf-mask::before, .vf-mask::after {
  content: ''; position: absolute; width: 20px; height: 20px; opacity: .55;
  border-color: rgba(245, 238, 226, .55); border-style: solid;
}
.vf-mask::before { left: 9px; top: 9px; border-width: 1.5px 0 0 1.5px; }
.vf-mask::after { right: 9px; bottom: 9px; border-width: 0 1.5px 1.5px 0; }
.vf-state {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 16px;
  align-items: center; justify-content: center; text-align: center; padding: 30px;
  background: #0D0C0B; color: var(--fg2); font-size: 14px; line-height: 1.5;
}
.shot-flash { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }
.shot-flash.go { animation: blade .16s steps(2, end); }
@keyframes blade { 0% { opacity: 1 } 100% { opacity: 0 } }

.topstrip {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px;
  padding: calc(10px + var(--sat, 0px)) 12px 14px;
  background: linear-gradient(#121010 58%, rgba(18, 16, 16, 0));
}
.strip-btn {
  background: none; border: 0; color: var(--fg3); font: inherit; cursor: pointer;
  font-size: 10px; letter-spacing: .12em; white-space: nowrap;
  padding: 11px 2px; display: inline-flex; align-items: center; gap: 7px;
  transition: color .14s var(--ease), transform .1s var(--ease);
}
.strip-btn .ctl-ico { width: 17px; height: 17px; }
.strip-btn:first-of-type { justify-self: start; }
.strip-btn:last-of-type { justify-self: end; }
.strip-btn:active { color: var(--accent); transform: scale(.96); }

/* the counter is a frame of film in a gate: perforations top and bottom, number between */
.counter {
  background: none; border: 0; cursor: pointer; color: var(--fg);
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 2px 4px;
}
.counter-stock { color: var(--fg2); font-size: 9px; letter-spacing: .13em; white-space: nowrap; }
.counter-gate {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 78px; height: 40px; border-radius: var(--r-film);
  background: linear-gradient(180deg, #241E19, #16130F);
  box-shadow: 0 1px 0 rgba(245, 238, 226, .07) inset, 0 6px 14px -8px #000;
}
.counter-gate .gate { position: absolute; inset: 0; width: 100%; height: 100%; }
.gate-perf { fill: #0B0A09; stroke: rgba(245, 238, 226, .10); stroke-width: .22; }
.counter-gate .gate { transform: translateX(var(--wind, 0px)); }
.counter-num {
  position: relative; font-size: 27px; font-weight: 700; line-height: 1; letter-spacing: -.02em;
  font-stretch: 78%; color: var(--accent);
  text-shadow: 0 0 18px rgba(242, 166, 43, .35);
}
.counter-num.low { animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 0%, 100% { opacity: 1 } 50% { opacity: .58 } }
.counter-num.spent, .counter-num.none { color: var(--fg3); text-shadow: none; }
.counter-num.none { font-size: 20px; letter-spacing: .08em; }
.counter-cap { color: var(--fg3); font-size: 8.5px; letter-spacing: .16em; white-space: nowrap; }
.counter:active .counter-gate { filter: brightness(1.3); }

.controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  height: calc(126px + var(--sab, 0px)); padding-bottom: var(--sab, 0px);
  display: flex; align-items: center; justify-content: space-around;
  background: linear-gradient(rgba(18, 16, 16, 0), #121010 38%);
}
.ctl {
  background: none; border: 0; cursor: pointer; width: 68px;
  display: flex; flex-direction: column; align-items: center; gap: 7px; color: var(--fg3);
  transition: color .14s var(--ease), transform .1s var(--ease);
}
.ctl:active { transform: scale(.93); color: var(--fg); }
.ctl.on { color: var(--accent); }
.ctl-lab { font-size: 9px; letter-spacing: .16em; }

/* the shutter: a machined ring with a lit core */
.shutter { background: none; border: 0; cursor: pointer; width: 78px; height: 78px; position: relative; }
.shutter-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 210deg, #4A423A, #221E1A 35%, #554C41 62%, #201C18 100%);
  box-shadow: 0 6px 16px -8px #000;
}
.shutter-ring::after {
  content: ''; position: absolute; inset: 4px; border-radius: 50%; background: #17140F;
}
.shutter-core {
  position: absolute; inset: 9px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #FFFCF5, #E9E0CE 58%, #B9AF9B);
  transition: transform .08s var(--ease), background .16s var(--ease);
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, .8);
}
.shutter:active .shutter-core {
  transform: scale(.9);
  background: radial-gradient(circle at 38% 32%, #FFD98A, var(--accent) 60%, var(--accent-deep));
}
.shutter[disabled] .shutter-core { background: #4E463C; box-shadow: none; }
.shutter[disabled] { cursor: default; }

.empty-cam {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 2;
  padding: 0 30px; text-align: center;
}
/* the drawn part of an empty camera: a cassette in the same film geometry as the mark */
.ec-art { width: min(74vw, 268px); margin: 0 auto 22px; }
.ec-art svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .8)); }
@media (prefers-reduced-motion: no-preference) {
  .ec-art { animation: ec-in .5s var(--ease) both; }
  @keyframes ec-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}
.ec-line { font-size: 23px; font-weight: 700; font-stretch: 100%; letter-spacing: -.02em;
           margin: 0 0 10px; text-wrap: balance; }
.ec-sub { font-size: 14px; color: var(--fg3); margin: 0 auto; line-height: 1.55; max-width: 30ch; }
.empty-cam .btn.big { margin-top: 30px; }

/* the wind-on: the sprocket run advancing, with the words for it */
.windon {
  position: absolute; left: 0; right: 0; bottom: calc(126px + var(--sab, 0px)); z-index: 4;
  padding: 0 20px 12px; display: flex; flex-direction: column; gap: 7px; align-items: center;
}
.wind-track {
  width: 100%; height: 5px; border-radius: 1px;
  background: repeating-linear-gradient(90deg, #221E19 0 5px, transparent 5px 9px);
}
.ratchet { height: 100%; width: 0%; border-radius: 1px;
           background: repeating-linear-gradient(90deg, var(--accent) 0 5px, transparent 5px 9px); }
.wind-lab { margin: 0; font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase;
            font-weight: 700; color: var(--fg3); }

/* --- sheets archive --- */
.rollcard {
  display: flex; flex-direction: column; align-items: stretch; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--hair);
  border-radius: var(--r); padding: 15px; margin-bottom: 14px; cursor: pointer; color: inherit; font: inherit;
  box-shadow: var(--lift), var(--drop);
  animation: rise-in .34s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms);
  transition: transform .11s var(--ease), border-color .16s var(--ease);
}
@keyframes rise-in { from { opacity: 0; transform: translateY(10px) } }
.rollcard:active { transform: scale(.988); border-color: var(--hair2); }
.rollcard.waiting { background: none; border-style: dashed; box-shadow: none; }
.rollcard > * { width: 100%; }
.shelf button > * { width: 100%; }
.rc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rc-stock { font-size: 12px; letter-spacing: .15em; text-transform: uppercase; font-weight: 700; }
.rc-no { font-size: 11px; letter-spacing: .16em; color: var(--fg3); }
/* the archive strip is a length of film, so it sits on a rebate with perforations */
.rc-strip {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; margin: 13px 0 11px;
  padding: 6px 5px; background: linear-gradient(180deg, #241E19, #1A1613); border-radius: var(--r-film);
  position: relative;
}
.rc-strip::before, .rc-strip::after {
  content: ''; position: absolute; left: 5px; right: 5px; height: 3px;
  background: repeating-linear-gradient(90deg, #0B0A09 0 5px, transparent 5px 9px);
}
.rc-strip::before { top: 1.5px; }
.rc-strip::after { bottom: 1.5px; }
.rc-strip img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block;
                background: var(--filmblack); border-radius: var(--r-film); }
.rc-meta { font-size: 12.5px; color: var(--fg3); margin: 0; }
.rc-back { font-size: 13px; color: var(--accent); margin: 10px 0 0; font-weight: 700; }
.rc-wait { display: flex; align-items: center; gap: 9px; margin: 12px 0 6px; }
.rc-wait .dashes { flex: 1; height: 5px;
                   background: repeating-linear-gradient(90deg, var(--hair) 0 5px, transparent 5px 9px); }
.rc-kept { color: var(--accent); }

/* --- empty states, drawn --- */
.empty { text-align: center; padding: 34px 10px 20px; }
.empty-art { max-width: 250px; margin: 0 auto 24px; opacity: .95; }
.empty-art svg { width: 100%; height: auto; display: block;
                 filter: drop-shadow(0 14px 26px rgba(0, 0, 0, .7)); }
.empty-h { font-size: 19px; font-weight: 700; font-stretch: 100%; letter-spacing: -.015em;
           margin: 0 0 8px; color: var(--fg); text-wrap: balance; }
.empty-p { font-size: 14px; color: var(--fg3); margin: 0 auto; line-height: 1.55; max-width: 32ch; }

/* --- one contact sheet --- */
.sh-head { margin-bottom: 18px; }
.sh-stock { color: var(--fg); margin: 0 0 5px; font-size: 13px; }
.sh-meta { font-size: 12.5px; color: var(--fg3); margin: 0; }
.sh-marks { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
            margin: 10px 0 0; font-weight: 700; display: flex; flex-wrap: wrap; gap: 7px; }
.sh-marks span { border: 1px solid rgba(242, 166, 43, .42); border-radius: 2px; padding: 3px 8px;
                 background: var(--accent-wash); }
#shScroll { padding-bottom: calc(84px + var(--sab, 0px)); }
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px 4px; touch-action: none; }
.cell { position: relative; animation: cell-in .3s var(--ease) both;
        animation-delay: calc(var(--row, 0) * 36ms); }
@keyframes cell-in { from { opacity: 0; transform: translateY(6px) } }
.cell .im {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block;
  background: var(--filmblack); border-radius: var(--r-film);
  box-shadow: 0 1px 4px -2px rgba(0, 0, 0, .9);
}
/* clear film. A frame nobody exposed prints black, with the faintest edge so the grid
   still reads as thirty-six places rather than a hole. */
.cell .im.blank { background: linear-gradient(160deg, #16120F, #0C0A09);
                  box-shadow: inset 0 0 0 1px rgba(207, 198, 182, .045); }
.cell.unshot .no { color: #857C6E; }
.rc-strip .blank { width: 100%; aspect-ratio: 2 / 3; display: block; border-radius: var(--r-film);
                   background: linear-gradient(160deg, #16120F, #0C0A09); }
.cell .pencil { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none;
                aspect-ratio: 2 / 3; height: auto; }
.cell .pencil path { fill: none; stroke: var(--accent); stroke-width: 5.5; stroke-linecap: round; opacity: .92; }
.reb { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px; margin-top: 4px; height: 6px; }
.spro { height: 4px; border-radius: 1px;
        background: repeating-linear-gradient(90deg, rgba(143, 134, 118, .5) 0 3px, transparent 3px 6px); }
.no { font-size: 8.5px; letter-spacing: .04em; color: var(--fg3); font-weight: 700; line-height: 1; }
.cell.keeper .no { color: var(--accent); }
.sh-tip { font-size: 12.5px; color: var(--fg3); margin: 22px 2px 0; line-height: 1.5;
          display: flex; gap: 10px; align-items: flex-start; }
.sh-tip .ctl-ico { width: 17px; height: 17px; margin-top: 1px; opacity: .8; }

.sheetbar, .framebar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  height: calc(64px + var(--sab, 0px)); padding: 0 16px var(--sab, 0px);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--hair);
  background: linear-gradient(180deg, #191512, #141110);
}
.kept { color: var(--fg3); }
.kept.some { color: var(--accent); }

.loupe {
  position: fixed; width: 156px; height: 156px; border-radius: 50%; overflow: hidden;
  border: 2px solid rgba(245, 238, 226, .5);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .8), 0 0 0 6px rgba(18, 16, 16, .55);
  pointer-events: none; z-index: 40; background: #0B0A09;
}
.loupe canvas { width: 100%; height: 100%; display: block; }

/* --- one frame --- */
.frame-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 18px 16px 0; min-height: 0;
}
.frame-hold { position: relative; max-height: 100%; display: flex;
              box-shadow: 0 26px 60px -30px rgba(0, 0, 0, 1); }
#frImg { max-width: 100%; max-height: 100%; object-fit: contain; display: block; border-radius: var(--r-film); }
.pencil { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pencil path { fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; opacity: .92; }
.pencil.draw path { stroke-dasharray: 900; stroke-dashoffset: 900; animation: pencil .5s ease-out forwards; }
@keyframes pencil { to { stroke-dashoffset: 0 } }
.fr-meta { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--fg3);
           margin: 18px 0 calc(78px + var(--sab, 0px)); text-align: center;
           display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.fr-meta span + span { position: relative; }
.fr-meta span + span::before {
  content: ''; position: absolute; left: -8px; top: 50%; width: 3px; height: 3px; margin-top: -1.5px;
  border-radius: 50%; background: currentColor; opacity: .7;
}

/* --- the shelf --- */
.shelf-foot { font-size: 13.5px; color: var(--fg3); margin: 26px 2px 0; line-height: 1.6; }
.shelf-note { font-size: 13.5px; color: var(--fg3); margin: 0 2px 22px; line-height: 1.5; }
.shelf { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px 11px; }
.shelf button { display: flex; flex-direction: column; align-items: stretch; background: none;
                border: 0; padding: 0; cursor: pointer; text-align: left;
                animation: rise-in .34s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms);
                transition: transform .12s var(--ease); }
.shelf button:active { transform: translateY(2px) scale(.985); }
.shelf .under { display: block; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase;
                color: var(--fg3); margin-top: 10px; font-weight: 700; min-height: 2.6em; line-height: 1.3; }
.shelf .under.loaded { color: var(--accent); }

/* a film box is an object on a shelf, so it has a spine, a lit edge and a shadow */
.box {
  position: relative; aspect-ratio: 3 / 4; border-radius: var(--r); overflow: hidden;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 10px 20px -8px rgba(0, 0, 0, .8), 0 2px 5px -2px rgba(0, 0, 0, .6),
              inset 0 0 0 1px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .28);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 10%; font-stretch: 88%;
}
/* the fold down the left, the way a carton catches light: a shade that dies out,
   never a band with an edge of its own */
.box::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 22%; z-index: 3; pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .16), rgba(0, 0, 0, .04) 38%, rgba(0, 0, 0, 0));
}
.box .b-name { font-size: 12.5px; font-weight: 700; line-height: 1.02; letter-spacing: -.005em;
               text-transform: uppercase; position: relative; z-index: 2; }
.box .b-iso { font-size: 30px; font-weight: 700; line-height: .84; letter-spacing: -.03em;
              position: relative; z-index: 2; font-stretch: 78%; }
.box .b-foot { font-size: 6px; letter-spacing: .18em; text-transform: uppercase; font-weight: 700;
               position: relative; z-index: 2; opacity: .9; }
.box .b-band { position: absolute; z-index: 1; }
.box[data-style=band] .b-band { left: 0; right: 0; top: 0; height: 34%; background: var(--band); }
.box[data-style=band] .b-name { color: var(--paper); margin-top: -2%; }
.box[data-style=split] .b-band {
  left: -30%; right: -30%; bottom: -50%; height: 74%; background: var(--band); transform: rotate(-13deg);
}
/* small print on the yellow has to be dark to be readable at all */
.box[data-style=split] .b-foot { color: #2A1B08; opacity: .9; }
.box[data-style=plate] { box-shadow: 0 10px 20px -8px rgba(0, 0, 0, .85),
                                     inset 0 0 0 1px rgba(255, 255, 255, .1); }
.box[data-style=plate] .b-band { left: 5%; right: 5%; top: 5%; bottom: 5%; border: 1px solid var(--band); background: none; }
.box[data-style=plate] .b-name, .box[data-style=plate] .b-iso { color: var(--band); }
.box[data-style=kraft] .b-band { left: 4%; right: 4%; top: 4%; bottom: 4%; border: 1.5px dashed var(--band); background: none; }
.box[data-style=kraft] .b-iso { color: var(--band); }

.boxstage { perspective: 1000px; max-width: 236px; margin: 10px auto 12px; }
.boxstage .box .b-name { font-size: 18px; }
.boxstage .box .b-iso { font-size: 46px; }
.boxstage .box .b-foot { font-size: 8px; }
.box3d { position: relative; transform-style: preserve-3d; transition: transform .62s cubic-bezier(.22, .7, .2, 1); cursor: pointer; }
.box3d.flip { transform: rotateY(180deg); }
.box3d .face { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.box3d .back { position: absolute; inset: 0; transform: rotateY(180deg); }
.box.rear { justify-content: flex-start; gap: 6px; padding: 9%; }
.box.rear .r-h { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; }
.box.rear .r-row { display: flex; justify-content: space-between; gap: 8px; font-size: 8.5px;
                   border-bottom: 1px solid rgba(0, 0, 0, .18); padding: 3px 0; line-height: 1.35; }
.box.rear .r-row b { font-weight: 700; }
/* The data sheet is 8.5px print on a coloured box: it gets the ink at full strength,
   and the label reads as the label because it is the bold one. */
.box.rear .r-row span { text-align: right; }
.flip-tip { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg3);
            text-align: center; margin: 0 0 24px; font-weight: 700; }
.st-note { font-size: 15px; line-height: 1.6; color: var(--fg2); margin: 0; }
.curve { width: 100%; height: auto; background: linear-gradient(163deg, #1C1815, #141210);
         border: 1px solid var(--hair); border-radius: var(--r); box-shadow: var(--lift); }
.curve .ax { stroke: var(--hair2); stroke-width: 1; }
.curve .ln { fill: none; stroke-width: 2; stroke-linecap: round; }
.curve-cap { font-size: 12px; color: var(--fg3); margin: 8px 0 0; }
.specs { margin-top: 22px; }
.specs .row { display: grid; grid-template-columns: 90px 1fr; gap: 14px; padding: 11px 0;
              border-bottom: 1px solid var(--hair); }
.specs .row:first-child { border-top: 1px solid var(--hair); }
.specs .k2 { font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--fg3); font-weight: 700; }
.specs .v { font-size: 14px; color: var(--fg2); }
.st-warn { font-size: 13px; color: var(--fg2); margin: 14px 0 0; line-height: 1.55;
           border-left: 2px solid var(--accent); padding: 2px 0 2px 12px; }

/* --- the lab --- */
.lab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
       padding: calc(40px + var(--sat, 0px)) 30px calc(40px + var(--sab, 0px));
       text-align: center; position: relative; }
.safelight {
  position: absolute; left: 50%; top: 30%; width: 400px; height: 400px; margin: -200px 0 0 -200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242, 166, 43, .18), rgba(228, 85, 43, .06) 42%, rgba(242, 166, 43, 0) 70%);
  animation: breathe 5.5s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: .6 } 50% { opacity: 1 } }
.lab-spool { width: 108px; height: 108px; position: relative; margin-bottom: 26px; }
.lab-spool svg { width: 100%; height: 100%; display: block;
                 filter: drop-shadow(0 12px 26px rgba(0, 0, 0, .8)); }
.sp-turn { transform-origin: 50% 50%; transform: rotate(var(--turn, 0deg)); transition: transform .5s var(--ease); }
.lab-k { color: var(--accent); margin: 0 0 10px; position: relative; }
.lab-roll { font-size: 26px; font-weight: 700; font-stretch: 100%; letter-spacing: -.02em;
            margin: 0 0 28px; position: relative; }
.lab-bar { width: min(280px, 78%); height: 5px; position: relative;
           background: repeating-linear-gradient(90deg, #221E19 0 5px, transparent 5px 9px); }
.lab-fill { height: 100%; width: 0%; transition: width .22s linear;
            background: repeating-linear-gradient(90deg, var(--accent) 0 5px, transparent 5px 9px); }
.lab-n { font-size: 13px; color: var(--fg2); margin: 16px 0 0; letter-spacing: .12em; position: relative; }
.lab-note { font-size: 12.5px; color: var(--fg3); margin: 38px 0 0; position: relative; max-width: 30ch; }

/* --- modals --- */
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(8, 7, 6, .84);
  display: flex; align-items: flex-end; justify-content: center;
  animation: veil .2s ease-out;
}
@keyframes veil { from { opacity: 0 } }
.modal-panel {
  width: 100%; max-width: 520px; background: var(--surface);
  border-top: 1px solid var(--hair2);
  border-radius: 14px 14px 0 0; padding: 24px 22px calc(26px + var(--sab, 0px));
  box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, .95);
  animation: rise .26s var(--ease);
}
@keyframes rise { from { transform: translateY(22px) } }
.modal-panel .btn { width: 100%; margin-top: 10px; }
.modal-k { color: var(--accent); margin: 0 0 8px; }
.modal-h { font-size: 22px; font-weight: 700; font-stretch: 100%; letter-spacing: -.02em;
           margin: 0 0 8px; line-height: 1.2; text-wrap: balance; }
.modal-p { font-size: 14px; color: var(--fg2); margin: 0 0 16px; line-height: 1.55; }
.modal-help { font-size: 13px; color: var(--fg3); margin: 12px 0 0; min-height: 38px; line-height: 1.45; }

.rw-spool { width: 62px; height: 62px; margin: 2px auto 20px; }
.rw-spool svg { width: 100%; height: 100%; display: block; }
.rw-spool .sp-turn { animation: rewind 1.5s linear infinite; }
@keyframes rewind { to { transform: rotate(-360deg) } }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + var(--sab, 0px)); z-index: 60;
  background: linear-gradient(168deg, #262019, #1A1613);
  color: var(--fg); border: 1px solid var(--hair2); border-radius: var(--r);
  padding: 11px 16px; font-size: 13.5px; max-width: 86%; text-align: center;
  box-shadow: var(--drop);
  animation: toast-in .24s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px) } }
/* on the camera the controls and the wind-on own the bottom of the screen */
body.on-camera .toast { bottom: calc(158px + var(--sab, 0px)); }

/* Animations off at the system level means stop the travel, not delete the picture.
   Everything below keeps its shape, its colour and its position; only movement stops. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .safelight { opacity: .8 !important; }         /* hold the pulse at its middle */
  .counter-num.low { opacity: 1 !important; }
  .rw-spool .sp-turn { transform: rotate(-22deg); }
  .btn.busy::after { animation: none !important; border-top-color: transparent;
                     border-right-color: #1B1206; }
}
