:root {
  --bg: #eef1f4; --panel: #ffffff; --ink: #23293a; --muted: #6b7280;
  --accent: #2d6cdf; --accent-dark: #1f4fa8; --border: #dfe3ea; --radius: 16px;
  --shadow: 0 6px 20px rgba(30, 40, 60, 0.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  font-family: "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg);
  -webkit-user-select: none; user-select: none; }
#app { width: 100vw; height: 100vh; display: flex; flex-direction: column; position: relative; }
#topbar { height: 72px; flex: 0 0 auto; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px; }
.venue-name { font-size: 24px; font-weight: 700; }
.clock { font-size: 22px; color: var(--muted); font-variant-numeric: tabular-nums; }
#layout { flex: 1 1 auto; display: flex; min-height: 0; }
#sidebar { width: 420px; flex: 0 0 auto; background: var(--panel); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px; gap: 14px; min-height: 0; }
#searchBox { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 2px solid var(--border);
  border-radius: 999px; padding: 12px 16px; flex: 0 0 auto; }
#searchBox .search-icon { font-size: 20px; }
#searchInput { flex: 1; border: none; background: transparent; font-size: 20px; outline: none; color: var(--ink); }
.icon-btn { border: none; background: none; font-size: 18px; color: var(--muted); cursor: pointer; padding: 6px 10px; border-radius: 999px; }
.icon-btn:active { background: var(--border); }
#categoryTiles { display: flex; flex-wrap: wrap; gap: 8px; flex: 0 0 auto; }
.cat-tile { border: 2px solid var(--border); background: var(--panel); border-radius: 12px; padding: 10px 14px;
  font-size: 15px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--ink); }
.cat-tile.active { border-color: var(--accent); background: #eaf1fd; color: var(--accent-dark); }
.cat-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
#resultsList { flex: 1 1 auto; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.result-item { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; }
.result-item:active { background: #e3e8ee; }
.result-item.selected { border-color: var(--accent); background: #eaf1fd; }
.result-badge { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; overflow: hidden; }
.result-badge-logo { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
.result-text { min-width: 0; }
.result-name { font-size: 17px; font-weight: 600; line-height: 1.25; }
.result-cat { font-size: 13px; color: var(--muted); }
.empty-note { padding: 20px; color: var(--muted); font-size: 15px; text-align: center; }
.route-pref-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; flex: 0 0 auto; }
.route-pref-bar.hidden { display: none; }
.route-pref-label { font-size: 14px; color: var(--muted); font-weight: 600; margin-right: 2px; }
.pref-btn { display: flex; align-items: center; gap: 7px; border: 2px solid var(--border); background: var(--panel);
  border-radius: 999px; padding: 9px 16px; font-size: 15px; font-weight: 600; color: var(--ink); cursor: pointer; }
.pref-btn svg { flex: 0 0 auto; }
.pref-btn.active { border-color: var(--accent); background: var(--accent); color: #fff; }
.pref-btn:active { background: var(--border); }
.pref-btn.active:active { background: var(--accent-dark); }
#mapArea { flex: 1 1 auto; position: relative; min-width: 0; background: #e5e9ee; overflow: hidden; }
#mapViewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
#mapStage { position: absolute; top: 50%; left: 50%; transform-origin: center center; will-change: transform; }
#mapImage { display: block; max-width: none; pointer-events: none; box-shadow: var(--shadow); border-radius: 4px; background: #fff; }
#mapOverlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.floor-tabs { position: absolute; left: 50%; top: 20px; transform: translateX(-50%); display: flex; gap: 6px;
  background: var(--panel); padding: 6px; border-radius: 999px; box-shadow: var(--shadow); z-index: 6; }
.floor-tab { border: none; background: transparent; padding: 12px 20px; border-radius: 999px; font-size: 16px;
  font-weight: 700; color: var(--muted); cursor: pointer; }
.floor-tab.active { background: var(--accent); color: #fff; }
.floor-tab:active { background: var(--border); }
.floor-tab.active:active { background: var(--accent-dark); }
#mapControls { position: absolute; right: 20px; top: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 5; }
.map-btn { width: 52px; height: 52px; border-radius: 14px; border: none; background: var(--panel); box-shadow: var(--shadow); font-size: 24px; color: var(--ink); cursor: pointer; }
.map-btn:active { background: var(--border); }
/* Panel wybranego punktu - po lewej stronie, w tym samym miejscu niezależnie
   od tego, czy punkt wybrano z listy wyników, czy dotykiem ikonki na mapie. */
.selected-panel { background: var(--panel); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 16px; flex: 0 0 auto; }
.selected-panel.hidden { display: none; }
.selected-panel-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.selected-panel-text { min-width: 0; flex: 1 1 auto; }
.selected-panel-close { flex: 0 0 auto; margin: -6px -6px 0 0; }
.card-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.card-cat { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.card-desc { font-size: 15px; color: var(--ink); margin-bottom: 16px; line-height: 1.4; }
.card-actions { display: flex; gap: 10px; }
.btn { border: none; border-radius: 12px; padding: 14px 18px; font-size: 16px; font-weight: 700; cursor: pointer; }
.btn-primary { background: var(--accent); color: #fff; flex: 1; }
.btn-primary:active { background: var(--accent-dark); }
.btn-secondary { background: var(--bg); color: var(--ink); border: 1px solid var(--border); }
.btn-secondary:active { background: var(--border); }
#routeBar { position: absolute; left: 50%; top: 20px; transform: translateX(-50%); background: var(--panel); border-radius: 24px; box-shadow: var(--shadow); padding: 12px 22px; display: flex; align-items: center; gap: 16px; z-index: 6; font-size: 16px; max-width: calc(100% - 40px); }
/* Gdy widoczny jest przełącznik pięter, pasek trasy schodzi niżej, żeby go nie zasłaniać. */
#floorTabs.floor-tabs:not(.hidden) ~ #routeBar { top: 90px; }
#routeBar.hidden { display: none; }
#routeBar .route-info b { color: var(--accent-dark); }
#routeBar .route-floors { font-size: 13px; color: var(--muted); margin-top: 2px; }
#routeBar button { border: none; background: #fde8e8; color: #b23b3b; font-weight: 700; border-radius: 999px; padding: 10px 16px; cursor: pointer; }
#homeOverlay { position: absolute; inset: 0; background: linear-gradient(160deg, #2d6cdf, #1a3f80); color: #fff; display: flex; align-items: center; justify-content: center; z-index: 50; text-align: center; }
.home-content { max-width: 720px; padding: 20px; }
#homeTitle { font-size: 52px; margin: 0 0 12px; }
.home-sub { font-size: 22px; opacity: 0.9; margin-bottom: 34px; }
#homeCategoryTiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-bottom: 40px; }
#homeCategoryTiles .cat-tile { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.35); color: #fff; font-size: 18px; padding: 16px 22px; }
#homeCategoryTiles .cat-tile:active { background: rgba(255,255,255,0.28); }
#startBtn { border: none; background: #fff; color: var(--accent-dark); font-size: 20px; font-weight: 700; padding: 16px 34px; border-radius: 999px; cursor: pointer; }
#keyboardOverlay { position: absolute; left: 0; right: 0; bottom: 0; background: #1c2333; padding: 14px; z-index: 60; box-shadow: 0 -8px 24px rgba(0,0,0,0.3); }
#keyboardOverlay.hidden { display: none; }
.kb-row { display: flex; justify-content: center; gap: 6px; margin-bottom: 6px; }
.kb-key { min-width: 46px; height: 52px; padding: 0 10px; background: #2c3550; color: #fff; border: none; border-radius: 8px; font-size: 18px; cursor: pointer; }
.kb-key:active { background: #3d4970; }
.kb-key.wide { min-width: 220px; }
.kb-key.func { background: #45507a; }
#resultsList::-webkit-scrollbar { width: 8px; }
#resultsList::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.hidden { display: none !important; }

/* Przycisk wysokiego kontrastu - zawsze widoczny (nawet na ekranie startowym,
   który wizualnie zakrywa resztę interfejsu), więc stoi poza normalnym
   układem, w rogu ekranu, z najwyższym z-index. */
.contrast-toggle-btn {
  position: fixed; bottom: 16px; right: 16px; z-index: 100;
  width: 52px; height: 52px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--panel); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); cursor: pointer;
}
.contrast-toggle-btn:active { background: var(--border); }
.contrast-toggle-btn[aria-pressed="true"] { background: #ffd400; color: #000; border-color: #000; }

/* Dyskretny link do panelu administracyjnego - widoczny, ale mały i stonowany,
   żeby nie rozpraszał gości kiosku; przeciwny róg niż przełącznik kontrastu. */
.admin-link {
  position: fixed; bottom: 8px; left: 10px; z-index: 100;
  font-size: 11px; color: var(--muted); text-decoration: none;
  opacity: .55; padding: 4px 6px;
}
.admin-link:hover, .admin-link:focus-visible { opacity: 1; text-decoration: underline; }
body.contrast-high .admin-link { color: var(--ink); opacity: .8; }

/* --- Tryb wysokiego kontrastu (dla osób niedowidzących) ---
   Większość kolorów w interfejsie jest już zdefiniowana przez zmienne
   --bg/--panel/--ink/--muted/--accent/--border, więc nadpisanie ich tutaj
   automatycznie "przefarbowuje" praktycznie cały interfejs. Osobno
   poprawiamy tylko te kilka miejsc, które mają kolor wpisany na sztywno. */
body.contrast-high {
  --bg: #000000; --panel: #000000; --ink: #ffffff; --muted: #e6e6e6;
  --accent: #ffd400; --accent-dark: #e0b800; --border: #ffffff;
  --shadow: 0 0 0 2px #ffffff;
}
body.contrast-high #topbar,
body.contrast-high #sidebar { border-color: #ffffff; }
body.contrast-high #searchBox,
body.contrast-high .cat-tile,
body.contrast-high .result-item,
body.contrast-high .pref-btn,
body.contrast-high .floor-tabs,
body.contrast-high .map-btn,
body.contrast-high .card,
body.contrast-high #routeBar,
body.contrast-high .kb-key { border: 2px solid #ffffff; }
body.contrast-high .cat-tile.active,
body.contrast-high .pref-btn.active,
body.contrast-high .floor-tab.active,
body.contrast-high .result-item.selected { color: #000000; }
body.contrast-high .cat-dot { box-shadow: 0 0 0 1px #ffffff; }
body.contrast-high #mapArea { background: #000000; }
body.contrast-high #mapImage { filter: contrast(1.4) saturate(1.2); box-shadow: 0 0 0 2px #ffffff; }
body.contrast-high .route-line { stroke: #00e5ff !important; }
body.contrast-high .route-start-marker { fill: #ffd400 !important; }
body.contrast-high #routeBar button { background: #000000; color: #ffd400; border: 2px solid #ffd400; }
body.contrast-high #homeOverlay { background: #000000; }
body.contrast-high #homeCategoryTiles .cat-tile { background: #000000; border-color: #ffffff; color: #ffffff; }
body.contrast-high #startBtn { background: #ffd400; color: #000000; }
body.contrast-high #keyboardOverlay { background: #000000; border-top: 2px solid #ffffff; }
body.contrast-high .kb-key { background: #000000; color: #ffffff; }
body.contrast-high .kb-key.func { background: #333333; }
body.contrast-high .kb-key:active { background: #333333; }
