
:root{
  --navy:#172f59;--text:#26384f;--muted:#718096;--line:#d9e4ef;
  --teal:#12aaa1;--soft:#f5f8fb;--danger:#c84f4f;
}
*{box-sizing:border-box}
html,body{margin:0;background:#eef2f5;color:var(--text);font-family:Arial,Helvetica,sans-serif}
button,select,input{font:inherit}
button{cursor:pointer}
.app{max-width:1180px;margin:0 auto;padding:15px}
.topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:13px}
.topbar h1{margin:0;color:var(--navy);font-size:26px}
.topbar p{margin:4px 0 0;color:var(--muted);font-size:13px}
.badge{background:#e8f7f5;color:#197e78;border-radius:999px;padding:6px 10px;font-size:11px;font-weight:700}
.layout{display:grid;grid-template-columns:276px minmax(0,1fr);gap:13px}
.sidebar{display:flex;flex-direction:column;gap:8px}
.panel{background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 5px 18px rgba(23,47,89,.045);overflow:hidden}
details.panel>summary{padding:11px 13px;color:var(--navy);font-size:14px;font-weight:800;cursor:pointer;list-style:none;position:relative}
details.panel>summary::-webkit-details-marker{display:none}
details.panel>summary::after{content:"+";position:absolute;right:13px;top:8px;font-size:20px;color:#8090a2}
details.panel[open]>summary::after{content:"−"}
details.panel[open]>summary{border-bottom:1px solid #edf1f5}
.panel-body{padding:12px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:8px}
label{font-size:11px;font-weight:700;color:#526176}
select,input[type=text]{width:100%;margin-top:4px;padding:8px;border:1px solid #cfdae5;border-radius:8px;background:#fff}
.field{display:block;margin-top:9px}
input[type=range]{width:100%;margin-top:6px}
input[type=color]{display:block;width:100%;height:35px;margin-top:5px;border:1px solid #cfdae5;border-radius:8px;background:#fff;padding:2px}
.button-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px}
.button-grid button,.tool-grid button,.align-row button,.action-panel button{
  border:1px solid #d6e0ea;border-radius:8px;background:#fff;color:var(--navy);font-weight:700;padding:8px 6px
}
.button-grid button:hover,.tool-grid button:hover,.align-row button:hover{border-color:var(--teal);background:#f2fbfa}
.sudoku-buttons{margin-top:8px}
.hint{margin:0 0 8px;color:var(--muted);font-size:11px;line-height:1.4}
.motif-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}
.motif{border:1px solid #dce5ee;border-radius:8px;background:#fff;padding:4px;color:var(--navy);overflow:hidden}
.motif:hover{border-color:var(--teal);box-shadow:0 3px 10px rgba(18,170,161,.12)}
.motif img{display:block;width:100%;aspect-ratio:1/1;object-fit:contain;background:#fff;border-radius:5px}
.motif span{display:block;padding:3px 1px 1px;font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tool-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:10px}
.align-row{display:grid;grid-template-columns:repeat(3,1fr);gap:5px;margin-top:8px}
.danger{color:var(--danger)!important}
.action-panel{padding:10px;display:grid;grid-template-columns:1fr 1fr;gap:7px}
.primary{background:var(--navy)!important;color:#fff!important;border-color:var(--navy)!important}
.workspace{min-width:0;background:#fff;border:1px solid var(--line);border-radius:12px;overflow:hidden;box-shadow:0 5px 18px rgba(23,47,89,.045)}
.workspace-bar{display:flex;justify-content:space-between;gap:12px;padding:10px 13px;border-bottom:1px solid var(--line);font-size:11px;color:var(--muted)}
.workspace-bar strong{color:var(--navy)}
.page-stage{padding:15px;background:#e7ecf1;overflow:auto;min-height:650px;text-align:center}
.page{position:relative;margin:0 auto;background:#fff;box-shadow:0 8px 28px rgba(0,0,0,.14);overflow:hidden;transform-origin:top center;zoom:.50;text-align:left}
.page.a4.portrait{width:794px;height:1123px}
.page.a4.landscape{width:1123px;height:794px}
.page.a3.portrait{width:1123px;height:1587px}
.page.a3.landscape{width:1587px;height:1123px}

.design-el{
  position:absolute;left:5%;top:5%;width:30%;cursor:move;transform-origin:center center;
  user-select:none;touch-action:none;
}
.design-el.selected{outline:3px solid rgba(18,170,161,.85);outline-offset:3px}
.design-el img,.design-el svg,.design-el canvas{display:block;width:100%;height:auto;pointer-events:none}
.design-el.text-el{
  min-width:80px;padding:4px 6px;white-space:pre-wrap;line-height:1.22;color:var(--navy);
  font-size:30px;font-family:"Trebuchet MS",Arial,sans-serif;font-weight:400
}
.design-el.heading-el{
  font-size:46px;font-family:"Trebuchet MS",Arial,sans-serif;font-weight:800;text-align:center
}
.design-el.text-el[contenteditable=true]{cursor:text;user-select:text;outline:2px dashed var(--teal);background:rgba(255,255,255,.9)}

.resize-handle{
  display:none;position:absolute;width:26px;height:26px;right:-16px;bottom:-16px;
  border-radius:50%;background:#fff;border:5px solid var(--teal);box-shadow:0 2px 7px rgba(0,0,0,.2);
  cursor:nwse-resize;z-index:99999;touch-action:none
}
.design-el.selected>.resize-handle{display:block}

.modal{position:fixed;inset:0;background:rgba(15,27,43,.45);display:flex;align-items:center;justify-content:center;padding:20px;z-index:10000}
.modal[hidden]{display:none}
.modal-card{width:min(430px,100%);background:#fff;border-radius:14px;padding:20px}
.modal-card h2{margin:0 0 14px;color:var(--navy)}
.modal-actions{display:flex;justify-content:flex-end;gap:7px;margin-top:14px}
.modal button{border:1px solid #d6e0ea;border-radius:8px;background:#fff;padding:8px 12px;font-weight:700}
@media(max-width:1000px){.layout{grid-template-columns:255px minmax(0,1fr)}.page{zoom:.42}}
@media(max-width:780px){.layout{grid-template-columns:1fr}.page{zoom:.38}.page-stage{min-height:500px}.topbar{align-items:flex-start;gap:10px}.workspace-bar{flex-direction:column}}
@media print{
  body{background:#fff}
  .topbar,.sidebar,.workspace-bar{display:none!important}
  .app,.layout,.workspace,.page-stage{display:block!important;margin:0!important;padding:0!important;border:0!important;box-shadow:none!important;background:#fff!important;max-width:none!important;overflow:visible!important}
  .page{zoom:1!important;box-shadow:none!important;margin:0!important}
  .design-el.selected{outline:0!important}
  .resize-handle{display:none!important}
  @page{margin:0}
}


/* V2.1: transparente Bausteine lassen sich dichter zusammenschieben */
.design-el:not(.text-el) {
  background: transparent !important;
}
.design-el img,
.design-el svg,
.design-el canvas {
  background: transparent !important;
}


/* =========================================================
   V2.2 – Design-Ebene wie beim Restaurant-Beispiel
   ========================================================= */

.subhead{
  margin:10px 0 6px;
  color:#7a8797;
  font-size:10px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.06em;
}

.design-preset-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:6px;
}
.design-preset-grid button{
  min-height:38px;
  border:1px solid #d6e0ea;
  border-radius:8px;
  color:#fff;
  font-size:10px;
  font-weight:900;
  letter-spacing:.02em;
}
.preset.brush{
  clip-path:polygon(4% 18%,94% 5%,100% 28%,96% 86%,6% 100%,0 68%);
}
.preset.green{background:#8ca180}
.preset.orange{background:#dda02d}
.preset.red{background:#cf654c}
.banner-preview{
  background:#fff8e9;
  color:#172f59!important;
  clip-path:polygon(8% 15%,92% 15%,100% 50%,92% 85%,8% 85%,0 50%);
}

.toggle-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:6px;
  margin:8px 0;
}
.check{
  display:flex;
  align-items:center;
  gap:6px;
  min-height:32px;
  padding:6px 8px;
  border:1px solid #dce5ee;
  border-radius:8px;
  background:#f8fafc;
}
.check input{margin:0}

.design-el.shape-el{
  min-width:30px;
  min-height:30px;
  background:transparent;
}
.design-el.shape-el .shape-body{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  background:var(--shape-fill,#fff8ee);
  border:var(--shape-stroke-width,2px) var(--shape-border-style,solid) var(--shape-stroke,#172f59);
  border-radius:var(--shape-radius,18px);
  pointer-events:none;
}
.design-el.shape-el.shape-frame .shape-body{
  background:transparent;
}
.design-el.shape-el.shape-speech .shape-body::after{
  content:"";
  position:absolute;
  left:14%;
  bottom:-20px;
  width:34px;
  height:34px;
  background:inherit;
  border-left:inherit;
  border-bottom:inherit;
  transform:skew(-18deg) rotate(-30deg);
}
.design-el.shape-el.shape-divider .shape-body{
  border:0;
  border-radius:0;
  clip-path:polygon(0 22%,96% 4%,100% 72%,5% 100%);
}

.design-el.deco-el svg{
  width:100%;
  height:100%;
  overflow:visible;
}

.design-el.text-el.style-brush-green,
.design-el.text-el.style-brush-orange,
.design-el.text-el.style-brush-red{
  color:#fff!important;
  font-weight:800;
  text-align:center;
  padding:10px 18px!important;
  clip-path:polygon(3% 20%,95% 7%,100% 34%,96% 84%,7% 100%,0 70%);
}
.design-el.text-el.style-brush-green{background:#8ca180!important}
.design-el.text-el.style-brush-orange{background:#dda02d!important}
.design-el.text-el.style-brush-red{background:#cf654c!important}

.design-el.text-el.style-banner{
  background:#fff8e8!important;
  color:#26384f!important;
  text-align:center;
  padding:10px 28px!important;
  clip-path:polygon(8% 8%,92% 8%,100% 50%,92% 92%,8% 92%,0 50%);
  border:0!important;
}
.design-el.text-el.style-pill{
  border-radius:999px!important;
  text-align:center;
  padding:10px 18px!important;
}

.design-el.logo-text{
  font-family:"Brush Script MT","Segoe Script",cursive;
  font-size:68px;
  font-weight:500;
  color:#111;
  text-align:center;
  line-height:1;
}

#heightControl{margin-top:4px}
.shape-options{margin-top:8px;padding-top:8px;border-top:1px solid #edf1f5}
.text-options{margin-top:8px;padding-top:8px;border-top:1px solid #edf1f5}


/* ===== V3 ===== */
.template-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:7px;
}
.template-grid button{
  min-height:42px;
  border:1px solid #d6e0ea;
  border-radius:9px;
  background:#fff;
  color:#172f59;
  font-weight:800;
  padding:8px;
}
.template-grid button:hover{
  border-color:#12aaa1;
  background:#f3fbfa;
}

/* Wichtig: Bibliotheksbilder und Rätsel haben KEINEN weißen Objekt-Hintergrund */
.design-el.library-image,
.design-el.sudoku-el,
.design-el.tictactoe-el,
.design-el.deco-el{
  background:transparent!important;
}
.design-el.library-image img{
  background:transparent!important;
}

/* SVGs transparent */
.design-el svg{
  background:transparent!important;
}

/* Speisekartenblock */
.menu-block{
  background:#fffaf3;
  border:2px dashed #899887;
  border-radius:24px;
  padding:18px 20px;
  color:#26384f;
  font-family:"Trebuchet MS",Arial,sans-serif;
}
.menu-block h3{
  margin:0 0 10px;
  color:#172f59;
  font-size:28px;
  text-align:center;
}
.menu-row{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin:8px 0;
  padding-bottom:6px;
  border-bottom:1px dotted #d7cdbf;
  font-size:20px;
}
.menu-row small{display:block;color:#718096;font-size:13px}
.review-block{
  background:#fffaf3;
  border:2px dashed #8ca180;
  border-radius:24px;
  padding:18px;
  text-align:center;
  font-family:"Trebuchet MS",Arial,sans-serif;
}
.review-block h3{
  margin:0 0 8px;
  color:#cf654c;
  font-size:26px;
}
.activity-title{
  display:inline-block;
  color:#fff;
  background:#dda02d;
  padding:10px 24px;
  font-size:26px;
  font-weight:900;
  text-align:center;
  clip-path:polygon(3% 20%,95% 7%,100% 34%,96% 84%,7% 100%,0 70%);
}
.footer-block{
  background:#8ca180;
  color:#fff;
  padding:10px 18px;
  border-radius:8px;
  font-size:20px;
  font-weight:700;
  text-align:center;
}
.chef-card{
  width:100%;
  height:100%;
}


/* =========================================================
   V3.1 Korrekturen
   ========================================================= */

/* Direkte Texteingabe in der Vorschau */
.design-el.text-el[contenteditable="true"],
.design-el [contenteditable="true"]{
  cursor:text!important;
  user-select:text!important;
}
.design-el.html-block [contenteditable="true"]{
  outline:none;
  cursor:text;
}
.design-el.html-block [contenteditable="true"]:focus{
  outline:2px dashed #12aaa1;
  outline-offset:2px;
  background:rgba(255,255,255,.7);
}

/* Koch ist ein transparentes PNG und darf keinen Kasten bekommen */
.design-el.chef-image,
.design-el.chef-image img{
  background:transparent!important;
}

/* Neue saubere Sprechblase */
.speech-bubble-clean{
  position:relative;
  width:100%;
  height:100%;
  background:#fffaf2;
  border:4px solid #111;
  border-radius:50%;
}
.speech-bubble-clean:after{
  content:"";
  position:absolute;
  left:18%;
  bottom:-13%;
  width:22%;
  height:28%;
  background:#fffaf2;
  border-left:4px solid #111;
  border-bottom:4px solid #111;
  transform:skew(-20deg) rotate(-18deg);
}

/* Starter-Vorlagen: genügend Rand, nichts wird abgeschnitten */
.page .design-el{
  max-width:96%;
}


/* =========================================================
   V3.2 – Layout und Bewertungsbereich
   ========================================================= */

.review-block{
  min-height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  padding:18px 18px 16px;
  overflow:hidden;
}

.review-block .review-text{
  width:100%;
  text-align:center;
}

.review-block .qr-dropzone{
  margin-top:auto;
  width:118px;
  height:118px;
  border:2px dashed #cf654c;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:#718096;
  font-size:12px;
  background:rgba(255,255,255,.38);
}

.review-block .qr-dropzone strong{
  display:block;
  color:#172f59;
  font-size:13px;
  margin-bottom:3px;
}

.design-el.html-block{
  min-width:90px;
  min-height:55px;
  background:transparent!important;
}

.design-el.html-block > .menu-block,
.design-el.html-block > .review-block,
.design-el.html-block > .footer-block{
  width:100%;
  height:100%;
}

/* größere, präsente Kochfigur unten rechts */
.design-el.chef-image{
  z-index:7;
}

/* Footer soll am Seitenende wirken, nicht mitten im Layout */
.footer-block{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100%;
  line-height:1.2;
}

/* dezente Rasterhilfe nur im Editor */
.page.snap-guides{
  background-image:
    linear-gradient(to right, rgba(23,47,89,.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(23,47,89,.025) 1px, transparent 1px);
  background-size:2% 2%;
}

/* V3.3: mehr Luft zum unteren Seitenrand */
.footer-block{
  box-shadow:none;
}


/* =========================================================
   V3.4 – Speisekarten-Icons & feinere Startpositionen
   ========================================================= */

.food-icon-grid{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:6px;
  margin-bottom:10px;
}
.food-icon-btn{
  border:1px solid #d6e0ea;
  border-radius:8px;
  background:#fff;
  padding:5px;
  color:#172f59;
  font-weight:700;
  font-size:9px;
}
.food-icon-btn img{
  display:block;
  width:100%;
  height:54px;
  object-fit:contain;
  background:transparent;
}
.food-icon-btn span{
  display:block;
  margin-top:2px;
}

/* Menü mit echten Food-Icons */
.menu-row{
  align-items:center;
  gap:8px;
}
.menu-row-icon{
  flex:0 0 38px;
  width:38px;
  height:38px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.menu-row-icon img{
  max-width:38px;
  max-height:38px;
  width:auto;
  height:auto;
  object-fit:contain;
  background:transparent!important;
}
.menu-row-copy{
  min-width:0;
  flex:1 1 auto;
}
.menu-row-price{
  flex:0 0 auto;
  white-space:nowrap;
}

/* Koch darf optisch wirklich in der rechten unteren Ecke sitzen */
.design-el.chef-image{
  z-index:8;
}

/* Das 3x3-Hundebild bleibt vollständig im Blatt */
.design-el.odd-dogs{
  overflow:visible;
}


/* =========================================================
   V3.5 – echte Asset-Vorschauen, beweglicher Footer, PDF sauber
   ========================================================= */

.asset-button-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:7px;
  margin-bottom:10px;
}
.asset-btn{
  display:flex;
  align-items:center;
  gap:8px;
  min-height:62px;
  border:1px solid #d6e0ea;
  border-radius:10px;
  background:#fff;
  color:#172f59;
  font-weight:800;
  padding:7px 8px;
  text-align:left;
}
.asset-btn:hover{
  border-color:#12aaa1;
  background:#f3fbfa;
}
.asset-btn img{
  flex:0 0 50px;
  width:50px;
  height:48px;
  object-fit:contain;
  background:transparent!important;
}
.asset-btn span{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Footer ist ein normales Designer-Objekt und kann überall angefasst werden */
.design-el.footer-el{
  cursor:move;
}
.design-el.footer-el .footer-block{
  cursor:inherit;
  pointer-events:auto;
}
.design-el.footer-el .footer-block[contenteditable="true"]{
  cursor:text;
}

/* Koch darf groß am unteren rechten Rand stehen */
.design-el.chef-image{
  transform-origin:center center;
}

/* Im PDF keine Editor-Hilfen */
body.exporting .resize-handle,
body.exporting .design-el.selected{
  display:none!important;
  outline:none!important;
}
body.exporting .page{
  background-image:none!important;
}

/* Das Editor-Raster nicht auf der eigentlichen Seite anzeigen:
   Preview und PDF sehen dadurch gleich aus. */
.page.snap-guides{
  background-image:none!important;
}
