:root {
  --ink: #102225;
  --muted: #647276;
  --panel: rgba(13, 31, 36, 0.92);
  --card: #ffffff;
  --line: rgba(16, 34, 37, 0.12);
  --green: #39d98a;
  --green-dark: #147452;
  --blue: #5fb7ff;
  --amber: #ffbd59;
  --shadow: 0 22px 60px rgba(6, 19, 23, 0.25);
  font-family: "Avenir Next", "PingFang TC", "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 15%, rgba(57, 217, 138, 0.26), transparent 34%),
    linear-gradient(145deg, #071417 0%, #0d1f24 50%, #193c39 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  position: relative;
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background: #d9e6e1;
}

.map-screen {
  position: relative;
  min-height: 100vh;
  padding-bottom: 86px;
}

.map-canvas {
  --map-x: 0px;
  --map-y: 0px;
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  background:
    radial-gradient(circle at calc(62% + var(--map-x)) calc(34% + var(--map-y)), rgba(95, 183, 255, 0.34), transparent 8%),
    radial-gradient(circle at calc(40% + var(--map-x)) calc(70% + var(--map-y)), rgba(57, 217, 138, 0.24), transparent 10%),
    linear-gradient(135deg, #cdded8 0%, #edf3ef 48%, #c2d6d2 100%);
}

.map-grid {
  position: absolute;
  inset: -12%;
  transform: translate(var(--map-x), var(--map-y)) rotate(-8deg);
  background-image:
    linear-gradient(rgba(21, 70, 70, 0.14) 2px, transparent 2px),
    linear-gradient(90deg, rgba(21, 70, 70, 0.13) 2px, transparent 2px);
  background-size: 76px 76px;
}

.route-line {
  position: absolute;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 2px rgba(35, 80, 72, 0.12);
  transform: translate(var(--map-x), var(--map-y)) rotate(-20deg);
}

.route-line-a {
  left: -10%;
  top: 48%;
  width: 124%;
}

.route-line-b {
  left: 14%;
  top: 25%;
  width: 95%;
  transform: translate(var(--map-x), var(--map-y)) rotate(32deg);
}

.district {
  position: absolute;
  transform: translate(var(--map-x), var(--map-y));
  color: rgba(16, 34, 37, 0.38);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.district-a {
  left: 9%;
  top: 30%;
}

.district-b {
  right: 10%;
  top: 43%;
}

.district-c {
  left: 14%;
  bottom: 24%;
}

.top-panel {
  position: relative;
  z-index: 5;
  padding: max(18px, env(safe-area-inset-top)) 18px 0;
}

.location-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  margin-bottom: 12px;
  color: #eafff4;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 0.82rem;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(57, 217, 138, 0.16);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.search-box span {
  color: var(--green-dark);
  font-size: 1.4rem;
  line-height: 1;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.filter-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.filter-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: #f3fffb;
  background: rgba(13, 31, 36, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(6, 19, 23, 0.18);
}

.filter-button span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #0d1f24;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  font-weight: 800;
}

.filter-button.active {
  color: #092117;
  background: var(--green);
  border-color: rgba(255, 255, 255, 0.54);
}

.marker-layer,
.user-pin {
  position: absolute;
  inset: 0;
  transform: translate(var(--map-x), var(--map-y));
}

.map-marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  border: 0;
  border-radius: 16px 16px 16px 4px;
  color: #092117;
  background: var(--card);
  box-shadow: 0 12px 24px rgba(6, 19, 23, 0.25);
  transform: rotate(-45deg);
  transition: transform 180ms ease, background 180ms ease;
}

.map-marker small {
  position: absolute;
  left: 30px;
  bottom: 28px;
  width: 172px;
  padding: 9px 10px;
  color: #f5fffb;
  background: rgba(13, 31, 36, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  box-shadow: 0 12px 26px rgba(6, 19, 23, 0.26);
  font-size: 0.68rem;
  line-height: 1.35;
  text-align: left;
  transform: rotate(45deg);
}

.map-marker small strong {
  display: block;
  margin-bottom: 3px;
  color: var(--green);
  font-size: 0.76rem;
}

.map-marker span {
  transform: rotate(45deg);
  font-weight: 900;
}

.map-marker.active {
  background: var(--amber);
  transform: rotate(-45deg) scale(1.14);
}

.user-pin span {
  position: absolute;
  left: 50%;
  top: 51%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 4px solid white;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 12px rgba(95, 183, 255, 0.2), 0 10px 26px rgba(6, 19, 23, 0.22);
}

.bottom-sheet {
  position: absolute;
  z-index: 6;
  left: 10px;
  right: 10px;
  bottom: 78px;
  height: min(48vh, 430px);
  padding: 10px 14px 16px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 30px 30px 22px 22px;
  box-shadow: var(--shadow);
  transition: height 220ms ease;
}

.bottom-sheet.expanded {
  height: min(72vh, 650px);
}

.sheet-handle {
  display: block;
  width: 58px;
  height: 6px;
  margin: 0 auto 13px;
  border: 0;
  border-radius: 999px;
  background: rgba(16, 34, 37, 0.2);
}

.sheet-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.sheet-summary h1 {
  margin: 0;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}

.count-pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  color: #eafff4;
  background: #102225;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.card-list {
  display: grid;
  gap: 12px;
  max-height: calc(100% - 72px);
  overflow-y: auto;
  padding-bottom: 10px;
}

.place-card,
.empty-state {
  padding: 15px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 10px 24px rgba(16, 34, 37, 0.08);
}

.place-card.active {
  border-color: rgba(255, 189, 89, 0.95);
  box-shadow: 0 0 0 3px rgba(255, 189, 89, 0.18), 0 10px 24px rgba(16, 34, 37, 0.08);
}

.card-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.card-heading h2 {
  margin: 0 0 5px;
  font-size: 1.04rem;
  letter-spacing: -0.03em;
}

.card-heading p,
.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.card-heading > span {
  flex: 0 0 auto;
  color: var(--green-dark);
  font-weight: 800;
}

.location-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  color: #15312a;
  background:
    linear-gradient(135deg, rgba(57, 217, 138, 0.17), rgba(95, 183, 255, 0.13)),
    #f5faf7;
  border: 1px solid rgba(20, 116, 82, 0.14);
  border-radius: 16px;
}

.location-strip span {
  flex: 0 0 auto;
  color: var(--green-dark);
  font-size: 0.76rem;
  font-weight: 800;
}

.location-strip strong {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-align: right;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  margin: 14px 0 12px;
}

.detail-grid div {
  padding: 10px;
  background: #f3f7f4;
  border-radius: 14px;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 0.72rem;
}

.detail-grid dd {
  margin: 3px 0 0;
  font-size: 0.86rem;
  font-weight: 700;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-row span {
  padding: 7px 9px;
  color: #174a38;
  background: rgba(57, 217, 138, 0.14);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.navigate-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin-top: 13px;
  padding: 13px 15px;
  color: #082014;
  background: var(--green);
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(57, 217, 138, 0.22);
  font-weight: 900;
}

.navigate-button span {
  color: rgba(8, 32, 20, 0.7);
  font-size: 0.78rem;
  font-weight: 800;
}

.bottom-nav {
  position: absolute;
  z-index: 8;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.bottom-nav button {
  display: grid;
  gap: 3px;
  place-items: center;
  min-width: 0;
  padding: 8px 4px;
  color: rgba(255, 255, 255, 0.68);
  background: transparent;
  border: 0;
  border-radius: 18px;
  font-size: 0.72rem;
}

.bottom-nav span {
  font-size: 1rem;
}

.bottom-nav button.active {
  color: #082014;
  background: var(--green);
  font-weight: 800;
}

@media (min-width: 760px) {
  body {
    display: grid;
    place-items: center;
    padding: 32px;
  }

  .app-shell {
    min-height: 860px;
    border: 10px solid rgba(255, 255, 255, 0.14);
    border-radius: 44px;
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.36);
  }
}

@media (max-width: 380px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .bottom-nav button {
    font-size: 0.66rem;
  }
}
