:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #6b7280;
  --border: #e3e5e8;
  --accent: #1a73e8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.controls {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: 100vh;
}

.controls h1 {
  margin: 0 0 4px;
  font-size: 18px;
}

.controls .sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.controls label {
  display: block;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.controls label .val {
  color: var(--ink);
  text-transform: none;
  font-weight: 600;
  letter-spacing: 0;
}

.controls input[type="range"],
.controls select {
  display: block;
  width: 100%;
  margin-top: 6px;
}

.controls select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}

.controls .color-row,
.controls .checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.controls .color-row input[type="color"] {
  width: 56px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  padding: 0;
  cursor: pointer;
}

.controls .checkbox-row {
  justify-content: flex-start;
  gap: 10px;
}

.controls .checkbox-row input { margin: 0; }

.actions {
  display: flex;
  gap: 8px;
  margin: 18px 0 12px;
}

.actions button {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  cursor: pointer;
}

.actions button:first-child {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.actions button:hover { filter: brightness(0.97); }

.hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  background: #fff8e1;
  border: 1px solid #f1e1a8;
  border-radius: 6px;
  padding: 10px 12px;
  color: #5a4a16;
}

.hint strong { color: #2d2410; }
.hint ul { margin: 6px 0 0; padding-left: 18px; }
.hint li { margin-bottom: 3px; }

.page-wrap {
  padding: 32px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
}

.paper {
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08);
}

.paper svg {
  display: block;
  width: 100%;
  height: 100%;
}

@media print {
  /* Concrete @page size is injected dynamically from JS based on selected page. */
  html, body {
    background: #fff;
    margin: 0;
    padding: 0;
    overflow: hidden;
    width: auto;
    height: auto;
    min-height: 0;
  }
  body { display: block; }
  .no-print { display: none !important; }
  .page-wrap {
    padding: 0;
    margin: 0;
    display: block;
    overflow: hidden;
  }
  .paper {
    box-shadow: none;
    margin: 0;
    overflow: hidden;
    page-break-after: avoid;
    page-break-inside: avoid;
  }
  .paper svg { overflow: hidden; display: block; }
}
