:root {
  color-scheme: dark;
  --paper: #f6e0bf;
  --muted: #b99d88;
  --copper: #ebad7a;
  --edge: #593127;
  --serif: "Songti SC", "Noto Serif SC", "STSong", "SimSun", Georgia, serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #160c0a; color: var(--paper); font: 14px/1.45 system-ui, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid #ffd49d; outline-offset: 4px; }
.shell { width: min(1160px, calc(100% - 64px)); margin: 0 auto; }
.masthead, footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.masthead { min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 17px var(--serif); letter-spacing: .08em; }
.brand-mark { width: 23px; aspect-ratio: 1; border: 1px solid #ad6d50; border-radius: 50%; display: grid; place-items: center; }
.brand-mark::after { content: ""; width: 6px; aspect-ratio: 1; border-radius: 50%; background: #ed9165; box-shadow: 0 0 9px #ff875b8f; }
.safe-light { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); letter-spacing: .1em; font-size: 11px; }
.safe-light i { width: 6px; aspect-ratio: 1; border-radius: 50%; background: #ff775e; box-shadow: 0 0 10px #ff553d; }
.darkroom { border: 1px solid #663b30; border-radius: 4px; overflow: hidden; background: #1e100d; }
.room {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  max-height: 72svh;
  overflow: hidden;
  isolation: isolate;
  background: #35100b url("assets/workbench.webp") center / 100% 100% no-repeat;
}
.room::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  box-shadow: inset 0 0 70px 5px #14050465;
}
.room-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at var(--glow-x, 50%) var(--glow-y, 42%), #ff9f5520, transparent 36%);
  mix-blend-mode: screen;
}
.intro { position: absolute; top: 7%; left: 5.3%; pointer-events: none; text-shadow: 0 1px 20px #260907; }
h1 { margin: 0; font: 500 clamp(32px, 5.15vw, 70px)/1.18 var(--serif); letter-spacing: .08em; }
.intro p { margin: 11px 0 0; color: #debca4; letter-spacing: .09em; font-size: clamp(11px, 1.25vw, 14px); }
.line { position: absolute; left: 43%; right: 9.8%; top: 26%; height: 22%; }
.wire { position: absolute; inset: -18% -18% auto -2%; height: 39%; border-bottom: 1px solid #c08660b5; border-radius: 0 0 49% 51%; transform: rotate(-1.4deg); pointer-events: none; }
.line-label { position: absolute; top: 35%; left: 55%; color: #ecbfa1; font-size: 11px; letter-spacing: .12em; pointer-events: none; transition: opacity 200ms; }
.line:has(.pin) .line-label { opacity: 0; }
.line.is-target .wire, .room[data-phase="ready"] .wire { border-color: #ffcd91; filter: drop-shadow(0 0 5px #f68c60); }
.hanging { position: absolute; inset: -1% -4% 0 0; display: flex; gap: 2.8%; align-items: flex-start; overflow-x: auto; overflow-y: hidden; padding: 3.7% 2% 3%; scrollbar-width: none; }
.hanging::-webkit-scrollbar, .film-window::-webkit-scrollbar { display: none; }
.pin {
  position: relative;
  display: block;
  flex: 0 0 21%;
  aspect-ratio: 1.25;
  padding: .48vw .48vw .95vw;
  border: 0;
  background: #ead0a8;
  box-shadow: 0 6px 14px #0b0404a6;
  transform: rotate(var(--tilt));
  transform-origin: 50% -7%;
  transition: filter 180ms;
}
.pin:hover { filter: brightness(1.1); }
.pin::before {
  content: "";
  position: absolute;
  z-index: 1;
  width: 7%;
  height: 23%;
  top: -12%;
  left: 47%;
  background: linear-gradient(90deg, #96613b, #e2a575 57%, #9f5535);
  border-radius: 1px;
  box-shadow: 1px 2px 2px #1c0b07a3;
}
.pin img { position: absolute; inset: 5% 5% 12%; width: 90%; height: 83%; }
.print img { width: 100%; height: 100%; }
.pin img, .print img { object-fit: cover; display: block; pointer-events: none; }
.pin.is-new { animation: sway 900ms cubic-bezier(.19,.8,.27,1) both; }
@keyframes sway {
  from { transform: rotate(calc(var(--tilt) - 16deg)); }
  55% { transform: rotate(calc(var(--tilt) + 6deg)); }
  to { transform: rotate(var(--tilt)); }
}
.film {
  position: absolute;
  z-index: 2;
  left: 14%;
  top: 59%;
  width: 34.2%;
  height: 21.8%;
  display: flex;
  transform: rotate(-3.15deg) skewX(-5deg);
  filter: drop-shadow(2px 6px 6px #43211194);
}
.film-window {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 4px;
  overflow: auto hidden;
  padding: 4px 2px;
  scrollbar-width: none;
  touch-action: pan-y;
  cursor: grab;
}
.film-window.is-dragging { cursor: grabbing; }
.film-window.is-dragging button { cursor: inherit; }
.film-frame {
  flex: 0 0 calc((100% - 8px) / 3);
  position: relative;
  display: grid;
  grid-template-rows: 1fr;
  padding: clamp(5px, 1.03vw, 13px) 3px;
  height: 100%;
  overflow: hidden;
  border: 0;
  background: #392118;
}
.film-frame:focus-visible { outline-offset: -2px; }
.film-frame::before, .film-frame::after {
  position: absolute;
  inset-inline: 3px;
  height: clamp(2px, .43vw, 5px);
  content: "";
  background: repeating-linear-gradient(90deg, #bd8552 0 5px, transparent 5px 10px);
}
.film-frame::before { top: 2px; }
.film-frame::after { bottom: 2px; }
.film-frame img { min-height: 0; display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; filter: sepia(.45) saturate(.84) brightness(.78); transition: filter 240ms; }
.film-frame:is(:hover, :focus-visible, [aria-pressed="true"]) img { filter: sepia(.12) saturate(1.05) brightness(1.12); }
.frame-number { position: absolute; bottom: 14%; right: 6%; color: #ffe3b3; text-shadow: 0 1px 3px #1f0d08; font: 9px var(--mono); pointer-events: none; }
.tray {
  position: absolute;
  z-index: 2;
  top: 53.4%;
  left: 54.1%;
  width: 32.3%;
  height: 27%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14% 13% 8% 8%;
}
.tray-label { display: inline-block; color: #ffc49b; font-size: 12px; letter-spacing: .13em; text-shadow: 0 1px 5px #280603; transition: opacity 240ms; }
.tray[aria-disabled="true"] { cursor: default; }
.room[data-phase="ready"] .print { cursor: grab; }
.room[data-phase="inspect"] .tray, .tray.is-target { border-color: #ffb47682; box-shadow: inset 0 0 22px #ff8d4936, 0 0 20px #ff7c3529; }
.room:is([data-phase="developing"],[data-phase="ready"]) .tray-label { opacity: 0; }
.water { position: absolute; z-index: 4; top: 53.4%; left: 54.1%; width: 32.3%; height: 27%; clip-path: polygon(2% 12%, 84% 10%, 99% 96%, 5% 99%); pointer-events: none; }
.print {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  width: 100px;
  height: 100px;
  padding: 1% 1% 2.1%;
  overflow: hidden;
  border: 0;
  border-radius: 1px;
  background: #f0d8b5;
  box-shadow: 0 9px 27px #130403bd;
  transform-origin: 50% 50%;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.print.is-dragging { cursor: grabbing; }
.print:focus-visible { outline-offset: -3px; }
.print img { filter: sepia(calc(.27 * (1 - var(--develop, 1)))) brightness(calc(.16 + .84 * var(--develop, 1))); }
.paper-glare { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(124deg, #ffd59626 0%, transparent 38%, transparent 68%, #ac643322); }
.room[data-phase="developing"] .print { box-shadow: 0 3px 6px #16050499; }
.workbar { min-height: 88px; padding: 12px clamp(12px, 2.5vw, 30px); border-top: 1px solid #633929; display: grid; grid-template-columns: 1fr 1.8fr 1fr; align-items: center; gap: 16px; }
.reel, .controls { display: flex; align-items: center; gap: 9px; }
.reel-name { min-width: 72px; display: grid; text-align: center; }
.reel-name span, footer { color: var(--copper); font: 10px var(--mono); letter-spacing: .14em; }
.reel-name strong { font: 600 16px/1.7 var(--serif); }
.icon-button {
  flex: 0 0 39px;
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  padding: 0;
  background: #2c1711;
  border: 1px solid var(--edge);
  border-radius: 50%;
  transition: background 180ms, border-color 180ms;
}
.icon-button:hover { background: #432419; border-color: #9b6549; }
.arrow { width: 7px; height: 7px; display: inline-block; border-right: 1px solid currentColor; border-top: 1px solid currentColor; transform: rotate(45deg); }
.arrow.back { transform: rotate(-135deg); }
.controls { justify-content: flex-end; }
.main-button { min-height: 42px; display: inline-flex; align-items: center; gap: 11px; white-space: nowrap; padding: 8px 13px; border-radius: 3px; border: 1px solid #fac293; color: #2a140d; background: #e7a977; font-weight: 650; transition: background 180ms; }
.main-button:hover { background: #f4bf93; }
.main-button:disabled { cursor: default; opacity: .65; }
.close-print { font-size: 21px; }
.readout { min-width: 0; align-self: center; text-align: center; }
.readout p { margin: 0; }
.readout-title { color: #ffe6c7; font: 600 19px/1.3 var(--serif); }
.readout-note { color: #e0c3ad; font-size: 12px; line-height: 1.55; }
.instruction { color: #d6ad90; font-size: 12px; }
.readout-title:not(:empty) ~ .instruction { margin-top: 4px; font-size: 11px; }
progress { display: block; width: min(100%, 190px); height: 4px; margin: 5px auto 0; border: 0; accent-color: var(--copper); }
footer { min-height: 46px; color: var(--muted); }
@media (max-width: 700px) {
  .shell { width: calc(100% - 26px); }
  .masthead { min-height: 55px; }
  .brand { font-size: 15px; }
  .room { aspect-ratio: 1.13; max-height: none; background-image: linear-gradient(180deg, #250d0a 0%, #250d0a 23.5%, #250d0a9c 28%, transparent 38%), url("assets/workbench.webp"); background-size: 100% 100%, 100% 75.5%; background-position: center, center bottom; background-repeat: no-repeat; }
  .room::after { box-shadow: inset 0 0 32px #14050465; }
  .intro { top: 6%; left: 5%; }
  .intro p { margin-top: 7px; }
  .line { top: 43%; height: 18%; left: 39%; right: 10%; }
  .line-label, .tray-label { font-size: 9px; }
  .film { left: 13.2%; top: 69%; width: 35%; height: 16.8%; }
  .film-window { gap: 2px; }
  .film-frame { flex-basis: calc((100% - 4px) / 3); padding-inline: 1px; }
  .film-frame::before, .film-frame::after { inset-inline: 1px; background-size: 7px 100%; }
  .frame-number { font-size: 7px; }
  .tray, .water { top: 64.7%; height: 21%; }
  .pin { padding: 2px 2px 4px; flex-basis: 26%; }
  .workbar { grid-template-columns: 1fr auto; gap: 12px 8px; min-height: 114px; }
  .readout { grid-column: 1/-1; grid-row: 1; text-align: left; min-height: 20px; }
  .readout progress { margin-inline-start: 0; }
  .reel-name { min-width: 62px; }
  .reel-name strong { font-size: 14px; }
  .controls { gap: 6px; }
  .main-button { font-size: 12px; }
  .icon-button { width: 36px; height: 36px; flex-basis: 36px; }
}
@media (max-width: 360px) {
  .shell { width: calc(100% - 18px); }
  .reel { gap: 5px; }
  .reel-name { min-width: 50px; }
  .controls { gap: 4px; }
  .icon-button { width: 32px; height: 32px; flex-basis: 32px; }
  .main-button { padding-inline: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
