:root {
  --bg: #f6f4ef;
  --panel: #ffffff;
  --ink: #1f2328;
  --muted: #6b6f76;
  --line: #e6e2d9;
  --soft: #efece5;
  --accent: #14365a;
  --gold: #f2b84b;
  --ok: #2b9348;
  --danger: #c92a2a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 40, .06), 0 6px 20px rgba(20, 30, 40, .06);
  --topbar: 60px;
  --side: 240px;
  --editor: 440px;
  --font: Outfit, "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar);
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  background: rgba(246, 244, 239, .86); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; }
.project-name {
  flex: 0 1 280px; min-width: 80px; border: 1px solid transparent; background: transparent; border-radius: 10px;
  padding: 7px 10px; font-weight: 600; font-size: 16px; transition: border-color .15s, background .15s;
}
.project-name:hover { border-color: var(--line); }
.project-name:focus { outline: none; border-color: var(--accent); background: #fff; }
.progress { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.progress svg { width: 28px; height: 28px; transform: rotate(-90deg); }
.progress circle { fill: none; stroke-width: 4; }
.progress .track { stroke: var(--line); }
.progress .bar { stroke: var(--ok); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .5s ease; }
.progress b { color: var(--ink); }
.save-state { font-size: 13px; color: var(--muted); white-space: nowrap; margin-left: auto; transition: opacity .3s; }
.save-state.busy { color: #b07d12; }
.save-state.err { color: var(--danger); }
.top-actions { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.btn:hover { border-color: #cfc9bd; box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1b4775; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: #fff; }
.btn.small { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 0; background: transparent;
  cursor: pointer; font-size: 22px; line-height: 1; color: var(--muted);
}
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
.layout { display: flex; align-items: flex-start; }
.sidebar {
  position: sticky; top: var(--topbar); width: var(--side); flex: 0 0 var(--side); height: calc(100vh - var(--topbar));
  overflow-y: auto; padding: 18px 12px 30px; border-right: 1px solid var(--line);
}
.side-group { margin-bottom: 16px; }
.side-group h3 { margin: 0 0 6px 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.side-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 9px;
  background: transparent; cursor: pointer; text-align: left; font-size: 14px; transition: background .15s;
}
.side-item:hover { background: var(--soft); }
.seg { display: flex; gap: 3px; padding: 3px; margin: 0 4px; border-radius: 10px; background: var(--soft); }
.seg button { flex: 1; border: 0; background: transparent; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s, box-shadow .15s; }
.lang2 { display: flex; align-items: center; gap: 8px; margin: 8px 4px 0; font-size: 12px; color: var(--muted); }
.lang2 select { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; background: #fff; font-size: 13px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.side-item.active { background: #fff; box-shadow: var(--shadow); }
.side-item .dot { width: 12px; height: 12px; border-radius: 4px; flex: 0 0 12px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.side-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-item .count.done { color: var(--ok); font-weight: 600; }

.main { flex: 1; min-width: 0; padding: 22px 26px 80px; transition: margin-right .3s ease; }
body.editing .main { margin-right: var(--editor); }

.banner {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; margin-bottom: 18px; border-radius: 12px;
  background: #fff6e0; border: 1px solid #f1dfae; font-size: 14px;
}
.banner span { flex: 1; }

.section { margin-bottom: 34px; scroll-margin-top: calc(var(--topbar) + 14px); animation: fadeUp .4s ease both; }
.sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.sec-head .swatch { width: 18px; height: 18px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.sec-head h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.sec-head .year { color: var(--muted); font-weight: 500; }
.sec-head .meta { color: var(--muted); font-size: 13px; }
.sec-head .btn { margin-left: auto; }
.sub-head { margin: 14px 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 16px; }
.thumb {
  position: relative; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: center;
  border-radius: 10px; transition: transform .18s ease;
}
.thumb canvas {
  width: 100%; height: auto; display: block; border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 4px 14px rgba(0,0,0,.08); transition: box-shadow .18s ease;
  background: #fff;
}
.thumb:hover { transform: translateY(-3px); }
.thumb:hover canvas { box-shadow: 0 2px 4px rgba(0,0,0,.1), 0 12px 26px rgba(0,0,0,.14); }
.thumb.selected canvas { box-shadow: 0 0 0 3px var(--accent), 0 12px 26px rgba(0,0,0,.14); }
.thumb .tlabel { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb .tick {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--ok); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; box-shadow: 0 0 0 2px var(--bg); transform: scale(0); transition: transform .25s cubic-bezier(.3,1.6,.5,1);
}
.thumb.done .tick { transform: scale(1); }
.thumb.flash canvas { animation: flash .6s ease; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(43,147,72,.6); } 100% { box-shadow: 0 0 0 10px rgba(43,147,72,0); } }

/* ---------- editor ---------- */
.editor {
  position: fixed; top: var(--topbar); right: 0; bottom: 0; width: var(--editor); z-index: 20;
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(0,0,0,.05);
  display: flex; flex-direction: column; animation: slideIn .28s ease both;
}
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.ed-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.ed-head .ttl { flex: 1; min-width: 0; }
.ed-head .ttl b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-head .ttl small { color: var(--muted); font-size: 12px; }
.ed-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.ed-preview {
  position: sticky; top: 0; z-index: 2;
  display: grid; place-items: center; padding: 18px 20px 14px; background:
  radial-gradient(circle at 50% 40%, #fff 0, #f2efe8 70%); border-bottom: 1px solid var(--line);
}
.ed-preview .pv-wrap { position: relative; width: min(240px, 62%); }
@media (max-height: 760px) { .ed-preview .pv-wrap { width: min(190px, 50%); } }
.ed-preview canvas {
  width: 100%; height: auto; display: block; border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12), 0 18px 40px rgba(0,0,0,.18);
}
.ed-preview canvas.draggable { cursor: grab; touch-action: none; }
.ed-preview canvas.dragging { cursor: grabbing; }
.ed-preview .hint { margin: 10px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.ed-form { padding: 16px 18px 30px; display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.field .note { font-size: 12px; color: var(--muted); }
.field input[type=text], .field input[type=number], .field textarea, .field select, .opt-grid input, .opt-grid select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 64px; line-height: 1.35; }
.field input:focus, .field textarea:focus, .field select:focus, .opt-grid input:focus, .opt-grid select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20,54,90,.12);
}
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.row .shrink { flex: 0 0 auto; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.color-row code { font-size: 13px; color: var(--muted); }
.fixed-box { background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.4; }
.fixed-box b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 3px; }
.photo-tools { display: grid; gap: 10px; }
.photo-tools input[type=range] { width: 100%; accent-color: var(--accent); }
.set-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.ed-foot { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 14px; }
.divider { height: 1px; background: var(--line); margin: 2px 0; }

/* ---------- dialogs ---------- */
.dialog {
  border: 0; padding: 0; border-radius: 18px; width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  box-shadow: 0 30px 80px rgba(0,0,0,.25); color: var(--ink);
}
.dialog[open] { animation: pop .22s ease both; }
.dialog::backdrop { background: rgba(25, 30, 38, .38); backdrop-filter: blur(3px); }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px 22px; margin: 0; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-size: 18px; }
.dlg-body { padding: 18px 22px 22px; overflow-y: auto; }
.opt-grid { display: grid; grid-template-columns: 1.2fr 2fr 1fr 1fr 1.4fr; gap: 10px; }
.opt-grid label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.opt-grid:not(.custom) .custom-size { display: none; }
.opt-grid:not(.custom) { grid-template-columns: 1.2fr 2fr 1.4fr; }
.spec { font-size: 13px; color: var(--muted); margin: 12px 0 16px; }
.export-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.export-item {
  display: grid; gap: 3px; text-align: left; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.export-item:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.export-item:active { transform: translateY(1px); }
.export-item span { font-size: 13px; color: var(--muted); }
.export-item .inline { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--ink); margin-top: 4px; cursor: pointer; }
.export-item.wide { grid-column: 1 / -1; border-color: var(--accent); background: #f5f8fc; }
.export-item.mock-item { background: linear-gradient(120deg, #fff6e0, #f5f8fc); border-color: #e7c98a; }
.export-item:disabled { opacity: .5; cursor: default; }
.export-progress { margin-top: 16px; display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.export-progress .bar { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.export-progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.muted { color: var(--muted); font-size: 14px; margin-top: 0; }
.project-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.project-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.project-list li.current { border-color: var(--accent); background: #f5f8fc; }
.project-list .pinfo { flex: 1; min-width: 0; }
.project-list .pinfo b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-list .pinfo small { color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #1f2328; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  transition: opacity .25s, transform .25s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- tablet / mobiel ---------- */
@media (max-width: 1180px) {
  :root { --editor: 400px; --side: 210px; }
  .progress .lbl { display: none; }
}
@media (max-width: 900px) {
  :root { --topbar: 56px; }
  .topbar { gap: 8px; padding: 0 10px; padding-top: env(safe-area-inset-top); height: calc(var(--topbar) + env(safe-area-inset-top)); }
  .brand span { display: none; }
  .project-name { flex: 1 1 auto; font-size: 15px; padding: 6px 6px; }
  .save-state { display: none; }
  .top-actions .btn span { display: none; }
  .top-actions .btn { padding: 0 10px; }
  .layout { display: block; }
  .sidebar {
    position: sticky; top: calc(var(--topbar) + env(safe-area-inset-top)); z-index: 15; width: auto; height: auto; display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden;
    padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--line); background: rgba(246,244,239,.94); backdrop-filter: blur(10px);
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .side-group { display: contents; }
  .seg { flex: 0 0 auto; margin: 0; border-radius: 20px; }
  .lang2 { flex: 0 0 auto; margin: 0; }
  .lang2 span { display: none; }
  .seg button { border-radius: 16px; padding: 5px 10px; }
  .side-group h3 { display: none; }
  .side-item { width: auto; flex: 0 0 auto; padding: 6px 10px; background: #fff; border: 1px solid var(--line); border-radius: 20px; font-size: 13px; }
  .side-item .name { max-width: 120px; }
  .main { padding: 14px 12px 60px; }
  body.editing .main { margin-right: 0; }
  .section { scroll-margin-top: calc(var(--topbar) + 60px); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; }
  .thumb .tlabel { font-size: 11px; }
  .sec-head h2 { font-size: 17px; }
  .editor {
    top: 0; left: 0; width: auto; z-index: 50; border-left: 0; animation: slideUp .3s ease both;
    padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
  }
  @keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .ed-preview { padding: 14px; }
  .ed-preview .pv-wrap { width: min(170px, 44vw); }
  .opt-grid, .opt-grid:not(.custom) { grid-template-columns: 1fr 1fr; }
  .export-list { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .progress span { font-size: 13px; }
  .progress svg { width: 24px; height: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- mockup (CSS 3D) ---------- */
.mk {
  position: fixed; inset: 0; z-index: 200; overflow: hidden; opacity: 0; transition: opacity .25s ease;
  --cw: clamp(70px, 10vw, 150px); --ch: calc(var(--cw) * var(--ratio, 1.397));
  --rx: 52deg; --rz: -18deg;
  background: radial-gradient(ellipse at 50% 28%, #4a3426 0%, #1d140e 55%, #0c0806 100%);
  color: #fff; user-select: none; -webkit-user-select: none;
}
.mk.show { opacity: 1; }
.mk[data-bg="dark"] { background: radial-gradient(ellipse at 50% 25%, #26324a 0%, #0d121c 60%, #05070b 100%); }
.mk[data-bg="light"] { background: radial-gradient(ellipse at 50% 25%, #ffffff 0%, #ece7de 60%, #d8d1c4 100%); color: var(--ink); }
.mk-bar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: linear-gradient(rgba(0,0,0,.35), transparent);
}
.mk[data-bg="light"] .mk-bar { background: linear-gradient(rgba(255,255,255,.7), transparent); }
.mk-bar b { font-size: 16px; margin-right: auto; }
.mk-bar select { border-radius: 8px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.12); color: inherit; padding: 6px 8px; font-size: 13px; }
.mk[data-bg="light"] .mk-bar select { border-color: var(--line); background: #fff; }
.mk-bar select option { color: #1f2328; }
.mk-bar .icon-btn { color: inherit; font-size: 26px; }
.mk-bar .btn { color: var(--ink); }
.mk-bar .icon-btn:hover { background: rgba(255,255,255,.15); }
.mk-hint { position: absolute; bottom: 10px; left: 0; right: 0; margin: 0; text-align: center; font-size: 12px; opacity: .6; padding-bottom: env(safe-area-inset-bottom); }
.mk-stage {
  position: absolute; inset: 40px 0 20px; display: grid; place-items: center;
  perspective: calc(var(--cw) * 11); perspective-origin: 50% 20%; cursor: grab; touch-action: none;
}
.mk-stage.drag { cursor: grabbing; }
.mk-spin, .mk-world { transform-style: preserve-3d; }
.mk-world { position: relative; width: 0; height: 0; transform: translateX(calc(var(--cw) * -.2)) translateY(calc(var(--ch) * .4)) rotateX(var(--rx)) rotateZ(var(--rz)); transition: transform .08s linear; }
.mk-world > * { position: absolute; transform-style: preserve-3d; }

.mk-table {
  left: calc(var(--cw) * -5); top: calc(var(--cw) * -3.6); width: calc(var(--cw) * 10); height: calc(var(--cw) * 7.4); border-radius: 18px;
  background:
    radial-gradient(ellipse at 42% 42%, rgba(255,236,200,.38), rgba(255,236,200,0) 55%),
    radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 45%, rgba(0,0,0,.55) 100%),
    repeating-linear-gradient(92deg, #8a5a36 0 7px, #966641 7px 15px, #7d512f 15px 19px, #93623c 19px 31px);
  box-shadow: 0 40px 80px rgba(0,0,0,.6);
}
.mk[data-bg="dark"] .mk-table {
  background: radial-gradient(ellipse at 42% 42%, rgba(160,190,255,.22), rgba(0,0,0,0) 55%), radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 40%, rgba(0,0,0,.6) 100%), #1b2333;
}
.mk[data-bg="light"] .mk-table {
  background: radial-gradient(ellipse at 42% 42%, rgba(255,255,255,.9), rgba(255,255,255,0) 60%), radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 50%, rgba(0,0,0,.12) 100%), #e9e3d8;
  box-shadow: 0 40px 80px rgba(0,0,0,.15);
}

.mk-card, .mk-layer { position: absolute; left: 0; top: 0; width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * .055); background: #fff; overflow: hidden; }
.mk-card img, .mk-layer img, .mk-top img { width: 100%; height: 100%; display: block; object-fit: cover; pointer-events: none; }
.mk-sheen {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(118deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.08) 28%, rgba(255,255,255,0) 50%, rgba(255,255,255,.1) 85%, rgba(255,255,255,.25) 100%);
}

/* doos */
.mk-box {
  --bw: calc(var(--cw) * var(--boxw, 2.1)); --bh: calc(var(--ch) * var(--boxh, 1.03)); --bd: calc(var(--cw) * .36);
  left: calc(var(--cw) * -3.5); top: calc(var(--ch) * -2.15); width: var(--bw); height: var(--bh);
  background: var(--box); transform: rotateZ(-6deg);
  box-shadow: calc(var(--cw) * .12) calc(var(--cw) * .2) calc(var(--cw) * .25) rgba(0,0,0,.55);
}
.mk-face { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.mk-top { width: var(--bw); height: var(--bh); transform: translateZ(var(--bd)); border-radius: 3px; overflow: hidden; box-shadow: inset 0 0 0 2px rgba(255,255,255,.15); }
.mk-side { background: linear-gradient(var(--box), color-mix(in srgb, var(--box) 70%, #000)); display: grid; place-items: center; overflow: hidden; }
.mk-s { width: var(--bw); height: var(--bd); transform: translateY(var(--bh)) translateZ(var(--bd)) rotateX(-90deg); }
.mk-n { width: var(--bw); height: var(--bd); transform: translateZ(var(--bd)) rotateX(-90deg); filter: brightness(.7); }
.mk-w { width: var(--bd); height: var(--bh); transform: translateZ(var(--bd)) rotateY(90deg); filter: brightness(.6); }
.mk-e { width: var(--bd); height: var(--bh); transform: translateX(var(--bw)) translateZ(var(--bd)) rotateY(90deg); filter: brightness(.85); }
.mk-label { color: var(--accent); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: calc(var(--cw) * .12); white-space: nowrap; }
.mk-e .mk-label { writing-mode: vertical-rl; }

/* stapel */
.mk-deck { left: calc(var(--cw) * -2.6); top: calc(var(--ch) * -.75); width: var(--cw); height: var(--ch); transform: rotateZ(9deg); }
.mk-layer { box-shadow: 0 0 0 .6px rgba(0,0,0,.22), 0 .5px 0 rgba(0,0,0,.15); }
.mk-layer:first-child { box-shadow: calc(var(--cw) * .06) calc(var(--cw) * .1) calc(var(--cw) * .14) rgba(0,0,0,.5); }

/* waaier */
.mk-loose { width: var(--cw); height: var(--ch); }
.mk-loose .mk-card { box-shadow: calc(var(--cw) * .03) calc(var(--cw) * .06) calc(var(--cw) * .1) rgba(0,0,0,.45); }
.mk-fan { left: calc(var(--cw) * .35); top: calc(var(--ch) * -.7); width: var(--cw); height: var(--ch); transform: rotateZ(-4deg); }
.mk-world > .mk-fan { transform-style: flat; }
.mk-fan .mk-card { transform-origin: 50% 125%; box-shadow: calc(var(--cw) * .03) calc(var(--cw) * .06) calc(var(--cw) * .1) rgba(0,0,0,.45); }

/* rechtopstaande kaart */
.mk-hero { left: calc(var(--cw) * -1.1); top: calc(var(--ch) * .2); width: var(--cw); height: var(--ch); transform: rotateZ(4deg); }
.mk-stand { transform-origin: 50% 100%; transform: rotateX(-74deg); box-shadow: 0 0 calc(var(--cw) * .25) rgba(255,230,180,.25); }
.mk-hero-shadow {
  position: absolute; left: 4%; width: 92%; top: 30%; height: 70%; border-radius: 30% 30% 6px 6px;
  background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,0)); filter: blur(5px); transform: translateY(18%) skewX(-8deg);
}
@media (max-width: 700px) {
  .mk { --cw: clamp(52px, 13vw, 100px); }
  .mk-world { margin-left: calc(var(--cw) * .9); }
  .mk-bar { flex-wrap: wrap; }
}

/* inline mockup bovenaan de kaartenlijst */
.mk.mk-inline {
  position: relative; inset: auto; z-index: 1; opacity: 1; height: clamp(230px, 34vw, 400px); margin-bottom: 26px;
  border-radius: 18px; box-shadow: var(--shadow); --cw: clamp(40px, 6.4vw, 96px);
}
.mk-inline .mk-bar { padding: 10px 12px; gap: 8px; }
.mk-inline .mk-bar b { font-size: 14px; }
.mk-inline .mk-stage { inset: 0; cursor: default; }
.mk-inline .mk-world { transition: none; }
body.editing .mk.mk-inline { --cw: clamp(38px, 4.6vw, 80px); }
@media (max-width: 900px) {
  .mk.mk-inline { height: 210px; --cw: clamp(30px, 10.5vw, 60px); border-radius: 14px; margin-bottom: 16px; }
  .mk-inline .mk-bar select { display: none; }
  .mk-inline .mk-bar .btn { height: 28px; padding: 0 9px; font-size: 12px; }
}

.grid .thumb.thumb-wide { grid-column: span 2; max-width: 320px; }
.mk-inline .mk-world { transform: translateX(calc(var(--cw) * -.7)) translateY(calc(var(--ch) * -.05)) rotateX(var(--rx)) rotateZ(var(--rz)); }
@media (max-width: 900px) { .mk-inline .mk-world { margin-left: 0; transform: translateX(calc(var(--cw) * -.4)) translateY(calc(var(--ch) * .05)) rotateX(var(--rx)) rotateZ(var(--rz)); } }

/* direct bewerken in de preview */
.pv-pop {
  position: absolute; left: 0; right: 0; margin: 0 auto; width: min(280px, calc(100% - 24px)); z-index: 5;
  background: #fff; border-radius: 12px; padding: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); display: grid; gap: 6px;
  animation: pop .15s ease both;
}
.pv-pop label { font-size: 12px; font-weight: 600; color: var(--muted); }
.pv-pop input, .pv-pop textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; }
.pv-pop input:focus, .pv-pop textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20,54,90,.12); }
.pv-pop-btns { display: flex; justify-content: flex-end; }
