:root {
  --paper: #e7e0d4;
  --sheet: #f7f3eb;
  --ink: #1c1916;
  --muted: #5e574e;
  --line: #cfc6b8;
  --seal: #b6402c;
  --ok: #1d6b45;
  --warn: #8a5a12;
  --shadow: 0 16px 40px rgba(48, 36, 22, 0.08);
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", "Avenir Next", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
}

.top, .layout {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
}

.top { padding: 28px 0 8px; }

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--seal);
}

h1 {
  margin: 0;
  font-family: Palatino, "Iowan Old Style", Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.lede { max-width: 46rem; color: var(--muted); }

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 18px;
  padding-bottom: 40px;
  align-items: start;
}

.panel {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-family: Palatino, Georgia, serif;
}

section + section { margin-top: 22px; }

.drop {
  display: grid;
  gap: 4px;
  padding: 18px;
  border: 1.5px dashed #8d8376;
  border-radius: 14px;
  background: #fffdf8;
  cursor: pointer;
}

.drop input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.drop-title { font-weight: 650; }
.drop-note, .hint { color: var(--muted); font-size: 0.92rem; }
.hint { margin: 6px 0 0; }

.drop:focus-within, .drop.over { border-color: var(--ink); background: #fff; }

.field, .choice { display: grid; gap: 6px; margin-top: 12px; }
.field span, legend { font-weight: 650; }

input[type="number"], input[type="color"] {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
}

input[type="color"] { padding: 4px; }

.choices { border: 0; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.choice {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.choice span { font-weight: 650; }
.choice small { grid-column: 2; color: var(--muted); }
.choice input { margin-top: 4px; width: 18px; height: 18px; }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatches button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #b7aea1;
  cursor: pointer;
}
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }

.primary, .ghost {
  min-height: 46px;
  border-radius: 12px;
  font: inherit;
  font-weight: 680;
  cursor: pointer;
}
.primary {
  width: 100%;
  margin-top: 18px;
  border: 0;
  background: var(--ink);
  color: #f7f3eb;
}
.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.ghost {
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  padding: 0 14px;
}

.status, .file-title { font-weight: 650; }
.status.bad, .fit.bad { color: var(--seal); }
.status.warn, .fit.warn { color: var(--warn); }
.status.ok, .fit.ok { color: var(--ok); }

.reasons, .violations { margin: 8px 0 0; padding-left: 18px; }
.reasons li, .violations li { margin: 6px 0; }

.preview {
  position: relative;
  margin-top: 12px;
  display: inline-block;
  max-width: 100%;
  background: repeating-conic-gradient(#efeae2 0% 25%, #f7f3eb 0% 50%) 50% / 16px 16px;
  border-radius: 12px;
  overflow: hidden;
}
.preview img { display: block; max-width: 100%; height: auto; }
.preview svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.empty, .busy {
  min-height: 280px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 12px;
}
.empty-kicker {
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--seal);
}
.bar {
  height: 4px;
  width: min(240px, 70%);
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--seal), transparent);
  background-size: 40% 100%;
  animation: slide 1.1s linear infinite;
}
@keyframes slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }

.toolbar { display: grid; gap: 10px; }
.modes, .layers, .downloads { display: flex; flex-wrap: wrap; gap: 8px; }
.modes button {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  padding: 0 12px;
  cursor: pointer;
}
.modes button[aria-selected="true"] { background: var(--ink); color: #f7f3eb; border-color: var(--ink); }
.layers label { display: flex; gap: 6px; align-items: center; font-size: 0.92rem; }

.sheet {
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  max-height: 72vh;
}
.sheet svg { display: block; width: 100%; height: auto; min-width: 280px; }

dl {
  display: grid;
  grid-template-columns: minmax(9rem, 0.8fr) 1.2fr;
  gap: 6px 12px;
  margin: 0;
}
dt { color: var(--muted); }
dd { margin: 0; font-variant-numeric: tabular-nums; }

.viz { margin: 22px 0 0; }
.viz figcaption {
  font-family: Palatino, Georgia, serif;
  font-size: 1.2rem;
  margin-bottom: 8px;
}
.viz-body img { width: 100%; border-radius: 12px; display: block; }
.viz-body .note {
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; width: min(100% - 20px, 1180px); }
  .top { width: min(100% - 20px, 1180px); }
  dl { grid-template-columns: 1fr; }
  dd { margin-bottom: 8px; }
}
