/* Mobiki Maps — web. Tokens mirror the kiosk (android-kiosk kiosk_colors.xml). */
:root {
  --navy: #0E1726;
  --primary: #1554D1;
  --primary-soft: #E1EAFB;
  --primary-tint: #EEF3FD;
  --here: #E8710A;
  --ground: #F4F6F9;
  --panel: #FFFFFF;
  --ink: #0E1726;
  --ink-2: #3B4657;
  --muted: #556173;
  --faint: #9AA5B4;
  --line: #DCE2EA;
  --line-strong: #C8D1DD;
  --topbar-muted: #A9B4C4;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(14, 23, 38, .14);
  --top-h: 56px;
  --panel-w: 400px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--ground);
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

/* ── top bar ───────────────────────────────────────────────────────────── */
.top {
  height: var(--top-h);
  padding: 0 12px 0 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark {
  flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--primary);
  display: grid; place-items: center; font-weight: 800;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-text b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--topbar-muted); font-size: 12px; }
.brand-text small:empty { display: none; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.top-btn {
  height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .22);
  background: transparent; color: #fff; font-weight: 600; font-size: 13px;
}
.lang { display: flex; background: rgba(255, 255, 255, .1); border-radius: 10px; padding: 3px; }
.lang button {
  border: 0; background: transparent; color: #fff; font-weight: 700; font-size: 13px;
  min-width: 40px; height: 30px; border-radius: 8px;
}
.lang button[aria-pressed="true"] { background: #fff; color: var(--navy); }

/* ── layout ────────────────────────────────────────────────────────────── */
.layout { position: relative; height: calc(100% - var(--top-h)); }
.map { position: absolute; inset: 0 var(--panel-w) 0 0; background: #E9EDF2; }
.map.loading::after {
  content: attr(data-loading); position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%);
  background: var(--panel); color: var(--muted); font-weight: 600; padding: 10px 16px; border-radius: 12px;
  box-shadow: var(--shadow); z-index: 2;
}
body.no-venue .map, body.no-venue .floors, body.no-venue .map-ctrls { display: none; }
body.no-venue .panel { position: static; width: auto; max-width: 720px; margin: 0 auto; height: 100%; box-shadow: none; background: transparent; }

.panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: var(--panel-w);
  background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.panel-grip { display: none; }
.panel-body { flex: 1; overflow-y: auto; padding: 22px 22px calc(22px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }

.floors {
  position: absolute; left: 12px; top: 12px; max-height: calc(100% - 24px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px; padding: 5px;
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  scrollbar-width: none;
}
.floors:empty { display: none; }
.floors button {
  position: relative; border: 0; background: var(--ground); min-width: 44px; height: 40px; padding: 0 8px;
  border-radius: 10px; font-weight: 700; font-size: 15px; color: var(--ink);
}
.floors button[aria-current="true"] { background: var(--primary); color: #fff; }
.floors button .dot {
  position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--here); border: 1.5px solid #fff;
}

.map-ctrls { position: absolute; top: 12px; right: calc(var(--panel-w) + 12px); display: flex; flex-direction: column; gap: 8px; }
.map-ctrls button {
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--panel);
  box-shadow: var(--shadow); font-size: 22px; line-height: 1; color: var(--ink);
}

/* ── panel content ─────────────────────────────────────────────────────── */
h1 { font-size: 24px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; font-weight: 700; }
p { margin: 0 0 12px; }

.search { position: relative; margin: 14px 0 4px; }
.search input {
  width: 100%; height: 52px; padding: 0 44px 0 46px; border-radius: var(--radius);
  border: 2px solid var(--line-strong); background: #fff; font: inherit; font-size: 16px; color: var(--ink);
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { border-color: var(--primary); outline: none; }
.search::before {
  content: ""; position: absolute; left: 16px; top: 50%; width: 15px; height: 15px; margin-top: -10px;
  border: 2.5px solid var(--primary); border-radius: 50%;
}
.search::after {
  content: ""; position: absolute; left: 30px; top: 50%; width: 8px; height: 2.5px; margin-top: 6px;
  background: var(--primary); border-radius: 2px; transform: rotate(45deg);
}
.search .clear {
  position: absolute; right: 6px; top: 6px; width: 40px; height: 40px; border: 0; background: transparent;
  font-size: 20px; color: var(--muted); border-radius: 10px;
}

.list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.item {
  width: 100%; text-align: left; border: 0; background: var(--ground); border-radius: 12px;
  padding: 11px 14px; display: flex; align-items: center; gap: 12px; min-height: 56px;
}
.item:hover { background: var(--primary-tint); }
.item .badge {
  flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--primary-soft);
  color: var(--primary); display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.item .txt { min-width: 0; flex: 1; }
.item .txt b { display: block; font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.item .txt small { color: var(--muted); font-size: 13px; }
.item .side { flex: none; font-weight: 700; color: var(--ink-2); font-size: 14px; }
a.item { color: inherit; text-decoration: none; }

.back { border: 0; background: transparent; color: var(--primary); font-weight: 700; padding: 6px 0; margin-bottom: 8px; }
.back::before { content: "‹ "; font-size: 18px; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 14px 0; }
.fact { background: var(--ground); border-radius: 12px; padding: 10px 12px; }
.fact small { display: block; font-size: 11px; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.fact b { font-size: 19px; }

.btn {
  width: 100%; min-height: 52px; border-radius: var(--radius); border: 2px solid var(--line-strong);
  background: #fff; font-weight: 700; font-size: 16px; padding: 0 16px; margin-top: 8px;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }

.modes { display: flex; background: var(--ground); border-radius: 12px; padding: 4px; gap: 2px; margin: 12px 0; }
.modes button {
  flex: 1; min-width: 0; border: 0; background: transparent; border-radius: 9px; padding: 8px 2px;
  font-size: 12px; font-weight: 700; color: var(--ink-2); line-height: 1.2;
}
.modes button small { display: block; font-weight: 600; color: var(--muted); font-size: 11px; }
.modes button[aria-pressed="true"] { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(14, 23, 38, .16); }
.modes button:disabled { opacity: .4; }

.summary { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 2px; }
.summary b { font-size: 26px; letter-spacing: -.01em; }
.summary span { color: var(--muted); }

.steps { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.step {
  width: 100%; text-align: left; border: 0; background: var(--ground); border-radius: 12px;
  padding: 11px 14px; display: flex; gap: 12px; align-items: flex-start;
}
.step[aria-current="true"] { background: var(--primary-tint); box-shadow: inset 0 0 0 2px var(--primary-soft); }
.step .n {
  flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
}
.step .txt { flex: 1; min-width: 0; }
.step .txt b { display: block; }
.step .txt small { color: var(--muted); display: block; }
.step .fl { flex: none; font-weight: 700; color: var(--ink-2); }
.turns { margin: 6px 0 0; padding: 0 0 0 16px; color: var(--ink-2); font-size: 14px; }
.turns li { margin: 2px 0; }

.endpoints { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.endpoint {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 12px; background: #fff; width: 100%; text-align: left;
}
.endpoint i { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--here); }
.endpoint.to i { background: var(--primary); border-radius: 3px; }
.endpoint span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.endpoint small { color: var(--muted); font-weight: 600; margin-left: auto; flex: none; }

.notice { background: var(--primary-tint); border-radius: 12px; padding: 12px 14px; color: var(--ink-2); margin: 12px 0; }
.notice.warn { background: #FDF1E4; }

/* ── markers ───────────────────────────────────────────────────────────── */
.mk-here { width: 20px; height: 20px; border-radius: 50%; background: var(--here); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(232, 113, 10, .22); }
.mk-dest { width: 30px; height: 40px; }
.mk-dest svg { display: block; filter: drop-shadow(0 2px 3px rgba(14, 23, 38, .35)); }

/* ── app bar + toast ───────────────────────────────────────────────────── */
.app-bar {
  position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 10px;
  background: var(--navy); color: #fff; border-radius: var(--radius); padding: 8px 8px 8px 14px; box-shadow: var(--shadow);
  font-weight: 600; font-size: 14px;
}
.app-bar a { background: #fff; color: var(--navy); border-radius: 10px; padding: 8px 12px; text-decoration: none; font-weight: 700; }
.app-bar button { border: 0; background: transparent; color: var(--topbar-muted); font-size: 18px; width: 32px; height: 32px; }
.toast {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff;
  padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow); z-index: 5; max-width: 90%;
}
.noscript { padding: 24px; }
.maplibregl-ctrl-attrib { font-size: 11px; }

/* ── phone: panel becomes a bottom sheet ───────────────────────────────── */
@media (max-width: 760px) {
  :root { --top-h: 52px; }
  .map { inset: 0; }
  .panel {
    top: auto; left: 0; width: auto; height: auto; max-height: 56%;
    border-left: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -6px 24px rgba(14, 23, 38, .16);
  }
  body.sheet-min .panel { max-height: 132px; }
  .panel { z-index: 2; }
  .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: var(--sheet-h, 0px); }
  .panel-grip { display: block; flex: none; height: 22px; position: relative; cursor: grab; }
  .panel-grip::after { content: ""; position: absolute; left: 50%; top: 9px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line-strong); }
  .panel-body { padding: 4px 16px calc(16px + env(safe-area-inset-bottom)); }
  .map-ctrls { right: 12px; }
  .floors { max-height: calc(44% - 24px); }
  .floors button { min-width: 40px; height: 36px; font-size: 14px; }
  h1 { font-size: 20px; }
  .app-bar { left: 8px; right: 8px; bottom: auto; top: 8px; justify-content: space-between; z-index: 3; }
  body.has-app-bar .floors, body.has-app-bar .map-ctrls { top: 64px; }
  .top-btn span { display: none; }
  body.no-venue .panel { max-height: none; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
