@font-face {
  font-family: OpenSans;
  src: url('assets/fonts/open-sans-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Oswald;
  src: url('assets/fonts/oswald-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --forest: #193c31;
  --paper: #f7f8f4;
  --ink: #182d25;
  --signal: #a3d778;
  --sans: OpenSans, 'Open Sans', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { height: 100%; background: #fff; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 360px;
  overflow: auto;
  color: var(--ink);
  background: var(--paper);
  font: 400 16px/1.6 var(--sans);
}
button, a, select { -webkit-tap-highlight-color: transparent; }
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, select:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 2px;
}
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
svg, img { display: block; }
svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
[hidden] { display: none !important; }
::selection { background: #dcebdc; color: var(--ink); }
main { height: 100%; min-height: 0; }

/* Hausbereiche: Bild links, aufklappbare Raumauswahl rechts. */
.explorer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(250px, 28%, 340px);
  height: 100%;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  border-radius: 17px;
  background: var(--paper);
}
.room-panel, .welcome-panel { grid-column: 1; grid-row: 1; }
.selection-panel {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  background: #173c31;
  color: #fff;
}
.selection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  padding: 22px 20px 13px;
}
.list-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
}
.selection-heading h2 {
  color: #fff;
  font: 400 28px/1.13 Oswald, sans-serif;
  letter-spacing: -.025em;
}
.list-count { color: #d1e0d1; font: 400 13px/1.4 var(--sans); }
.photo-navigation, .category-picker { display: none; }
.photo-panel {
  min-height: 0;
  min-width: 0;
  padding: 0 16px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #acbeb0 transparent;
}
.photo-group h3 { padding: 0; }
.photo-group h3 button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 45px;
  padding: 10px 4px;
  border: 0;
  border-top: 1px solid #557268;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font: 400 15px/1.4 var(--sans);
  text-align: left;
}
.photo-group h3 button:hover { background: #ffffff0c; }
.photo-group h3 button span {
  margin-left: auto;
  color: #c9d8d0;
  font-size: 13px;
}
.photo-group h3 button::after {
  content: '';
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  margin: 0 4px 4px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.photo-group h3 button[aria-expanded='true']::after {
  margin-top: 5px;
  transform: rotate(225deg);
}
.photo-room {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 75px;
  margin: 0 0 8px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #254c40;
  text-align: left;
}
.photo-room:hover { background: #315b4c; }
.photo-thumbnail {
  display: block;
  flex: 0 0 82px;
  height: 58px;
  overflow: hidden;
  border-radius: 6px;
  background: #e7eae3;
}
.photo-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.photo-room-copy { display: block; min-width: 0; flex: 1; }
.photo-room-name { color: #fff; font: 400 15px/1.34 var(--sans); }
.photo-room[aria-pressed='true'] { background: #edf5e7; border-color: #e3eedc; }
.photo-room[aria-pressed='true'] .photo-room-name { color: #193e30; font-weight: 700; }
.thumbnail-fallback { display: grid; place-items: center; height: 100%; color: #526044; font-size: 12px; }

/* Die Bildbeschriftung bleibt unten; Bedienung und Hilfe liegen oben. */
.room-panel { position: relative; min-width: 0; min-height: 0; }
.viewer-stage { position: relative; height: 100%; min-height: 0; overflow: hidden; isolation: isolate; background: #283024; }
#panorama-host, .panorama-instance { position: absolute; inset: 0; }
.panorama-instance { background: #283024; }
.panorama-instance:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.viewer-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(0deg, #0c1a15e0 0%, #0c1a15a8 12%, #0c1a1521 32%, transparent 48%);
}
.room-title-row {
  position: absolute;
  inset: auto 0 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 2px 16px;
  padding: 18px 25px 22px;
  color: #fff;
  pointer-events: none;
}
.current-area { grid-column: 1; font: 600 13px/1.5 var(--sans); }
.room-title-row h2 {
  grid-column: 1;
  grid-row: 2;
  font: 400 clamp(26px, 3.4vw, 42px)/1.15 Oswald, sans-serif;
  letter-spacing: -.015em;
  text-wrap: balance;
  outline: 0;
}
#scene-position { grid-column: 2; grid-row: 2; align-self: center; font: 600 13px/1.4 var(--sans); white-space: nowrap; font-variant-numeric: tabular-nums; }
.viewer-toolbar {
  position: absolute;
  z-index: 8;
  inset: 14px 14px auto auto;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 44px;
  padding: 0 2px 0 7px;
  border-radius: 24px;
  background: #15362e;
  color: #fff;
  box-shadow: 0 3px 12px #0003;
}
.viewer-toolbar button { min-height: 44px; padding: 0; border: 0; border-radius: 20px; background: transparent; color: inherit; }
.viewer-toolbar button:hover:not(:disabled) { background: #ffffff16; }
.viewer-toolbar button:focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
.help-toggle { display: flex; align-items: center; gap: 6px; padding-inline: 3px !important; font-size: 14px; }
.help-toggle svg { width: 15px; height: 15px; transform: rotate(180deg); }
.help-toggle[aria-expanded='true'] svg { transform: rotate(0); }
.help-toggle:disabled { color: #b3b9ad; }
.primary-actions, .zoom-controls { display: flex; align-items: center; }
.primary-actions button { display: grid; place-items: center; width: 44px; height: 44px; }
.primary-actions svg { width: 19px; height: 19px; }
.zoom-controls[hidden] { display: flex !important; visibility: hidden; }
.help-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: min(310px, calc(100vw - 34px));
  max-height: calc(100vh - 86px);
  max-height: calc(100dvh - 86px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 17px 18px 10px;
  border-radius: 14px;
  background: #193c31;
  color: #fff;
}
.help-copy h3 { margin-bottom: 5px; font: 400 18px/1.4 Oswald, sans-serif; }
.help-copy p { max-width: 340px; color: #eef1e9; font-size: 12px; line-height: 1.7; }
.helper-actions { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 4px; margin-top: 12px; }
.helper-actions button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 56px; padding: 6px 2px; font-size: 11px; line-height: 1.4; }
.helper-actions svg { width: 20px; height: 20px; }
.viewer-state {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: 15px;
  overflow-y: auto;
  padding: 78px 28px 28px;
  background: #293222;
  color: #fff;
  text-align: center;
  font-size: 14px;
}
.viewer-state > * { flex-shrink: 0; }
.spinner { width: 26px; height: 26px; border: 2px solid #fff3; border-top-color: #c3df9f; border-radius: 50%; animation: spin 1s linear infinite; }
.error-state h3 { max-width: 360px; font: 400 27px/1.3 Oswald, sans-serif; }
.error-state p { max-width: 360px; color: #e4e9dd; font-size: 13px; }
.primary-button { min-height: 44px; padding: 11px 19px; border: 0; border-radius: 2px; background: #cb101b; color: #fff; font-size: 13px; }
.primary-button:hover { background: #ab1018; }
.welcome-panel { display: flex; flex-direction: column; justify-content: center; min-height: 0; min-width: 0; padding: 36px; background: #f4f7ef; }
.welcome-panel h2 { max-width: 380px; margin-bottom: 15px; color: var(--forest); font: 400 30px/1.3 Oswald, sans-serif; }
.welcome-panel p { max-width: 360px; font-size: 15px; }

/* Native Vollbildansicht und die vom Script verwendete Vergrößerung. */
.explorer:fullscreen, .explorer.is-expanded { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); border-radius: 0; }
.explorer:fullscreen .selection-panel, .is-expanded .selection-panel { display: none; }
.explorer:fullscreen { width: 100%; height: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.noscript { position: fixed; inset: 0; z-index: 20; padding: 20px; background: #fff4da; }
.pnlm-about-msg, .pnlm-panorama-info { display: none !important; }
.pnlm-dragfix { cursor: grab; }
.pnlm-grabbing .pnlm-dragfix { cursor: grabbing; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 767px) {
  body { min-height: 480px; }
  .explorer { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 156px; border-radius: 12px; }
  .selection-panel { grid-column: 1; grid-row: 2; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 54px minmax(0, 1fr); }
  .selection-heading { grid-column: 2; grid-row: 1; padding: 3px 10px 3px 7px; }
  .list-heading { display: none; }
  .photo-navigation { display: flex; align-items: center; gap: 5px; }
  .photo-navigation button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid #aabbb0; border-radius: 50%; background: transparent; color: #fff; }
  .photo-navigation button:disabled { color: #b0bfb7; border-color: #6e887b; }
  .photo-navigation button:hover:not(:disabled) { background: #ffffff16; }
  .photo-navigation svg { width: 17px; height: 17px; }
  .category-picker { display: flex; grid-column: 1; grid-row: 1; align-items: center; gap: 7px; min-width: 0; padding-left: 10px; }
  .category-picker > span { flex-shrink: 0; font-size: 13px; }
  .category-picker select { width: 100%; min-width: 0; max-width: 190px; height: 44px; padding: 0 5px; border: 0; border-radius: 8px; background: #f1f5ed; color: #173b30; font: 600 14px var(--sans); }
  .photo-panel { grid-column: 1 / -1; grid-row: 2; margin-inline: 10px; padding: 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; overscroll-behavior-y: auto; scrollbar-width: none; scroll-snap-type: x mandatory; }
  .photo-panel::-webkit-scrollbar { display: none; }
  .photo-list { display: flex; gap: 9px; width: 100%; height: 100%; }
  .photo-group, .group-photos:not([hidden]) { display: contents; }
  .photo-group h3 { display: none; }
  .photo-room { flex: 0 0 calc((100% - 9px) / 2); flex-direction: column; align-items: stretch; gap: 0; width: auto; min-height: 0; height: 96px; margin: 0; padding: 0 2px; border: 0; background: transparent; scroll-snap-align: start; }
  .photo-room:hover { background: #ffffff0c; }
  .photo-thumbnail { width: 100%; height: 52px; flex: 0 0 52px; }
  .photo-room-copy { padding: 4px 0 0; }
  .photo-room-name { display: block; font-size: 14px; line-height: 18px; }
  .photo-room[aria-pressed='true'] { background: transparent; }
  .photo-room[aria-pressed='true'] .photo-room-name { color: #fff; }
  .photo-room[aria-pressed='true'] .photo-thumbnail { outline: 3px solid var(--signal); outline-offset: -3px; }
  .photo-room:focus-visible { outline-offset: -3px; }
  .room-title-row { gap: 2px 12px; padding: 10px 15px 16px; }
  .room-title-row h2 { font-size: 26px; }
  .viewer-toolbar { inset: 9px 9px auto auto; }
  .help-toggle { font-size: 13px; }
  .help-panel { padding: 15px 16px 10px; }
  .viewer-state { gap: 12px; padding: 66px 20px 20px; }
  .error-state h3 { font-size: 25px; }
  .error-state p { font-size: 12px; }
  .welcome-panel { padding: 24px; }
  .welcome-panel h2 { font-size: 28px; }
  .welcome-panel p { font-size: 14px; }
}

/* Auf schmalen Smartphones erhält auch „Terrasse und Garten“ genug Platz. */
@media (max-width: 360px) {
  .explorer { grid-template-rows: minmax(0, 1fr) 172px; }
  .selection-panel { grid-template-rows: 70px minmax(0, 1fr); }
  .category-picker { flex-direction: column; align-items: stretch; gap: 1px; }
  .category-picker > span { font-size: 11px; line-height: 15px; }
  .category-picker select { flex-shrink: 0; max-width: none; }
}

@media (max-height: 500px) and (min-width: 768px) {
  .selection-heading { padding-top: 12px; }
  .photo-room { min-height: 68px; }
  .photo-thumbnail { height: 50px; }
  .error-state h3 { font-size: 23px; }
  .error-state p { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
