:root {
  color-scheme: dark;
  font: 16px/1.5 "Segoe UI", system-ui, sans-serif;
  color: #f5f6fa;
  background: #111318;
  --surface: #1a1d24;
  --line: #323640;
  --muted: #acb2c0;
  --accent: #c5f67a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { width: min(1360px, 100% - 64px); margin: auto; padding-bottom: 36px; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; font-size: 1.2rem; font-weight: 750; }
.mark { width: 12px; height: 12px; display: inline-block; margin: 0 12px 12px 0; background: var(--accent); box-shadow: 12px 0 #7ca745, 0 12px #7ca745, 12px 12px var(--accent); }
.intro { margin: 37px 0 27px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.25rem, 5.5vw, 4.4rem); line-height: 1.05; letter-spacing: -.06em; }
h1 span { color: var(--accent); }
.intro p { margin-top: 12px; color: var(--muted); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 320px); gap: 16px; align-items: start; }
.preview, .controls { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
h2 { font-size: 1rem; }
.panel-heading span, footer p { color: var(--muted); font-size: .875rem; }
.stage { min-height: 400px; padding: 22px; display: grid; place-items: center; background: #15171d; }
.stage.dragging { background: #252f1f; }
.empty { border: 1px dashed #4a505b; border-radius: 12px; width: 100%; padding: 44px 16px; text-align: center; }
.empty p { color: var(--muted); margin: 4px 0 18px; }
.image-icon { font-size: 2rem; color: var(--accent); }
.photo { position: relative; max-width: 100%; }
canvas { display: block; max-width: 100%; max-height: 68vh; width: auto; height: auto; object-fit: contain; }
#overlays { position: absolute; inset: 0; pointer-events: none; }
.face-box { position: absolute; pointer-events: auto; border: 2px solid white; background: transparent; color: white; padding: 0; border-radius: 3px; box-shadow: 0 0 0 1px #15171d; }
.face-box span { position: absolute; top: 0; left: 0; padding: 0 5px; color: #111318; background: white; font-size: .75rem; font-weight: 800; }
.face-box[aria-pressed="true"] { border-color: var(--accent); }
.face-box[aria-pressed="true"] span { background: var(--accent); }
.photo.adding, .photo.adding .face-box { cursor: crosshair; }
.photo.adding .face-box { pointer-events: none; }
.control-body, footer { padding: 16px 18px; }
#status { color: var(--muted); font-size: .925rem; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 13px 0 0; }
button, .button { font: inherit; cursor: pointer; }
.button, .actions button, .remove { display: inline-block; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: inherit; font-weight: 650; }
.actions button, .remove { font-size: .875rem; padding: 5px 8px; }
.primary, .actions button[aria-pressed="true"] { color: #18220f; background: var(--accent); border-color: var(--accent); }
button:disabled { cursor: default; opacity: .45; }
button:not(:disabled):hover, .button:hover { filter: brightness(1.15); }
:focus-visible, .top:has(input:focus-visible) .secondary { outline: 2px solid var(--accent); outline-offset: 3px; }
footer { border-top: 1px solid var(--line); text-align: center; }
footer .button { width: 100%; }
footer p { margin-top: 8px; }
.download-warning { margin: 10px 0 12px; color: #f5d49c; text-align: left; }
.face-row { margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.face-title, .size-title { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.face-title label { display: flex; gap: 6px; align-items: center; font-weight: 650; }
.size-title { margin-top: 6px; color: var(--muted); font-size: .875rem; }
input[type="range"] { width: 100%; margin: 3px 0 0; }
input { accent-color: var(--accent); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 760px) {
  main { width: calc(100% - 28px); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .stage { min-height: 260px; padding: 10px; }
  .intro { margin: 26px 0 20px; }
}
