:root {
  --bg: #1c1916;
  --panel: #24201c;
  --panel-2: #2d2823;
  --line: #3d362f;
  --text: #ece3d3;
  --muted: #a89a86;
  --accent: #c8643f;
  --accent-2: #e2b071;
  --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 'DS Fell', Georgia, 'Times New Roman', serif;
}

.app { display: grid; grid-template-columns: 360px 1fr; height: 100vh; }

/* ---------- Seitenleiste ---------- */
.panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 22px 22px 16px;
}
.brand h1 {
  font: 400 28px/1 'DS Cinzel', Georgia, serif;
  letter-spacing: 0.08em;
  margin: 0 0 6px;
}
.brand h1 span { color: var(--accent); margin: 0 4px; }
.brand p { margin: 0 0 8px; color: var(--muted); font-family: 'DS Fell Italic', Georgia, serif; font-size: 15px; }

section { border-top: 1px solid var(--line); padding: 16px 0 6px; }
h2 {
  font: 400 15px/1 'DS Cinzel', Georgia, serif;
  letter-spacing: 0.12em;
  margin: 0 0 12px;
  color: var(--accent-2);
}
h2 .num { color: var(--accent); margin-right: 8px; font-size: 13px; }

.drop {
  display: block;
  border: 1.5px dashed #5a4f43;
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.drop:hover, .drop.over { background: var(--panel-2); border-color: var(--accent-2); }
.drop input { display: none; }
.drop strong { display: block; font: 400 15px 'DS Cinzel', Georgia, serif; letter-spacing: 0.06em; }
.drop small { color: var(--muted); font-family: 'DS Fell Italic', Georgia, serif; font-size: 13px; }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.examples { margin-top: 10px; color: var(--muted); }
.examples button, .link {
  background: none; border: 0; color: var(--accent-2); cursor: pointer;
  font: 14px 'DS Fell Italic', Georgia, serif; padding: 2px 4px;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #6b5a44;
}
.examples button:hover, .link:hover { color: var(--text); }

.info {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--radius);
  background: var(--panel-2); font-size: 13.5px;
}
.info b { font: 400 15px 'DS Cinzel', Georgia, serif; letter-spacing: 0.04em; display: block; margin-bottom: 2px; }
.info .meta { color: var(--muted); font-family: 'DS Fell Italic', Georgia, serif; }
.error {
  margin-top: 12px; padding: 10px 12px; border-radius: var(--radius);
  background: #4a2219; color: #ffd9cc; font-size: 13.5px;
}

.styles { display: grid; gap: 8px; }
.style-card {
  display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: center;
  padding: 9px 10px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; text-align: left; color: var(--text);
  font: inherit;
}
.style-card:hover { border-color: #6b5a44; }
.style-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.style-card .swatch { width: 46px; height: 46px; border-radius: 6px; position: relative; overflow: hidden; }
.style-card .swatch::after {
  content: ''; position: absolute; inset: 9px 7px; border-radius: 50%;
  border: 2px solid var(--ink); border-right-color: transparent; transform: rotate(-20deg);
}
.style-card b { display: block; font: 400 14px 'DS Cinzel', Georgia, serif; letter-spacing: 0.04em; }
.style-card small { color: var(--muted); font-family: 'DS Fell Italic', Georgia, serif; font-size: 12.5px; line-height: 1.3; display: block; }

.field { margin-bottom: 12px; }
.field > label { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: 6px; font-size: 13.5px; }
.field output { color: var(--text); }
select {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit;
}
input[type=range] { width: 100%; accent-color: var(--accent); }

.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button {
  flex: 1; padding: 7px 4px; border: 0; background: var(--panel-2); color: var(--muted);
  font: inherit; font-size: 13.5px; cursor: pointer; border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--text); }
.seg button.active { background: #4a2f22; color: var(--text); }

.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.checks label { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 14px; }
.checks input { accent-color: var(--accent); width: 15px; height: 15px; }

.variant span { color: var(--muted); font-family: 'DS Fell Italic', Georgia, serif; }
.hint { color: var(--muted); font-size: 12.5px; font-family: 'DS Fell Italic', Georgia, serif; margin: 8px 0 0; }

button.primary, button.secondary {
  border-radius: 8px; cursor: pointer; font: 400 14px 'DS Cinzel', Georgia, serif; letter-spacing: 0.06em;
}
button.primary {
  width: 100%; padding: 12px; border: 0; color: #fff8ee;
  background: linear-gradient(180deg, #c8643f, #a24a2b);
  box-shadow: 0 2px 0 #6e2f1a;
}
button.primary:hover:not(:disabled) { filter: brightness(1.08); }
button.primary:disabled { opacity: 0.45; cursor: default; }
button.secondary { padding: 7px 12px; border: 1px solid #6b5a44; background: var(--panel-2); color: var(--text); }
button.secondary:hover { border-color: var(--accent-2); }
.dims { color: var(--muted); font-family: 'DS Fell Italic', Georgia, serif; margin: 0 0 10px; min-height: 1.4em; }

.foot { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; color: #7d705f; font-size: 12px; font-family: 'DS Fell Italic', Georgia, serif; }

/* ---------- Bühne ---------- */
.stage {
  position: relative; overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #2c2721 0%, #161411 75%);
  display: flex; align-items: center; justify-content: center; padding: 28px;
}
.preview { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.preview canvas {
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
}
.empty { position: absolute; text-align: center; color: #857765; font-family: 'DS Fell Italic', Georgia, serif; font-size: 18px; }
.empty .quill { font-size: 54px; color: #5c4f40; margin-bottom: 6px; }
.busy {
  position: absolute; right: 22px; top: 18px; display: flex; align-items: center; gap: 10px;
  background: rgba(20, 17, 14, 0.85); padding: 8px 14px; border-radius: 20px; color: var(--accent-2);
  font-family: 'DS Fell Italic', Georgia, serif; font-size: 15px;
}
.busy.center { right: auto; top: auto; font-size: 18px; padding: 14px 22px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #5c4f40; border-top-color: var(--accent-2); animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; height: auto; }
  .stage { min-height: 70vh; }
}
