:root { font-family: system-ui, sans-serif; color: #182944; background: #f2f5fa; color-scheme: light; --brand: #174881; --text-quiet: #4c6381; --stroke: #ccd8e7; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--brand); }
button, select, input { font: inherit; }
button { font-weight: 660; cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible { outline: 3px solid #8d4408; outline-offset: 3px; }
header { background: #fff; border-bottom: 1px solid var(--stroke); padding: 13px max(22px, calc((100% - 1300px)/2)); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 750; }
main { max-width: 1344px; padding: 34px 22px 22px; margin: auto; }
.intro { margin-bottom: 23px; }
h1 { font-size: clamp(2rem, 5.2vw, 3.8rem); letter-spacing: -.055em; line-height: 1.05; margin: 0 0 10px; }
p { line-height: 1.5; margin: 0; }
.intro p { color: var(--text-quiet); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(278px, 338px); align-items: start; gap: 16px; }
.editor { color: #f2f7ff; background: #142640; border: 1px solid #203956; border-radius: 13px; min-width: 0; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.editor > .bar { padding: 14px 16px; }
h2 { font-size: 16px; margin: 0; }
#source-size, #output-size { white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
#source-size { color: #d2e1f4; }
.stage { display: grid; place-items: center; min-height: 365px; background: #0a1629; border-block: 1px solid #283e58; padding: 13px; }
canvas { display: block; max-width: 100%; background-color: white; background-image: conic-gradient(#dbe2eb 25%, #fff 0 50%, #dbe2eb 0 75%, #fff 0); background-size: 16px 16px; }
#source { max-height: min(59vh, 640px); touch-action: none; cursor: crosshair; box-shadow: 0 4px 24px #0006; }
#source:focus-visible { outline-color: #ffba76; }
#preview { max-height: 184px; margin: 12px auto; border: 1px solid #e0e7ef; }
.empty { display: grid; place-items: center; gap: 10px; min-height: 250px; text-align: center; }
.editor-footer p { font-size: 12px; color: #d2e1f4; }
.controls { display: grid; gap: 12px; }
.card { background: #fff; border: 1px solid var(--stroke); border-radius: 13px; padding: 14px; min-width: 0; }
.card > label { display: grid; gap: 6px; margin: 11px 0; }
label, legend { font-size: 13px; font-weight: 650; }
select, input[type=number] { width: 100%; padding: 7px 8px; min-height: 40px; color: #182944; border: 1px solid #becce0; border-radius: 7px; background: #fff; font-size: 14px; }
input[type=number]:disabled { background: #f3f6fb; }
fieldset { padding: 9px 0; margin: 0; border: 0; min-width: 0; }
.numbers { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.numbers label { display: grid; gap: 4px; }
.primary, .secondary, .light { min-height: 40px; padding: 7px 13px; border-radius: 7px; border: 1px solid; white-space: nowrap; }
.primary { background: var(--brand); color: white; border-color: var(--brand); }
.primary:not(:disabled):hover { background: #275f9d; }
.light { background: #213b5b; color: #f5f9ff; border-color: #4e6788; }
.light:hover { background: #304f72; }
.secondary { background: #eef4fc; color: var(--brand); border-color: var(--stroke); }
#download { width: 100%; }
#status { color: var(--text-quiet); font-size: 12px; min-height: 18px; margin-top: 8px; overflow-wrap: anywhere; }
#output-size { color: var(--text-quiet); }
footer { display: flex; flex-wrap: wrap; gap: 15px; padding: 0 22px 25px; max-width: 1344px; margin: auto; font-size: 13px; }
.info main { max-width: 800px; }
.info h2 { margin: 23px 0 8px; }
.info p + p { margin-top: 10px; }
@media (max-width: 760px) {
  .workspace { grid-template-columns: 1fr; }
  .stage { min-height: 250px; }
  #source { max-height: 51vh; }
}
@media (max-width: 460px) {
  main { padding: 24px 12px 18px; }
  header, footer { padding-inline: 12px; }
  .editor > .bar { padding: 10px; }
  .stage { padding: 8px; }
  .empty { min-height: 228px; }
}
