* { box-sizing: border-box; }
body {
  margin: 0;
  display: grid;
  grid-template-columns: 370px 1fr;
  height: 100vh;
  font: 14px/1.4 system-ui, sans-serif;
  color: #1f1e1b;
  background: #ebe4d6;
}
aside {
  overflow-y: auto;
  padding: 16px;
  background: #f7f3ea;
  border-right: 1px solid #d5cec0;
}
.aside-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -0.02em; }
.brand-link { color: inherit; text-decoration: none; }
.brand-link:hover { text-decoration: underline; }
.lang-pick { margin: 0; color: inherit; }
.lang-pick select {
  width: auto;
  min-width: 4.2rem;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 600;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.advanced {
  margin: 8px 0;
  border-top: 1px solid #e3e3e3;
  padding-top: 6px;
}
.advanced > summary {
  cursor: pointer;
  font-weight: 600;
  color: #6e6a62;
  font-size: 13px;
  margin-bottom: 6px;
}
.advanced.photo-adv { border-top: 0; padding-top: 0; }
fieldset.nested {
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  margin: 0;
  padding: 8px 12px 12px;
}
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #555; }
label.block { margin-bottom: 6px; }
textarea {
  width: 100%;
  font: 14px/1.45 system-ui, sans-serif;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  resize: vertical;
}
select, button {
  font: inherit;
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fafafa;
}
a.btn { font: inherit; padding: 5px 8px; border: 1px solid #ccc; border-radius: 6px; background: #fafafa; color: inherit; text-decoration: none; }
button, a.btn { cursor: pointer; }
button:hover, a.btn:hover { background: #f0f0f0; }
fieldset {
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  margin: 12px 0;
  padding: 8px 12px 12px;
}
legend { font-weight: 600; padding: 0 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.range { flex-direction: row; align-items: center; justify-content: space-between; margin: 6px 0; }
.range input { flex: 1; margin: 0 8px; }
.range output { width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.check { flex-direction: row; align-items: center; gap: 6px; margin: 8px 0; }
.row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.hint { color: #888; font-size: 12px; }
input[type="color"] { width: 100%; height: 31px; padding: 2px; border: 1px solid #ccc; border-radius: 6px; background: #fafafa; }
.swatches { display: flex; gap: 6px; margin: 2px 0 6px; }
.swatches button { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #bbb; }
.swatches button.on { box-shadow: 0 0 0 2px #333; }

main { overflow-y: auto; padding: 24px; }
#status { color: #666; margin-bottom: 12px; min-height: 18px; }
#pages { display: flex; flex-wrap: wrap; gap: 28px; justify-content: center; }
.page { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.page .sheet {
  width: min(620px, 80vw);
  box-shadow: 0 4px 18px rgba(0,0,0,.18);
  background: #fff;
}
.page .sheet svg { display: block; width: 100%; height: auto; }
.page .sheet .line { cursor: grab; }
.page .sheet .line:hover { filter: drop-shadow(0 0 0.4px #f39c12); }
.page .sheet .line.dragging { cursor: grabbing; }
.page .bar { display: flex; gap: 8px; align-items: center; }

#modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
}
#modal[hidden] { display: none; }
.modal-box { background: #222; padding: 10px; border-radius: 8px; max-height: 95vh; display: flex; flex-direction: column; }
.modal-head { display: flex; gap: 12px; align-items: center; color: #eee; margin-bottom: 8px; }
.modal-head a { color: #8cf; margin-left: auto; }
#modal-img { max-height: 85vh; max-width: 90vw; object-fit: contain; }
