:root {
  --ink: #221713;
  --muted: #66584e;
  --paper: #fff7eb;
  --panel: #fffaf2;
  --accent: #a61922;
  --accent-dark: #741219;
  --line: rgba(60, 39, 28, 0.16);
  --shadow: 0 24px 80px rgba(43, 24, 14, 0.28);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(246, 235, 219, 0.96)),
    #f4e7d5;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 42px;
  transition: filter 180ms ease;
}

body.popup-open .app-shell {
  filter: blur(9px);
  pointer-events: none;
  user-select: none;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 2px 14px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.5vw, 2.5rem);
  line-height: 1.15;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.map-panel {
  border: 1px solid var(--line);
  background: #dfd0b9;
  box-shadow: 0 18px 56px rgba(55, 33, 20, 0.18);
  overflow: hidden;
}

.map-frame {
  position: relative;
  width: 100%;
  background: #d7c0a1;
  isolation: isolate;
}

.tour-map {
  display: block;
  width: 100%;
  height: auto;
}

.markers {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.mobile-map-sections {
  display: none;
}

.map-marker {
  position: absolute;
  width: clamp(30px, 2.7vw, 46px);
  height: clamp(30px, 2.7vw, 46px);
  transform: translate(-50%, -50%);
  border: 3px solid #fff6e8;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-weight: 900;
  line-height: 1;
  padding: 0;
}

.desktop-place-label {
  position: absolute;
  z-index: 3;
  transform: translateY(-50%);
  max-width: 150px;
  border: 1px solid rgba(117, 18, 25, 0.22);
  background: rgba(255, 250, 242, 0.88);
  color: #2a1713;
  box-shadow: 0 6px 14px rgba(30, 18, 12, 0.16);
  padding: 4px 6px;
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(5px);
}

.map-label-name,
.map-label-fee {
  display: block;
  overflow-wrap: anywhere;
}

.map-label-name {
  font-size: clamp(0.62rem, 0.82vw, 0.86rem);
  font-weight: 900;
  line-height: 1.08;
}

.map-label-fee {
  margin-top: 2px;
  color: var(--accent-dark);
  font-size: clamp(0.58rem, 0.7vw, 0.76rem);
  font-weight: 850;
  line-height: 1;
}

.map-marker:hover,
.map-marker:focus-visible,
.desktop-place-label:hover,
.desktop-place-label:focus-visible,
.stop-card:hover,
.stop-card:focus-visible {
  outline: 3px solid rgba(255, 213, 98, 0.9);
  outline-offset: 3px;
}

.stop-list-section {
  padding-top: 24px;
}

.stop-list-section h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
}

.stop-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.stop-card {
  min-height: 68px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.stop-badge,
.place-number {
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.stop-badge {
  width: 34px;
  height: 34px;
}

.stop-name {
  display: block;
  font-weight: 850;
  line-height: 1.2;
}

.stop-zh {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: 0.92rem;
}

.stop-fee {
  display: block;
  color: var(--accent-dark);
  margin-top: 3px;
  font-size: 0.86rem;
  font-weight: 850;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(35, 18, 12, 0.38);
}

.overlay[hidden] {
  display: none;
}

.popup {
  position: relative;
  width: min(1120px, 100%);
  max-height: min(92vh, 920px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: var(--paper);
  box-shadow: var(--shadow);
  padding: 18px;
}

.close-button {
  position: sticky;
  top: 0;
  z-index: 3;
  float: right;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-dark);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.audio-card {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 14px;
  align-items: center;
  margin: 0 50px 16px 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 242, 0.96);
  backdrop-filter: blur(12px);
}

.play-button {
  min-height: 44px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
}

.audio-main {
  min-width: 0;
}

.progress {
  width: 100%;
  accent-color: var(--accent);
}

.time-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.popup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 18px;
  clear: both;
}

.image-column {
  min-width: 0;
}

.image-stack {
  display: grid;
  gap: 12px;
}

.popup-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #e4d4bf;
  border: 1px solid var(--line);
}

.place-heading {
  display: grid;
  grid-template-columns: 46px 1fr;
  column-gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.place-number {
  width: 44px;
  height: 44px;
  grid-row: span 2;
}

.place-heading h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.place-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-weight: 750;
}

.description {
  margin: 14px 0 0;
  font-size: 1.08rem;
  line-height: 1.7;
  font-weight: 700;
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    padding: 12px 10px 34px;
  }

  .hero {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .status {
    white-space: normal;
  }

  .map-panel {
    max-height: none;
    overflow: visible;
  }

  .map-frame {
    min-width: 0;
    display: block;
  }

  .tour-map,
  .markers {
    display: none;
  }

  .mobile-map-sections {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .mobile-map-section {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 246, 232, 0.72);
    background: #d7c0a1;
    box-shadow: 0 10px 26px rgba(55, 33, 20, 0.18);
  }

  .mobile-map-section img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
  }

  .mobile-hotspot {
    position: absolute;
    width: 36px;
    height: 36px;
    transform: translate(-50%, -50%);
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    z-index: 2;
  }

  .mobile-hotspot:focus-visible {
    outline: 3px solid rgba(255, 213, 98, 0.95);
    outline-offset: 2px;
  }

  .mobile-place-label {
    position: absolute;
    z-index: 3;
    transform: translateY(-50%);
    max-width: 116px;
    border: 1px solid rgba(117, 18, 25, 0.22);
    background: rgba(255, 250, 242, 0.86);
    color: #2a1713;
    box-shadow: 0 5px 12px rgba(30, 18, 12, 0.16);
    padding: 3px 5px;
    text-align: left;
    cursor: pointer;
    backdrop-filter: blur(5px);
  }

  .mobile-place-label .map-label-name {
    font-size: clamp(0.56rem, 2.35vw, 0.68rem);
    line-height: 1.03;
  }

  .mobile-place-label .map-label-fee {
    margin-top: 2px;
    font-size: clamp(0.54rem, 2.15vw, 0.62rem);
  }

  .mobile-place-label:hover,
  .mobile-place-label:focus-visible {
    outline: 2px solid rgba(255, 213, 98, 0.95);
    outline-offset: 1px;
  }

  .map-marker {
    width: 36px;
    height: 36px;
    font-size: 0.95rem;
  }

  .stop-list {
    grid-template-columns: 1fr;
  }

  .overlay {
    align-items: stretch;
    padding: max(4px, env(safe-area-inset-top)) 6px max(8px, env(safe-area-inset-bottom));
  }

  .popup {
    max-height: none;
    height: 100%;
    padding: 6px;
  }

  .close-button {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 36px;
    height: 36px;
    font-size: 1.35rem;
  }

  .audio-card {
    position: sticky;
    top: 0;
    grid-template-columns: 64px 1fr;
    gap: 8px;
    margin: 0 40px 10px 0;
    padding: 4px 6px;
  }

  .play-button {
    min-height: 34px;
    padding: 0 8px;
    font-size: 0.86rem;
  }

  .popup-grid {
    grid-template-columns: 1fr;
  }

  .popup-image {
    aspect-ratio: 3 / 2;
  }
}

@media (max-width: 410px) {
  .audio-card {
    grid-template-columns: 58px 1fr;
    margin-right: 38px;
    padding-top: 4px;
  }

  .close-button {
    position: absolute;
    right: 6px;
    top: 6px;
  }
}
