:root { color-scheme: light dark; font: 16px/1.5 system-ui,sans-serif; --page: #f2f3f7; --panel: #fff; --ink: #252b3c; --quiet: #525a72; --edge: #d0d6e3; --action: #514d91; }
@media(prefers-color-scheme:dark) { :root { --page: #1d2332; --panel: #2a3041; --ink: #f2f3fa; --quiet: #c8cfe1; --edge: #505970; --action: #5f59a3; } }
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--page); }
main { max-width: 860px; margin: auto; padding: clamp(16px, 4vw, 36px); }
h1,h2,p { margin: 0; }
h1 { font-size: clamp(1.75rem, 4.8vw, 2.4rem); line-height: 1.13; letter-spacing: -.03em; }
h2 { font-size: 1.25rem; }
p,footer { margin-top: 8px; color: var(--quiet); }
section { margin-top: 15px; padding: clamp(12px, 3vw, 20px); background: var(--panel); border: 1px solid var(--edge); border-radius: 10px; }
label,summary,button { font-weight: 650; }
input,button { font: inherit; color: var(--ink); }
input:not([type=range]),button { padding: 7px 10px; border: 1px solid var(--edge); border-radius: 6px; background: var(--page); }
input:not([type=range]) { display: block; margin-top: 5px; max-width: 100%; }
button { cursor: pointer; margin-top: 8px; }
#run,#download { background: var(--action); color: white; border-color: transparent; }
button:disabled { opacity: .7; cursor: wait; }
.toolbar { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.toolbar button { margin: 0; }
.image-area { position: relative; margin: 10px 0; }
canvas { display: block; width: 100%; height: auto; border-radius: 6px; }
#selection { position: absolute; inset: 0; touch-action: none; cursor: crosshair; }
#selection.selection-hidden { opacity: 0; }
.rectangle { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 8px; }
.rectangle input { width: 100%; }
#limits,footer { font-size: .9rem; }
a { color: var(--quiet); }
:focus-visible { outline: 2px solid #7362aa; outline-offset: 2px; }
