:root {
  --ink: #1c1915;
  --muted: #5c564c;
  --paper: #f4f0e7;
  --card: #fffdf8;
  --line: #e2d9cb;
  --accent: #9a3412;
  --accent-ink: #fff7ed;
  --good: #3f6212;
  color-scheme: light;
  font-family: "Segoe UI", Candara, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { min-height: 100vh; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 22px 28px 8px;
}
.brand {
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 32px;
  line-height: 1;
  margin: 0;
}
.brand span { color: var(--accent); }
.lede { margin: 8px 0 0; color: var(--muted); max-width: 46ch; }
.domain { font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  padding: 16px 28px 28px;
}

.stage {
  background: #d9d1c3;
  border-radius: 18px;
  min-height: 640px;
  position: relative;
  overflow: hidden;
}
#view { width: 100%; height: 640px; display: block; touch-action: none; }
.stage-error {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  text-align: center;
  background: #1c1915;
  color: #fff7ed;
}

.toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 2;
}
button, select {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}
button.active, button.primary {
  background: var(--ink);
  color: var(--accent-ink);
  border-color: var(--ink);
}
button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.panel h2 {
  font-family: Georgia, "Iowan Old Style", serif;
  font-size: 20px;
  margin: 0;
}
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
select { width: 100%; border-radius: 12px; }
.styles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.styles button { border-radius: 12px; }
.specs { margin: 0; display: grid; gap: 6px; font-size: 14px; }
.specs div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-variant-numeric: tabular-nums; }
.source { font-size: 12px; color: var(--muted); margin: 0; }
.adds { display: flex; flex-wrap: wrap; gap: 8px; }
.adds button { border-radius: 12px; }
.piece-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.piece-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  background: var(--paper);
  border-radius: 10px;
  padding: 8px 8px 8px 12px;
}
.piece-list button { padding: 6px 10px; }
.foot {
  padding: 0 28px 28px;
  color: var(--muted);
  font-size: 13px;
  max-width: 78ch;
}

@media (max-width: 900px) {
  .top, .layout, .foot { padding-left: 16px; padding-right: 16px; }
  .layout { grid-template-columns: 1fr; }
  .stage, #view { min-height: 520px; height: 520px; }
  .brand { font-size: 28px; }
}
