:root {
  color: #262440;
  background: #f4f2fa;
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.shell { max-width: 1080px; margin-inline: auto; padding: clamp(24px, 6vw, 76px) clamp(16px, 4vw, 36px); }
header { margin-bottom: clamp(20px, 4vw, 42px); }
h1 { margin: 0 0 8px; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.08; letter-spacing: -.045em; }
header p { margin: 0; color: #56526a; font-size: 1.08rem; }
.editor { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(270px, 1fr); gap: 20px; }
.preview, .controls { min-width: 0; padding: clamp(16px, 3vw, 28px); border: 1px solid #dad5e9; border-radius: 20px; }
.preview { display: grid; align-content: center; justify-items: center; background: #e9e4f6; }
.frame { position: relative; width: min(100%, 420px); aspect-ratio: 1; border: 1px solid #c5bdd9; border-radius: 14px; background: repeating-conic-gradient(#fdfbff 0 25%, #e2dced 0 50%) 0 0 / 24px 24px; overflow: hidden; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
canvas[data-loaded] { cursor: grab; }
canvas[data-loaded]:active { cursor: grabbing; }
#empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-weight: 650; pointer-events: none; }
.hint { color: #5d5771; font-size: .9rem; line-height: 1.45; margin: 8px 0; }
.preview .hint { text-align: center; margin-top: 16px; }
.controls { background: #fff; }
label, legend { font-weight: 650; }
label { display: block; margin-bottom: 6px; }
input, select, button { font: inherit; }
input[type=file], select { width: 100%; color: inherit; }
input[type=file]::file-selector-button, button, select, .download { min-height: 40px; border: 1px solid #b9afce; border-radius: 9px; padding: 7px 12px; background: #f7f4fc; color: #2d2542; }
button:enabled, a, input[type=range], select { cursor: pointer; }
button:disabled { opacity: .48; }
.sample { margin-top: 2px; }
fieldset { min-width: 0; border: 0; border-top: 1px solid #e5dfef; margin: 20px 0; padding: 12px 0 0; }
fieldset:disabled { opacity: .55; }
legend { padding-right: 9px; }
output { float: right; color: #605675; font-variant-numeric: tabular-nums; }
input[type=range] { display: block; margin: 0 0 12px; min-height: 28px; width: 100%; accent-color: #5d3ac1; }
.reset { min-height: 36px; }
.export, .download { width: 100%; display: block; text-align: center; font-weight: 700; margin-top: 12px; }
.export { background: #593ab9; color: #fff; border-color: #593ab9; }
.download { text-decoration: none; }
#status { margin: 13px 0 0; color: #57516b; font-size: .9rem; line-height: 1.4; }
#status[data-error] { color: #9e2941; }
footer { display: flex; gap: 16px; margin-top: 24px; font-size: .9rem; }
footer a, .legal a { color: #4b2f9f; }
.legal { max-width: 720px; margin-inline: auto; }
.legal section { margin-top: 28px; }
.legal p { line-height: 1.6; }
:focus-visible { outline: 3px solid #6f48c9; outline-offset: 3px; }
@media (max-width: 685px) {
  .editor { grid-template-columns: 1fr; }
  .frame { width: min(100%, 340px); }
}
