*, *::before, *::after { box-sizing: border-box; }
:root {
  --ink: #1c1a17;
  --muted: #7d746a;
  --line: #e2ddd4;
  --paper: #fbf9f5;
  --card: #ffffff;
  --accent: #c9481b;
  --accent-soft: #fdf0ea;
}
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }

header {
  border-bottom: 1px solid var(--line);
  background: var(--card);
  padding: 18px 24px;
}
header h1 { margin: 0; font-size: 20px; letter-spacing: -.01em; }
header h1 span { color: var(--accent); }
header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

#tabs { margin-top: 14px; }
.tabgroup { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.tabcat {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #b0a698; width: 118px; flex: none;
}
@media (max-width: 700px) { .tabcat { width: 100%; } }
.tabgroup button {
  border: 1px solid var(--line); background: var(--paper); color: var(--muted);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px;
}
.tabgroup button:hover { border-color: #cfc7bb; color: var(--ink); }
.tabgroup button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.hint {
  margin: 12px 0 0; font-size: 13px; color: var(--muted);
  border-left: 3px solid var(--line); padding-left: 12px;
}

.wrap {
  display: grid; grid-template-columns: 320px minmax(0, 1fr);
  gap: 24px; padding: 24px; align-items: start; max-width: 1400px; margin: 0 auto;
}
@media (max-width: 900px) { .wrap { grid-template-columns: 1fr; } }

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 18px;
}
.panel + .panel { margin-top: 16px; }
.panel h2 {
  margin: 0 0 12px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); font-weight: 600;
}
.blurb { margin: 0 0 16px; font-size: 13px; color: var(--muted); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.row label { font-size: 13px; color: #4a453e; }
.row input[type=number], .row select {
  width: 108px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; font-size: 13px; background: #fff; color: var(--ink);
}
.row select { width: 100%; }
.row.full { display: block; }
.row.full select { margin-top: 6px; }
input[type=number]:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.units { display: flex; gap: 6px; }
.units button {
  flex: 1; border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 6px 0; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px;
}
.units button.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.check { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; font-size: 13px; }
.check input { accent-color: var(--accent); }

.stage {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px; position: sticky; top: 24px;
}
.stagehead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.stagehead strong { font-size: 15px; }
.stagehead em { font-style: normal; color: var(--muted); font-size: 13px; }
#preview {
  background: repeating-conic-gradient(#f4f1ec 0% 25%, #fbf9f5 0% 50%) 50% / 18px 18px;
  border-radius: 8px; padding: 16px; display: flex; justify-content: center;
}
#preview svg { max-height: 62vh; width: auto; filter: drop-shadow(0 1px 3px rgba(0,0,0,.10)); }

.legend { display: flex; gap: 18px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 2px solid #111; vertical-align: middle; margin-right: 6px; }
.legend .f { border-top: 2px dashed var(--accent); }

.warn {
  margin-top: 12px; padding: 10px 13px; border-radius: 6px; font-size: 13px;
  background: var(--accent-soft); color: #8f3312; border: 1px solid #f3d5c8;
}
.warn:empty { display: none; }
.warn.bad {
  background: #fff4f2; border: 1px solid #e8a08a; border-left: 4px solid #c9481b;
  color: #8f2b12;
}
.warn .wline { margin: 0 0 8px; }
.warn .wline:last-child { margin-bottom: 0; }
.warn .wacts { display: flex; gap: 8px; flex-wrap: wrap; }
.warn .wacts button {
  border: 1px solid #dda590; background: #fff; color: #8f2b12;
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 12.5px;
}
.warn .wacts button:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.dl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.dl button {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 16px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 13px;
}
.dl button:hover { border-color: #cfc7bb; background: var(--paper); }
.dl button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.dl button.primary:hover { background: #b03f17; }

footer { color: var(--muted); font-size: 12px; padding: 8px 24px 32px; max-width: 1400px; margin: 0 auto; }

/* ---------------- brand + page chrome (generated pages) ---------------- */
.brand {
  display: inline-block; font-weight: 700; font-size: 20px; letter-spacing: -.01em;
  color: var(--accent); text-decoration: none; margin-bottom: 6px;
}
.brand span { color: var(--ink); }
header h1 { margin: 0; font-size: 21px; letter-spacing: -.01em; font-weight: 650; }

/* ---------------------------- artwork ---------------------------- */
.muted { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.filebtn {
  display: block; text-align: center; cursor: pointer;
  border: 1px dashed #cfc7bb; border-radius: 8px; padding: 10px;
  color: var(--ink); font-size: 13px; background: var(--paper); margin-bottom: 10px;
}
.filebtn:hover { border-color: var(--accent); color: var(--accent); }
.art { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-top: 10px; }
.arthead { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.thumb { width: 30px; height: 30px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.artname { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art .x {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0 4px;
}
.art .x:hover { color: var(--accent); }
.placesel {
  width: 100%; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; font-size: 12px; margin-bottom: 8px; background: #fff; color: var(--ink);
}
.srow { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.sname { width: 34px; font-size: 12px; color: var(--muted); }
.srow input[type=range] { flex: 1; accent-color: var(--accent); }
.snum {
  width: 58px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px;
  font: inherit; font-size: 12px; text-align: right; background: #fff; color: var(--ink);
}
.sunit { width: 18px; font-size: 12px; color: var(--muted); }
#preview image { cursor: move; }

/* ------------------------- page copy / SEO ------------------------- */
main { max-width: 1400px; margin: 0 auto; padding: 8px 24px 0; }
.copy { max-width: 760px; }
.copy h2 { font-size: 17px; margin: 30px 0 10px; letter-spacing: -.01em; }
.copy h3 { font-size: 13px; margin: 0 0 6px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.copy p, .copy li, .copy dd { color: #4a453e; font-size: 14.5px; }
.copy ul, .copy ol { padding-left: 20px; }
.copy li { margin-bottom: 6px; }
.copy dt { font-weight: 650; margin-top: 14px; font-size: 14.5px; }
.copy dd { margin: 4px 0 0; }
.allgrid { display: flex; gap: 32px; flex-wrap: wrap; }
.allcat ul { list-style: none; padding: 0; margin: 0; }
.allcat li { margin-bottom: 4px; font-size: 14px; }
footer { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 16px; }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--accent); }
