: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);
  --font: "Figtree", "Segoe UI", sans-serif;
  --radius: 12px;
  color-scheme: light;
  /* z: 1 photo, 2 pins, 20 tooltip */
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
}
button, input { font: inherit; color: inherit; }
h1, 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); }

.top, .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: 6px; width: 14px; height: 14px;
  background: oklch(0.98 0.01 255);
  clip-path: polygon(0 0, 100% 0, 100% 32%, 42% 32%, 42% 100%, 0 100%);
}
.top p { margin: 8px 0 0; max-width: 52ch; color: var(--muted); font-size: 0.98rem; }

.studio {
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 16px;
  display: grid;
  grid-template-columns: 88px minmax(0, 1.35fr) minmax(300px, 0.72fr);
  gap: 14px;
  align-items: start;
}
.reel { display: grid; gap: 8px; }
.thumb {
  padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden;
  cursor: pointer; background: var(--line); aspect-ratio: 4 / 3;
  opacity: 0.48;
  transition: opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transform: scale(1.02);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s ease;
  filter: saturate(0.65);
}
.thumb:hover { opacity: 0.92; }
.thumb:hover img { filter: none; transform: scale(1.08); }
.thumb[aria-current="true"] {
  opacity: 1;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent);
}
.thumb[aria-current="true"] img { filter: none; transform: scale(1); }
.thumb:active { transform: scale(0.98); }
.thumb:focus-visible, .detector:focus-visible, .pin:focus-visible, .tabs button:focus-visible, .feature-list button:focus-visible {
  outline: 3px solid oklch(0.72 0.08 255); outline-offset: 2px;
}

.stage { min-width: 0; }
.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 img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity 0.28s ease;
}
.frame img.is-ready { opacity: 1; }
.caption { margin: 10px 2px 0; color: var(--muted); font-size: 0.9rem; }
.pin {
  position: absolute; z-index: 2;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid oklch(0.99 0.002 255);
  background: var(--accent);
  box-shadow: 0 1px 4px oklch(0.2 0.02 255 / 0.35);
  padding: 0; cursor: pointer;
}
.pin .tag {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  background: oklch(0.2 0.03 255 / 0.88); color: oklch(0.98 0.01 255);
  font-size: 0.72rem; font-weight: 650; white-space: nowrap;
  padding: 3px 7px; border-radius: 8px; pointer-events: none;
  opacity: 1;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), background 0.18s ease, box-shadow 0.18s ease;
}
.pin.flip .tag { left: auto; right: 16px; }
.pins:hover .pin { opacity: 0.42; }
.pins:hover .pin:hover,
.pins:hover .pin:focus-visible,
.pins.is-focus .pin.is-on,
.pins.is-focus .pin.is-hot,
.pin:focus-visible { opacity: 1; z-index: 4; }
.pin:hover .tag,
.pin:focus-visible .tag,
.pin.is-on .tag,
.pin.is-hot .tag {
  transform: translateY(-50%) scale(1.08);
  background: oklch(0.14 0.03 255);
  box-shadow: 0 8px 18px oklch(0.18 0.02 255 / 0.32);
}
.pin.is-on, .pin.is-hot { background: oklch(0.72 0.12 85); transform: translate(-50%, -50%) scale(1.25); }
.pins.is-focus .pin { opacity: 0.55; }
.pins.is-focus .pin.is-on,
.pins.is-focus .pin.is-hot { opacity: 1; }
.pin:active { transform: translate(-50%, -50%) scale(0.96); }
@media (prefers-reduced-motion: no-preference) {
  .pin { animation: pin-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) backwards; animation-delay: calc(var(--i) * 35ms); }
}
@keyframes pin-in { from { opacity: 0; } }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}
.detectors {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.detector {
  border: 0; border-right: 1px solid var(--line);
  background: transparent; padding: 10px 8px; cursor: pointer;
  text-align: left; display: grid; gap: 2px;
  transition: background 0.2s ease;
}
.detector:last-child { border-right: 0; }
.detector:active { transform: scale(0.98); }
.detector b { font-size: 0.84rem; }
.detector span { color: var(--muted); font-size: 0.72rem; }
.detector[aria-pressed="true"] { background: var(--accent-soft); }
.detector[aria-pressed="true"] b { color: var(--accent-deep); }
.tabs { display: flex; gap: 4px; margin: 12px 0 10px; }
.tabs button {
  border: 0; background: transparent; padding: 6px 10px; border-radius: 8px;
  cursor: pointer; font-weight: 650; color: var(--muted);
}
.tabs button:active { transform: scale(0.98); }
.tabs button[aria-selected="true"] { background: var(--ink); color: oklch(0.98 0.01 255); }
.results { display: grid; gap: 16px; min-height: 180px; }
.block h3 { margin: 0; font-size: 0.92rem; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
.walk {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 8px; padding: 4px 10px; font-size: 0.78rem; font-weight: 650; cursor: pointer;
}
.walk:hover { border-color: var(--accent); color: var(--accent-deep); }
.walk:active { transform: scale(0.98); }
.row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: baseline; font-size: 0.9rem; margin: 0 0 8px; }
.bar { height: 4px; border-radius: 99px; background: var(--line); grid-column: 1 / -1; overflow: hidden; }
.bar i {
  display: block; height: 100%; width: 100%; background: var(--accent);
  border-radius: inherit; transform: scaleX(0); transform-origin: left center;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.feature-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 260px; overflow: auto; }
.feature-list button {
  width: 100%; text-align: left; border: 0; background: transparent;
  border-radius: 8px; padding: 6px 8px; cursor: pointer;
  transition: background 0.18s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease;
}
.feature-list button:hover, .feature-list button.is-on, .feature-list button.is-hot {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.feature-list button.is-hot { transform: translateX(4px); }
.feature-list button:active { transform: scale(0.99); }
.note { margin: 0; color: var(--muted); font-size: 0.9rem; }
.score { display: flex; align-items: baseline; gap: 8px; margin: 0 0 6px; }
.score strong { font-size: 1.7rem; letter-spacing: -0.04em; }
.json {
  margin: 0; max-height: 420px; overflow: auto;
  background: oklch(0.2 0.02 255); color: oklch(0.93 0.01 255);
  border-radius: 8px; padding: 12px; font-size: 0.78rem; line-height: 1.45;
}
.listing-use { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.listing-use h2 { margin: 0 0 6px; font-size: 0.92rem; }
.listing-use p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.foot {
  padding: 4px 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; }

.tip {
  position: fixed; z-index: 20; width: min(260px, calc(100vw - 16px));
  background: var(--ink); color: oklch(0.98 0.01 255);
  border-radius: 8px; padding: 10px 12px; pointer-events: none;
}
.tip strong { display: block; margin-bottom: 4px; }
.tip span { color: oklch(0.88 0.02 255); font-size: 0.88rem; }
.tip[hidden] { display: none; }

@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; }
  .reel { grid-auto-flow: column; grid-auto-columns: 84px; overflow-x: auto; padding-bottom: 4px; }
  .foot { display: grid; }
}
@media (max-width: 640px) {
  .detectors { grid-template-columns: 1fr; }
  .detector { border-right: 0; border-bottom: 1px solid var(--line); }
  .detector:last-child { border-bottom: 0; }
}

@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);
    color-scheme: dark;
  }
  .mark::before { background: oklch(0.16 0.02 255); }
  .tabs button[aria-selected="true"] { background: oklch(0.94 0.01 255); color: oklch(0.18 0.02 255); }
  .json { background: oklch(0.14 0.015 255); }
  .pin { border-color: oklch(0.96 0.01 255); }
  .pin .tag { background: oklch(0.12 0.02 255 / 0.92); }
}

@media (prefers-reduced-motion: reduce) {
  .frame img, .bar i, .thumb, .thumb img, .pin .tag, .feature-list button { transition: none; }
  .feature-list button.is-hot { transform: none; }
}
