:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  color: #17202a;
  background: #eef1f4;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; }
body { min-height: 100dvh; overflow: hidden; }

button, select { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 0.8fr);
  width: 100%;
  height: 100dvh;
  min-height: 560px;
  background: #f5f6f7;
}

.map-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.map {
  width: 100%;
  height: 100%;
  min-height: 360px;
  background: #dde3e8;
}

.map-status {
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  max-width: calc(100% - 96px);
  padding: 9px 12px;
  border: 1px solid rgba(23, 32, 42, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 18px rgba(23, 32, 42, 0.12);
  backdrop-filter: blur(8px);
  font-size: 13px;
}

.map-status strong { font-size: 14px; white-space: nowrap; }
.map-status span { color: #5d6873; white-space: nowrap; }

.map-error {
  position: absolute;
  z-index: 3;
  inset: 16px;
  margin: auto;
  width: min(520px, calc(100% - 32px));
  height: fit-content;
  padding: 16px 18px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(23, 32, 42, 0.18);
}

.place-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid #dfe3e7;
  background: #f8f9fa;
}

.place-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 12px;
}

.eyebrow {
  margin: 0 0 2px;
  color: #77818b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.place-panel h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.25;
}

.fit-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #d4d9df;
  border-radius: 9px;
  background: #fff;
  color: #34404c;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.fit-button:hover,
.fit-button:focus-visible {
  border-color: #aeb7c1;
  outline: none;
  background: #f3f5f7;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0 20px 10px;
}

.filters label {
  display: grid;
  gap: 4px;
  color: #66717c;
  font-size: 11px;
  font-weight: 650;
}

.filters select {
  width: 100%;
  min-height: 36px;
  padding: 6px 30px 6px 9px;
  border: 1px solid #d5dae0;
  border-radius: 9px;
  background: #fff;
  color: #27313b;
  font-size: 12px;
}

.filters select:focus-visible {
  border-color: #6b9ee8;
  outline: 2px solid rgba(31, 111, 235, 0.16);
}

.filter-summary {
  margin: 0;
  padding: 0 20px 10px;
  color: #77818b;
  font-size: 11px;
}

.place-list {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 14px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding: 12px;
}

.place-card {
  margin: 0 0 10px;
  border: 1px solid #e0e4e8;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(23, 32, 42, 0.055);
  overflow: hidden;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.place-card[hidden] { display: none; }

.place-card:hover {
  border-color: #c9d1d9;
  box-shadow: 0 4px 14px rgba(23, 32, 42, 0.09);
}

.place-card.is-selected {
  border-color: #d94841;
  box-shadow: 0 0 0 2px rgba(217, 72, 65, 0.12), 0 5px 16px rgba(23, 32, 42, 0.11);
}

.place-card__select {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.place-card__select:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.22);
  outline-offset: -3px;
}

.place-card__media {
  position: relative;
  min-height: 92px;
  overflow: hidden;
  background: linear-gradient(145deg, #e6e9ec, #d8dde2);
}

.place-card__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.place-card__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #8a949f;
  font-size: 11px;
  font-weight: 650;
}

.place-card__media.has-photo .place-card__placeholder { opacity: 0; }
.place-card__media.has-photo img { opacity: 1; }
.place-card__media.is-missing img { display: none; }
.place-card__media.is-missing .place-card__placeholder { opacity: 1; }

.place-card__body {
  min-width: 0;
  padding: 11px 12px 9px;
}

.place-card__order {
  display: block;
  margin-bottom: 3px;
  color: #929ba4;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.place-card__title {
  display: block;
  margin-bottom: 7px;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
}

.place-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2f5;
  color: #5c6772;
  font-size: 10px;
  font-weight: 650;
}

.meta-pill--status {
  background: #eef5ff;
  color: #3f6594;
}

.meta-pill--muted {
  background: #f3f4f5;
  color: #8a939c;
}

.place-card__links {
  display: flex;
  gap: 8px;
  padding: 0 12px 10px 104px;
}

.place-card__links a {
  color: #1f5fbf;
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}

.place-card__links a:hover,
.place-card__links a:focus-visible { text-decoration: underline; }

.empty-state {
  margin: auto 20px 24px;
  padding: 18px;
  border: 1px dashed #d2d8de;
  border-radius: 12px;
  color: #707b86;
  text-align: center;
  font-size: 12px;
}

.place-marker {
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #1f6feb;
  box-shadow: 0 2px 8px rgba(23, 32, 42, 0.28);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, opacity 120ms ease;
}

.place-marker[hidden] { display: none !important; }

.place-marker:hover,
.place-marker:focus-visible {
  transform: scale(1.18);
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.22), 0 3px 10px rgba(23, 32, 42, 0.32);
}

.place-marker.is-selected {
  z-index: 2;
  transform: scale(1.34);
  background: #d94841;
  box-shadow: 0 0 0 4px rgba(217, 72, 65, 0.22), 0 4px 12px rgba(23, 32, 42, 0.34);
}

.place-marker__core {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
}

.place-popup { min-width: 180px; padding: 2px 0; }
.place-popup h2 { margin: 0 22px 6px 0; font-size: 16px; line-height: 1.35; }
.place-popup__meta { margin: 0 0 10px; color: #66717c; font-size: 12px; }
.place-popup__links { display: flex; gap: 8px; flex-wrap: wrap; }
.place-popup__links a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 8px;
  background: #f0f3f6;
  color: #1f5fbf;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.place-popup__links a:hover,
.place-popup__links a:focus-visible { text-decoration: underline; }

.maplibregl-popup-content { border-radius: 12px; padding: 13px 14px; box-shadow: 0 6px 24px rgba(23, 32, 42, 0.18); }
.maplibregl-ctrl-top-right { top: 4px; right: 4px; }

@media (max-width: 780px) {
  body { overflow: hidden; }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(300px, 46dvh) minmax(0, 1fr);
    min-height: 100dvh;
  }

  .place-panel {
    border-top: 1px solid #dfe3e7;
    border-left: 0;
  }

  .place-panel__header { padding: 12px 14px 8px; }
  .place-panel h1 { font-size: 18px; }
  .filters { padding: 0 14px 8px; }
  .filter-summary { padding: 0 14px 8px; }
  .place-list { padding: 0 10px 14px; }

  .map-status {
    top: 10px;
    left: 10px;
    gap: 7px;
    max-width: calc(100% - 78px);
    padding: 8px 10px;
  }

  .map-status strong { font-size: 13px; }
  .map-status span { font-size: 12px; }

  .place-marker { width: 24px; height: 24px; }

  .place-card__select { grid-template-columns: 84px minmax(0, 1fr); }
  .place-card__media { min-height: 84px; }
  .place-card__links { padding-left: 96px; }
}

@media (max-width: 420px) {
  .filters { grid-template-columns: 1fr 1fr; gap: 7px; }
  .place-panel__header { gap: 10px; }
  .fit-button { min-height: 32px; padding-inline: 8px; }
  .place-card__select { grid-template-columns: 74px minmax(0, 1fr); }
  .place-card__media { min-height: 80px; }
  .place-card__body { padding: 9px 10px 8px; }
  .place-card__links { padding: 0 10px 9px 84px; }
}
