/* Grundriss-Karte im Rundgang – Richtung B (Alex 22.09.2026, 18:13). Farben aus STILE["B"] in grundriss_kunde.py.
   Seit 24.09.2026: alle Standpunkte als Marken, der eigene groß mit Raumnamen; aufgeklappt sind sie Knöpfe. */
#karte {
  --papier: #f6f0e6;
  --rand: rgba(166, 132, 84, 0.47);
  --ink: #3a2c22;
  --leise: #806c58;
  --punkt: #963c28;
  --ruhend: rgba(122, 96, 72, 0.62);
  position: absolute;
  z-index: 110;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  width: clamp(168px, 27vw, 300px);
  padding: 8px 10px 10px;
  box-sizing: border-box;
  border-radius: 12px;
  background: rgba(246, 240, 230, 0.93);
  border: 1px solid var(--rand);
  box-shadow: 0 6px 22px rgba(30, 20, 10, 0.22);
  font-family: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: opacity 0.3s ease;
}
#karte[hidden] { display: none; }

#karte .kopf { display: flex; align-items: baseline; gap: 7px; padding: 0 2px 6px; flex-wrap: nowrap; }
#karte .titel { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink);
                white-space: nowrap; }
#karte .flaeche { font-size: 11px; font-weight: 400; color: var(--leise); font-variant-numeric: tabular-nums;
                  white-space: nowrap; }
#karte .gross {
  margin-left: auto; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink); cursor: pointer; line-height: 1; font-size: 15px;
}
#karte .gross:hover { background: rgba(166, 132, 84, 0.16); }

#karte .plan { position: relative; line-height: 0; }
#karte .plan img { width: 100%; height: auto; display: block; }
#karte .marken { position: absolute; inset: 0; }

/* Jeder Standpunkt eine Marke; der eigene ist größer, farbig und trägt den Raumnamen („Sie sind hier“). */
#karte .ziel {
  position: absolute; width: 6px; height: 6px; margin: -3px 0 0 -3px; padding: 0;
  border: 0; border-radius: 50%; background: var(--ruhend);
  box-shadow: 0 0 0 1.5px rgba(246, 240, 230, 0.85);
  cursor: pointer; line-height: 0; -webkit-appearance: none; appearance: none;
  transition: width 0.25s ease, height 0.25s ease, margin 0.25s ease, background 0.25s ease;
}
#karte .ziel.punkt, #karte .ziel.hier {
  width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; background: var(--punkt);
  box-shadow: 0 0 0 2px rgba(246, 240, 230, 0.9);
}
#karte .ziel.punkt::before {
  content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid var(--punkt);
  opacity: 0; animation: karte-puls 2.6s ease-out infinite;
}
@keyframes karte-puls {
  0% { transform: scale(0.6); opacity: 0.7; }
  70%, 100% { transform: scale(1.5); opacity: 0; }
}
#karte .etikett {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  padding: 2px 7px; border-radius: 4px; background: var(--punkt); color: #fff;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap;
  line-height: 1.5; pointer-events: none;
}
#karte .etikett:empty { display: none; }
#karte .ziel.links .etikett { left: auto; right: 13px; }

/* Aufgeklappt: Plan groß in der Mitte, Rest abgedunkelt – und jede Marke ist ein Knopf.
   Die Tippfläche liegt unsichtbar um die Marke herum (44 px, Regel aus P2 vom 17.09.2026). */
#karte.offen {
  top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%);
  width: min(86vw, 86vh, 760px); padding: 12px 14px 14px;
}
#karte.offen .titel, #karte.offen .flaeche { font-size: 13px; }
#karte.offen .ziel { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; cursor: pointer; }
#karte.offen .ziel::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px;
  transform: translate(-50%, -50%); border-radius: 50%;
}
#karte.offen .ziel:hover { background: var(--punkt); }
#karte.offen .ziel:focus-visible { outline: 2px solid var(--punkt); outline-offset: 4px; }
#karte.offen .ziel.punkt { width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; }
#karte.offen .etikett { font-size: 12px; left: 18px; padding: 3px 9px; }
#karte.offen .ziel.links .etikett { left: auto; right: 18px; }
#karte-schleier {
  position: absolute; inset: 0; z-index: 105; background: rgba(18, 14, 10, 0.55);
  opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
#karte-schleier.zeigen { opacity: 1; visibility: visible; transition: opacity 0.25s ease; }
/* Alex 23.09.2026, 10:25: bei offener Karte steht der Raumname nur noch am Kartenpunkt, nicht doppelt unten */
#viewer.karte-offen #raumname { opacity: 0; }

/* Handy hochkant: etwas kleiner, damit sie den Blick nicht zustellt */
@media (max-width: 520px) {
  #karte { width: 148px; padding: 7px 8px 8px; }
  #karte .titel, #karte .flaeche { font-size: 9.5px; }
  #karte .titel { letter-spacing: 0.1em; }
  #karte .gross { width: 20px; height: 20px; font-size: 13px; }
  #karte .ziel { width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; }
  #karte .ziel.punkt { width: 8px; height: 8px; margin: -4px 0 0 -4px; }
  #karte .etikett { font-size: 8px; padding: 1.5px 5px; left: 11px; letter-spacing: 0.1em; }
  #karte .ziel.links .etikett { left: auto; right: 11px; }
  #karte.offen { width: min(92vw, 92vh); }
  #karte.offen .ziel { width: 8px; height: 8px; margin: -4px 0 0 -4px; }
  #karte.offen .ziel.punkt { width: 12px; height: 12px; margin: -6px 0 0 -6px; }
}

/* Knopf zur Puppenstube (3D-Modell von außen) – nur wenn tour.json sie kennt (Alex 24.09.2026) */
#karte .puppe {
  margin-left: auto; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--rand);
  background: rgba(255, 255, 255, 0.55); color: var(--ink); text-decoration: none;
  font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap;
}
#karte .puppe:hover { background: rgba(166, 132, 84, 0.18); }
#karte .puppe + .gross { margin-left: 4px; }
#karte.offen .puppe { font-size: 12px; padding: 5px 11px; }
@media (max-width: 520px) {
  #karte .puppe { font-size: 8.5px; padding: 2px 6px; letter-spacing: 0.06em; }
}
/* iPhone (24.09.2026, 16:40): im kleinen Kasten passten Titel, Fläche und Puppenstube nicht nebeneinander – der
   Vergrößern-Knopf rutschte aus dem Bild. Klein nur „Grundriss“ + ⤢, Fläche und Puppenstube erst im aufgeklappten Plan. */
@media (max-width: 520px) {
  #karte:not(.offen) .flaeche, #karte:not(.offen) .puppe { display: none; }
}
