/* Decal Maker — paper-and-wood light theme. The subject is a picket sign and
   tin pins, so the page is cream card stock, brown ink, one RED accent. */
:root {
  --ground: #efe4cc;
  --surface: #f8f1e1;
  --surface-2: #ece1c9;
  --line: #d9cbae;
  --line-strong: #b9a784;
  --text: #2f2119;
  --muted: #6f5f4d;
  --accent: #b8383b;        /* TF2 RED */
  --accent-ink: #fff6e8;
  --blu: #5885a2;
  --good: #3f7d3a;
  --bad: #b8383b;
  --radius: 6px;
  --font-ui: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  --font-display: "Bowlby One SC", "Impact", "Arial Black", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--text); font: 16px/1.5 var(--font-ui); }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 400; letter-spacing: .01em; text-wrap: balance; }
p { margin: 0; }
button, input, select { font: inherit; }
code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--blu); outline-offset: 2px; }
.dim { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; line-height: 1.4; }
.hint b, .hint strong { color: var(--text); font-weight: 600; }

/* ---------- top bar ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 18px 32px; border-bottom: 2px solid var(--line-strong); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mark { width: 34px; height: 34px; }
.brand h1 { font-size: 24px; line-height: 1; color: var(--text); }
.brand-sub { color: var(--muted); font-size: 15px; }
.steps { display: flex; gap: 22px; margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.steps b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 12px var(--font-ui); }

/* ---------- workbench ---------- */
.bench { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 28px; padding: 28px 32px 8px; max-width: 1440px; margin: 0 auto; align-items: start; }
.pane { display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; min-width: 0; box-shadow: 0 1px 0 rgba(47,33,25,.06); }
.pane-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pane-head h2 { font-size: 18px; color: var(--text); margin-right: auto; }
.size { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

.btn { border-radius: var(--radius); padding: 8px 14px; cursor: pointer; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font-weight: 600; }
.btn:hover { border-color: var(--text); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); padding: 10px 18px; }
.btn-primary:hover { background: #a02f32; border-color: #a02f32; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-tight { gap: 10px; }

.seg { display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 7px 12px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

/* pin slots (Flair only) */
.slots { display: none; grid-template-columns: repeat(2, 1fr); gap: 8px; max-width: 384px; justify-self: center; width: 100%; }
.bench[data-item="flair"] .slots { display: grid; }
.slots button { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 14px; }
.slots button canvas { width: 40px; height: 40px; border-radius: 50%; background: #111; }
.slots button span { display: grid; line-height: 1.15; font-weight: 600; }
.slots button small { color: var(--muted); font-weight: 400; }
.slots button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.adjust .ctl-flair { display: none; }
.pane-head .ctl-flair-inline { display: none; }
.bench[data-item="flair"] .pane-head .ctl-flair-inline { display: flex; }
.ctl-flair-inline select { padding: 4px 8px; }
.bench[data-item="flair"] .adjust .ctl-flair { display: grid; }

/* stage */
.stage { position: relative; width: 100%; max-width: 384px; aspect-ratio: 1; justify-self: center; background: #171410; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; touch-action: none; }
.stage canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.stage.dragging canvas { cursor: grabbing; }
.dropzone { position: absolute; inset: 0; display: none; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 32px; gap: 8px; cursor: pointer; color: #f0e6d2; background: repeating-linear-gradient(45deg, #1a1612 0 12px, #201b16 12px 24px); }
.stage.empty .dropzone { display: flex; }
.drop-title { font-weight: 600; }
.drop-sub { color: #b9ad98; font-size: 13px; max-width: 32ch; }
.src { font-family: var(--font-mono); font-size: 12px; color: var(--muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.adjust { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.ctl { display: grid; grid-template-columns: 128px 1fr 64px; align-items: center; gap: 12px; }
.ctl > .row { grid-column: 2 / -1; }
.ctl label { color: var(--muted); font-size: 14px; }
.ctl output { text-align: right; font-family: var(--font-mono); font-size: 12px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=color] { width: 40px; height: 30px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface-2); cursor: pointer; }
select { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 6px 10px; }
.ctl .hint { flex: 1; min-width: 12ch; }
.ctl input[type=range][id=ringW] { flex: 1; min-width: 120px; }

/* ---------- preview pane ---------- */
.view3d { position: relative; width: 100%; aspect-ratio: 16 / 10; background: radial-gradient(ellipse at 50% 40%, #fbf6ea, #e6d9bd 70%, #dccdad); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; touch-action: none; }
.view3d canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.view3d.dragging canvas { cursor: grabbing; }

.flat { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; gap: 8px 16px; align-items: start; }
.flat-head { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.flat-head h3 { font-size: 15px; margin-right: auto; }
.flat canvas { grid-column: 1 / -1; width: 256px; height: 256px; image-rendering: pixelated; border: 1px solid var(--line-strong); background: #111; justify-self: start; }
.check { color: var(--muted); font-size: 14px; display: flex; gap: 6px; align-items: center; cursor: pointer; }
.check input { accent-color: var(--accent); }

.export { display: grid; grid-template-columns: auto auto auto 1fr; gap: 10px 12px; align-items: center; padding-top: 14px; border-top: 1px solid var(--line); }
.install { grid-column: 1 / -1; display: grid; gap: 6px; font-size: 15px; }
.install ol { margin: 0; padding-left: 22px; display: grid; gap: 4px; }
.install b { font-weight: 600; }
.install .exp { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #f2d9a6; color: #5a3d0c; font-size: 12px; font-weight: 600; margin-left: 6px; vertical-align: middle; }

/* ---------- how / footer ---------- */
.how { max-width: 1440px; margin: 0 auto; padding: 8px 32px 24px; }
.how details { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.how summary { cursor: pointer; padding: 14px 18px; font-family: var(--font-display); font-size: 15px; display: flex; gap: 12px; align-items: baseline; }
.how summary .dim { font-family: var(--font-ui); font-size: 14px; }
.how-body { padding: 0 18px 18px; display: grid; gap: 12px; max-width: 78ch; color: var(--muted); }
.how-body em { color: var(--text); }
.credits { max-width: 1440px; margin: 0 auto; padding: 0 32px 40px; color: var(--muted); font-size: 14px; }
.credits p { padding-top: 16px; border-top: 1px solid var(--line); }

.drop-veil { position: fixed; inset: 0; display: none; place-items: center; background: rgba(239, 228, 204, .88); border: 3px dashed var(--accent); z-index: 10; pointer-events: none; }
.drop-veil span { font: 30px var(--font-display); color: var(--accent); }
body.dragover .drop-veil { display: grid; }

@media (max-width: 1080px) {
  .bench { grid-template-columns: 1fr; }
  .stage { justify-self: start; }
}
@media (max-width: 720px) {
  .bar, .bench, .how, .credits { padding-left: 16px; padding-right: 16px; }
  .ctl { grid-template-columns: 96px 1fr 56px; }
  .export { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .seg button, .slots button { transition: border-color .12s, background-color .12s; }
}
