:root {
  --bg: #14161a;
  --panel: #1c2027;
  --line: #2c323c;
  --text: #e7eaf0;
  --muted: #8b94a3;
  --accent: #ff3b5c;
  --btn: #262c36;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex: none;
}
.status { border-bottom: none; border-top: 1px solid var(--line); color: var(--muted); }
.spacer { flex: 1; }
.meta { color: var(--muted); }
.center { text-align: center; }
button, select {
  font: inherit; color: var(--text); background: var(--btn);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 10px; cursor: pointer;
}
button:hover { background: #313945; }
button:active { transform: translateY(1px); }
button.primary { background: #2f6df6; border-color: #2f6df6; }
button.primary:hover { background: #4179ff; }
button.toggle.on { background: #2f6df6; border-color: #2f6df6; }
button.wide, .group.fill { width: 100%; }
.group { display: flex; align-items: center; gap: 6px; }
.group.fill button { flex: 1; }
label.group { color: var(--muted); }

main { flex: 1; display: flex; min-height: 0; }
.stage-wrap { flex: 1; position: relative; display: flex; min-width: 0; min-height: 0; }
#stage {
  flex: 1; position: relative; overflow: auto;
  display: flex; align-items: center; justify-content: center;
  /* "safe" keeps the top-left reachable once the image outgrows the stage */
  align-items: safe center; justify-content: safe center;
  background: #0e1013;
}
#frame { position: relative; line-height: 0; }
#shot { display: block; }
#shot.zoomed { image-rendering: pixelated; }
.cross { position: absolute; background: var(--accent); pointer-events: none; display: none; }
#hline { left: 0; right: 0; height: 1px; box-shadow: 0 0 0 1px rgba(255,255,255,.55); }
#vline { top: 0; bottom: 0; width: 1px; box-shadow: 0 0 0 1px rgba(255,255,255,.55); }
#dot {
  position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px;
  border: 2px solid #fff; border-radius: 50%; display: none; pointer-events: none;
  box-shadow: 0 0 0 1px var(--accent), inset 0 0 0 1px var(--accent);
}
#empty { color: var(--muted); padding: 24px; }
#stage.drag { outline: 2px dashed #2f6df6; outline-offset: -8px; }

aside {
  width: 300px; flex: none; padding: 12px; overflow-y: auto;
  background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 10px;
}
#mag {
  width: 100%; max-width: 172px; height: auto; aspect-ratio: 1; align-self: center; background: #000;
  border: 1px solid var(--line); border-radius: 6px; image-rendering: pixelated;
}
.panel { background: #171b21; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.panel.grow { flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 110px; }
.panel-title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.row { display: flex; align-items: baseline; gap: 8px; }
.row > span:first-child { width: 14px; color: var(--muted); }
.row .value { flex: 1; text-align: right; font: 600 24px/1.2 ui-monospace, Menlo, monospace; }
.row .value.small { font-size: 14px; font-weight: 400; color: var(--muted); }
.row.sub { margin-top: 2px; }
.copy { padding: 2px 8px; font-size: 12px; }
hr { border: none; border-top: 1px solid var(--line); margin: 10px 0; }
ol#points {
  flex: 1; overflow-y: auto; margin: 0; padding: 0 0 0 26px;
  font: 12px/1.7 ui-monospace, Menlo, monospace; color: var(--text);
}
ol#points li { cursor: pointer; }
ol#points li:hover { color: #7fb0ff; }
ol#points:empty::after { content: "none yet"; color: var(--muted); font-family: inherit; }
.hint { color: var(--muted); font-size: 11px; line-height: 1.35; margin: 0; }
.flash { animation: flash .5s ease-out; }
@keyframes flash { from { background: #2f6df6; } to { background: var(--btn); } }

/* Nudge pad - fine tuning without a keyboard, e.g. on the phone itself */
#pad {
  position: absolute; right: 14px; bottom: 14px;
  display: grid; gap: 4px;
  grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px);
  background: rgba(20, 22, 26, .82); padding: 6px; border-radius: 10px;
  border: 1px solid var(--line); backdrop-filter: blur(4px);
}
#pad button { padding: 0; font-size: 13px; }
#pad button:nth-child(1) { grid-area: 1 / 2; }
#pad button:nth-child(2) { grid-area: 2 / 1; }
#pad button:nth-child(3) { grid-area: 2 / 2; font-size: 11px; }
#pad button:nth-child(4) { grid-area: 2 / 3; }
#pad button:nth-child(5) { grid-area: 3 / 2; }

/* Narrow screens: stack the panel under the screenshot */
@media (max-width: 760px) {
  .bar { flex-wrap: wrap; }
  #meta { order: 10; width: 100%; }
  main { flex-direction: column; }
  .stage-wrap { flex: 1 1 60%; }
  aside {
    width: 100%; flex: 0 0 auto; max-height: 40vh;
    border-left: none; border-top: 1px solid var(--line);
  }
  aside { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
  #mag { flex: 0 0 108px; max-width: 108px; align-self: flex-start; }
  #hover { display: none; }            /* no hovering on a touch screen */
  .panel { flex: 1 1 170px; }
  .group.fill, #save, .panel.grow { flex: 1 1 100%; }
  .panel.grow { min-height: 84px; }
  .row .value { font-size: 20px; }
  .hint { display: none; }
  #pad {
    right: 10px; bottom: 10px;
    grid-template-columns: repeat(3, 36px); grid-template-rows: repeat(3, 36px);
  }
}
