:root {
  --ink: oklch(0.22 0.02 255);
  --muted: oklch(0.42 0.02 255);
  --paper: oklch(0.965 0.006 255);
  --card: oklch(0.995 0.002 255);
  --line: oklch(0.88 0.01 255);
  --accent: oklch(0.48 0.11 255);
  --accent-deep: oklch(0.38 0.1 255);
  --accent-soft: oklch(0.94 0.03 255);
  --clear: oklch(0.48 0.1 155);
  --review: oklch(0.58 0.11 70);
  --hold: oklch(0.52 0.14 28);
  --font: "Figtree", "Segoe UI", sans-serif;
  --radius: 12px;
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
}
button { font: inherit; color: inherit; }
h2 { font-weight: 650; letter-spacing: -0.03em; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: var(--accent-deep); }
a:hover { color: var(--accent); }
pre { font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace; }

.top, .why, .foot {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}
.top { padding: 20px 0 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; letter-spacing: -0.03em; }
.mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--accent); position: relative; flex: none;
}
.mark::before {
  content: "";
  position: absolute; left: 6px; top: 7px; width: 14px; height: 11px;
  border: 2px solid oklch(0.98 0.01 255);
  border-radius: 2px;
}
.mark::after {
  content: "";
  position: absolute; right: 4px; top: 4px; width: 7px; height: 2px;
  background: var(--hold);
  transform: rotate(40deg);
}
.top p { margin: 8px 0 0; max-width: 62ch; color: var(--muted); }

.lamp {
  width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--line);
}
.verdict.hold .lamp { background: var(--hold); }
.verdict.review .lamp { background: var(--review); }
.verdict.clear .lamp { background: var(--clear); }

.studio {
  width: min(1180px, calc(100% - 32px));
  margin: 16px auto;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.78fr);
  gap: 16px;
  align-items: start;
}
.frame {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: oklch(0.9 0.01 255);
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
}
.frame.is-frame-flag { box-shadow: inset 0 0 0 3px var(--hold); }
.frame.is-frame-review { box-shadow: inset 0 0 0 3px var(--review); }
.frame > img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity 0.28s ease;
}
.frame > img[hidden] { display: none; }
.frame > img.is-ready { opacity: 1; }
.frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, oklch(0.98 0.01 255 / 0.45) 50%, transparent 70%);
  transform: translateX(-120%);
  opacity: 0;
}
.frame.is-scan::after { animation: scan 0.7s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes scan {
  0% { opacity: 1; transform: translateX(-120%); }
  100% { opacity: 0; transform: translateX(120%); }
}
.pending {
  margin: 0; position: absolute; top: 14px; left: 16px; right: 16px;
  text-align: center; color: var(--muted); z-index: 1;
}
/* Layers: photo, then flag boxes. */
.boxes { position: absolute; inset: 0; z-index: 2; }
.box {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 2px solid var(--hold);
  border-radius: 8px;
  background: oklch(0.52 0.14 28 / 0.12);
  cursor: pointer;
  transition: opacity 0.18s ease, background 0.18s ease;
}
.box.review { border-color: var(--review); background: oklch(0.58 0.11 70 / 0.14); }
.box b {
  position: absolute;
  left: 0;
  bottom: calc(100% + 4px);
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--hold);
  color: oklch(0.98 0.01 255);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.box.review b { background: var(--review); color: oklch(0.2 0.03 70); }
.box.inside b { bottom: auto; top: 4px; }
.boxes.is-hot .box { opacity: 0.35; }
.boxes.is-hot .box.is-on { opacity: 1; background: oklch(0.52 0.14 28 / 0.22); }
.boxes.is-hot .box.review.is-on { background: oklch(0.58 0.11 70 / 0.24); }
.caption { margin: 10px 2px 0; color: var(--muted); font-size: 0.92rem; max-width: 65ch; }
.caption b { font-weight: 700; }
.caption b.hold { color: var(--hold); }
.caption b.review { color: var(--review); }
.caption b.clear { color: var(--clear); }

.mix { display: flex; gap: 6px; margin-top: 10px; }
.seg {
  flex-basis: 0;
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
}
.seg b { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.03em; }
.seg span { font-size: 0.75rem; font-weight: 650; }
.seg.hold { background: oklch(0.96 0.02 28); color: var(--hold); }
.seg.review { background: oklch(0.96 0.02 80); color: var(--review); }
.seg.clear { background: oklch(0.96 0.02 155); color: var(--clear); }
.seg[aria-selected="true"] { box-shadow: inset 0 0 0 2px currentColor; }
.seg:active { transform: scale(0.98); }
.gallery-label { margin: 14px 2px 0; color: var(--muted); font-size: 0.88rem; }
.film {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.thumb {
  padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden;
  background: var(--card); cursor: pointer; opacity: 0.55;
  display: grid; text-align: left;
  transition: opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.thumb .shot { position: relative; display: block; overflow: hidden; }
.thumb img, .thumb .slot { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.thumb img { transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1); }
.thumb:hover img { transform: scale(1.06); }
.pip {
  position: absolute; left: 6px; top: 6px; width: 8px; height: 8px; border-radius: 50%;
  box-shadow: 0 0 0 2px oklch(0.99 0.005 255 / 0.9);
}
.thumb.hold .pip { background: var(--hold); }
.thumb.review .pip { background: var(--review); }
.thumb.clear .pip { background: var(--clear); }
.thumb .slot {
  display: grid; place-items: center; background: var(--line); color: var(--muted);
  font-size: 0.72rem; padding: 6px; text-align: center;
}
.thumb span.name { padding: 4px 6px 6px; font-size: 0.75rem; font-weight: 650; }
.thumb:hover { opacity: 0.9; }
.thumb.is-on { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.thumb.hold.is-on { border-color: var(--hold); box-shadow: 0 0 0 2px var(--hold); }
.thumb.review.is-on { border-color: var(--review); box-shadow: 0 0 0 2px var(--review); }
.thumb.clear.is-on { border-color: var(--clear); box-shadow: 0 0 0 2px var(--clear); }
.thumb:active { transform: scale(0.98); }
.thumb:focus-visible, .modes button:focus-visible, .flag:focus-visible, .box:focus-visible, .seg:focus-visible, .kind:focus-visible, .shot:focus-visible {
  outline: 3px solid oklch(0.72 0.08 255); outline-offset: 2px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.verdict {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 10px; padding: 8px 10px; border-radius: 8px;
  background: oklch(0.97 0.004 255); font-size: 0.9rem;
}
.verdict b { font-weight: 700; }
.verdict span { color: var(--muted); }
.verdict.hold { background: oklch(0.96 0.02 28); }
.verdict.review { background: oklch(0.96 0.02 80); }
.verdict.clear { background: oklch(0.96 0.02 155); }
.modes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.modes button {
  border: 0; border-right: 1px solid var(--line);
  background: transparent; padding: 10px 8px; cursor: pointer; font-weight: 650;
}
.modes button:last-child { border-right: 0; }
.modes button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-deep); }
.modes button:active { transform: scale(0.98); }
.pane { margin-top: 12px; display: grid; gap: 8px; }
.pane p { margin: 0; font-size: 0.92rem; }
.pane .quiet { color: var(--muted); }
.crops { display: flex; flex-wrap: wrap; gap: 8px; }
.shot {
  width: 112px;
  display: grid;
  gap: 4px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.shot b { font-size: 0.75rem; font-weight: 700; }
.shot.hold b { color: var(--hold); }
.shot.review b { color: var(--review); }
.shot.is-on { border-color: var(--accent); }
.crop {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  background: var(--line);
}
.crop img { position: absolute; max-width: none; }
.flag {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: oklch(0.97 0.004 255);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), background 0.18s ease;
}
.flag:hover { transform: translateX(4px); }
.flag-copy { display: grid; gap: 2px; }
.flag strong { font-size: 0.95rem; }
.flag-copy span { color: var(--muted); font-size: 0.82rem; }
.flag.hold { background: oklch(0.97 0.015 28); }
.flag.hold strong { color: var(--hold); }
.flag.review strong { color: var(--review); }
.flag.is-on { box-shadow: inset 3px 0 0 var(--accent); }
.empty {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: oklch(0.96 0.02 155);
  color: var(--ink);
}
.json-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.json-bar p { margin: 0; color: var(--muted); font-size: 0.82rem; }
.copy {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--accent-deep);
  color: oklch(0.98 0.01 255);
  font-weight: 700;
  cursor: pointer;
}
.copy:active { transform: scale(0.98); }
pre.json, .note {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: oklch(0.96 0.01 255);
  font-size: 0.82rem;
  line-height: 1.45;
  overflow: auto;
  max-height: 360px;
  white-space: pre-wrap;
}
.note { font-size: 0.95rem; }

.why { padding: 8px 0 12px; }
.why h2 { margin: 0 0 10px; font-size: 1.25rem; }
.why .quiet { margin: 0 0 12px; color: var(--muted); max-width: 65ch; }
.kinds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.kind {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  text-align: left;
}
.kind span { display: grid; }
.kind b { font-size: 0.92rem; }
.kind span span { color: var(--muted); font-size: 0.82rem; }
.kind:hover { border-color: var(--accent); }
.kind:active { transform: scale(0.98); }
.foot {
  padding: 8px 0 28px;
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  color: var(--muted); font-size: 0.88rem;
}
.foot p { margin: 0; max-width: 62ch; }

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; }
  .film, .kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot { display: grid; }
}
@media (max-width: 640px) {
  .modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modes button { border-bottom: 1px solid var(--line); }
  .box b { font-size: 0.68rem; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: oklch(0.94 0.01 255);
    --muted: oklch(0.74 0.02 255);
    --paper: oklch(0.18 0.015 255);
    --card: oklch(0.22 0.015 255);
    --line: oklch(0.32 0.02 255);
    --accent: oklch(0.72 0.1 255);
    --accent-deep: oklch(0.82 0.08 255);
    --accent-soft: oklch(0.3 0.04 255);
    --clear: oklch(0.74 0.1 155);
    --review: oklch(0.78 0.1 75);
    --hold: oklch(0.72 0.12 28);
    color-scheme: dark;
  }
  .mark::before { border-color: oklch(0.16 0.02 255); }
  .thumb, .verdict, .flag, .empty, pre.json, .note, .kind { background: oklch(0.26 0.015 255); }
  .seg.hold { background: oklch(0.3 0.04 28); }
  .seg.review { background: oklch(0.3 0.04 80); }
  .seg.clear { background: oklch(0.28 0.03 155); }
  .verdict.hold, .flag.hold { background: oklch(0.3 0.04 28); }
  .verdict.review { background: oklch(0.3 0.04 80); }
  .verdict.clear, .empty { background: oklch(0.28 0.03 155); }
  .copy { background: var(--accent); color: oklch(0.16 0.02 255); }
}

@media (prefers-reduced-motion: reduce) {
  .frame > img, .thumb, .thumb img, .flag, .box, .frame.is-scan::after { transition: none; animation: none; }
}
