:root {
  --bg: #141315;
  --panel: #1d1c1f;
  --line: #2c2b2f;
  --text: #e8e6e3;
  --dim: #9a968f;
  --accent: #c9a876;
  --accent-2: #8f7a56;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 70% -10%, #211f23 0%, var(--bg) 60%);
  color: var(--text);
  font: 13px/1.45 "Avenir Next", "Segoe UI", system-ui, sans-serif;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  overflow: hidden;
}

/* ---------- top bar ---------- */
.bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: blur(8px);
  z-index: 5;
}
@media (max-width: 1100px) {
  .brand .dim { display: none; }
  .badge { display: none; }
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e6cfa4, var(--accent));
  box-shadow: 0 0 10px #c9a87666;
}
.brand h1 {
  font-size: 13px; font-weight: 600; letter-spacing: .08em;
  margin: 0; white-space: nowrap;
}
.brand .dim { color: var(--dim); font-weight: 400; margin-left: 6px; }

.modes {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  margin-inline: auto;
}
.modes button {
  appearance: none; border: 0; background: transparent; color: var(--dim);
  font: inherit; padding: 6px 14px; cursor: pointer; letter-spacing: .03em;
  transition: background .15s, color .15s;
}
.modes button + button { border-left: 1px solid var(--line); }
.modes button:hover { color: var(--text); }
.modes button.on { background: #2e2b26; color: var(--accent); }

.tools { display: flex; align-items: center; gap: 10px; }
.ctl { display: flex; align-items: center; gap: 7px; color: var(--dim); }
.ctl input[type="range"] { width: 90px; accent-color: var(--accent); }
.ghost {
  appearance: none; border: 1px solid var(--line); background: transparent;
  color: var(--dim); font: inherit; padding: 5px 12px; border-radius: 8px;
  cursor: pointer; transition: color .15s, border-color .15s;
}
.ghost:hover { color: var(--text); border-color: #3d3c41; }
.ghost.on { color: var(--accent); border-color: var(--accent-2); }
.badge {
  font-size: 11px; color: var(--dim); border: 1px solid var(--line);
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}

/* ---------- stage ---------- */
.stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 18px;
}
.frame {
  position: relative;
  box-shadow: 0 18px 60px #000a, 0 2px 10px #0008;
  border-radius: 3px;
  overflow: hidden;
  line-height: 0;
  background: #0c0c0d;
}
.frame img, .frame canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  user-select: none;
}
.frame canvas { touch-action: none; }
.frame.split img { clip-path: none; }

.divider {
  position: absolute; top: 0; bottom: 0; width: 0;
  cursor: ew-resize; z-index: 4;
}
.divider span {
  position: absolute; top: 0; bottom: 0; left: -1px; width: 2px;
  background: #f5f2ec;
  box-shadow: 0 0 0 .5px #0006, 0 0 14px #0009;
}
.divider::after {
  content: "⟷";
  position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%);
  width: 30px; height: 30px; border-radius: 50%;
  background: #f5f2ec; color: #221f1c;
  display: grid; place-items: center;
  font-size: 13px; line-height: 1;
  box-shadow: 0 3px 12px #000a;
}
.tag {
  position: absolute; top: 12px; z-index: 3;
  font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: #f2efeacc; background: #141313b8; padding: 4px 10px; border-radius: 6px;
  backdrop-filter: blur(4px);
  border: 1px solid #ffffff14;
}
.tagL { left: 10px; }
.tagR { right: 10px; }

.hint {
  text-align: center;
  color: #6d6a64;
  font-size: 11px;
  letter-spacing: .06em;
  padding: 8px 0 10px;
}

/* side-by-side mode */
.stage.side { grid-template-columns: 1fr 1fr; gap: 14px; place-items: center; }
.stage.side .frame { position: relative; width: min(100%, calc((100vh - 140px) * 1.0016)); }
.stage.side .frame + .frame { grid-column: 2; }
.stage.side .frame::before { content: ""; display: block; padding-top: 99.84%; }
.stage.side .frame .tag { display: block; }

/* shot/canonical mode: exact 1258x1256, no chrome */
body.shot { display: block; overflow: hidden; background: #000; }
body.shot .bar, body.shot .hint { display: none; }
body.shot .stage { padding: 0; display: block; overflow: hidden; }
body.shot .frame {
  width: 1258px; height: 1256px; margin: 0; border-radius: 0; box-shadow: none;
}
