/* Layout: 3D-Ansicht vollflächig, Hamburger-Menü oben links (Schublade), Raumleiste unten bei gewähltem Raum */
:root {
  --bg: #e9e6e1;
  --panel: rgba(250, 248, 245, 0.9);
  --panel-solid: #faf8f5;
  --panel-line: rgba(60, 55, 50, 0.14);
  --fg: #2a2724;
  --muted: #6f6962;
  --accent: #b9773a;
  --accent-ink: #fffaf3;
  --chip: rgba(60, 55, 50, 0.07);
  --chip-strong: rgba(60, 55, 50, 0.2);
  --shadow: 0 8px 28px rgba(40, 30, 20, 0.14);
  --display: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1a18; --panel: rgba(32, 30, 28, 0.88); --panel-solid: #201e1c; --panel-line: rgba(255, 245, 230, 0.12);
    --fg: #f1ece6; --muted: #aaa196; --accent: #e0a062; --accent-ink: #1c1a18;
    --chip: rgba(255, 245, 230, 0.08); --chip-strong: rgba(255, 245, 230, 0.22); --shadow: 0 8px 28px rgba(0, 0, 0, 0.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1a18; --panel: rgba(32, 30, 28, 0.88); --panel-solid: #201e1c; --panel-line: rgba(255, 245, 230, 0.12);
  --fg: #f1ece6; --muted: #aaa196; --accent: #e0a062; --accent-ink: #1c1a18;
  --chip: rgba(255, 245, 230, 0.08); --chip-strong: rgba(255, 245, 230, 0.22); --shadow: 0 8px 28px rgba(0, 0, 0, 0.4); color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--display); font-size: 14px; overflow: hidden; }
button { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { position: relative; height: 100%; width: 100%; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.glass { background: var(--panel); border: 1px solid var(--panel-line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* ── Kopfzeile */
.topbar { position: absolute; top: 12px; left: max(12px, env(safe-area-inset-left, 0px)); display: flex; gap: 8px; align-items: center; z-index: 20; max-width: calc(100% - 24px); }
.icon-btn { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--panel-solid); }
.icon-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.crumb { height: 40px; padding: 0 12px; border-radius: 10px; display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; min-width: 0; }
.crumb b { font: 500 11px/1 var(--mono); color: var(--accent); background: var(--chip); padding: 4px 6px; border-radius: 5px; }
.crumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb small { font: 400 11.5px var(--mono); color: var(--muted); white-space: nowrap; }
.hint { position: absolute; right: max(12px, env(safe-area-inset-right, 0px)); top: 12px; font-size: 11.5px; color: var(--muted); padding: 7px 10px; border-radius: 8px; z-index: 10; }
.plan-legend { position: absolute; right: max(12px, env(safe-area-inset-right, 0px)); top: 48px; display: flex; gap: 10px; font-size: 12px; padding: 7px 10px; border-radius: 8px; z-index: 10; }
.plan-legend span { display: flex; align-items: center; gap: 5px; }
.plan-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ── Menü-Schublade */
.scrim { position: absolute; inset: 0; z-index: 25; background: rgba(20, 16, 12, 0.18); }
.drawer {
  position: absolute; top: 0; bottom: 0; left: 0; z-index: 30; width: min(320px, 88vw);
  border-radius: 0 14px 14px 0; border-left: 0; box-shadow: var(--shadow);
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(-104%); transition: transform 0.22s ease, visibility 0s linear 0.22s; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; transition: transform 0.22s ease; }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer.open { transition: none; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding-bottom: 12px; }
.drawer-head h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.drawer-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.drawer section { padding: 12px 0; border-top: 1px solid var(--panel-line); }
.drawer h2 { margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.drawer .note { margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--muted); }

.seg { display: flex; background: var(--chip); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 7px 6px; border-radius: 7px; font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg button:hover { background: var(--chip); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.btn { border: 1px solid var(--panel-line); background: var(--panel-solid); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.btn:hover { border-color: var(--accent); }

.floor-group + .floor-group { margin-top: 8px; }
.floor-group h3 { margin: 0 0 2px; font-size: 12px; font-weight: 600; color: var(--muted); display: flex; gap: 6px; align-items: baseline; }
.floor-group h3 b { font: 500 10.5px var(--mono); color: var(--accent); }
.room-btn { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; font-size: 13px; font-weight: 500; cursor: pointer; text-align: left; }
.room-btn:hover { background: var(--chip); }
.room-btn[aria-current="true"] { background: var(--chip); box-shadow: inset 2px 0 0 var(--accent); }
.room-btn span:last-child { font: 400 11px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 13px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 34px; height: 20px; margin: 0; border-radius: 20px; background: var(--chip-strong); position: relative; cursor: pointer; transition: background 0.15s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(14px); }

.keys { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; font-size: 12px; color: var(--muted); margin-top: 10px; align-items: center; }
kbd { font: 500 10.5px var(--mono); padding: 2px 5px; border-radius: 4px; background: var(--chip); color: var(--fg); border: 1px solid var(--panel-line); white-space: nowrap; }

/* ── Raumleiste */
.roombar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; justify-content: center; pointer-events: none;
  padding: 0 max(12px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
}
.roombar-inner { pointer-events: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; border-radius: 12px; padding: 6px; max-width: 100%; box-shadow: var(--shadow); }
.rb-title { display: grid; padding: 2px 10px 2px 8px; line-height: 1.2; }
.rb-title b { font-size: 14px; font-weight: 700; }
.rb-title small { font: 400 11px var(--mono); color: var(--muted); white-space: nowrap; }
.roombar-inner > button, .rb-group > button { font-weight: 500; font-size: 13px; line-height: 1; background: transparent; border: 0; padding: 9px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.roombar-inner > button:hover, .rb-group > button:hover { background: var(--chip); }
.roombar-inner button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.rb-group { display: flex; gap: 2px; background: var(--chip); border-radius: 9px; padding: 2px; }
.rb-icon { display: grid !important; place-items: center; width: 34px; height: 34px; padding: 0 !important; }
.sep { width: 1px; align-self: stretch; background: var(--panel-line); margin: 2px; }

.popover { position: absolute; left: 50%; transform: translateX(-50%); width: min(420px, calc(100% - 24px)); border-radius: 12px; padding: 12px 14px; z-index: 16; box-shadow: var(--shadow); }
.popover h3 { margin: 0 0 8px; font-size: 14px; }
.popover dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 12.5px; }
.popover dt { color: var(--muted); }
.popover dd { margin: 0; font: 400 12px var(--mono); font-variant-numeric: tabular-nums; }
.popover p { margin: 8px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }

.err { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }

@media (max-width: 640px) {
  .hint { display: none; }
  .plan-legend { top: 60px; left: 12px; right: auto; }
  .crumb small { display: none; }
  .roombar-inner > button, .rb-group > button { padding: 8px 9px; font-size: 12px; }
  .rb-title { width: 100%; text-align: center; padding-bottom: 4px; }
  .roombar .sep { display: none; }
}
