@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/onest-400.woff2") format("woff2");
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/onest-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/onest-600.woff2") format("woff2");
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/onest-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/onest-800.woff2") format("woff2");
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: Onest;
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/onest-latin-800.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #14261d;
  --pine: #1b5c3a;
  --leaf: #2a8a52;
  --ticket: #e6c04a;
  --brick: #c45a38;
  --paper: #dce6df;
  --mist: #6f8176;
  --panel: #f3f7f4;
  --line: #c5d2c9;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --bar: 52px;
  --quick-h: 74px;
  --chrome-top: calc(var(--safe-top) + 10px + var(--bar) + 8px + var(--quick-h));
  --sheet-mid-h: min(42dvh, calc(100dvh - var(--chrome-top) - 10px));
  --sheet-list-h: min(52dvh, calc(100dvh - var(--chrome-top) - 10px));
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--ink);
  font-family: Onest, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}
body { overflow: hidden; }
button, input { font: inherit; }

.app {
  position: relative;
  height: 100dvh;
  background: var(--paper);
}

#campus {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  background: #c5d8c8;
}
#campus .leaflet-control-attribution {
  font-size: 9px;
  background: color-mix(in srgb, #fff 80%, transparent);
}

.pin {
  width: 36px;
  height: 36px;
  margin-left: -18px;
  margin-top: -18px;
  border-radius: 12px;
  background: #1b5c3a;
  color: #f6e27a;
  font: 800 15px Onest, sans-serif;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(20, 38, 29, 0.28);
  border: 2px solid #f4f7f4;
  cursor: pointer;
}
.pin.is-on {
  background: #e6c04a;
  color: #14261d;
  transform: scale(1.12);
}
.pin.is-dim { opacity: 0.38; }
.pin .badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ticket);
  color: var(--ink);
  font: 800 10px Onest, sans-serif;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(20, 38, 29, 0.2);
}
.pin { position: relative; }
.kind-mode .pin { visibility: hidden; pointer-events: none; }
.leaflet-interactive { cursor: pointer; }

.spot {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  filter: drop-shadow(0 6px 10px rgba(20, 38, 29, 0.22));
}
.spot-ico {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font: 800 13px Onest, sans-serif;
  letter-spacing: -0.03em;
  color: #fff;
  border: 2px solid #f4f7f4;
}
.spot.wc .spot-ico { background: #1f6f9c; }
.spot.food .spot-ico { background: #b77812; }
.spot.library .spot-ico { background: #5a4a86; }
.spot.faculty .spot-ico { background: #1b5c3a; color: #f6e27a; }
.spot.is-on .spot-ico {
  transform: scale(1.12);
  box-shadow: 0 0 0 3px var(--ticket);
}
.spot-lab {
  margin-top: 3px;
  max-width: 88px;
  padding: 2px 5px;
  border-radius: 8px;
  background: #f3f7f4;
  color: var(--ink);
  font: 700 10px/1.25 Onest, sans-serif;
  letter-spacing: -0.02em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spot-n {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--ticket);
  color: var(--ink);
  font: 800 9px Onest, sans-serif;
  display: grid;
  place-items: center;
}
.spot.is-cluster { position: relative; }
.spot.is-cluster .spot-ico { width: 40px; height: 40px; }

.top {
  position: absolute;
  left: 0; right: 0; top: 0;
  z-index: 2400;
  padding: calc(10px + var(--safe-top)) 12px 0;
  display: flex;
  gap: 8px;
  pointer-events: none;
}
.top > * { pointer-events: auto; }

.brand, .icon-btn, .search, .quick, .sheet, .results {
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid color-mix(in srgb, #fff 40%, var(--line));
  box-shadow: 0 10px 30px rgba(20, 38, 29, 0.08);
}

.brand {
  height: var(--bar);
  min-width: var(--bar);
  padding: 0 14px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
@media (max-width: 720px) {
  .brand span { display: none; }
  .brand { padding: 0; width: var(--bar); justify-content: center; }
}
.brand b {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.brand small {
  display: block;
  color: var(--mist);
  font-size: 11px;
  font-weight: 600;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex: none;
  object-fit: cover;
  background: #CE1531;
  display: block;
}
.mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--ink);
  flex: none;
}

.search {
  flex: 1;
  height: var(--bar);
  border-radius: 18px;
  display: flex;
  align-items: center;
  padding: 0 8px 0 16px;
  min-width: 0;
}
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  min-width: 0;
  color: var(--ink);
  font-size: 16px;
}
.search input::placeholder { color: var(--mist); }
.icon-btn {
  width: 40px; height: 40px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn[hidden] { display: none; }
.icon-btn:active { transform: scale(0.96); }
.icon-btn.is-on { background: var(--ink); color: var(--ticket); }
.icon-btn svg { width: 20px; height: 20px; }

.quick {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(var(--bar) + 18px + var(--safe-top));
  z-index: 2400;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 6px;
  border-radius: 20px;
  pointer-events: auto;
}
.quick[hidden] { display: none; }
.quick button {
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 14px;
  padding: 8px 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  min-width: 0;
}
.quick button span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.quick button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.quick button:active { transform: scale(0.97); }
.quick button.is-on {
  background: var(--ink);
  color: var(--ticket);
}

.app.is-indoor #campus {
  visibility: hidden;
  pointer-events: none;
}
#campus .leaflet-bottom { display: none; }
.leaflet-div-icon.spot-wrap {
  background: transparent;
  border: 0;
}

.fab {
  position: absolute;
  left: auto;
  right: 12px;
  top: auto;
  bottom: calc(var(--sheet-mid-h) + 12px);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.fab .icon-btn {
  pointer-events: auto;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--panel);
}
.app.has-list.sheet-mid .fab {
  bottom: calc(var(--sheet-list-h) + 12px);
}
.app.sheet-peek .fab { bottom: calc(104px + var(--safe-bot)); }
.app.sheet-full .fab { display: none; }
.app.is-indoor .quick { display: none; }
.app.is-indoor { --chrome-top: calc(var(--safe-top) + 10px + var(--bar) + 8px); }
.app.is-indoor .fab {
  display: flex;
  left: auto;
  right: 12px;
  top: calc(var(--safe-top) + 10px + var(--bar) + 8px);
  bottom: auto;
}
.app.is-indoor #sat { display: none; }

#indoor {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #c5d4c8;
  contain: layout paint;
}
#indoor[hidden] { display: none; }
#viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
#viewport.grabbing { cursor: grabbing; }
#world {
  position: absolute;
  left: 50%;
  top: 42%;
  will-change: transform;
  transform-origin: 0 0;
}
.floors {
  position: absolute;
  left: 12px;
  top: calc(var(--safe-top) + 10px + var(--bar) + 8px);
  z-index: 2300;
  display: none;
  flex-direction: column-reverse;
  padding: 6px;
  border-radius: 18px;
  gap: 4px;
  max-height: calc(100dvh - var(--bar) - 200px - var(--safe-top) - var(--safe-bot));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(16px);
  border: 1px solid color-mix(in srgb, #fff 40%, var(--line));
}
.floors.is-on { display: flex; }
.floors button {
  width: 40px; height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}
.floors button.is-on { background: var(--ink); color: var(--ticket); }
.plan-note { display: none !important; }
#indoor[hidden] .plan-note,
#indoor[hidden] .compass { display: none; }
.plan-note[hidden] { display: none; }
.compass { display: none !important; }

.pl-hall { fill: #fffef8; stroke: #1a3d2a; stroke-width: 1.25; }
.pl-room { fill: #fffef8; stroke: #1a3d2a; stroke-width: 1.25; cursor: pointer; }
.pl-room.is-fac { fill: #e7f2ea; }
.pl-room:hover, .pl-room.is-on, .pl-wc.is-on, .pl-food.is-on, .pl-library.is-on, .pl-public.is-on {
  fill: var(--ticket);
  stroke: #14261d;
  stroke-width: 1.8;
}
.pl-wc { fill: #c5dff0; stroke: #1f6f9c; stroke-width: 1.2; cursor: pointer; }
.pl-food { fill: #f3ddb0; stroke: #b77812; stroke-width: 1.2; cursor: pointer; }
.pl-library { fill: #ddd6f0; stroke: #5a4a86; stroke-width: 1.2; cursor: pointer; }
.pl-public { fill: #efe6c4; stroke: #8a6f1c; stroke-width: 1.2; }
.pl-ico { pointer-events: none; }
.pl-room, .pl-hall, .pl-wc, .pl-food, .pl-library, .pl-public {
  vector-effect: non-scaling-stroke;
}
.pl-label {
  fill: var(--ink);
  font-weight: 800;
  font-family: Onest, sans-serif;
  pointer-events: none;
}

.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2100;
  border-radius: 24px 24px 0 0;
  padding: 0 16px calc(14px + var(--safe-bot));
  min-height: 132px;
  max-height: var(--sheet-mid-h);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sheet-head {
  flex: none;
  min-width: 0;
}
.app.has-list.sheet-mid .sheet {
  max-height: var(--sheet-list-h);
}
.app.sheet-full .sheet,
.app.has-list.sheet-full .sheet {
  max-height: calc(100dvh - var(--chrome-top) - 10px);
}
.app.sheet-peek .sheet,
.app.has-list.sheet-peek .sheet {
  min-height: 76px;
  max-height: 92px;
  padding-bottom: calc(10px + var(--safe-bot));
}
.app.sheet-peek .sheet .list,
.app.sheet-peek .sheet .howto,
.app.sheet-peek .sheet .meta,
.app.sheet-peek .sheet .actions,
.app.sheet-peek .sheet p,
.app.sheet-peek .sheet .kicker,
.app.sheet-peek .sheet .byline { display: none; }
.app.sheet-peek .sheet h1 {
  font-size: 16px;
  margin: 0 0 2px;
}
.grip {
  display: block;
  width: calc(100% + 32px);
  margin: 0 -16px 4px;
  height: 28px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  flex: none;
  position: relative;
}
.grip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 12px;
  width: 42px;
  height: 4px;
  margin-left: -21px;
  border-radius: 4px;
  background: var(--line);
}
.kicker {
  color: var(--mist);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.kicker:empty,
.kicker[hidden] { display: none; }
.sheet h1 {
  margin: 4px 0 6px;
  font-size: 22px;
  letter-spacing: -0.04em;
  font-weight: 800;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.sheet p { margin: 0; color: #3d5246; font-size: 14px; line-height: 1.45; }
.sheet p[hidden] { display: none; }
.sheet .byline {
  margin: 0;
  color: var(--mist);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.byline a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--mist) 50%, transparent);
}
.howto {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.howto[hidden] { display: none; }
.howto li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: start;
  color: #2c4035;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 600;
}
.howto li::before {
  content: attr(data-n);
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: #e4eee7;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 2px 0 4px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 42px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.meta::-webkit-scrollbar { display: none; }
.chip { flex: none; }
.chip {
  border: 0;
  background: #e4eee7;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.chip.is-on { background: var(--ink); color: var(--panel); }
.actions { display: flex; gap: 8px; margin-top: 12px; flex: none; flex-wrap: wrap; }
.actions:empty { display: none; }
.actions .btn { flex: 1 1 auto; min-width: 0; }
.btn {
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--ink);
  color: var(--panel);
}
.btn.ghost { background: #e4eee7; color: var(--ink); }

.list {
  display: none;
  margin: 10px -8px 0;
  padding: 0 8px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  flex: 1;
}
.list.is-on { display: block; }
.row {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 8px;
  border-radius: 14px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  align-items: center;
}
.row:hover, .row:focus-visible, .row.is-on { background: #e7f0ea; }
.row .mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #e4eee7;
  color: var(--ink);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.03em;
  line-height: 1;
  text-align: center;
  padding: 0 4px;
  box-shadow: none;
}
.row .mark.wc { background: #dce9f2; }
.row .mark.food { background: #f3e6c8; }
.row .mark.library { background: #e4e0f0; }
.row .mark.faculty { background: #dceee3; }
.row .ttl { font-size: 14px; font-weight: 700; letter-spacing: -0.02em; }
.row .sub { color: var(--mist); font-size: 12px; font-weight: 600; margin-top: 2px; }

.results {
  display: none;
  position: absolute;
  left: 12px; right: 12px;
  top: calc(var(--bar) + 18px + var(--safe-top));
  z-index: 2500;
  max-height: min(58dvh, 520px);
  overflow: auto;
  border-radius: 20px;
  padding: 4px;
  -webkit-overflow-scrolling: touch;
}
.results.is-on { display: block; }
.hit {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 14px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
}
.hit:hover, .hit:focus-visible { background: #e7f0ea; }
.hit .num {
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.03em;
}
.hit .sub { color: var(--mist); font-size: 12px; font-weight: 600; }
.hit .ttl { font-size: 14px; font-weight: 600; }
.empty { padding: 18px; color: var(--mist); }

@media (min-width: 880px) {
  :root { --chrome-top: calc(var(--safe-top) + 10px + var(--bar) + 8px); }
  .quick {
    left: auto;
    right: 18px;
    width: 360px;
  }
  .sheet {
    left: auto;
    right: 18px;
    bottom: 18px;
    width: 360px;
    border-radius: 24px;
    min-height: 180px;
    max-height: min(70dvh, 640px);
  }
  .app.has-list .sheet { max-height: min(70dvh, 640px); }
  .app.sheet-full .sheet,
  .app.has-list.sheet-full .sheet { max-height: min(80dvh, 720px); }
  .app.sheet-peek .sheet,
  .app.has-list.sheet-peek .sheet { min-height: 88px; max-height: 100px; }
  .fab,
  .app.has-list.sheet-mid .fab,
  .app.sheet-full .fab {
    display: flex;
    left: auto;
    right: 400px;
    bottom: 24px;
    top: auto;
  }
  .app.is-indoor .fab {
    display: flex;
    left: auto;
    right: 400px;
    top: calc(var(--safe-top) + 10px + var(--bar) + 8px);
    bottom: auto;
  }
  .app.is-indoor .floors { left: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
