* { box-sizing: border-box; }
body { max-width: 68rem; margin: 0 auto; padding: 1rem; font: 1rem/1.45 system-ui, sans-serif; color: #171717; background: #fff; }
nav, footer { padding: .5rem 0; border-bottom: 1px solid #bbb; }
footer { margin-top: 3rem; border-top: 1px solid #bbb; border-bottom: 0; }
main { margin-top: 1.25rem; }
h1, h2 { line-height: 1.15; margin-bottom: .5rem; }
form { display: flex; flex-wrap: wrap; align-items: end; gap: .6rem; margin: 1rem 0 .35rem; }
form label { flex-basis: 100%; font-weight: 600; }
input, button, textarea { font: inherit; }
input[type="file"] { min-width: 0; max-width: 100%; }
button { padding: .45rem .75rem; cursor: pointer; }
button:disabled { cursor: wait; }
textarea { display: block; width: 100%; min-height: 4.5rem; margin-bottom: .4rem; padding: .45rem; resize: vertical; }
#status { min-height: 1.5rem; }
#box-warning, #content-warning { padding: .55rem; border: 1px solid #8a5900; }
#source-stage { position: relative; display: inline-block; max-width: 100%; border: 1px solid #aaa; }
#source-image { display: block; max-width: 100%; height: auto; }
#source-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.box { cursor: pointer; }
.box rect { fill: #00800018; stroke: #087b08; stroke-width: 3; vector-effect: non-scaling-stroke; }
.box.unknown rect { fill: #9a670018; stroke: #8a5900; }
.box.selected rect { stroke: #000; stroke-width: 5; }
.box text { fill: #fff; stroke: #000; stroke-width: 3px; paint-order: stroke; font-weight: 700; pointer-events: none; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(9rem, 100%), 1fr)); gap: .65rem; }
.crop-button { width: 100%; padding: .35rem; border: 1px solid #999; background: #fff; text-align: left; }
.crop-button.selected { border: 3px solid #222; }
.crop-button canvas, #selected-crop { display: block; width: 100%; height: auto; margin-bottom: .4rem; background: #eee; }
.crop-button small { display: block; overflow-wrap: anywhere; }
#selected { max-width: 30rem; }
figure { margin: 0; }
figcaption { margin-top: .5rem; }
details { margin-top: 1.25rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 38rem) {
  body { padding: .75rem; }
  main { margin-top: 1.25rem; }
  form { align-items: stretch; }
  form input, form button { width: 100%; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
}
