:root {
  --bg: #1b1d21;
  --panel: #24272d;
  --line: #34383f;
  --text: #e8e6e1;
  --muted: #9a9ea6;
  --accent: #d4a85c;
  --accent-ink: #1b1d21;
  --radius: 6px;
  --stage: 560px;
  /* lmaobox menu palette, sampled from screenshots */
  --lm-bg: #2b2b2b;
  --lm-blue: #1e90ff;
  --lm-text: #ececec;
  --lm-dim: #8c8c8c;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "IBM Plex Sans", "Segoe UI", system-ui, sans-serif; }
h1, h2 { margin: 0; font-weight: 600; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h2 .dim { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 6px; font-variant-numeric: tabular-nums; }
p { margin: 0; }
button, select { font: inherit; }

.top { padding: 28px 32px 8px; max-width: 1420px; margin: 0 auto; }
.top p { color: var(--muted); max-width: 78ch; margin-top: 4px; }

.work { display: grid; grid-template-columns: var(--stage) minmax(0, 1fr); gap: 32px; padding: 24px 32px 48px; max-width: 1420px; margin: 0 auto; align-items: start; }

.stage { position: relative; width: var(--stage); max-width: 480px; background: #0e0f11; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; touch-action: none; }
.stage canvas { display: block; width: 100%; height: auto; cursor: grab; }
.stage.dragging canvas { cursor: grabbing; }
.dropzone { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 40px; gap: 8px; cursor: pointer; background: repeating-linear-gradient(45deg, #15171a 0 12px, #181a1e 12px 24px); }
.dropzone.over { outline: 2px solid var(--accent); outline-offset: -8px; }
.drop-title { font-weight: 500; }
.drop-sub { color: var(--muted); font-size: 13px; max-width: 34ch; }
.work[data-state="loaded"] .dropzone { display: none; }
.work[data-state="empty"] .stage canvas { visibility: hidden; }

.controls { margin-top: 16px; display: grid; gap: 12px; }
.ctl { display: grid; grid-template-columns: 90px 1fr 60px; align-items: center; gap: 12px; }
.ctl-tab { grid-template-columns: 90px 1fr; margin-bottom: 12px; }
.ctl label { color: var(--muted); }
.ctl output { text-align: right; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--accent); }
select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; }
.hint { color: var(--muted); font-size: 13px; }
#rawHint { display: none; color: var(--accent); }
.work[data-raw="1"] #rawHint { display: block; }
.work[data-raw="1"] #cropHint { display: none; }
.work[data-raw="1"] .stage canvas { cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }

button { border-radius: var(--radius); padding: 8px 14px; cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
button:hover { border-color: #4a4f58; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary:hover { background: #e2b76b; }
button:disabled { opacity: .45; cursor: not-allowed; }

.preview-head { display: flex; gap: 16px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.preview-head h2 { margin-right: auto; }
.tabswitch { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tabswitch button { border: 0; border-radius: 0; padding: 5px 12px; font-size: 13px; }
.tabswitch button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.check { color: var(--muted); font-size: 14px; display: flex; gap: 6px; align-items: center; cursor: pointer; }
.check input { accent-color: var(--accent); }

/* The preview is laid out at the true menu size (770 × H css px) and scaled down
   with a transform when the column is narrower, so proportions never lie. */
.preview-wrap { width: 100%; overflow: hidden; }
.preview { position: relative; width: 770px; background: var(--lm-bg); transform-origin: 0 0; overflow: hidden; }
.preview canvas { display: block; width: 770px; height: 100%; position: absolute; inset: 0; }
.work[data-state="empty"] .preview canvas { visibility: hidden; }

/* ---- fake lmaobox menu, absolutely positioned in menu pixels ---- */
.menu { position: absolute; inset: 0; font: 10px/1 Tahoma, Verdana, "Segoe UI", sans-serif; color: var(--lm-text); text-transform: uppercase; pointer-events: none; }
.menu.hidden { display: none; }
.menu > * { position: absolute; white-space: nowrap; }
.menu .bar { left: 0; top: 0; width: 100%; height: 6px; background: var(--lm-blue); }
.menu .nav { left: 20px; font-size: 26px; line-height: 1; transform: translateY(-50%); letter-spacing: -.2px; font-family: "Segoe UI", Tahoma, sans-serif; }
.menu .nav.on { color: #2f9dff; }
.menu .sub { font-size: 19px; line-height: 1; transform: translateY(-50%); font-family: "Segoe UI", Tahoma, sans-serif; }
.menu .sub.on { color: #2f9dff; }
.menu .lbl { transform: translateY(-50%); }
.menu .lbl.dim { color: var(--lm-dim); }
.menu .val { transform: translateY(-50%); text-align: right; }
.menu .cb { width: 11px; height: 11px; border: 1px solid #ddd; transform: translateY(-50%); }
.menu .cb.on { background: var(--lm-blue); border-color: #63b3ff; }
.menu .cb.on::after { content: ""; position: absolute; left: 3px; top: 0; width: 3px; height: 6px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.menu .cbar { height: 8px; background: #000; }
.menu .cbar.lime { background: #a4ea3a; }
.menu .btn { height: 18px; border: 1px solid var(--lm-blue); display: flex; align-items: center; justify-content: center; }
.menu .hl { background: var(--lm-blue); height: 14px; transform: translateY(-50%); }

.export { margin-top: 20px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.export-note { flex-basis: 100%; color: var(--muted); font-size: 13px; }
code { background: var(--panel); padding: 1px 5px; border-radius: 3px; font-size: 13px; }

@media (max-width: 1100px) {
  :root { --stage: min(560px, calc(100vw - 48px)); }
  .work { grid-template-columns: 1fr; padding: 16px 24px 40px; }
  .top { padding: 20px 24px 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .dropzone { transition: outline-color .12s; }
}
