/* Lối Khám web. Palette follows the mobile mockup (Google-Maps-like neutrals + wayfinding colors). */
:root {
  --blue: #1a73e8; --blue-hover: #1765cc; --blue-soft: #e8f0fe; --blue-stroke: #aecbfa; --blue-on: #d2e3fc;
  --green: #188038; --green-soft: #e6f4ea; --green-ink: #137333;
  --red: #d93025; --red-soft: #fce8e6; --red-ink: #c5221f;
  --amber: #e37400; --amber-soft: #fef7e0;
  --ink: #1f1f1f; --ink-2: #3c4043; --muted: #5f6368; --subtle: #9aa0a6;
  --line: #dadce0; --line-soft: #eceff1; --chip: #f1f3f4;
  --map-bg: #eceff3; --plate-stroke: #cfd6dd; --slab: #aeb8c2;
  --shadow: 0 1px 3px rgba(0,0,0,.2), 0 2px 8px rgba(0,0,0,.08);
  --panel-w: 400px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Roboto, system-ui, sans-serif; color: var(--ink); background: var(--map-bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); } a:hover { color: var(--blue-hover); }
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; padding: 0; }
input { font: inherit; }
.ms { font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal; font-size: 22px; line-height: 1; display: inline-block; white-space: nowrap; direction: ltr; -webkit-font-feature-settings: 'liga'; font-feature-settings: 'liga'; }
.ms.fill { font-variation-settings: 'FILL' 1; }
.ms.sm { font-size: 18px; } .ms.md { font-size: 20px; } .ms.lg { font-size: 28px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--panel-w) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.panel { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; z-index: 10; box-shadow: 2px 0 8px rgba(0,0,0,.04); }
.panel-body { flex: 1; overflow: auto; padding: 4px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.panel-body > * { flex: none; }
.sheet-handle { display: none; }
.brand { display: flex; align-items: center; gap: 12px; padding: 16px; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; background: var(--blue); color: #fff; display: grid; place-items: center; flex: none; }
.brand-text { flex: 1; min-width: 0; }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.brand-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--chip); }
.lang-btn { border: 1px solid var(--line); color: var(--blue); font-size: 13px; font-weight: 700; }

.map { position: relative; overflow: hidden; overflow: clip; /* clip: focus can never scroll the map box */ background: var(--map-bg); touch-action: none; user-select: none; -webkit-user-select: none; }
.map-status[hidden] { display: none; }
.map-status { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; pointer-events: none; }

/* ---------- panel pieces ---------- */
.section-label { font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .4px; text-transform: uppercase; }
.search-pill { height: 52px; border-radius: 26px; background: var(--chip); display: flex; align-items: center; gap: 12px; padding: 0 16px; text-align: left; width: 100%; color: var(--muted); font-size: 15px; }
.search-pill:hover { background: #e8eaed; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.5; }

.route-card { border: 1px solid var(--line); border-radius: 20px; display: flex; align-items: stretch; padding: 4px 4px 4px 14px; gap: 2px; }
.route-rail { display: flex; flex-direction: column; align-items: center; padding: 19px 0 15px; gap: 3px; width: 16px; flex: none; }
.dot-start { width: 10px; height: 10px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); flex: none; }
.route-rail .dash { flex: 1; border-left: 2px dotted #bdc1c6; }
.route-rail .ms { color: var(--red); }
.route-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.route-field { height: 50px; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 0 8px; border-radius: 10px; text-align: left; }
.route-field:hover { background: #f8f9fa; }
.route-field + .route-field { border-top: 1px solid var(--line-soft); border-radius: 0 0 10px 10px; }
.route-field small { font-size: 11px; color: var(--muted); letter-spacing: .2px; }
.route-field span { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-field span.placeholder { color: var(--subtle); font-weight: 400; }
.route-actions { display: flex; flex-direction: column; justify-content: space-between; padding: 2px 0; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 1px 0; }
.chip { flex: none; height: 32px; padding: 0 12px 0 8px; border-radius: 16px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; }
.chip:hover { background: #f8f9fa; }
.chip.on { background: var(--blue-soft); border-color: var(--blue-stroke); color: var(--blue); }
.chip.square { border-radius: 8px; font-weight: 400; }

.summary { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.summary b { font-size: 26px; font-weight: 500; color: var(--green); }
.summary span { font-size: 14px; color: var(--muted); }
.error-row { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.error-row .ms { color: var(--red); }
.help-row { display: flex; gap: 12px; align-items: center; font-size: 14px; line-height: 1.45; color: var(--ink-2); background: var(--blue-soft); border-radius: 12px; padding: 10px 12px; }
.help-row .ms { color: var(--blue); }
.loading-row { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--blue-soft); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn { height: 48px; border-radius: 24px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; font-weight: 500; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); }
.btn-outline { border: 1px solid var(--line); color: var(--blue); background: #fff; }
.btn-outline:hover { background: var(--blue-soft); }
.btn-danger { background: var(--red-soft); color: var(--red-ink); height: 40px; font-size: 14px; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }
.btn[disabled] { opacity: .4; cursor: default; }

.steps { display: flex; flex-direction: column; border-top: 1px solid var(--line-soft); }
.step { display: flex; gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--chip); text-align: left; width: 100%; border-radius: 10px; }
.step:hover { background: #f8f9fa; }
.step.current { background: var(--blue-soft); }
.step-icon { width: 36px; height: 36px; border-radius: 18px; display: grid; place-items: center; flex: none; }
.step-icon.walk { background: var(--blue-soft); color: var(--blue); }
.step-icon.shaft { background: var(--amber-soft); color: var(--amber); }
.step-icon.dest { background: var(--red-soft); color: var(--red); }
.step-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.step-text b { font-size: 15px; font-weight: 500; text-wrap: pretty; }
.step-text span { font-size: 13px; color: var(--muted); }
.step .ms.go { color: var(--subtle); }

.room-card { border-radius: 20px; background: #f8f9fa; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.room-head { display: flex; gap: 12px; align-items: flex-start; }
.swatch { width: 44px; height: 44px; border-radius: 12px; flex: none; }
.room-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.room-title b { font-size: 19px; font-weight: 500; line-height: 1.25; text-wrap: pretty; }
.room-title span { font-size: 13px; color: var(--muted); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: 12px; font-weight: 500; padding: 3px 8px; border-radius: 6px; background: #fff; color: var(--ink-2); }
.tag.green { background: var(--green-soft); color: var(--green-ink); }

.nav-banner { background: var(--blue); color: #fff; border-radius: 20px; display: flex; align-items: center; gap: 14px; padding: 16px 16px 16px 14px; box-shadow: 0 2px 10px rgba(26,115,232,.3); }
.nav-banner .bubble { width: 48px; height: 48px; border-radius: 24px; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; }
.nav-banner b { font-size: 19px; font-weight: 500; line-height: 1.25; display: block; text-wrap: pretty; }
.nav-banner span { font-size: 14px; color: var(--blue-on); }
.nav-progress { display: flex; align-items: center; justify-content: space-between; }
.nav-progress small { font-size: 13px; color: var(--muted); display: block; }
.nav-progress b { font-size: 18px; font-weight: 500; color: var(--green); }
.progress { display: flex; gap: 4px; }
.progress i { flex: 1; height: 4px; border-radius: 2px; background: #e8eaed; }
.progress i.on { background: var(--blue); }

.search-head { display: flex; align-items: center; gap: 4px; }
.search-box { flex: 1; height: 48px; border-radius: 24px; background: var(--chip); display: flex; align-items: center; padding: 0 6px 0 16px; }
.search-box input { flex: 1; min-width: 0; border: none; background: transparent; font-size: 16px; color: var(--ink); outline: none; }
.results { display: flex; flex-direction: column; margin: 0 -16px; }
.result { display: flex; align-items: center; gap: 14px; padding: 10px 16px; text-align: left; width: 100%; }
.result:hover, .result.kb { background: #f8f9fa; }
.result .swatch { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.result-text { flex: 1; min-width: 0; }
.result-text b { display: block; font-size: 15px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-text span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .tag { background: var(--chip); }

/* ---------- map chrome ---------- */
.view-chip { position: absolute; left: 16px; top: 16px; background: rgba(255,255,255,.95); border-radius: 14px; padding: 8px 14px; box-shadow: var(--shadow); max-width: calc(100% - 110px); z-index: 3; }
.view-chip b { display: block; font-size: 14px; font-weight: 500; }
.view-chip span { display: block; font-size: 12px; color: var(--muted); }
.map-controls { position: absolute; right: 16px; top: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; z-index: 3; }
.rail { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.rail button { position: relative; width: 44px; height: 44px; border-radius: 12px; font-size: 15px; font-weight: 500; display: grid; place-items: center; color: var(--ink); }
.rail button:hover { background: var(--chip); }
.rail button.on { background: var(--blue); color: #fff; }
.rail button.dim { color: var(--subtle); }
.rail button .dot { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; border-radius: 3px; background: var(--blue); }
.rail button.on .dot { background: #fff; }
.fab { width: 44px; height: 44px; border-radius: 22px; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; }
.fab:hover { background: #f8f9fa; }
.fab.resume, .fab.resume:hover { background: var(--blue); color: #fff; } /* directions: tap to follow the dot again */
.empty-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(320px, calc(100% - 120px)); background: #fff; border-radius: 20px; padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; z-index: 3; }
.empty-card[hidden] { display: none; }
.empty-card .ms { font-size: 32px; color: var(--subtle); }
.empty-card b { font-size: 16px; font-weight: 500; }
.empty-card span { font-size: 13px; color: var(--muted); line-height: 1.4; }
.empty-card .btn { margin-top: 8px; height: 40px; background: var(--blue-soft); color: var(--blue); font-size: 14px; }

/* ---------- map drawing ---------- */
.world { position: absolute; transform-style: preserve-3d; transform-origin: 50% 50%; --px: 1; }
.floor { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.slab { position: absolute; border-radius: 16px; background: var(--slab); transform: translateZ(-22px); }
.floor-svg { position: absolute; left: 0; top: 0; overflow: visible; }
.plate { fill: #fff; stroke: var(--plate-stroke); stroke-width: 3; }
.plate.on-route { stroke: var(--blue); stroke-width: calc(var(--px) * 2.5px); }
.plate.todo { fill: rgba(255,255,255,.4); stroke: var(--subtle); stroke-width: calc(var(--px) * 2px); stroke-dasharray: calc(var(--px) * 10px) calc(var(--px) * 7px); }
.room { stroke: #fff; stroke-width: 2.5; stroke-linejoin: round; cursor: pointer; }
.room.hl { stroke-width: max(5px, calc(var(--px) * 3.5px)); }
.route-casing { fill: none; stroke: #fff; stroke-width: calc(var(--px) * 9px); stroke-linecap: round; stroke-linejoin: round; }
.route-line { fill: none; stroke: var(--blue); stroke-width: calc(var(--px) * 5px); stroke-linecap: round; stroke-linejoin: round; }
.todo-text { font: 500 64px Roboto, sans-serif; fill: #80868b; }

.overlay { position: absolute; inset: 0; pointer-events: none; transition: opacity 240ms ease; }
.overlay.hidden { opacity: 0; transition: none; }
.overlay-lines { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.lbl { position: absolute; transform: translate(-50%, -50%); text-align: center; font-weight: 500; }
.lbl.area { font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--ink-2); text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff; }
.floor-tag { position: absolute; transform: translateY(-100%); pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 14px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); font-size: 12px; font-weight: 500; white-space: nowrap; border: 1.5px solid transparent; }
.floor-tag i { width: 20px; height: 20px; border-radius: 10px; background: #e8eaed; color: var(--ink-2); display: grid; place-items: center; font-size: 11px; font-weight: 700; font-style: normal; }
.floor-tag.on-route { border-color: var(--blue); }
.floor-tag.on-route i { background: var(--blue); color: #fff; }
.floor-tag.todo { color: #80868b; }
.pin-end { position: absolute; transform: translate(-50%, -92%); font-size: 38px; color: var(--red); filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.pin-me { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 9px; background: var(--blue); border: 3px solid #fff; animation: me-pulse 2s ease-out infinite; animation-delay: var(--pulse-delay, 0s); }
@keyframes me-pulse {
  from { box-shadow: 0 1px 4px rgba(0,0,0,.35), 0 0 0 0 rgba(26,115,232,.45); }
  to { box-shadow: 0 1px 4px rgba(0,0,0,.35), 0 0 0 14px rgba(26,115,232,0); }
}
.pin-shaft { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 14px; background: #fff; border: 2px solid var(--blue); display: grid; place-items: center; color: var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* ---------- phones: map full screen, panel becomes a bottom sheet ---------- */
@media (max-width: 760px) {
  .app { display: block; }
  .map { position: fixed; inset: 0; }
  .panel { position: fixed; left: 0; right: 0; bottom: 0; max-height: 52dvh; border-right: none; border-radius: 24px 24px 0 0; box-shadow: 0 -2px 16px rgba(0,0,0,.12); padding-bottom: env(safe-area-inset-bottom); transition: max-height 220ms ease; }
  .panel.collapsed { max-height: 168px; }
  .panel.full { top: 0; max-height: none; border-radius: 0; }
  .sheet-handle { display: grid; place-items: center; height: 20px; flex: none; }
  .sheet-handle span { width: 32px; height: 4px; border-radius: 2px; background: var(--line); }
  .panel.full .sheet-handle { display: none; }
  .brand { padding: 4px 16px 8px; }
  .brand-logo { width: 32px; height: 32px; border-radius: 10px; }
  .brand-name { font-size: 16px; }
  .view-chip { left: 12px; top: 12px; }
  .map-controls { right: 12px; top: 12px; }
}
