@font-face { font-family: 'Montserrat'; src: url('/fonts/Montserrat-Variable.ttf') format('truetype'); font-weight: 100 900; font-style: normal; font-display: swap; }
:root { --bg: #f4f5f3; --karte: #ffffff; --text: #1f2a2e; --leise: #6b7479; --linie: #dfe2e0; --akzent: #d9412b; --akzent-hell: #fbe6e2; --kohle: #1f2a2e; --rot: #dc2626; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: 'Montserrat', -apple-system, system-ui, sans-serif; overscroll-behavior: none; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input, textarea { font: inherit; -webkit-user-select: text; user-select: text; }
.app { height: 100%; }
.hidden { display: none !important; }

/* Anmeldung */
.login { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px 16px; }
.login h1 { margin: 0 0 8px; font-size: 32px; font-weight: 800; }
.login input { width: 100%; max-width: 280px; padding: 14px; font-size: 20px; text-align: center; letter-spacing: 6px; border: 1px solid var(--linie); border-radius: 14px; background: #fff; }
.login .fehler { color: var(--rot); min-height: 20px; font-size: 14px; }

/* Knöpfe */
.knopf { background: var(--kohle); color: #fff; font-weight: 700; padding: 14px 22px; border-radius: 14px; font-size: 16px; }
.knopf.zweit { background: #e8ebe9; color: var(--kohle); }
.knopf.rot { background: var(--rot); }
.knopf:disabled { opacity: .5; }

/* Startseite */
.start { max-width: 760px; margin: 0 auto; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }
.start-kopf { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.start-kopf h1 { margin: 0; font-size: 28px; font-weight: 800; }
.start h2 { font-size: 15px; color: var(--leise); font-weight: 600; margin: 24px 0 10px; }
.raster { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 600px) { .raster { grid-template-columns: repeat(3, 1fr); } }
.karte { position: relative; background: var(--karte); border-radius: 16px; padding: 8px; box-shadow: 0 1px 3px rgba(20, 20, 50, .08); cursor: pointer; }
.karte .bild { aspect-ratio: 1; background: var(--bg); border-radius: 10px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.karte img { max-width: 100%; max-height: 100%; display: block; -webkit-user-drag: none; }
.karte .name { font-size: 14px; font-weight: 600; margin: 8px 30px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.karte .datum { font-size: 12px; color: var(--leise); margin: 2px 4px 2px; }
.karte .mehr { position: absolute; right: 6px; bottom: 6px; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--leise); }
.leer { color: var(--leise); text-align: center; padding: 40px 0; font-size: 14px; }

/* Fenster von unten */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(15, 15, 40, .4); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; background: #fff; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 85%; overflow: auto; }
.sheet h3 { margin: 0 0 14px; font-size: 17px; }
.sheet .reihe { display: flex; gap: 10px; margin-top: 14px; }
.sheet .reihe .knopf { flex: 1; }
.sheet textarea { width: 100%; min-height: 110px; font-size: 16px; padding: 12px; border: 1px solid var(--linie); border-radius: 12px; resize: none; }
.sheet input[type=text] { width: 100%; font-size: 16px; padding: 12px; border: 1px solid var(--linie); border-radius: 12px; }
.liste-knopf { display: block; width: 100%; text-align: left; padding: 15px 8px; font-size: 16px; font-weight: 600; border-bottom: 1px solid var(--linie); }
.liste-knopf:last-child { border-bottom: 0; }
.liste-knopf.rot { color: var(--rot); }
.format-knopf { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 8px; text-align: left; border-bottom: 1px solid var(--linie); }
.format-knopf:last-child { border-bottom: 0; }
.format-knopf .vorschau { width: 38px; display: flex; justify-content: center; }
.format-knopf .vorschau span { display: block; border: 2px solid var(--akzent); border-radius: 4px; }
.format-knopf b { display: block; font-size: 16px; }
.format-knopf small { color: var(--leise); font-size: 13px; }
.logo-raster { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.logo-kachel { position: relative; aspect-ratio: 1; background: var(--bg); border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 8px; font-size: 13px; font-weight: 600; color: var(--akzent); text-align: center; }
.logo-kachel img { max-width: 100%; max-height: 100%; }
.logo-kachel .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; color: var(--leise); display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.2); }

/* Editor */
.editor { height: 100%; display: flex; flex-direction: column; position: relative; }
.oben { display: flex; align-items: center; gap: 4px; padding: 8px 10px; }
.oben .abstand { flex: 1; }
.oben .ik { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.oben .ik:disabled { opacity: .3; }
.oben .zurueck { display: flex; align-items: center; gap: 2px; font-weight: 600; font-size: 15px; padding: 8px 10px 8px 4px; }
.oben .speichern { background: var(--akzent); color: #fff; font-weight: 700; font-size: 14px; padding: 10px 16px; border-radius: 12px; margin-left: 6px; }
.buehne { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 14px; overflow: hidden; }
.buehne canvas { background: #fff; box-shadow: 0 2px 14px rgba(20, 20, 50, .18); touch-action: none; display: block; }
.leiste { background: #fff; border-radius: 22px 22px 0 0; box-shadow: 0 -2px 12px rgba(20, 20, 50, .08); padding-bottom: env(safe-area-inset-bottom); }
.leiste .tb { display: flex; align-items: stretch; }
.tb-scroll { flex: 1; display: flex; overflow-x: auto; scrollbar-width: none; padding: 6px 4px; }
.tb-scroll::-webkit-scrollbar { display: none; }
.tb-knopf { flex: 0 0 auto; min-width: 66px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; font-size: 11px; font-weight: 600; color: var(--text); border-radius: 12px; }
.tb-knopf.aktiv { color: var(--akzent); background: var(--akzent-hell); }
.tb-knopf.rot { color: var(--rot); }
.tb-ok { flex: 0 0 auto; width: 58px; margin: 8px 8px 8px 0; border-radius: 14px; background: var(--akzent); color: #fff; display: flex; align-items: center; justify-content: center; }
.fenster { padding: 12px 14px 2px; border-bottom: 1px solid var(--linie); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fenster .fertig { margin-left: auto; margin-bottom: 8px; color: var(--akzent); font-weight: 700; font-size: 14px; padding: 8px; }
.fenster label { font-size: 13px; color: var(--leise); font-weight: 600; }
.fenster input[type=range] { flex: 1; min-width: 120px; accent-color: var(--akzent); height: 32px; }
.fenster .wert { font-size: 13px; font-weight: 700; min-width: 38px; text-align: right; }
.fenster .gruppe { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-bottom: 10px; }
.opt { padding: 9px 14px; border-radius: 10px; background: #eceef5; font-size: 14px; font-weight: 600; }
.opt.aktiv { background: var(--akzent); color: #fff; }
.tupfer { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--linie); }
.tupfer.aktiv { border-color: var(--akzent); box-shadow: 0 0 0 2px var(--akzent-hell); }
.farbwahl { width: 36px; height: 32px; padding: 0; border: 0; background: none; }
.hinweis { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(110px + env(safe-area-inset-bottom)); background: rgba(27, 27, 43, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 80; max-width: 90%; text-align: center; }
.hinweis.fehler { background: rgba(185, 28, 28, .95); }

/* Gemälde-Stil (Weg 2): Ölbild-Schnee hinter Login und Startseite, Editor bleibt ruhig */
.app:has(> .start)::before, .app:has(> .login)::before { content: ""; position: fixed; inset: 0; z-index: 0; background: #f4f5f3 url('/gemaelde.jpg') center top / cover no-repeat; }
.app > .start, .app > .login { position: relative; z-index: 1; }
.start-kopf h1, .login h1 { text-shadow: 0 1px 12px rgba(255, 255, 255, .9); }
.start h2 { color: var(--kohle); text-shadow: 0 1px 8px rgba(255, 255, 255, .9); }
.karte { background: rgba(255, 255, 255, .9); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: 0 2px 10px rgba(31, 42, 46, .12); }
.leer { background: rgba(255, 255, 255, .85); border-radius: 16px; color: var(--kohle); }
