:root {
  --papier: #f3efe6;
  --flaeche: #ffffff;
  --text: #1f2430;
  --leise: #6b7080;
  --linie: #e3ded3;
  --akzent: #4c5ee8;
  --akzent-hell: #e9ecff;
  --gefahr: #d6336c;
  --schatten: 0 6px 24px rgba(31, 36, 48, .12), 0 1px 3px rgba(31, 36, 48, .08);
  --rund: 14px;
  --kopf: 56px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--papier);
  -webkit-tap-highlight-color: transparent;
}
body.im-raum { overflow: hidden; overscroll-behavior: none; touch-action: none; position: fixed; inset: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
svg .voll, svg circle[r="1.3"], svg circle[r=".6"] { fill: currentColor; }

/* ---------- Startseite ---------- */
.start { max-width: 760px; margin: 0 auto; padding: max(48px, 8vh) 20px 40px; }
.start-karte { background: var(--flaeche); border-radius: 22px; box-shadow: var(--schatten); padding: 36px 32px 30px; text-align: center; }
.start-kopf { display: flex; align-items: center; justify-content: center; gap: 14px; }
.logo { width: 56px; height: 56px; }
.start h1 { font-size: 40px; margin: 0; letter-spacing: -.5px; }
.unterzeile { color: var(--leise); font-size: 17px; margin: 10px 0 26px; }
.gross {
  background: var(--akzent); color: #fff; border: 0; border-radius: 12px; padding: 14px 26px;
  font-size: 17px; font-weight: 600; box-shadow: 0 4px 14px rgba(76, 94, 232, .35); transition: transform .1s, box-shadow .1s;
}
.gross:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(76, 94, 232, .42); }
.gross:active { transform: translateY(1px); }
.gross:disabled { opacity: .6; transform: none; }
.link-form { display: flex; gap: 8px; max-width: 420px; margin: 22px auto 0; }
.link-form input { flex: 1; min-width: 0; border: 1px solid var(--linie); border-radius: 10px; padding: 10px 12px; background: #fbfaf7; }
.link-form button { border: 1px solid var(--linie); border-radius: 10px; background: #fff; padding: 0 16px; }
.fehlertext { color: var(--gefahr); margin: 14px 0 0; }
.zuletzt-bereich h2 { font-size: 16px; color: var(--leise); font-weight: 600; margin: 34px 4px 12px; }
.karten { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.karte { position: relative; display: block; background: var(--flaeche); border-radius: var(--rund); box-shadow: var(--schatten); padding: 8px; color: inherit; text-decoration: none; transition: transform .12s; }
.karte:hover { transform: translateY(-2px); }
.karte-bild { aspect-ratio: 16 / 10; border-radius: 8px; background: #fff; border: 1px solid var(--linie); overflow: hidden; }
.karte-bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.karte-titel { font-weight: 600; margin: 8px 4px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.karte-zeit { color: var(--leise); font-size: 13px; margin: 0 4px 2px; }
.karte-weg { position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); box-shadow: 0 1px 4px rgba(0, 0, 0, .2); font-size: 17px; line-height: 1; opacity: 0; transition: opacity .15s; }
.karte:hover .karte-weg { opacity: 1; }
@media (hover: none) { .karte-weg { opacity: .85; } }
.hinweis { text-align: center; color: var(--leise); font-size: 13px; margin-top: 34px; }

/* ---------- Bild ---------- */
.kopf {
  position: fixed; top: 0; left: 0; right: 0; height: calc(var(--kopf) + env(safe-area-inset-top)); z-index: 20;
  display: flex; align-items: center; gap: 8px; padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--linie);
}
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  min-width: 40px; height: 40px; padding: 0 9px; border: 0; border-radius: 10px; background: transparent; color: var(--text); text-decoration: none;
}
.knopf:hover { background: #f1efe9; }
.knopf.an { background: var(--akzent-hell); color: var(--akzent); }
.knopf.betont { background: var(--akzent); color: #fff; padding: 0 14px; font-weight: 600; }
.knopf.betont:hover { background: #3f50d6; }
.knopf.betont svg { width: 19px; height: 19px; }
.knopf.klein { min-width: 34px; height: 34px; padding: 0; }
.titel { flex: 1 1 auto; min-width: 60px; max-width: 420px; border: 1px solid transparent; border-radius: 8px; background: transparent; padding: 6px 8px; font-weight: 600; font-size: 16px; text-overflow: ellipsis; }
.titel:hover { border-color: var(--linie); }
.titel:focus { outline: none; border-color: var(--akzent); background: #fff; }
.leute { display: flex; align-items: center; margin-left: auto; padding-left: 6px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--f); color: #fff; font-weight: 700; font-size: 15px;
  display: grid; place-items: center; border: 2px solid #fff; margin-left: -7px; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); padding: 0;
  transition: box-shadow .2s;
}
.avatar.ich { cursor: pointer; }
.avatar.mehr { background: #868e96; font-size: 12px; }
.avatar.malt { box-shadow: 0 0 0 3px color-mix(in srgb, var(--f) 45%, transparent); animation: puls 1.2s ease-in-out infinite; }
@keyframes puls { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--f) 20%, transparent); } }

.ansicht {
  position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--kopf) + env(safe-area-inset-top)); overflow: hidden; touch-action: none;
  background-color: #e8e4da;
  background-image: radial-gradient(circle, rgba(31, 36, 48, .13) 1px, transparent 1.2px);
  background-size: 22px 22px;
  cursor: crosshair; user-select: none; -webkit-user-select: none;
}
.ansicht[data-werkzeug="text"] { cursor: text; }
.ansicht[data-werkzeug="hand"], .ansicht.hand { cursor: grab; }
.ansicht.schiebt { cursor: grabbing; }
.brett { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; box-shadow: 0 10px 40px rgba(31, 36, 48, .18), 0 0 0 1px rgba(31, 36, 48, .06); will-change: transform; }
.brett canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.zeiger-ebene { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fremdzeiger { position: absolute; left: 0; top: 0; transition: transform .07s linear, opacity .4s; will-change: transform; }
.fremdzeiger svg { width: 20px; height: 20px; fill: var(--f); stroke: #fff; stroke-width: 1.4; margin: -2px 0 0 -3px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3)); }
.fremdzeiger .name { position: absolute; left: 14px; top: 16px; background: var(--f); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 6px; white-space: nowrap; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.fremdzeiger.aus { opacity: 0; }
.fremdzeiger.ruhig { opacity: .45; }
.fremdzeiger.malt .name::after { content: " ✎"; }
.ring { position: absolute; left: 0; top: 0; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .55); box-shadow: 0 0 0 1px rgba(255, 255, 255, .7); pointer-events: none; }
.text-eingabe {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; min-width: 40px; max-width: 80vw; padding: 0; margin: 0; border: 0;
  outline: 1.5px dashed var(--akzent); outline-offset: 3px; background: rgba(255, 255, 255, .35); resize: none; overflow: hidden; white-space: pre; field-sizing: content;
}

.leiste {
  position: fixed; z-index: 15; left: 50%; transform: translateX(-50%); bottom: max(12px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 2px; padding: 6px; background: var(--flaeche); border-radius: 16px; box-shadow: var(--schatten);
  max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none;
}
.leiste::-webkit-scrollbar { display: none; }
.leiste .gruppe { display: flex; align-items: center; gap: 2px; }
.leiste { touch-action: pan-x; }
.leiste .knopf { width: 42px; height: 42px; padding: 0; }
.trenner { width: 1px; align-self: stretch; margin: 6px 4px; background: var(--linie); flex: none; }
.farb-punkt { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18); }
.groesse-punkt { border-radius: 50%; background: var(--text); }
.groesse-punkt.als-text { background: none; border-radius: 0; width: auto !important; height: auto !important; }
.groesse-punkt.als-text::before { content: "Aa"; font-weight: 700; font-size: 15px; }

.zoom-leiste { position: fixed; z-index: 15; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; align-items: center; background: var(--flaeche); border-radius: 12px; box-shadow: var(--schatten); padding: 3px; }
.zoom-wert { border: 0; background: none; min-width: 58px; height: 34px; font-size: 13px; font-variant-numeric: tabular-nums; border-radius: 8px; }
.zoom-wert:hover { background: #f1efe9; }

.popup { position: fixed; z-index: 30; background: var(--flaeche); border-radius: var(--rund); box-shadow: var(--schatten); padding: 12px; }
.farb-raster { display: grid; grid-template-columns: repeat(5, 34px); gap: 8px; }
.farbe { width: 34px; height: 34px; border-radius: 50%; border: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); padding: 0; }
.farbe.an { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), 0 0 0 2px #fff, 0 0 0 4px var(--akzent); }
.eigene-farbe { display: flex; align-items: center; gap: 10px; margin-top: 12px; cursor: pointer; color: var(--leise); font-size: 14px; }
.eigene-farbe input { width: 34px; height: 34px; border: 0; padding: 0; background: none; cursor: pointer; }
.groesse-schnell { display: flex; gap: 6px; }
.groesse-wahl { width: 42px; height: 42px; border: 0; border-radius: 10px; background: #f6f4ef; display: grid; place-items: center; padding: 0; }
.groesse-wahl span { border-radius: 50%; background: var(--text); display: block; }
.groesse-wahl.an { background: var(--akzent-hell); outline: 2px solid var(--akzent); }
.regler-zeile { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.regler-zeile input { flex: 1; accent-color: var(--akzent); }
.groesse-wert { min-width: 92px; text-align: right; font-size: 13px; color: var(--leise); font-variant-numeric: tabular-nums; }
.menue { padding: 6px; min-width: 230px; }
.menue button { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; padding: 10px 12px; border-radius: 9px; text-align: left; }
.menue button:hover { background: #f4f2ec; }
.menue .ic svg { width: 20px; height: 20px; color: var(--leise); }
.menue .gefahr { color: var(--gefahr); }
.menue .gefahr .ic svg { color: var(--gefahr); }

.banner { position: fixed; z-index: 40; top: calc(var(--kopf) + env(safe-area-inset-top) + 10px); left: 50%; transform: translateX(-50%); background: #fff4e6; color: #a34700; border: 1px solid #ffd8a8; padding: 8px 14px; border-radius: 10px; box-shadow: var(--schatten); font-size: 14px; }
.meldung { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(max(12px, env(safe-area-inset-bottom)) + 76px); background: rgba(31, 36, 48, .92); color: #fff; padding: 8px 16px; border-radius: 10px; font-size: 14px; transition: opacity .35s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
.meldung.weg { opacity: 0; }

.dialog { border: 0; border-radius: 18px; box-shadow: var(--schatten); padding: 24px; width: min(420px, calc(100vw - 32px)); color: var(--text); }
.dialog::backdrop { background: rgba(31, 36, 48, .35); }
.dialog h2 { margin: 0 0 6px; font-size: 20px; }
.dialog p { margin: 0 0 16px; color: var(--leise); }
.dialog input { width: 100%; border: 1px solid var(--linie); border-radius: 10px; padding: 11px 12px; font-size: 16px; }
.dialog input:focus { outline: 2px solid var(--akzent); border-color: transparent; }
.dialog-knoepfe { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.dialog-knoepfe button:not(.gross), .breit, .link-zeile button { border: 1px solid var(--linie); background: #fff; border-radius: 10px; padding: 10px 16px; }
.dialog-knoepfe .gross { padding: 11px 22px; font-size: 16px; }
.gefahr-knopf { background: var(--gefahr) !important; color: #fff; border-color: transparent !important; font-weight: 600; }
.link-zeile { display: flex; gap: 8px; }
.link-zeile input { font-size: 14px; background: #fbfaf7; }
.breit { width: 100%; margin-top: 10px; }
.qr { display: block; width: 190px; height: 190px; margin: 18px auto 4px; border-radius: 10px; border: 1px solid var(--linie); }
.klein-text { text-align: center; font-size: 13px; margin: 0 !important; }
.knopf-link { text-decoration: none; display: inline-block; }
.hilfe { width: 100%; border-collapse: collapse; font-size: 14px; }
.hilfe td { padding: 6px 4px; border-bottom: 1px solid var(--linie); vertical-align: top; }
.hilfe td:first-child { white-space: nowrap; font-weight: 600; padding-right: 14px; }

@media (max-width: 700px) {
  :root { --kopf: 52px; }
  .kopf { gap: 4px; }
  .knopf.betont .txt { display: none; }
  .knopf.betont { padding: 0 10px; }
  .titel { font-size: 15px; padding: 6px 4px; }
  .zoom-leiste { display: none; }
  .leiste { left: 8px; right: 8px; transform: none; max-width: none; bottom: max(8px, env(safe-area-inset-bottom)); border-radius: 14px; padding: 4px; flex-direction: column; align-items: stretch; gap: 0; }
  .leiste .haupt-trenner { display: none; }
  .leiste .werkzeuge { gap: 0; justify-content: space-between; overflow-x: auto; scrollbar-width: none; }
  .leiste .werkzeuge .knopf { flex: 1 1 0; min-width: 33px; max-width: 48px; width: auto; height: 42px; }
  .leiste .einstellungen { justify-content: center; border-top: 1px solid var(--linie); padding-top: 4px; margin-top: 2px; }
  .leiste .einstellungen .knopf { width: 48px; height: 40px; }
  .meldung { bottom: calc(max(8px, env(safe-area-inset-bottom)) + 104px); }
  .avatar { width: 30px; height: 30px; font-size: 13px; }
  .start h1 { font-size: 32px; }
  .start-karte { padding: 28px 20px 24px; }
}
