:root {
  --ink: #1d1b18;
  --paper: #f4f1ea;
  --sand: #d8cfbf;
  --accent: #b5532a;
  --glass: rgba(24, 22, 19, 0.55);
  --line: rgba(255, 255, 255, 0.22);
  font-family: "Avenir Next", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #14120f; color: var(--paper); overflow: hidden; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }

/* ---------- Startkarte ---------- */
#start {
  position: fixed; inset: 0; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(120% 90% at 50% 20%, rgba(20, 18, 15, 0.35), rgba(20, 18, 15, 0.86));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: opacity .5s ease; z-index: 10;
}
#start.weg { opacity: 0; pointer-events: none; }
#karte { width: min(560px, 100%); padding: 34px 36px 26px; background: rgba(244, 241, 234, 0.96); color: var(--ink);
  border-radius: 4px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
#karte .k { margin: 0 0 10px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: #6f675b; }
#karte h1 { margin: 0; font-weight: 500; font-size: clamp(40px, 9vw, 64px); line-height: 1; letter-spacing: -.02em; }
#karte .u { margin: 10px 0 22px; font-size: 17px; color: #4b453c; }
#lade { height: 3px; background: #ddd5c6; overflow: hidden; }
#balken { height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
#status { margin: 8px 0 18px; font-size: 13px; color: #6f675b; min-height: 1.2em; font-variant-numeric: tabular-nums; }
#los { appearance: none; border: 0; background: var(--ink); color: var(--paper); font: inherit; font-size: 16px;
  padding: 13px 22px; border-radius: 2px; cursor: pointer; letter-spacing: .02em; }
#los:disabled { opacity: .35; cursor: default; }
#los:not(:disabled):hover { background: var(--accent); }
#tasten { margin: 24px 0 0; padding: 16px 0 0; border-top: 1px solid #d9d1c2; display: grid;
  grid-template-columns: 1fr 1fr; gap: 6px 22px; font-size: 13px; }
#tasten div { display: flex; justify-content: space-between; gap: 10px; }
#tasten dt { font-weight: 600; white-space: nowrap; }
#tasten dd { margin: 0; color: #5d564b; text-align: right; }
#quellen { margin: 16px 0 0; font-size: 10.5px; line-height: 1.45; color: #857c6e; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#ort { position: absolute; left: 18px; top: 16px; padding: 9px 14px; background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 3px; }
#raum { font-size: 17px; letter-spacing: .01em; }
#geschoss { margin-left: 10px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
#kompass { position: absolute; right: 18px; top: 16px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#nadel { position: absolute; inset: 0; }
#nadel::before { content: ""; position: absolute; left: 50%; top: 7px; width: 0; height: 0; margin-left: -4px;
  border: 4px solid transparent; border-bottom: 9px solid var(--accent); }
#nadel i { position: absolute; left: 0; right: 0; bottom: 6px; text-align: center; font-style: normal; font-size: 10px;
  letter-spacing: .08em; opacity: .85; }
#hinweis { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); padding: 8px 14px; font-size: 13px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 3px; opacity: 0; transition: opacity .3s;
  white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
#hinweis.an { opacity: 1; }
#leiste { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px 14px; display: flex; flex-wrap: wrap;
  gap: 8px 14px; justify-content: space-between; align-items: flex-end;
  background: linear-gradient(transparent, rgba(12, 11, 9, .55)); pointer-events: auto; transition: opacity .3s; }
body.gesperrt #leiste { opacity: .0; pointer-events: none; }
#spruenge, #aktionen { display: flex; flex-wrap: wrap; gap: 6px; }
#leiste button { appearance: none; font: inherit; font-size: 13px; color: var(--paper); cursor: pointer;
  padding: 7px 11px; background: var(--glass); border: 1px solid var(--line); border-radius: 2px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#leiste button:hover, #leiste button.an { background: var(--accent); border-color: transparent; }
#leiste button b { font-weight: 600; opacity: .6; margin-right: 6px; font-variant-numeric: tabular-nums; }
#joy { position: absolute; left: 22px; bottom: 96px; width: 112px; height: 112px; border-radius: 50%;
  background: rgba(255, 255, 255, .10); border: 1px solid var(--line); pointer-events: auto; touch-action: none; }
#joyk { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  background: rgba(255, 255, 255, .5); }
@media (max-width: 640px) {
  #karte { padding: 26px 22px 20px; }
  #tasten { grid-template-columns: 1fr; }
  #leiste { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Auswahl der Ausstattung ---------- */
#wahl { position: absolute; left: 16px; bottom: 104px; width: min(330px, calc(100% - 32px)); padding: 14px 16px 12px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#wahl .wk { margin: 0 0 10px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; opacity: .75; }
#wahl .wg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
#wahl .wg span { width: 68px; font-size: 12.5px; opacity: .85; }
#wahl button { appearance: none; font: inherit; font-size: 13px; color: var(--paper); cursor: pointer; padding: 7px 11px; background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 2px; }
#wahl button:hover { border-color: #fff; }
#wahl button.an { background: var(--accent); border-color: transparent; }
#wahl .wn { margin: 8px 0 0; font-size: 11.5px; line-height: 1.4; opacity: .7; }
body.gesperrt #wahl { opacity: 0; pointer-events: none; }
#karte .g { margin: 8px 0 14px; font-size: 12.5px; color: #6f675b; }
#karte .links { margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; }
#karte .links a { color: #4b453c; }
@media (max-width: 640px) { #wahl { bottom: 150px; } }

/* ---------- Telefon und Tablet ---------- */
html, body { position: fixed; inset: 0; width: 100%; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#start { overflow-y: auto; -webkit-overflow-scrolling: touch; }
#karte { margin: auto; }
#film { display: inline-block; background: var(--ink); color: var(--paper); font-size: 16px; padding: 13px 22px; border-radius: 2px; text-decoration: none; }
#film[hidden], #lade[hidden], #los[hidden] { display: none; }
#tasten-touch { display: none; margin: 24px 0 0; padding: 16px 0 0; border-top: 1px solid #d9d1c2; gap: 6px 22px; font-size: 13px; }
#tasten-touch div { display: flex; justify-content: space-between; gap: 10px; }
#tasten-touch dt { font-weight: 600; white-space: nowrap; }
#tasten-touch dd { margin: 0; color: #5d564b; text-align: right; }
html.touch #tasten { display: none; }
html.touch #tasten-touch { display: grid; }
html.touch #ort { left: max(14px, env(safe-area-inset-left)); top: max(12px, env(safe-area-inset-top)); padding: 7px 11px; }
html.touch #raum { font-size: 15px; }
html.touch #kompass { right: max(14px, env(safe-area-inset-right)); top: max(12px, env(safe-area-inset-top)); width: 42px; height: 42px; }
html.touch #hinweis { top: calc(max(12px, env(safe-area-inset-top)) + 52px); white-space: normal; text-align: center; width: max-content; max-width: 86vw; line-height: 1.35; }
html.touch #leiste { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 6px;
  padding: 10px max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
html.touch #spruenge, html.touch #aktionen { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; touch-action: pan-x; }
html.touch #spruenge::-webkit-scrollbar, html.touch #aktionen::-webkit-scrollbar { display: none; }
html.touch #leiste button { flex: none; min-height: 40px; padding: 8px 13px; font-size: 14px; white-space: nowrap; }
html.touch #leiste button:hover { background: var(--glass); border-color: var(--line); }
html.touch #leiste button.an { background: var(--accent); border-color: transparent; }
html.touch #joy { left: max(20px, env(safe-area-inset-left)); bottom: calc(max(10px, env(safe-area-inset-bottom)) + 112px); width: 124px; height: 124px; }
html.touch #joyk { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
html.touch #wahl { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); top: calc(max(12px, env(safe-area-inset-top)) + 54px); bottom: auto; width: auto; max-width: 420px; }
html.touch #wahl button { min-height: 40px; padding: 8px 13px; }
@media (orientation: landscape) and (max-height: 480px) {
  html.touch #leiste { flex-direction: row; align-items: flex-end; gap: 8px; }
  html.touch #spruenge { flex: 1 1 auto; min-width: 0; }
  html.touch #aktionen { flex: 0 1 46%; min-width: 0; }
  html.touch #joy { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 62px); width: 112px; height: 112px; }
  html.touch #wahl { left: auto; right: max(12px, env(safe-area-inset-right)); top: calc(max(12px, env(safe-area-inset-top)) + 52px); width: min(400px, 52vw); }
  #karte { padding: 18px 22px 16px; }
  #karte h1 { font-size: 34px; }
  #karte .u { margin: 6px 0 12px; font-size: 15px; }
  #tasten-touch { margin-top: 14px; padding-top: 10px; grid-template-columns: 1fr 1fr; }
}
