:root {
  --bg: #f6f6f4;
  --panel: #ffffff;
  --ink: #1d1d22;
  --muted: #6b6b73;
  --line: #e4e3df;
  --accent: #8c7f4e;
  --accent-soft: #f1eedf;
  --bezel: #16161a;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
.muted { color: var(--muted); }
button { font: inherit; }

.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 10px; align-items: baseline; }
.controls { margin-left: auto; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; cursor: pointer; color: var(--muted);
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-selected="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.toggle { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; user-select: none; }
.jump { display: none; }

.layout { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 53px); }
.nav {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 8px 40px;
  overflow-y: auto;
  position: sticky; top: 53px; height: calc(100vh - 53px);
}
.nav h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 16px 8px 6px;
}
.nav h2:first-child { margin-top: 4px; }
.nav a {
  display: block; padding: 5px 8px; border-radius: 6px;
  color: var(--ink); text-decoration: none;
}
.nav a.state { padding-left: 22px; color: var(--muted); font-size: 13px; }
.nav a:hover { background: var(--bg); }
.nav a[aria-current="true"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }

.stage { padding: 20px 24px 40px; min-width: 0; }
.heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.heading h1 { font-size: 20px; margin: 0 0 2px; }
.heading p { margin: 0; }
.pager { display: flex; gap: 8px; align-items: center; }
.pager button {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer;
}

.pair { display: flex; gap: 32px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.frame-wrap { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
figcaption { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.frame {
  --w: 300px;
  width: var(--w);
  padding: 10px;
  border-radius: 44px;
  background: var(--bezel);
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
  position: relative;
}
.frame.tablet { --w: 420px; border-radius: 30px; padding: 14px; }
.frame img {
  display: block; width: 100%; height: auto;
  border-radius: 34px; background: #222;
}
.frame.tablet img { border-radius: 18px; }
.frame .missing {
  aspect-ratio: 390 / 844; border-radius: 34px; background: #2a2a30; color: #bbb;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px;
}

.overlay-view { margin-top: 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.overlay-frame { overflow: hidden; }
.overlay-frame .ov-new { position: absolute; top: 10px; left: 10px; width: calc(100% - 20px); }
.overlay-frame.tablet .ov-new { top: 14px; left: 14px; width: calc(100% - 28px); }
.ov-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); pointer-events: none; }
.slider-row { display: flex; gap: 10px; align-items: center; width: min(420px, 100%); }
.slider-row input { flex: 1; accent-color: var(--accent); }

.notes { margin: 18px auto 0; max-width: 720px; font-size: 12px; color: var(--muted); text-align: center; }
.hint { text-align: center; font-size: 12px; margin-top: 10px; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .nav { display: none; }
  .jump { display: block; flex: 1 1 100%; padding: 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
  .controls { margin-left: 0; }
  .stage { padding: 16px; }
  .pair { gap: 16px; }
  .frame { --w: min(300px, calc(50vw - 24px)); padding: 6px; border-radius: 26px; }
  .frame img { border-radius: 20px; }
  .frame.tablet { --w: min(420px, calc(50vw - 24px)); }
}
