/* =========================================================================
   360°-Rundgang – Oberfläche
   Mein Zuhause Massivhaus GmbH

   Eigenständig, läuft im iframe der Haus-Detailseiten. Farben und Schrift
   folgen der Website (Navy #183054 / #0F172A, Akzent #C8811E, Inter).
   ========================================================================= */

:root {
  --navy-deep: #0F172A;
  --navy: #183054;
  --navy-soft: #1E2F51;
  --panel: rgba(15, 23, 42, .72);
  --line: rgba(255, 255, 255, .12);
  --text: #F3F4F6;
  --muted: #A3ADBD;
  --accent: #C8811E;
  --accent-ink: #1A1206;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--navy-deep);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}
button { font-family: inherit; }

#stage { position: fixed; inset: 0; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ============================== Leisten ============================== */
.bar { position: absolute; left: 0; right: 0; display: flex; pointer-events: none; z-index: 10; }
.bar > * { pointer-events: auto; }

.bar--top {
  top: 0; align-items: flex-start; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .78), rgba(15, 23, 42, 0));
}
.ident {
  padding: 9px 16px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.ident__title { margin: 0; font-size: .95rem; font-weight: 700; letter-spacing: -.01em; }
.ident__sub { margin: 2px 0 0; font-size: .74rem; color: var(--muted); }

.tools { margin-left: auto; display: flex; gap: 8px; }
.icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon[aria-pressed="true"] { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.icon:focus-visible, .chip:focus-visible, .hs:focus-visible, .dot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ============================ Standortschild ============================ */
.place {
  position: absolute; left: 16px; top: calc(76px + env(safe-area-inset-top)); z-index: 9;
  display: flex; flex-direction: column; gap: 2px;
  padding: 11px 16px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  pointer-events: none;
}
.place__eyebrow { font-size: .62rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.place__name { font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; }
.place__area { font-size: .8rem; color: var(--accent); font-weight: 600; }

/* ================================ Karte ================================ */
.map {
  position: absolute; right: 16px; top: calc(76px + env(safe-area-inset-top)); z-index: 9;
  width: clamp(150px, 22vw, 260px); margin: 0; padding: 8px;
  border-radius: var(--radius); overflow: hidden;
  background: rgba(15, 23, 42, .82); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transition: opacity .25s, transform .25s;
}
.map[hidden] { display: none; }
.map img { display: block; position: relative; z-index: 0; width: 100%; height: auto; border-radius: 8px; opacity: .92; }
.map__dots { position: absolute; inset: 8px; z-index: 2; }
.map__label {
  position: absolute; left: 14px; bottom: 14px; z-index: 3; margin: 0; padding: 3px 8px;
  font-size: .7rem; font-weight: 600; letter-spacing: .02em; color: #fff; border-radius: 6px;
  background: rgba(15, 23, 42, .78); pointer-events: none;
}
.map__label[hidden] { display: none; }
.dot[hidden] { display: none; }
.dot {
  position: absolute; width: 26px; height: 26px; padding: 0; transform: translate(-50%, -50%);
  border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .92); border: 2px solid var(--navy);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.dot::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--navy); }
.dot[data-active="true"] { background: var(--accent); border-color: #fff; }
.dot[data-active="true"]::after { background: #fff; }
.map__cone {
  position: absolute; width: 74px; height: 74px;
  transform-origin: 50% 50%; pointer-events: none; z-index: 1;
}
.map__cone[hidden] { display: none; }

/* Auf schmalen Geräten ist die Karte standardmäßig zu, der Knopf öffnet sie. */
@media (max-width: 720px) {
  .map { width: 44vw; opacity: 0; transform: translateY(-8px); pointer-events: none; }
  .map.is-open { opacity: 1; transform: none; pointer-events: auto; }
}

/* ============================== Wegpunkte ============================== */
#hotspots { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.hs {
  position: absolute; left: 0; top: 0; padding: 6px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: 0; color: var(--text); cursor: pointer;
  pointer-events: auto; will-change: transform;
}
.hs[hidden] { display: none; }
.hs__ring {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid rgba(255, 255, 255, .92); background: rgba(15, 23, 42, .38);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .12), 0 6px 20px rgba(0, 0, 0, .38);
  transition: transform .15s, border-color .15s;
  animation: hsPulse 2.6s ease-in-out infinite;
}
.hs__ring svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hs:hover .hs__ring, .hs:focus-visible .hs__ring { transform: scale(1.1); border-color: var(--accent); }
.hs__lbl {
  font-size: .76rem; font-weight: 600; white-space: nowrap;
  max-width: 42vw; overflow: hidden; text-overflow: ellipsis;
  padding: 4px 11px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
@keyframes hsPulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(255, 255, 255, .12), 0 6px 20px rgba(0, 0, 0, .38); }
  50%      { box-shadow: 0 0 0 13px rgba(255, 255, 255, .04), 0 6px 20px rgba(0, 0, 0, .38); }
}

/* ============================== Räume unten ============================== */
.bar--bottom {
  bottom: 0; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(15, 23, 42, .84), rgba(15, 23, 42, 0));
}
.chips { display: flex; gap: 8px; max-width: 100%; overflow-x: auto; padding: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips__sep { flex: none; align-self: center; padding: 0 4px 0 6px; font-size: .68rem; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.chips__sep:first-child { padding-left: 2px; }
.chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 11px 16px; min-height: 44px; border-radius: 999px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  font-size: .84rem; font-weight: 600;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.chip[data-active="true"] { border-color: rgba(200, 129, 30, .6); }
.chip[data-active="true"] .chip__dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(200, 129, 30, .25); }
.hint { margin: 0; font-size: .72rem; color: var(--muted); text-align: center; text-wrap: balance; }
.note { margin: 0; font-size: .68rem; color: rgba(163, 173, 189, .8); text-align: center; }
@media (pointer: coarse) { .hint { display: none; } }

/* ============================== Zustände ============================== */
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .32s ease; z-index: 20; }
#fade.on { opacity: 1; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--navy-deep); z-index: 30; text-align: center; padding: 24px; }
#loading[hidden] { display: none; }
#loading p { margin: 0; font-size: .9rem; color: var(--muted); }
#loading .err { color: var(--text); line-height: 1.6; }
#loading .err span { color: var(--muted); font-size: .8rem; }
.panofail {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 9;
  margin: 0; padding: 12px 18px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); font-size: .85rem; color: var(--muted);
}
.panofail[hidden] { display: none; }

/* ============================== Editor ============================== */
.editor { display: none; }
body.edit .editor {
  display: flex; flex-direction: column; gap: 8px;
  position: absolute; left: 16px; bottom: 120px; z-index: 40; width: min(420px, calc(100vw - 32px));
  padding: 14px; border-radius: var(--radius);
  background: rgba(15, 23, 42, .94); border: 1px solid var(--line);
}
.editor__title { margin: 0; font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.editor input {
  width: 100%; padding: 10px 12px; border-radius: 9px; font: 500 .8rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); color: var(--text);
  -webkit-user-select: all; user-select: all;
}
.editor__row { display: flex; align-items: center; gap: 10px; font-size: .74rem; color: var(--muted); }
.editor__row input { flex: 1; accent-color: var(--accent); }
.editor__row output { font-variant-numeric: tabular-nums; color: var(--text); min-width: 42px; text-align: right; }
.editor button {
  padding: 10px 14px; border-radius: 9px; cursor: pointer; font-size: .8rem; font-weight: 600;
  background: var(--accent); border: 0; color: var(--accent-ink);
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ===================== Enge Bildschirme: Kopfbereich ===================== */
/* Auf dem Handy stehen Haustitel und Standortschild sonst übereinander.
   Dort trägt die Kopfzeile nur den Haustitel, das Schild rückt darunter. */
@media (max-width: 720px) {
  .ident { max-width: calc(100vw - 190px); }
  .ident__title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ident__sub { display: none; }
  .place { top: calc(74px + env(safe-area-inset-top)); padding: 9px 14px; }
  .place__name { font-size: 1rem; }
}
@media (max-width: 380px) {
  .icon { width: 40px; height: 40px; }
  .chip { padding: 10px 13px; font-size: .8rem; }
}

/* KI-Kennzeichnung beim direkten Aufruf des Viewers */
.ki-hinweis {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 40;
  margin: 0; padding: 5px 10px; border-radius: 6px;
  background: rgba(15, 23, 42, .76); border: 1px solid rgba(255, 255, 255, .18);
  color: #fff; font: 600 11px/1.25 Inter, system-ui, sans-serif; white-space: nowrap;
  pointer-events: none;
}
.ki-hinweis[hidden] { display: none; }
@media (max-width: 640px) { .ki-hinweis { top: auto; bottom: 64px; font-size: 10px; } }
.ki-hinweis { background: none; border: 0; padding: 0; font-weight: 400; font-size: 10.5px; color: rgba(255,255,255,.82); text-shadow: 0 1px 2px rgba(0,0,0,.55), 0 0 8px rgba(0,0,0,.35); }
