:root {
  color-scheme: dark;
  font: 15px/1.4 system-ui, sans-serif;
  color: #f5f2e9;
  background: #202728;
}
* { box-sizing: border-box; }
body, figure, p { margin: 0; }
main { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
#stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: #687071;
}
figure { position: relative; min-height: 0; overflow: hidden; background: #343d40; }
figure img { width: 100%; height: 100%; display: block; object-fit: contain; }
figcaption {
  position: absolute;
  z-index: 2;
  left: .75rem;
  top: .75rem;
  padding: .26rem .65rem;
  background: #1c2225ec;
  border-left: 3px solid #eab16c;
  border-radius: 2px;
  font-weight: 600;
  letter-spacing: .015em;
  pointer-events: none;
}
canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
canvas:active { cursor: grabbing; }
canvas:focus-visible { outline: 2px solid #ffd69f; outline-offset: -3px; }
footer { padding: .7rem 1rem .8rem; border-top: 1px solid #566264; }
#controls, #actions { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
#actions:empty { display: none; }
button, select {
  padding: .36rem .7rem;
  min-height: 2.3rem;
  font: inherit;
  color: inherit;
  background: #303a3c;
  border: 1px solid #788384;
  border-radius: .3rem;
}
button { cursor: pointer; }
button:hover, select:hover { background: #414e50; }
button:focus-visible, select:focus-visible { outline: 2px solid #ffd69f; outline-offset: 2px; }
#retry { background: #f0c18a; color: #24201e; border-color: transparent; font-weight: 600; }
#in, #out { width: 2.4rem; font-size: 1.2rem; line-height: 1; }
#status { color: #d4d9d6; font-size: .88rem; margin-top: .45rem; }
[hidden] { display: none !important; }
@media (max-width: 540px) and (orientation: portrait) {
  #stage { grid-template-columns: 1fr; grid-template-rows: repeat(2, minmax(0, 1fr)); }
  footer { padding: .6rem .7rem; }
}
