:root {
  --ink: #172126;
  --muted: #69777d;
  --line: #d7dedf;
  --paper: #f4f7f5;
  --panel: #ffffff;
  --accent: #d34e38;
  --accent-dark: #a83c2b;
  --teal: #2d7773;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.topbar { display: flex; align-items: center; justify-content: space-between; max-width: 1180px; margin: auto; padding: 28px 28px 20px; }
.eyebrow { margin: 0 0 4px; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(24px, 4vw, 34px); letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 19px; letter-spacing: 0; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); gap: 20px; max-width: 1180px; margin: auto; padding: 0 28px 36px; }
.preview-panel, .controls-panel { min-width: 0; padding: 22px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; }
.section-heading, .preview-meta, .transfer-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preview-stage { position: relative; display: grid; place-items: center; min-height: 590px; margin-top: 20px; padding: 22px; border: 1px solid #e2e8e7; background: #e9eeeb; }
#previewCanvas { width: min(100%, 304px); height: auto; aspect-ratio: 152 / 296; image-rendering: pixelated; background: #fff; box-shadow: 0 12px 28px #18332b20; touch-action: none; cursor: grab; }
#previewCanvas.is-panning { cursor: grabbing; }
.empty-state { position: absolute; color: var(--muted); pointer-events: none; }
.preview-meta { margin-top: 12px; color: var(--muted); font-size: 12px; }
.status-pill { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.status-pill.connected { border-color: #a9d3c8; color: #246a5d; background: #edf9f5; }
fieldset { margin: 0; padding: 0 0 19px; border: 0; border-bottom: 1px solid var(--line); }
fieldset + fieldset { padding-top: 19px; }
legend { margin-bottom: 11px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.legend-hint { margin-left: 6px; color: var(--teal); font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; }
label { display: grid; gap: 7px; margin-bottom: 13px; color: var(--ink); font-size: 13px; }
label:last-child { margin-bottom: 0; }
select, input[type="range"] { width: 100%; }
select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: #fbfcfb; }
input[type="range"] { accent-color: var(--accent); }
output { float: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.grid-fields { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
.grid-fields legend { grid-column: 1 / -1; }
.file-drop { display: flex; grid-template-columns: none; align-items: center; gap: 12px; padding: 14px; border: 1px dashed #afc0bd; border-radius: 6px; color: var(--ink); background: #f7faf8; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.file-drop.is-dragging { border-color: var(--accent); background: #fff4ef; }
.file-drop small { display: block; margin-top: 2px; color: var(--muted); }
.file-drop input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.file-icon { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #b9cfca; border-radius: 50%; color: var(--teal); font-size: 22px; line-height: 1; }
.transfer-panel { padding-top: 19px; }
.transfer-heading { margin-bottom: 10px; font-size: 13px; font-weight: 750; }
#transferSize { color: var(--muted); font-weight: 500; }
progress { display: block; width: 100%; height: 7px; accent-color: var(--accent); }
.status-message { min-height: 44px; margin: 11px 0 12px; color: var(--muted); font-size: 13px; }
.button { min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 5px; font-weight: 750; }
.button-primary { color: #fff; background: var(--teal); }
.button-primary:hover { background: #245f5c; }
.button-send { width: 100%; color: #fff; background: var(--accent); }
.button-send:hover:not(:disabled) { background: var(--accent-dark); }
.button:disabled { cursor: not-allowed; opacity: .45; }
@media (max-width: 780px) {
  .topbar { padding: 22px 16px 16px; }
  .workspace { grid-template-columns: 1fr; padding: 0 16px 24px; }
  .preview-stage { min-height: 430px; }
}
