:root{font-family:system-ui,-apple-system,Arial,sans-serif;color:#17263c;background:#edf1f5}*{box-sizing:border-box}body{margin:0;height:100dvh;display:flex;flex-direction:column;overflow:hidden}button,select,input{font:inherit}button{cursor:pointer;border:1px solid #ccd5df;border-radius:9px;background:white;color:#22334b;padding:8px 12px}button:active{transform:scale(.97)}header{height:56px;display:flex;align-items:center;gap:8px;padding:6px 10px;background:#17263c;color:white}header button{background:#2c415b;color:white;border:0;font-size:22px;min-width:40px}header input{background:#263d57;color:white;border:1px solid #52657b;border-radius:6px;padding:7px;min-width:80px;width:180px}header strong{white-space:nowrap}.grow{flex:1}main{flex:1;min-height:0;display:flex}aside{width:59px;background:#fff;border-right:1px solid #d8dfe7;display:flex;flex-direction:column;align-items:center;gap:7px;padding:9px 4px;overflow-y:auto}aside button{width:46px;height:46px;font-size:26px;padding:0}aside button.active{background:#d8eafb;border-color:#367cb9;color:#1267a6}#workspace{position:relative;flex:1;min-width:0;overflow:hidden;touch-action:none;background:#dfe5eb}canvas{display:block;width:100%;height:100%;touch-action:none}#status{position:absolute;bottom:10px;right:12px;padding:5px 9px;border-radius:8px;background:#ffffffd9;font-size:12px;pointer-events:none}footer{display:flex;gap:14px;align-items:center;flex-wrap:wrap;padding:7px 12px;background:#fff;border-top:1px solid #d8dfe7;min-height:54px}footer label{display:flex;align-items:center;gap:6px;font-size:13px}input[type=color]{width:34px;height:32px;padding:1px;border:0;background:transparent}input[type=range]{width:90px}dialog{border:0;border-radius:16px;box-shadow:0 10px 60px #0004;max-width:min(440px,94vw);width:100%;color:#17263c}dialog::backdrop{background:#17263c88}dialog h2{margin-top:0}.buttons{display:grid;grid-template-columns:1fr 1fr;gap:8px}.hint{font-size:13px;line-height:1.5;color:#58677b}#close,#closeprojects{margin-top:12px;width:100%}.project{display:flex;gap:8px;align-items:center;padding:7px 0;border-bottom:1px solid #ddd}.project button:first-child{flex:1;text-align:left;overflow:hidden;text-overflow:ellipsis}@media(max-width:650px){header strong{display:none}header input{width:120px}footer{gap:7px;padding:5px}footer label{font-size:12px}aside{width:51px}aside button{width:41px;height:41px}}
#pagebar{display:flex;align-items:center;gap:7px;padding:6px;background:#e7edf4;border-top:1px solid #c9d5e0;overflow-x:auto;flex-shrink:0}#pagelist{display:flex;gap:5px;align-items:center}#pagebar button{white-space:nowrap;font-size:12px;padding:7px 9px}#pagelist button.current{background:#c9e4fc;border-color:#3884c1;font-weight:700}#photolock{font-size:12px;padding:6px}footer{max-height:100px;overflow-y:auto}#status{max-width:75%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

aside button{height:53px;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:1px;font-size:23px}aside button small{font-size:9px;line-height:1.1;font-weight:600}aside button svg{width:31px;height:29px}#finishwall{background:#d8eafb;border-color:#367cb9}.checkpick{display:flex;align-items:center;gap:4px;font-size:12px;white-space:nowrap}.checkpick select{max-width:112px;font-size:12px;padding:5px}.numberpad{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:14px 0}.numberpad button{font-size:22px;padding:12px}.dialogactions{display:flex;gap:8px;justify-content:flex-end}#numberinput{font-size:24px;padding:10px;width:100%}@media(max-height:700px){aside button{height:45px}aside button small{font-size:8px}}

.camerabutton{display:inline-flex;align-items:center;justify-content:center;min-height:32px;padding:4px 10px;border:1px solid #a8b6c9;border-radius:6px;background:#f4f7fb;color:#17263c;cursor:pointer;font:inherit}.camera-input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}

#textinput{width:100%;font:20px system-ui;padding:10px;margin-bottom:12px;border:1px solid #aab9c9;border-radius:8px;resize:vertical}#numberinput[readonly]{background:#f5f8fc;color:#17263c;cursor:default}

.toolpopup{border:1px solid #b9c7d8;border-radius:14px;padding:18px;max-width:min(92vw,380px);box-shadow:0 12px 36px #0004}.toolpopup::backdrop{background:#17263c66}.toolpopup h3{margin:0 0 15px}.shapegrid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-bottom:16px}.shapegrid button{min-height:74px;font-size:27px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px}.shapegrid small{font-size:12px}.colorgrid{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-bottom:18px}.colorgrid button{width:43px;height:43px;border-radius:50%;font-size:22px;cursor:pointer}#colordialog label{display:flex;align-items:center;gap:12px;margin-bottom:12px}#savecustomcolor{margin-bottom:10px}#shapesbutton.active{background:#d8eafb;border-color:#367cb9}

.textsettings{display:flex;gap:12px;flex-wrap:wrap;margin-bottom:12px}.textsettings label{flex:1;min-width:120px;font-size:13px}.textsettings input{width:100%;padding:8px;margin-top:4px;border:1px solid #aab9c9;border-radius:7px}

/* Version 1.5.0: Textfarben und Vorschau */
.textcolorsection{margin:8px 0 12px}.textcolorsection strong{display:block;margin-bottom:10px;font-size:14px}.textcolorsection .colorgrid{gap:7px;margin-bottom:8px}.textcolorsection .colorgrid button{width:36px;height:36px;font-size:17px}.textcustom{display:flex;align-items:center;gap:12px;font-size:13px}.textpreview{margin:10px 0;padding:10px;border:1px solid #d1dce9;border-radius:9px;background:#f4f7fb;max-height:115px;overflow:auto}.textpreview span{display:block;font-size:11px;color:#68778c;margin-bottom:5px}.textpreview #textpreviewvalue{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.25}#textdialog{max-height:90dvh;overflow-y:auto}

/* v1.5.1: kompakter Textdialog oben, Schieberegler plus Zahleneingabe */
#textdialog{position:fixed;top:max(8px,env(safe-area-inset-top));bottom:auto;margin:0 auto;left:0;right:0;max-height:min(75dvh,620px);overflow-y:auto;padding:14px 18px 12px;overscroll-behavior:contain}
#textdialog h2{font-size:19px;margin:0 0 8px}
#textinput{font-size:17px;min-height:58px;max-height:110px;margin-bottom:7px;padding:7px}
#textdialog .textsettings{gap:9px;margin-bottom:7px}
#textdialog .textsettings label{min-width:95px}
.textfontlabel{flex:2!important;min-width:170px!important}
.textfontcontrols{display:flex;align-items:center;gap:9px}
.textfontcontrols #textfont{width:66px;flex:0 0 66px}
.textfontcontrols #textfontrange{flex:1;min-width:65px;accent-color:#2677bd}
#textdialog .textcolorsection{margin:5px 0 7px}
#textdialog .textcolorsection strong{margin-bottom:5px}
#textdialog .textcolorsection .colorgrid{margin-bottom:4px;gap:5px}
#textdialog .textcolorsection .colorgrid button{width:31px;height:31px}
#textdialog .hint{font-size:11px;line-height:1.25;margin:5px 0 7px}
#textdialog .dialogactions{position:sticky;bottom:0;background:#fff;padding:7px 0 0;z-index:1}
@media(max-height:650px){#textdialog{max-height:72dvh}#textdialog .hint{display:none}}

/* v1.5.2: Stift-Einstellungen und vier Speicherplätze */
#pendialog{width:min(92vw,400px);max-height:82dvh;overflow-y:auto}
#pendialog>label{display:block;margin:12px 0;font-size:14px}
#pendialog select{display:block;width:100%;margin-top:6px;padding:9px}
.penwidthrow{display:flex;align-items:center;gap:10px;margin-top:7px}
.penwidthrow input[type=number]{width:78px;padding:8px}
.penwidthrow input[type=range]{flex:1;min-width:90px}
.penpresets{display:grid;gap:7px;margin:10px 0}
.penpreset{display:flex;gap:8px;align-items:center}
.penpresetuse{flex:1;display:flex;gap:9px;align-items:center;text-align:left;min-width:0;padding:9px}
.penpresetuse span:last-child{font-size:13px}
.penswatch{width:24px;height:24px;border:1px solid #8292a5;border-radius:50%;flex-shrink:0}
.penpreset>button:last-child{padding:9px;font-size:12px}

/* v1.5.3: kleines, nicht modales Stiftfenster wie Squid */
#pendialog{position:fixed;margin:0;width:min(310px,calc(100vw - 16px));max-width:calc(100vw - 16px);max-height:min(440px,calc(100dvh - 16px));padding:10px 12px;overflow:auto;border-radius:12px;box-shadow:0 8px 24px #0003}
#pendialog h3{font-size:15px;margin:0 0 8px;display:flex;justify-content:space-between;align-items:center}
#penx{font-size:21px;line-height:1;border:0;background:transparent;padding:0 5px}
#pendialog>label{margin:6px 0;font-size:12px}
#pendialog select{padding:5px;margin-top:3px;font-size:13px}
#pendialog .penwidthrow{margin-top:3px;gap:7px}
#pendialog .penwidthrow input[type=number]{width:58px;padding:5px}
#pendialog .hint{display:none}
#pendialog strong{font-size:12px}
#pendialog .penpresets{gap:3px;margin:5px 0}
#pendialog .penpreset{gap:5px}
#pendialog .penpresetuse{padding:5px}
#pendialog .penpresetuse span:last-child{font-size:12px}
#pendialog .penswatch{width:17px;height:17px}
#pendialog .penpreset>button:last-child{padding:5px;font-size:11px}
#pendialog .dialogactions{margin-top:4px}
#pendialog .dialogactions button{padding:5px 10px;font-size:12px}

/* v1.5.4: Squid-artiges Stiftmenü und reduzierte linke Werkzeugleiste */
footer{display:none!important}
#pendialog{width:252px;max-height:310px;padding:12px 11px 10px;overflow:visible}
#pendialog .penpopupclose{position:absolute;right:2px;top:0;font-size:18px;background:transparent;border:0;padding:3px 7px;opacity:.6}
.pentypeicons{display:flex;gap:6px;justify-content:space-between;padding:8px 0 1px}
#pendialog .pentypeicons button{width:48px;height:48px;padding:7px;border-radius:50%;border:1px solid #c5d1df;background:#fff;display:flex;align-items:center;justify-content:center;color:#344b66}
#pendialog .pentypeicons button.chosen{background:#d8eafb;border:2px solid #2677bd;color:#1267a6}
.pentypeicons svg{width:31px;height:31px}
#pentypelabel{font-size:11px;color:#53677f;text-align:center;min-height:16px;margin:4px 0 8px}
.penwidthvisual{position:relative;padding:5px 6px 19px;margin:0 2px 9px}
#pendialog #penwidthrange{width:100%;display:block;accent-color:#2677bd;cursor:pointer;margin:0}
.penwidthline{height:1px;background:#b3c3d5;position:relative;margin:7px 6px 0}
#penwidthdot{position:absolute;top:50%;transform:translate(-50%,-50%);background:#2677bd;border:1px solid white;border-radius:50%;min-width:4px;min-height:4px}
#pendialog .penpresets{display:flex;justify-content:space-around;gap:9px;margin:4px 0 0;padding:10px 3px 1px;border-top:1px solid #e3e9f0}
#pendialog .penpresetdot{border-radius:50%;width:42px;height:42px;flex:0 0 42px;padding:0;display:flex;align-items:center;justify-content:center;background:#fff;border:1px solid #becbda;touch-action:manipulation}
.presetstroke{width:25px;height:6px;background:var(--preset-color);border-radius:8px;transform:rotate(-30deg)}
#sidecolorswatch{width:27px;height:27px;border-radius:50%;display:block;border:1px solid #8796aa}
#wallsubmenu{font-size:20px;position:relative}
#wallsubmenu small{font-size:9px}
#wallflyout{position:fixed;z-index:100;display:flex;flex-direction:column;gap:5px;background:#fff;border:1px solid #bdcddd;box-shadow:0 6px 22px #0003;border-radius:10px;padding:7px}
#wallflyout[hidden]{display:none}
#wallflyout button{min-width:105px;text-align:left;padding:9px;font-size:13px}

[data-tool="wall"]{position:relative}[data-tool="wall"]:after{content:"◢";position:absolute;bottom:0;right:2px;font-size:9px;color:#3476a8}

/* v1.5.6: Vollflächige Zeichenfläche, schwebende Schnellbefehle und Projektmenü links */
body{position:relative}
#quickbar{position:fixed;z-index:60;top:max(7px,env(safe-area-inset-top));right:max(8px,env(safe-area-inset-right));height:auto;display:flex;gap:4px;padding:5px;background:rgba(245,248,252,.93);color:#17263c;border:1px solid #cbd6e2;border-radius:14px;box-shadow:0 3px 13px #17263c25;backdrop-filter:blur(6px)}
#quickbar button{background:transparent;color:#233c58;min-width:38px;height:38px;padding:3px 7px;border-radius:9px;font-size:23px}
#quickbar button:active{background:#d8eafb}
.projectname-store{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none;left:-9999px}
#projectmenu{font-size:23px}
#projectflyout{position:fixed;z-index:101;display:flex;flex-direction:column;gap:5px;background:#fff;border:1px solid #bdcddd;box-shadow:0 6px 22px #0003;border-radius:11px;padding:9px;width:min(230px,calc(100vw - 75px));max-height:calc(100dvh - 18px);overflow-y:auto}
#projectflyout[hidden]{display:none}
#projectflyout button{text-align:left;padding:9px;font-size:13px}
#projectflyout label{font-size:12px;font-weight:600;color:#52657b}
#projectnameedit{display:block;width:100%;font-size:14px;padding:8px;margin-top:5px;border:1px solid #c5d1df;border-radius:7px}

/* v1.5.7 – Stiftstärke, Skalen und synchronisierte Farben */
#pendialog{width:286px;max-height:min(480px,calc(100dvh - 16px));overflow-y:auto}
.penquickwidths{display:flex;justify-content:space-between;gap:1px;margin:2px 0 8px}
.penquickwidths button{font-size:10px;min-width:0;flex:1;padding:5px 0;border:0;background:transparent;border-radius:5px;color:#42566c}
.penquickwidths button.chosen{background:#d8eafb;color:#075d9c;font-weight:700}
#pendialog .penwidthvisual{display:flex;flex-direction:column;gap:8px;padding:5px 7px 8px;margin:0}
#pendialog .penwidthline{order:0;margin:8px 6px;height:2px}
#pendialog #penwidthrange{order:1;margin:0;width:100%}
#pendialog .penpresets{margin-top:7px}
#pendialog .penpresetdot{position:relative}
.presetwidth{position:absolute;right:-3px;bottom:-7px;background:#f5f8fc;border:1px solid #bdcddd;border-radius:8px;font-size:9px;padding:0 3px;line-height:14px;color:#31435a}
.pencolorswatches{display:grid;grid-template-columns:repeat(6,1fr);gap:7px;margin:12px 3px 5px;padding-top:10px;border-top:1px solid #e3e9f0}
.pencolorswatches button{width:29px;height:29px;justify-self:center;border-radius:50%;border:1px solid #8899aa;box-shadow:inset 0 0 0 1px #fff5;padding:0}
.pencolorswatches button.chosen{outline:2px solid #2677bd;outline-offset:2px}
#pendialog .pencustom{width:100%;font-size:11px;border:0;background:transparent;color:#376e9d;padding:3px}
.shapecurrent{display:flex;align-items:center;gap:10px;font-size:12px;margin-bottom:12px}
.shapesample{width:34px;height:24px;border-style:solid;border-radius:3px;flex-shrink:0}

/* v1.5.8: Versionskennung während der Entwicklung */
#devversion{position:absolute;right:190px;top:10px;z-index:3;background:#fffdf0;border:1px solid #e5dca4;border-radius:7px;padding:5px 8px;color:#445066;font-size:12px;font-weight:700;pointer-events:none;box-shadow:0 1px 4px #0002}
@media(max-width:450px){#devversion{right:184px;font-size:10px;padding:4px}}
#pendialog .penquickwidths button{font-size:11px;padding:6px 0}
#pendialog .penwidthvisual{gap:10px}
#pendialog .penwidthline{margin:10px 8px 3px}
#pendialog #penwidthrange{touch-action:pan-x}

/* v1.5.9 – sieben Stiftstärken, exakt synchronisierte Auswahl */
#pendialog .penquickwidths{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:0;margin:6px 0 4px}
#pendialog .penquickwidths button{font-size:12px;min-height:34px;border-radius:50%;padding:0;justify-self:center;width:32px;height:32px}
#pendialog .penquickwidths button.chosen{background:#d8eafb;outline:2px solid #2677bd;outline-offset:-2px;color:#075d9c;font-weight:800}
#pendialog .penwidthvisual{padding:5px 0 8px}
#pendialog .penwidthline{margin:20px 0 14px;height:2px;overflow:visible}
#pendialog #penwidthdot{background:#2677bd88;border:1px solid #2677bd;min-width:1px;min-height:1px;max-width:none;max-height:none;pointer-events:none}
#pendialog #penwidthrange{margin:0;width:100%}

/* v1.6.0 – eine Strichprobe und gemeinsame Formen-Stifteinstellungen */
.linesample{width:75%;max-width:190px;min-height:1px;max-height:40px;border-radius:20px;margin:12px auto 18px;pointer-events:none}
#shapequickwidths{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:0;margin:12px 0}
#shapequickwidths button{border:0;background:transparent;border-radius:50%;font-size:13px;width:34px;height:34px;justify-self:center;padding:0}
#shapequickwidths button.chosen{background:#d8eafb;outline:2px solid #2677bd;outline-offset:-2px;font-weight:800}
#shapesdialog{max-height:calc(100dvh - 24px);overflow-y:auto;max-width:min(360px,calc(100vw - 16px))}
#shapecolorswatches{display:grid;grid-template-columns:repeat(6,1fr);gap:8px}
#shapecolorswatches button{width:30px;height:30px;border-radius:50%;border:1px solid #8b98a8;justify-self:center;padding:0}
#shapecolorswatches button.chosen{outline:2px solid #2677bd;outline-offset:2px}

/* v1.6.1 – 8 Größenpositionen */
.penquickwidths{grid-template-columns:repeat(8,minmax(0,1fr))}

/* v1.6.2 – elf Stiftstufen auch auf schmalen Tablets gut antippbar */
.penquickwidths{display:grid;grid-template-columns:repeat(11,minmax(0,1fr));gap:0}
#pendialog .penquickwidths button{width:23px;min-height:28px;font-size:11px}
#shapequickwidths button{width:23px;font-size:11px}

/* v1.6.3: seven selectable widths; keep numbers and slider aligned */
#pendialog .penquickwidths, #shapesdialog .penquickwidths{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:0}
#pendialog .penquickwidths button{width:32px;min-height:32px;font-size:12px}

/* v1.6.6: Kompaktes Radierer-Menü neben der linken Werkzeugleiste */
#eraserdialog{position:fixed;margin:0;width:min(278px,calc(100vw - 75px));max-height:calc(100dvh - 16px);overflow:auto;padding:12px;border:1px solid #b9c7d8;border-radius:12px;box-shadow:0 8px 24px #0003;background:#fff;color:#263b51;z-index:120}
#eraserdialog::backdrop{background:transparent}
.eraserheading{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;font-size:14px}
#eraserx{font-size:24px;line-height:1;border:0;background:transparent;padding:2px 8px}
.eraserquick{display:flex;justify-content:space-between;gap:3px;margin:5px 0 14px}
.eraserquick button{border:1px solid #d4e0ec;border-radius:18px;background:#f8fbff;padding:6px 8px;font-size:12px}
.eraserquick button.chosen{background:#d8eafb;border-color:#2677bd;font-weight:700}
.erasercontrols{display:flex;align-items:center;gap:10px}
#eraserrange{flex:1;min-width:0;touch-action:pan-x}
#erasernumber{width:54px;border:1px solid #bdccda;border-radius:7px;padding:6px;font-size:14px}
.eraserpreviewwrap{height:110px;display:flex;align-items:center;justify-content:center;margin:9px 0 3px;background:#f4f7fa;border-radius:8px}
#eraserpreview{width:28px;height:28px;border-radius:50%;background:#b6c3d1;border:1px solid #71869d;box-sizing:border-box}
.eraserhint{display:block;font-size:11px;color:#64778a;line-height:1.4}

#photoflyout,#pageactions{position:fixed;z-index:110;display:flex;flex-direction:column;gap:4px;padding:7px;background:#fff;border:1px solid #b6c4d3;border-radius:9px;box-shadow:0 5px 18px #0002}#photoflyout[hidden],#pageactions[hidden]{display:none}#photoflyout button,#pageactions button{padding:9px 13px;text-align:left;white-space:nowrap;background:#f5f8fc;border:1px solid #d6e0eb;border-radius:5px}#pagelist button{touch-action:pan-x}

#pagelist button,#pagelist button *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;touch-action:manipulation}
#cameraoverlay{position:fixed;inset:0;z-index:1000;background:#000d;display:flex;align-items:center;justify-content:center;padding:12px}
#cameraoverlay[hidden]{display:none}
#camerapanel{width:min(96vw,850px);background:#182331;border-radius:12px;padding:12px;box-shadow:0 8px 35px #0009}
#cameravideo{display:block;width:100%;max-height:75vh;object-fit:contain;background:#000;border-radius:8px}
.cameraactions{display:flex;gap:12px;justify-content:center;padding-top:12px}
.cameraactions button{padding:12px 18px;border-radius:8px;border:1px solid #ddd;background:#f5f8fc;font-size:16px}

/* v1.7.0: long-press on tool buttons must never select their text */
#tools,#tools button,#tools button *{-webkit-user-select:none!important;user-select:none!important;-webkit-touch-callout:none!important;touch-action:manipulation}

#selectactions{position:fixed;z-index:30;bottom:54px;left:72px;background:#fff;border:1px solid #c7d2df;border-radius:9px;box-shadow:0 4px 16px #0002;padding:6px;display:flex;align-items:center;gap:7px}#selectactions[hidden]{display:none}#selectactions button{padding:7px 9px;border:1px solid #ccd3da;border-radius:6px;background:#f7f9fc}#selectname{font-weight:600;font-size:12px;padding:0 6px}
