:root {
  --bg: #0E0E10; --surface: #18181B; --line: #27272A; --line-strong: #3F3F46;
  --text: #F4F4F5; --muted: #A1A1AA; --soft: #D4D4D8; --accent: #C6F432; --on-accent: #0E0E10;
  --danger: #FF9B8A;
  --display: 'Space Grotesk', system-ui, sans-serif; --body: Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 var(--body);
  min-height: 100dvh; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2 { font-family: var(--display); margin: 0; letter-spacing: -0.5px; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; letter-spacing: 0; }
p { margin: 0; }

.shell { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column;
  padding: calc(18px + env(safe-area-inset-top)) 20px calc(96px + env(safe-area-inset-bottom)); gap: 18px; }
.shell.bare { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg); border-top: 1px solid var(--line);
  padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); display: flex; justify-content: center; z-index: 20; }
.tabbar a { flex: 1 1 0; max-width: 170px; height: 52px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; color: var(--muted); font-size: 12px; }
.tabbar a.on { color: var(--accent); font-weight: 600; }
.tabbar svg, .icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }

.btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 58px; padding: 0 22px;
  border-radius: 29px; border: 0; background: var(--accent); color: var(--on-accent);
  font: 700 17px var(--display); width: 100%; }
.btn.split { justify-content: space-between; }
.btn small { font: 600 14px var(--body); }
.btn.ghost { background: transparent; color: var(--text); border: 1.5px solid var(--line-strong);
  font: 600 15px var(--body); }
.btn.slim { min-height: 44px; width: auto; padding: 0 16px; font: 600 14px var(--body); border-radius: 22px; }
.btn[disabled] { opacity: .45; }
.link { background: none; border: 0; color: var(--accent); min-height: 44px; padding: 0 4px; font-size: 14px; }
.link.danger { color: var(--danger); }
.iconbtn { width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 0 20px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; min-height: 44px; padding: 0 16px; border-radius: 22px; border: 0; background: var(--surface);
  color: var(--soft); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; }
.chip.on { background: var(--text); color: var(--bg); font-weight: 600; }

.card { background: var(--surface); border-radius: 18px; padding: 14px; }
.figure { font: 700 28px var(--display); letter-spacing: -0.5px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* Tiles have the shape of the photos (9:16) and show each picture whole: nothing is cut off. */
.tile { position: relative; border-radius: 16px; overflow: hidden; background: var(--surface); aspect-ratio: 9 / 16;
  border: 0; padding: 0; display: block; width: 100%; text-align: left; color: var(--text); }
.tile img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; font-size: 13px;
  background: linear-gradient(transparent, rgba(14, 14, 16, .85)); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.tile .tag { position: absolute; top: 8px; left: 8px; background: var(--bg); border-radius: 12px; padding: 4px 9px;
  font-size: 12px; }
.tile .words { padding: 12px; font-size: 13px; color: var(--soft); line-height: 1.35; display: -webkit-box;
  -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden; }
.tile.pick.on { outline: 3px solid var(--accent); outline-offset: -3px; }
.tile .check { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 14px;
  background: var(--accent); color: var(--on-accent); font: 700 14px var(--body); display: none;
  align-items: center; justify-content: center; }
.tile.pick.on .check { display: flex; }
.tile.add { border: 1.5px dashed var(--line-strong); background: transparent; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; font-size: 14px; color: var(--text); text-align: center; }
.wide { aspect-ratio: 16 / 9; }
.round { aspect-ratio: 1; border-radius: 50%; }

label.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--muted); }
input[type=text], input[type=password], textarea, select { width: 100%; min-height: 56px; border-radius: 16px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--text); padding: 14px 16px; font-size: 16px; }
textarea { resize: none; line-height: 1.4; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
.switch { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 15px; color: var(--text); }
.switch input { width: 22px; height: 22px; accent-color: var(--accent); }

.bar { display: grid; gap: 4px; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.bar i { height: 6px; border-radius: 3px; background: var(--line-strong); }
.bar i.done { background: var(--accent); }
.bar i.bad { background: var(--danger); }
.thumbs { display: flex; gap: 4px; flex: 0 0 auto; }
.thumbs img, .thumbs span { width: 40px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--line); display: block; }

.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--bg); border-top: 1px solid var(--line);
  padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); }
.dock > div { max-width: 480px; margin: 0 auto; display: flex; gap: 10px; }
.steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.steps i { height: 4px; border-radius: 2px; background: var(--line-strong); }
.steps i.on { background: var(--accent); }
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-end; }
.sheet > div { background: var(--surface); width: 100%; max-width: 520px; margin: 0 auto; border-radius: 24px 24px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px;
  max-height: 88dvh; overflow-y: auto; }
.sheet input[type=text], .sheet textarea, .sheet select { background: var(--bg); }
.notice { background: var(--surface); border-radius: 16px; padding: 14px 16px; font-size: 15px; }
.notice.bad { color: var(--danger); }
.hero { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 14px; }
.hero h1 { font-size: 40px; letter-spacing: -1.2px; line-height: 1.05; }
.mark { width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center; }
.full { width: 100%; border-radius: 20px; display: block; background: var(--surface); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin 1s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
input[type=range] { width: 100%; height: 44px; accent-color: var(--accent); background: transparent; margin: 0; }
section.stack { padding-top: 6px; border-top: 1px solid var(--line); }
.chip.pickable { cursor: pointer; }
.chip.pickable input { position: absolute; opacity: 0; pointer-events: none; }
.chip.pickable:has(input:checked) { background: var(--text); color: var(--bg); font-weight: 600; }
.chip.pickable:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.pickable:has(input:disabled) { opacity: .45; cursor: default; }
.chosen { display: flex; gap: 6px; overflow-x: auto; margin: 0 -20px; padding: 0 20px; scrollbar-width: none; }
.chosen::-webkit-scrollbar { display: none; }
.chosen img, .chosen span { flex: 0 0 auto; width: 48px; height: 60px; border-radius: 10px; object-fit: cover;
  background: var(--surface); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; }
.card.pickrow { border: 0; width: 100%; text-align: left; color: inherit; }
.markpad { display: flex; justify-content: center; }
.markpad > div { position: relative; line-height: 0; }
.markpad img { display: block; max-width: 100%; max-height: 62dvh; border-radius: 16px; background: var(--surface); }
.markpad canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; border-radius: 16px; }
output { color: var(--text); font-variant-numeric: tabular-nums; }
.reel { display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.reel::-webkit-scrollbar { display: none; }
.reel img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: start; }
.dots { position: absolute; left: 0; right: 0; bottom: 34px; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .5); transition: width .2s; }
.dots i.on { width: 16px; background: var(--accent); }
.tile .tag.written { font: 700 13px var(--display); color: var(--accent); padding: 4px 10px; }
.tile.pick { cursor: pointer; }
.reelbox { position: relative; aspect-ratio: 9 / 16; border-radius: 20px; overflow: hidden; background: var(--surface); }
.reelbox .dots { bottom: 12px; }
/* Retouch: one screen, no scrolling. The photo takes whatever height the tools and the request leave. */
.shell.retouch { height: 100dvh; min-height: 0; padding: calc(6px + env(safe-area-inset-top)) 6px 0; gap: 6px; }
.shell.retouch .markpad { flex: 1 1 0; min-height: 0; align-items: center; overflow: hidden; }
.shell.retouch .markpad img { max-width: none; max-height: none; border-radius: 10px; }
.shell.retouch .markpad canvas { border-radius: 10px; }
.toolrow { display: flex; gap: 6px; align-items: center; }
.side { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.side::-webkit-scrollbar { display: none; }
.side .tile { flex: 0 0 44px; width: 44px; height: 44px; aspect-ratio: auto; border-radius: 10px; }
.side .tile img { object-fit: cover; }
.side .tile .check { top: 2px; right: 2px; width: 18px; height: 18px; font-size: 11px; }
.retouchdock { position: static; margin: 0 -6px; padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); }
.retouchdock > div { flex-direction: column; gap: 6px; max-width: 508px; }
.retouchdock textarea { min-height: 0; height: 88px; padding: 10px 12px; border-radius: 14px; font-size: 16px; overflow-y: auto; }
.retouchdock .chip { min-height: 36px; }
.gorow { gap: 8px; align-items: center; }
.btn.go { flex: 1 1 auto; width: auto; min-height: 52px; border-radius: 26px; padding: 0 18px; justify-content: space-between; font: 700 17px var(--display); }
.btn.go small { font: 600 14px var(--body); }
.toolrow .iconbtn { width: 40px; height: 40px; border-radius: 20px; }
.iconbtn.tool.on { background: var(--accent); color: var(--on-accent); }
.shell.retouch .markpad canvas { touch-action: pinch-zoom; }
.seg { display: flex; flex: 0 0 auto; background: var(--surface); border-radius: 18px; padding: 3px; }
.seg button { flex: 1 1 0; min-height: 38px; padding: 0 11px; border: 0; border-radius: 15px; background: transparent; color: var(--muted);
  font: 600 12px var(--body); white-space: nowrap; }
.seg button.on { background: var(--line-strong); color: var(--text); }
.seg button[disabled] { opacity: .4; }
.seg small { font-size: 10px; opacity: .8; }
.btn.go.hard { background: var(--text); color: var(--bg); }
#notes { position: absolute; inset: 0; pointer-events: none; line-height: 1.2; }
.tip { position: absolute; max-width: 48%; padding: 4px 8px; border-radius: 9px; background: rgba(14, 14, 16, .86); color: #fff;
  font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#notes input.tipinput { position: absolute; width: min(78%, 260px); min-height: 0; height: 40px; padding: 0 12px; border-radius: 12px;
  border: 2px solid var(--accent); background: var(--bg); color: var(--text); font-size: 16px; pointer-events: auto; }
.daybars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; align-items: end; }
.daybars > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; min-height: 104px; }
.daybars i { width: 100%; max-width: 28px; border-radius: 6px; background: var(--accent); }
.daybars .muted { font-size: 11px; white-space: nowrap; }
.tileactions { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; }
.tileactions .iconbtn { width: 40px; height: 40px; background: rgba(14, 14, 16, .72); }
/* The boxes stay in view while the page scrolls, all of them at once: a scene can be dropped on any. */
.movebar { position: sticky; top: 0; z-index: 15; background: var(--bg); margin: 0 -20px; padding: 8px 20px 10px; }
.movebar .chips { margin: 0; padding: 0; flex-wrap: wrap; overflow: visible; gap: 6px; }
.movebar .chip { min-height: 36px; padding: 0 12px; font-size: 13px; }
.movebar .chip small { margin-left: 5px; opacity: .7; font-size: 11px; }
.movebar .chip.target { outline: 1.5px dashed var(--accent); outline-offset: -1.5px; color: var(--text); }
.movebar .chip.over { background: var(--accent); color: var(--on-accent); outline: 0; }
[data-scene] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
[data-scene] img { -webkit-user-drag: none; pointer-events: none; }
[data-scene] .check { top: auto; bottom: 8px; right: 8px; }
[data-scene].carried { opacity: .35; }
.tile.ghost { position: fixed; z-index: 60; width: 90px; height: 160px; aspect-ratio: auto; pointer-events: none; box-shadow: 0 12px 32px rgba(0, 0, 0, .6); outline: 2px solid var(--accent); }
body.carrying { overflow: hidden; }
[data-scene] .tag { top: auto; bottom: 36px; }
