:root {
 font-family: system-ui, Arial, sans-serif;
 color-scheme: light;
 color: #17251d;
 background: #f0fff5;
 line-height: 1.35;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main { max-width: 1100px; margin: auto; padding: 24px; }
header { position: relative; margin-bottom: 24px; }
.home { position: absolute; top: 4px; right: 6px; display: block; line-height: 0; }
.home img { object-fit: contain; }
a { color: #285d3d; }
a:hover { color: #a32121; }
h1 { margin: 0 0 12px; padding: 8px 60px; min-height: 58px; text-align: center; border-top: 2px solid #17251d; border-bottom: 2px solid #17251d; background: antiquewhite; font-size: clamp(1.35rem, 4vw, 2rem); }
header p { margin: 0; }
.intro { display: flex; align-items: center; gap: 18px; }
.tool-image { flex: 0 0 auto; width: 132px; height: auto; border-radius: .45rem; }
.intro p + p { margin-top: .5rem; color: #52645a; }
.controls { clear: both; display: flex; flex-wrap: wrap; align-items: end; gap: 18px; padding: 20px; margin-bottom: 20px; border: 1px solid #9ab7a5; border-radius: .45rem; background: #fff; }
label { display: flex; flex-direction: column; gap: 6px; font-size: .95rem; font-weight: 600; max-width: 100%; }
input, select, button { font: inherit; font-size: 1rem; }
input[type=number], select { padding: .55rem .6rem; border: 1px solid #8ca397; border-radius: .3rem; color: #17251d; background: #fff; max-width: 100%; }
input[type=number] { width: 95px; }
input[type=file] { max-width: 100%; font-weight: normal; }
.numeric-field { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.stepper { display: flex; align-items: stretch; gap: 4px; }
.stepper button { width: 44px; min-height: 44px; padding: 0; flex: 0 0 44px; font-size: 1.4rem; touch-action: manipulation; }
.stepper input { width: 80px; min-width: 0; text-align: center; appearance: textfield; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.colour-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.colour-field legend { padding: 0; margin-bottom: 6px; font-size: .95rem; font-weight: 600; }
.colour-field .current-colour { display: block; width: 44px; height: 44px; padding: 0; background: #333333; border: 1px solid #8ca397; touch-action: manipulation; }
.palette { display: grid; grid-template-columns: repeat(4, 44px); gap: 6px; margin-top: 10px; }
.palette button { position: relative; width: 44px; height: 44px; padding: 0; border: 1px solid #8ca397; touch-action: manipulation; }
.palette button[aria-pressed=true] { outline: 2px solid #17251d; outline-offset: 1px; }
.palette button[aria-pressed=true]::after { content: '✓'; font-size: 1.6rem; font-weight: bold; }
button { padding: .6rem .9rem; border: 1px solid #28653f; border-radius: .3rem; background: #357e50; color: #fff; cursor: pointer; }
button:hover { filter: brightness(.94); }
button:disabled { opacity: .5; cursor: default; }
.alignment { border: 0; padding: 0; margin: 0; }
.alignment legend { padding: 0; margin-bottom: 6px; font-size: .95rem; font-weight: 600; }
.alignment-buttons, .alignment-buttons [role=group] { display: flex; gap: 5px; }
.alignment-buttons { gap: 14px; }
.alignment button { width: 44px; height: 44px; padding: 0; font-size: 1.5rem; background: #fff; color: #285d3d; border-color: #8ca397; touch-action: manipulation; }
.alignment button[aria-pressed=true] { background: #357e50; color: #fff; border-color: #17251d; box-shadow: inset 0 0 0 2px #285d3d; font-weight: bold; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid #3e8b5d; outline-offset: 3px; }
.check { flex-direction: row; align-items: center; min-height: 40px; font-weight: normal; }
input[type=checkbox] { accent-color: #357e50; }
.wide { flex-basis: 100%; }
.field-help { margin: 0; color: #52645a; font-size: .9rem; }
.viewer { padding: 12px; border: 1px solid #9ab7a5; border-radius: .45rem; background: #e4ede7; overflow: auto; text-align: center; }
.canvasWrap { display: inline-block; position: relative; max-width: 100%; line-height: 0; }
canvas { display: block; max-width: 100%; height: auto; cursor: pointer; }
canvas:focus-visible { outline: 2px solid #3e8b5d; outline-offset: -2px; }
small { display: block; margin-top: 12px; color: #52645a; }
body.image-only { background: #fff; }
.image-only main { max-width: none; padding: 0; }
.image-only main > :not(.viewer) { display: none; }
.image-only .viewer { display: flex; align-items: center; justify-content: center; min-height: 100vh; min-height: 100dvh; padding: 0; border: 0; border-radius: 0; background: transparent; overflow: hidden; }
.image-only canvas { max-width: 100vw; max-height: 100vh; max-height: 100dvh; width: auto; height: auto; object-fit: contain; }
@media (max-width: 600px) {
 main { padding: 14px; }
 .controls { padding: 14px; gap: 14px; }
 .intro { align-items: flex-start; gap: 12px; }
 .tool-image { width: 84px; }
 select { width: 100%; }
 label:has(select) { flex-basis: 100%; }
 button { width: 100%; }
}
