:root {
  --brand: #15598a;
  --brand-d: #0f456c;
  --ok: #1f9d55;
  --bad: #d8392b;
  --ink: #1c2530;
  --panel: rgba(255, 255, 255, 0.95);
  --cat-street: #5b6470;
  --cat-platz: #c8771a;
  --cat-sight: #8e44ad;
  --cat-park: #2e8b57;
  --cat-nightlife: #c0317a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--ink); background: #dfe0db;
  -webkit-text-size-adjust: 100%;
}
#map { position: absolute; inset: 0; }
.hidden { display: none !important; }

/* ---- Inline-SVG-Icons (ersetzen Emojis, erben currentColor) ---- */
#controls button.icon svg { width: 22px; height: 22px; }
#controls button.primary svg { width: 18px; height: 18px; }
.mode-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
#sv-close svg { width: 18px; height: 18px; }
#geohint-arrow svg { width: 26px; height: 26px; }
.ico-inline { width: 1.05em; height: 1.05em; vertical-align: -0.18em; }
h1 .ico-inline { width: 0.95em; height: 0.95em; vertical-align: -0.12em; }

.panel {
  position: absolute; z-index: 10;
  background: var(--panel);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

/* ---- top prompt ---- */
#topbar {
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: 8px; right: 8px; max-width: 600px; margin: 0 auto;
  padding: 10px 14px 12px; text-align: center;
}
#score { font-size: 13px; color: #5a6470; font-variant-numeric: tabular-nums; }
#score-best { margin-left: 6px; color: #97a0aa; }
#prompt { margin-top: 4px; display: flex; align-items: center; justify-content: center;
  gap: 10px; flex-wrap: wrap; }
#prompt-name { font-size: clamp(21px, 5.2vw, 31px); font-weight: 750; line-height: 1.1; }
#hint { margin-top: 4px; font-size: 13px; color: #7a838d; }

.chip {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--cat-street);
}
.chip.street { background: var(--cat-street); }
.chip.platz { background: var(--cat-platz); }
.chip.sight { background: var(--cat-sight); }
.chip.park { background: var(--cat-park); }
.chip.nightlife { background: var(--cat-nightlife); }

/* ---- feedback ---- */
#feedback {
  position: absolute; z-index: 11; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 118px);
  padding: 9px 18px; border-radius: 999px; color: #fff; font-weight: 700;
  font-size: 15px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  max-width: 92vw; text-align: center;
}
#feedback.ok { background: var(--ok); }
#feedback.bad { background: var(--bad); }

/* ---- street view photo ---- */
#photo {
  position: absolute; z-index: 11; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
  width: min(340px, 86vw); margin: 0; pointer-events: none;
  background: #0b0e12; border-radius: 14px; overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.32);
}
/* Umkehr-Modus: statisches Fallback-Foto nach oben (unten liegt das Antwort-Panel) */
#photo.rev {
  bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 168px);
  width: min(300px, 76vw);
}
#photo img { display: block; width: 100%; height: auto; }
#photo figcaption {
  padding: 6px 10px; font-size: 12px; font-weight: 600; color: #e8edf2;
  background: #0b0e12; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* interaktives Street-View-Panorama – gross, aber nicht ganz randlos */
#sv {
  position: fixed; z-index: 14;
  left: 50%; transform: translateX(-50%);
  width: min(720px, calc(100vw - 36px));
  top: calc(env(safe-area-inset-top, 0px) + 24px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 100px);
  border-radius: 16px; overflow: hidden; background: #0b0e12;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.45);
}
#sv-pano { position: absolute; inset: 0; }
#sv-cap {
  position: absolute; left: 10px; bottom: 10px; z-index: 2;
  max-width: calc(100% - 70px); padding: 6px 12px; border-radius: 999px;
  background: rgba(11, 14, 18, 0.78); color: #fff; font-size: 14px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
#sv-close {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 40px; height: 40px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(11, 14, 18, 0.78); color: #fff; font-size: 18px; line-height: 40px;
}
#sv-close:active { transform: scale(0.94); }

/* Street-View-Modus: Panorama oben angedockt (Karte/Antwort bleiben darunter) */
#sv.gg {
  left: 8px; right: 8px; width: auto; max-width: 600px; margin: 0 auto;
  transform: none;
  top: calc(env(safe-area-inset-top, 0px) + 78px);
  bottom: auto; height: 44vh;
}

/* ---- controls ---- */
#controls {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  left: 8px; right: 8px; max-width: 600px; margin: 0 auto;
  padding: 10px; display: flex; gap: 8px; align-items: center; justify-content: center;
  flex-wrap: wrap;
}
#controls button {
  font: inherit; font-size: 16px; font-weight: 600; border: 0; border-radius: 12px;
  padding: 12px 16px; min-height: 50px; background: #eef0f2; color: var(--ink);
  cursor: pointer; flex: 1 1 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
#controls button.icon { flex: 0 0 auto; min-width: 50px; font-size: 20px; }
#controls button.primary { background: var(--brand); color: #fff; flex: 1 1 100%; }
#controls button:active { transform: scale(0.97); }
#controls button:disabled { opacity: .45; }
#controls button.icon.off { opacity: .4; text-decoration: line-through; }

/* ---- overlay / start sheet ---- */
#overlay {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center;
  justify-content: center; background: rgba(15, 30, 45, 0.55); padding: 16px;
}
.sheet {
  background: #fff; border-radius: 22px; padding: 22px 20px 18px;
  width: min(480px, 94vw); max-height: 88vh; overflow: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.sheet h1 { margin: 0 0 6px; font-size: 24px; color: var(--brand-d); }
.sheet h2 { margin: 16px 0 8px; font-size: 15px; color: #44505c; }
.sheet .lead { margin: 0; font-size: 15px; line-height: 1.45; color: #3a444f; }

#cats { display: flex; flex-direction: column; gap: 8px; }
.cat {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px;
  border: 1.5px solid #e2e5e9; border-radius: 13px; cursor: pointer; user-select: none;
}
.cat.on { border-color: var(--brand); background: #f1f7fc; }
.cat .dot { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; }
.cat .nm { font-weight: 650; flex: 1 1 auto; }
.cat .ct { color: #8a939c; font-size: 13px; font-variant-numeric: tabular-nums; }
.cat input { width: 22px; height: 22px; accent-color: var(--brand); }

#howto { margin: 14px 0 4px; font-size: 14px; color: #45505b; }
#howto summary { cursor: pointer; font-weight: 650; }
#howto ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.5; }

.big { width: 100%; font-size: 18px; font-weight: 700; padding: 15px; border: 0;
  border-radius: 14px; margin-top: 16px; cursor: pointer; }
.primary { background: var(--brand); color: #fff; }
.primary:active { background: var(--brand-d); }
.attrib { margin: 12px 0 0; font-size: 11px; color: #9aa3ac; text-align: center; }

/* MapLibre controls a touch lower so they don't collide with the prompt */
.maplibregl-ctrl-top-right { margin-top: calc(env(safe-area-inset-top, 0px) + 132px); }

#blocked-wrap { margin: 14px 0 4px; font-size: 14px; color: #45505b; }
#blocked-wrap summary { cursor: pointer; font-weight: 650; }
#blocked-list { max-height: 40vh; overflow: auto; margin-top: 6px; }
.blocked-item { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 2px; border-bottom: 1px solid #eef0f2; }
.blocked-item span { flex: 1 1 auto; }
.blocked-item button { font: inherit; font-size: 13px; border: 0; cursor: pointer;
  background: #fbe3df; color: #b1342a; border-radius: 8px; padding: 6px 11px; }
.muted { color: #9aa3ac; font-size: 14px; padding: 6px 0; }
.ghost { margin-top: 10px; width: 100%; font: inherit; font-size: 14px; cursor: pointer;
  background: #eef0f2; color: var(--ink); border: 0; border-radius: 10px; padding: 11px; }

#summary { position: fixed; inset: 0; z-index: 21; display: flex; align-items: center;
  justify-content: center; background: rgba(15, 30, 45, 0.55); padding: 16px; }

@media (min-width: 720px) {
  #topbar, #controls { max-width: 560px; }
  #controls button { flex: 0 1 auto; }
  #controls button.primary { flex: 0 1 auto; min-width: 160px; }
}

/* ---- Modus-Auswahl (Start-Sheet) ---- */
#modes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.mode-btn {
  flex: 1 1 0; min-width: 0; font: inherit; font-size: 14px; font-weight: 650;
  line-height: 1.15; padding: 12px 6px; border: 1.5px solid #e2e5e9; border-radius: 13px;
  background: #fff; color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.mode-btn.on { border-color: var(--brand); background: #f1f7fc; color: var(--brand-d); }
.mode-btn:active { transform: scale(0.98); }
.mode-note { margin: 8px 2px 0; font-size: 13px; line-height: 1.45; color: #7a838d; }

/* ---- Umkehr-Modus: Antwortart + Schwierigkeit (Start-Sheet) ---- */
#ans-modes, #diff-modes { display: flex; gap: 8px; }
#text-diff { margin-top: 10px; }
.ans-btn, .diff-btn {
  flex: 1 1 0; font: inherit; font-weight: 650;
  padding: 12px 10px; border: 1.5px solid #e2e5e9; border-radius: 13px;
  background: #fff; color: var(--ink); cursor: pointer;
}
.ans-btn { font-size: 15px; }
.diff-btn { font-size: 14px; }
.ans-btn.on, .diff-btn.on { border-color: var(--brand); background: #f1f7fc; color: var(--brand-d); }
.ans-btn:active, .diff-btn:active { transform: scale(0.98); }

/* ---- Street-View-Modus: Antwortart + Schwierigkeit (Start-Sheet) ---- */
#ggans-modes { display: flex; flex-wrap: wrap; gap: 8px; }
#ggdiff-modes { display: flex; gap: 8px; }
#gg-text-diff { margin-top: 10px; }
.ggans-btn, .ggdiff-btn {
  flex: 1 1 0; min-width: 96px; font: inherit; font-size: 14px; font-weight: 650;
  padding: 12px 8px; border: 1.5px solid #e2e5e9; border-radius: 13px;
  background: #fff; color: var(--ink); cursor: pointer;
}
.ggans-btn.on, .ggdiff-btn.on { border-color: var(--brand); background: #f1f7fc; color: var(--brand-d); }
.ggans-btn:active, .ggdiff-btn:active { transform: scale(0.98); }

/* ---- Umkehr-Modus: Antwort-Panel ueber den Steuerungs-Buttons ---- */
#answer {
  z-index: 11; left: 8px; right: 8px; max-width: 600px; margin: 0 auto;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
  padding: 12px;
}
#mc-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mc-opt {
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2;
  min-height: 56px; padding: 10px 12px; border: 1.5px solid #e2e5e9; border-radius: 12px;
  background: #fff; color: var(--ink); cursor: pointer;
}
.mc-opt:active { transform: scale(0.98); }
.mc-opt.correct { border-color: var(--ok); background: #e7f6ee; color: #147a3f; }
.mc-opt.wrong { border-color: var(--bad); background: #fbe3df; color: #b1342a; }
.mc-opt:disabled { cursor: default; }

#text-form-row { display: flex; gap: 8px; }
#text-input {
  flex: 1 1 auto; min-width: 0; font: inherit; font-size: 17px; padding: 12px 13px;
  border: 1.5px solid #d6dade; border-radius: 12px; background: #fff; color: var(--ink);
}
#text-input:focus { outline: none; border-color: var(--brand); }
#text-input:disabled { background: #f4f5f7; color: #6b747d; }
#text-submit {
  flex: 0 0 auto; font: inherit; font-size: 16px; font-weight: 700; border: 0;
  border-radius: 12px; padding: 0 20px; min-height: 50px; cursor: pointer;
}
#text-submit:disabled { opacity: .5; }
#suggest { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 10px; }
#suggest:empty { display: none; }
.sugg {
  font: inherit; font-size: 14px; font-weight: 600; border: 1.5px solid #cfe0ef;
  background: #eef6fc; color: var(--brand-d); border-radius: 999px;
  padding: 8px 13px; cursor: pointer;
}
.sugg:active { transform: scale(0.97); }

/* ---- Vor-Ort: Richtungshinweis (auf Abruf) ---- */
#geohint {
  z-index: 11; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 150px);
  display: flex; align-items: center; gap: 12px; padding: 9px 16px 9px 11px;
}
#geohint-arrow {
  width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  will-change: transform; transition: transform 0.25s ease-out;
}
#geohint-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
#geohint-dist { font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; }
#geohint-dir { font-size: 13px; color: #7a838d; white-space: nowrap; }

/* ---- login page ---- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100%; padding: 16px;
  background: linear-gradient(160deg, #1c2530 0%, #15598a 100%);
}
#login.sheet { width: min(380px, 94vw); }
.field { display: block; margin: 16px 0 4px; }
.field span { display: block; font-size: 13px; font-weight: 650; color: #44505c;
  margin-bottom: 6px; }
.field input {
  width: 100%; font: inherit; font-size: 17px; padding: 12px 13px;
  border: 1.5px solid #d6dade; border-radius: 12px; background: #fff; color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--brand); }
.remember { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px;
  font-size: 15px; color: #3a444f; cursor: pointer; user-select: none; }
.remember input { width: 22px; height: 22px; accent-color: var(--brand); }
.login-err { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px;
  background: #fbe3df; color: #b1342a; font-size: 14px; font-weight: 600; }
