/* Lackierungseditor – dieselben Farben und Schrift wie der Streckeneditor (Tools/geo/abstecken/vorlage/stil.css).
   Schrift selbst ausgeliefert (keine IP-Adresse an Dritte), Lizenz schrift/OFL.txt. Zuerst schmal, breiter als Erweiterung. */
@font-face{font-family:"Barlow";font-style:normal;font-weight:400;font-display:swap;src:url(schrift/barlow-400.woff2) format("woff2")}
@font-face{font-family:"Barlow";font-style:normal;font-weight:500;font-display:swap;src:url(schrift/barlow-500.woff2) format("woff2")}
@font-face{font-family:"Barlow";font-style:normal;font-weight:600;font-display:swap;src:url(schrift/barlow-600.woff2) format("woff2")}
@font-face{font-family:"Barlow Condensed";font-style:normal;font-weight:600;font-display:swap;src:url(schrift/barlow-condensed-600.woff2) format("woff2")}
:root{
  --grund:#22262a; --feld:#2d3237; --rand:#434a51; --schrift:#f1f2ee; --leise:#a9b0b6;
  --pflock:#ff8a1f; --auf-farbe:#1c1206; --pflock-zart:rgba(255,138,31,.10);
  --buehne-grund:#16191c; --buehne-schrift:#f1f2ee; --buehne-leise:#c9ced2; --ueberlage:rgba(16,18,20,.78);
  --umriss:#ffffff; --umriss-schatten:rgba(0,0,0,.65); --vorlage-umriss:rgba(255,255,255,.55);
  --gefahr:#b3261e; --fehler:#ff6b5e; --erfolg:#30d158; --hover:rgba(127,127,127,.08); --kontur:rgba(0,0,0,.45);
  --schatten:0 6px 20px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: light){
  :root:not([data-theme="dark"]){ --grund:#eceee9; --feld:#ffffff; --rand:#c9cec8; --schrift:#1c2023; --leise:#5c656c; --fehler:#c62828; --buehne-grund:#d9dcd7; --pflock-zart:rgba(255,138,31,.14); }
}
:root[data-theme="light"]{ --grund:#eceee9; --feld:#ffffff; --rand:#c9cec8; --schrift:#1c2023; --leise:#5c656c; --fehler:#c62828; --buehne-grund:#d9dcd7; --pflock-zart:rgba(255,138,31,.14); }
:root[data-theme="dark"]{ --grund:#22262a; --feld:#2d3237; --rand:#434a51; --schrift:#f1f2ee; --leise:#a9b0b6; --buehne-grund:#16191c; }
*,*::before,*::after{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;min-height:100%}
body{background:var(--grund);color:var(--schrift);font-family:"Barlow",system-ui,-apple-system,"Segoe UI",sans-serif;font-size:16px;line-height:1.4;-webkit-text-size-adjust:100%}
button,input,select,textarea{font:inherit;color:inherit}
h1,h2{font-family:"Barlow Condensed","Barlow",sans-serif;font-weight:600;letter-spacing:.01em}
h1{font-size:28px;margin:0 0 6px}
h2{font-size:20px;margin:0 0 10px}
a{color:var(--pflock)}
.leise{color:var(--leise)}
.klein{font-size:14px}
.unsichtbar{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
:focus-visible{outline:2px solid var(--pflock);outline-offset:2px}

.knopf{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:40px;padding:7px 12px;border:1px solid var(--rand);border-radius:6px;background:var(--feld);cursor:pointer;text-decoration:none;white-space:nowrap}
.knopf:hover{border-color:var(--leise)}
.knopf:disabled{opacity:.45;cursor:default}
.knopf[aria-pressed="true"],.knopf[aria-checked="true"]{border-color:var(--pflock);box-shadow:inset 0 -3px 0 var(--pflock)}
.knopf.primaer{background:var(--pflock);border-color:var(--pflock);color:var(--auf-farbe);font-weight:600}
.knopf.gefahr{border-color:var(--gefahr)}
.knopf.klein{min-height:34px;padding:4px 10px}
.knopf.symbol{flex:0 0 auto;width:40px;height:40px;padding:0}
.knopf.symbol svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.segment{display:flex;border:1px solid var(--rand);border-radius:6px;overflow:hidden;width:max-content;max-width:100%}
.segment .knopf{border:0;border-radius:0;min-height:38px;padding:6px 10px}
.segment .knopf + .knopf{border-left:1px solid var(--rand)}
.segment.umbruch{flex-wrap:wrap;width:auto}
.segment.umbruch .knopf{flex:1 1 auto}
.reihe{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0}
.felder{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:8px 0}
.felder input[type=text]{flex:1 1 180px;min-width:0;min-height:40px;padding:6px 8px;border:1px solid var(--rand);border-radius:6px;background:var(--feld);font-family:ui-monospace,Consolas,monospace;font-size:14px}
.felder.raster{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:8px}
.felder.raster label{display:flex;flex-direction:column;gap:3px;font-size:14px;color:var(--leise)}
.felder.raster input[type=text]{flex:none;min-height:40px;font-family:inherit;font-size:16px;color:var(--schrift)}
.felder input[type=number],.felder select,.zahlzeile input{min-height:38px;padding:5px 8px;border:1px solid var(--rand);border-radius:6px;background:var(--feld);color:var(--schrift)}
.hinweis{padding:10px 12px;border:1px solid var(--rand);border-left:3px solid var(--pflock);border-radius:6px;background:var(--pflock-zart);margin:0 0 14px}
.codebox{margin:14px 0}
.codebox summary{cursor:pointer;color:var(--leise);padding:6px 0}

/* Auswahl */
.oben{border-bottom:1px solid var(--rand)}
.oben-innen{max-width:1200px;margin:0 auto;padding:10px 16px;display:flex;align-items:center;gap:12px;font-size:15px;list-style:none}
.oben-innen a.heim{display:inline-flex;align-items:center;gap:4px;color:var(--schrift);text-decoration:none;font-weight:500}
.oben-innen svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.oben-innen .leise::before{content:"/";margin-right:12px;color:var(--rand)}
.inhalt{max-width:1200px;margin:0 auto;padding:20px 16px 48px}
.einleitung{max-width:68ch;margin:0 0 24px}
#eigene{margin-bottom:28px}
.kacheln{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,230px),1fr));gap:10px;margin-bottom:28px}
.kachel{display:flex;flex-direction:column;gap:6px;padding:0 0 12px;border:1px solid var(--rand);border-radius:8px;background:var(--feld);overflow:hidden}
.kachel .bild{display:block;width:100%;aspect-ratio:16/9;object-fit:contain;background:var(--buehne-grund)}
.kachel .kname{padding:0 12px;font-weight:600;font-size:17px}
.kachel .kunter{padding:0 12px;font-size:14px;color:var(--leise)}
.kachel .varianten{display:flex;flex-wrap:wrap;gap:6px;padding:2px 12px 0}
.kachel .varianten .knopf{min-height:36px}

/* Editor: schmal Bühne oben, Tafel darunter; breit nebeneinander */
#editor{display:flex;flex-direction:column;min-height:100vh;min-height:100dvh}
#buehne{position:sticky;top:0;z-index:2;height:min(46vh,440px);background:var(--buehne-grund);touch-action:none;overflow:hidden;user-select:none;-webkit-user-select:none}
#leinwand{position:absolute;inset:0;width:100%;height:100%;display:block;cursor:grab}
#buehne.ziehen #leinwand{cursor:grabbing}
#umrisse{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}
#umrisse .vorlage{fill:none;stroke:var(--vorlage-umriss);stroke-width:1;stroke-dasharray:4 4}
#umrisse .eigen{fill:transparent;stroke:var(--umriss);stroke-width:1.5;filter:drop-shadow(0 0 1px var(--umriss-schatten))}
#umrisse .gewaehlt{stroke:var(--pflock);stroke-width:2.5}
#umrisse .griff{fill:var(--pflock);stroke:#fff;stroke-width:1.5}
#umrisse .linie{stroke:var(--pflock);stroke-width:1.5}
.buehne-oben{position:absolute;left:8px;right:8px;top:8px;display:flex;justify-content:center;pointer-events:none}
.buehne-oben .segment{pointer-events:auto;background:var(--ueberlage);border-color:rgba(255,255,255,.18);overflow-x:auto;scrollbar-width:none}
.buehne-oben .segment .knopf{background:none;color:var(--buehne-schrift);min-height:36px;padding:5px 9px;font-size:15px}
.buehne-oben .segment .knopf + .knopf{border-left-color:rgba(255,255,255,.18)}
.buehne-hinweis{position:absolute;left:8px;right:8px;bottom:8px;margin:0;text-align:center;font-size:13px;color:var(--buehne-leise);text-shadow:0 1px 2px rgba(0,0,0,.8);pointer-events:none}
.rechnet{position:absolute;right:10px;bottom:30px;margin:0;padding:3px 9px;border-radius:12px;background:var(--ueberlage);color:var(--buehne-schrift);font-size:13px}
#tafel{flex:1 1 auto;background:var(--grund)}
.tafel-kopf{display:flex;align-items:center;gap:8px;padding:10px 12px;border-bottom:1px solid var(--rand)}
.tafel-kopf .titel{flex:1 1 auto;min-width:0}
.tafel-kopf h1{font-size:22px;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tafel-kopf p{margin:0;font-size:14px}
.tafel-inhalt{padding:14px 16px 40px}
.abschnitt{padding:0 0 18px;margin:0 0 18px;border-bottom:1px solid var(--rand)}
.abschnitt:last-child{border-bottom:0}
.vorlagen{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.vorlage{display:flex;flex-direction:column;align-items:center;gap:4px;padding:6px 4px;border:1px solid var(--rand);border-radius:8px;background:var(--feld);cursor:pointer;font-size:13px;min-width:0}
.vorlage svg{width:100%;height:auto;max-width:96px}
.vorlage[aria-checked="true"]{border-color:var(--pflock);box-shadow:inset 0 -3px 0 var(--pflock)}
.farbzeile{display:flex;gap:10px;align-items:flex-start;margin:8px 0}
.farbname{flex:0 0 64px;padding-top:8px;font-weight:500}
.farben{display:flex;flex-wrap:wrap;gap:6px}
.farbe{width:38px;height:38px;padding:4px;border:1px solid var(--rand);border-radius:8px;background:var(--feld);cursor:pointer}
.farbe span{display:block;width:100%;height:100%;border-radius:5px;border:1px solid var(--kontur)}
.farbe[aria-checked="true"]{border-color:var(--pflock);box-shadow:0 0 0 2px var(--pflock)}
.farbe.text{width:auto;padding:4px 10px;font-size:14px}
.farbe.eigen{position:relative;overflow:hidden}
.farbe.eigen input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;border:0;padding:0}
.farbe.eigen span{background:conic-gradient(#ff453a,#ffd60a,#30d158,#40c8e0,#4c95ff,#bf5af2,#ff453a)}
.zahlzeile{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-top:10px}
.zahlzeile label{font-weight:500;margin-right:4px}
.zahlzeile input{width:80px;text-align:center}
.schalter{display:flex;align-items:center;gap:8px;margin:4px 0 10px;font-size:15px;cursor:pointer}
.schalter input{width:18px;height:18px;accent-color:var(--pflock)}
.formenliste{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}
.formenliste button{width:100%;display:flex;align-items:center;gap:10px;min-height:40px;padding:6px 10px;border:1px solid var(--rand);border-radius:6px;background:var(--feld);cursor:pointer;text-align:left}
.formenliste button[aria-pressed="true"]{border-color:var(--pflock);box-shadow:inset 3px 0 0 var(--pflock)}
.formenliste .muster{flex:0 0 18px;height:18px;border-radius:4px;border:1px solid var(--kontur)}
.formenliste .wo{margin-left:auto;color:var(--leise);font-size:14px}
.formtafel{margin-top:10px;padding:12px;border:1px solid var(--rand);border-radius:8px;background:var(--hover)}
#code{color:var(--leise)}
.schalter.oben-buendig{align-items:flex-start}
.schalter.oben-buendig input{margin-top:3px;flex:0 0 auto}
.paypal{margin-top:12px;max-width:420px}
.auftraege{list-style:none;margin:6px 0 0;padding:0;display:flex;flex-direction:column;gap:4px;font-size:14px}
.auftraege li{display:flex;gap:10px;flex-wrap:wrap;padding:6px 10px;border:1px solid var(--rand);border-radius:6px;background:var(--feld)}
.auftraege .nr{font-family:ui-monospace,Consolas,monospace;color:var(--leise)}
.auftraege .st{margin-left:auto;font-weight:600}
#uStand.fehler{color:var(--fehler)}
h3{font-size:16px;margin:12px 0 4px}
.meldung{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);z-index:9;max-width:calc(100% - 32px);margin:0;padding:10px 14px;border-radius:8px;background:#16181a;color:#f1f2ee;border:1px solid #444;box-shadow:var(--schatten)}

@media (min-width:900px){
  #editor{flex-direction:row;height:100vh;height:100dvh;min-height:0}
  #buehne{position:relative;flex:1 1 auto;height:auto}
  #tafel{flex:0 0 420px;display:flex;flex-direction:column;border-left:1px solid var(--rand);min-height:0}
  .tafel-inhalt{flex:1 1 auto;overflow-y:auto}
  .buehne-oben{top:14px}
}
@media (max-width:380px){
  .vorlagen{grid-template-columns:repeat(2,1fr)}
}
