/* Hong Kong Explorer — game-like discovery UI */

:root {
  --hk-red: #c41e3a;
  --hk-gold: #f5c542;
  --hk-red-deep: #8f1428;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --muted: #64748b;
  --surface: #f8fafc;
  --surface-elevated: #ffffff;
  --panel-bg: rgba(255, 255, 255, 0.97);
  --accent: var(--hk-red);
  --success: #0d9488;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 22px 50px rgba(15, 23, 42, 0.14);
  --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.1);
  --shadow-glow: 0 0 0 1px rgba(196, 30, 58, 0.12);
  --border-soft: rgba(148, 163, 184, 0.35);
  --chip-bg: #fff4cf;
  --chip-text: #7a5112;
  --hidden: #166534;
  --hidden-bg: #dcfce7;
  --planner-bg: #f1f5f9;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 16px;
  --space-4: 22px;
  --font-sans: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "PingFang HK",
    "Microsoft JhengHei", sans-serif;
  --font-display: "Noto Serif HK", "Outfit", "PingFang HK", "Microsoft JhengHei", serif;
  --header-offset: 100px;
  --panel-top-offset: 128px;
  --hk-header-h: 76px;
  --motion-fast: 0.14s;
  --motion-base: 0.22s;
  --motion-slow: 0.34s;
  --motion-ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Golden Era Hong Kong palette - parchment, ink, gold-foil and neon. */
  --paper: #fdf6e6;
  --paper-deep: #f3e5c3;
  --paper-edge: #e9d4a3;
  --ink: #1a1410;
  --ink-soft: #4a3c2c;
  --ink-muted: #6b5840;
  --gold-foil: #c9a352;
  --gold-foil-deep: #a8862f;
  --gold-line: #b88a30;
  --gold-soft: rgba(201, 163, 82, 0.32);
  --neon-red: #e63946;
  --neon-red-deep: #b92836;
  --neon-glow: 0 0 14px rgba(230, 57, 70, 0.45);
  --neon-glow-soft: 0 0 8px rgba(230, 57, 70, 0.25);
  --film-teal: #2b3942;
  --film-shadow: 0 14px 28px rgba(43, 57, 66, 0.22);
  --grain-bg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.55  0 0 0 0 0.4  0 0 0 0 0.18  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");

  --mtr-color: #d12b2b;
  --light-rail-color: #2f7d32;
  --cycling-color: #0ea5e9;
  --tram-color: #7c3aed;
  --ferry-color: #2563eb;
  --peak-tram-color: #b45309;
  --bus-color: #64748b;
  --gmb-color: #94a3b8;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
}

#map {
  height: 100vh;
  height: 100dvh;
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.hk-shell {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10000;
}

.hk-header,
.filter-bar,
.side-panel,
.side-panel-backdrop,
.toast-host,
.celebration-root,
.progress-pill,
.onboarding-overlay {
  pointer-events: auto;
}

/* ----- Header ----- */
.hk-header {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: max(56px, calc(12px + env(safe-area-inset-left, 0px)));
  right: max(24px, calc(12px + env(safe-area-inset-right, 0px)));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 12px 18px;
  min-height: var(--hk-header-h);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    105deg,
    #e8b84a 0%,
    #d4a32c 14%,
    #c96b2a 32%,
    var(--hk-red) 52%,
    var(--hk-red-deep) 72%,
    #3d1218 100%
  );
  color: #fff;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(196, 30, 58, 0.15);
  max-width: calc(100% - 96px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hk-header::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
  pointer-events: none;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  z-index: 1;
  flex: 1 1 160px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-image: url("../img/logo_bauhinia_circular.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-color: transparent;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  flex: 0 0 auto;
}

.hk-title {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.hk-subtitle {
  font-size: 0.8rem;
  opacity: 0.9;
  font-weight: 500;
}

/* Progress pill (XP / level) */
.progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 8px 14px 8px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  z-index: 1;
  transition: transform var(--motion-fast) var(--motion-ease), background var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease);
  backdrop-filter: blur(10px);
  min-height: 44px;
  box-sizing: border-box;
}

.progress-pill:hover {
  background: rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.progress-pill:focus-visible {
  outline: 2px solid var(--hk-gold);
  outline-offset: 2px;
}

.level-ring {
  --pct: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: conic-gradient(var(--hk-gold) calc(var(--pct) * 1%), rgba(255, 255, 255, 0.2) 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.level-ring__inner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1e293b;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 800;
}

.progress-pill__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.2;
  text-align: left;
}

.progress-pill__level {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.progress-pill__sub {
  font-size: 0.72rem;
  opacity: 0.9;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  z-index: 1;
  justify-content: flex-end;
}

.filter-toggle,
.guide-btn,
.ghost-btn,
.action-btn,
.tab-btn,
.planner-btn,
.transport-toggle-btn {
  font: inherit;
}

.filter-toggle,
.guide-btn {
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  font-weight: 700;
  font-size: 0.9rem;
  backdrop-filter: blur(12px);
  min-height: 44px;
  box-sizing: border-box;
}

.filter-toggle .btn-label,
.guide-btn .btn-label {
  margin-left: 6px;
}

.filter-toggle:hover,
.guide-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.2);
}

.ghost-btn,
.action-btn,
.planner-btn {
  border: 1px solid var(--border-soft);
  background: var(--surface-elevated);
  color: var(--text-dark);
  border-radius: var(--radius-pill);
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ghost-btn:hover,
.action-btn:hover,
.planner-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Filter drawer */
.filter-bar {
  position: absolute;
  top: calc(var(--header-offset) + 8px + env(safe-area-inset-top, 0px));
  left: max(56px, calc(12px + env(safe-area-inset-left, 0px)));
  width: min(400px, calc(100% - 80px - env(safe-area-inset-left, 0px)));
  max-height: calc(100vh - var(--header-offset) - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--panel-bg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
  display: none;
  border: 1px solid var(--border-soft);
  z-index: 10010;
}

.filter-bar.is-visible {
  display: block;
}

.filter-section {
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.filter-section:last-of-type {
  border-bottom: none;
}

.filter-title-row,
.filter-row,
.action-row,
.planner-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-title-row {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.results-label {
  font-size: 0.86rem;
  color: var(--text-muted);
  font-weight: 600;
}

.field-group {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  flex: 1 1 150px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.field-group input,
.field-group select {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  background: var(--surface-elevated);
  color: var(--text-dark);
  font-size: 0.95rem;
  font-family: inherit;
}

.field-group input:focus,
.field-group select:focus {
  outline: none;
  border-color: rgba(196, 30, 58, 0.45);
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.12);
}

.switch-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-dark);
  padding: 9px 12px;
  border: 1px solid var(--border-soft);
  cursor: pointer;
  user-select: none;
  min-height: 44px;
  box-sizing: border-box;
}

.switch-chip input {
  accent-color: var(--hk-red);
  width: 18px;
  height: 18px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.transport-section {
  margin-top: 6px;
  padding-top: 4px;
}

.transport-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.transport-caption {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.transport-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.transport-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--border-soft);
  background: #fff;
  color: var(--text-dark);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  min-height: 48px;
}

.transport-toggle-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.transport-toggle-btn.is-active {
  border-color: rgba(196, 30, 58, 0.45);
  box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.12), var(--shadow-md);
  background: linear-gradient(180deg, #ffffff, #fffaf5);
}

.transport-toggle-btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.transport-toggle-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.transport-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.16);
}

.transport-meta {
  display: grid;
  gap: 2px;
}

.transport-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-dark);
}

.transport-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.transport-state {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
}

.transport-state.is-on {
  color: var(--hk-red);
}

/* Side panel */
.side-panel {
  position: absolute;
  top: var(--panel-top-offset);
  right: 24px;
  width: min(480px, calc(100% - 48px));
  max-height: calc(100dvh - var(--panel-top-offset) - 24px);
  max-height: calc(100vh - var(--panel-top-offset) - 24px);
  background: var(--panel-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 18px));
  transition: transform var(--motion-base) var(--motion-ease);
  border: 1px solid var(--border-soft);
  z-index: 10015;
}

.side-panel.is-open {
  transform: translateX(0);
}

.side-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10014;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-base) var(--motion-ease);
}

/* Scrollable tab row with icons */
.tab-row {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  padding: 8px 8px 8px 10px;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  border-radius: 14px;
  padding: 8px 10px;
  min-width: 60px;
  min-height: 52px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.66rem;
  text-transform: none;
  letter-spacing: 0.02em;
  flex: 1 1 auto;
  scroll-snap-align: start;
  transition: background var(--motion-fast) var(--motion-ease), color var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) var(--motion-ease), transform var(--motion-fast) var(--motion-ease);
}

@media (max-width: 720px) {
  .tab-btn {
    font-size: 0.62rem;
    min-width: 54px;
    padding: 8px 6px;
  }
  .tab-btn__icon svg,
  .tab-btn__icon img {
    width: 20px;
    height: 20px;
  }
}

.tab-btn__icon {
  display: block;
  line-height: 0;
  opacity: 0.75;
}

.tab-btn__icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-btn__icon img {
  width: 28px;
  height: 28px;
  display: block;
  object-fit: contain;
}

.tab-btn.is-active {
  background: linear-gradient(140deg, var(--hk-red) 0%, #c45c32 100%);
  color: #fff;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.tab-btn.is-active .tab-btn__icon {
  opacity: 1;
  color: #fff;
}

.tab-btn:hover:not(.is-active) {
  background: rgba(196, 30, 58, 0.08);
  color: var(--text-dark);
}

.tab-panel {
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 12px 14px 18px;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.tab-panel.is-active {
  display: block;
  min-height: 0;
  animation: panel-fade-in var(--motion-base) var(--motion-ease);
}

@keyframes panel-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Place panel: Overview / Reviews segments */
.place-subtabs {
  display: flex;
  gap: 6px;
  margin: 10px 0 12px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(241, 245, 249, 0.95);
  border: 1px solid var(--border-soft);
}

.place-subtab {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 800;
  font-size: 0.82rem;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition:
    background var(--motion-fast) var(--motion-ease),
    color var(--motion-fast) var(--motion-ease);
}

.place-subtab.is-active {
  background: #fff;
  color: var(--text-dark);
  box-shadow: var(--shadow-sm);
}

.place-pane {
  display: none;
}

.place-pane.is-active {
  display: block;
}

.place-reviews-scroll {
  max-height: min(40dvh, 280px);
  max-height: min(40vh, 280px);
  overflow-y: auto;
  margin-top: 10px;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
}

.chip-btn-link {
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--hk-red);
  cursor: pointer;
  text-decoration: underline;
}

.route-context-card .btns {
  margin-top: 8px;
}

.filter-preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.filter-preset-btn.is-active {
  border-color: var(--hk-red);
  color: var(--hk-red);
  background: rgba(196, 30, 58, 0.08);
}

.hk-marker--landmark img {
  transform: scale(1.12);
}

.hk-marker--hidden {
  opacity: 0.88;
}

.hk-marker--hidden img {
  transform: scale(0.9);
  box-shadow: 0 0 0 2px var(--hidden-bg);
  border-radius: 50%;
}

.hk-marker-wrap.hk-marker-tier-landmark {
  z-index: 600;
}

.hk-marker-wrap.hk-marker-tier-hidden {
  z-index: 400;
}

.hk-marker--dimmed {
  opacity: 0.35;
  filter: grayscale(0.4);
}

.hk-marker--next-stop {
  animation: marker-pulse 1.6s ease-in-out infinite;
}

@keyframes marker-pulse {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(196, 30, 58, 0));
  }
  50% {
    filter: drop-shadow(0 0 8px rgba(196, 30, 58, 0.55));
  }
}

.reward-forecast {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  background: #fffefb;
  font-size: 0.86rem;
}

.reward-forecast__xp {
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.reward-forecast__hint {
  color: var(--text-muted);
  line-height: 1.35;
}

.reward-forecast__mission {
  margin-top: 6px;
  font-weight: 700;
  color: var(--hk-red);
}

.offline-banner {
  display: none;
  width: 100%;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  background: #fef3c7;
  color: #92400e;
  border-bottom: 1px solid #fcd34d;
}

.offline-banner.is-visible {
  display: block;
}

.filter-section--collapsible > summary {
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.filter-section--collapsible > summary::-webkit-details-marker {
  display: none;
}

@media (max-width: 860px) {
  .filter-section--collapsible:not([open]) .filter-section__body {
    display: none;
  }
}

.place-sticky-cta-row {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px -14px -18px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, #fff 24%);
  border-top: 1px solid var(--border-soft);
  box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.06);
}

.place-sticky-cta-row .action-btn,
.place-sticky-cta-row .ghost-btn {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
  font-size: 0.82rem;
  padding: 10px 8px;
}

.side-panel-sheet-handle {
  display: none;
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 0 4px;
  cursor: pointer;
  flex-shrink: 0;
}

.side-panel-sheet-handle::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  margin: 0 auto;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.2);
}

.reviews-summary {
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #fffefb 0%, #f8fafc 100%);
}

.reviews-summary__hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.reviews-summary__avg {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--hk-red);
  min-width: 2.6rem;
  text-align: center;
}

.reviews-summary__hint {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.reviews-summary__dist {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.reviews-summary__bar-row {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.reviews-summary__track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.reviews-summary__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hk-red) 0%, #c45c32 100%);
}

.eyebrow,
.section-subtitle,
.detail-label {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 800;
}

.side-header h2 {
  margin: 6px 0 8px;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.side-copy,
.place-meta,
.trail-card p,
.reward-list,
.nearby-meta,
.detail-card,
.passport-label,
.stat-label,
.planner-summary,
.planner-meta,
.empty-state {
  color: var(--text-muted);
  line-height: 1.5;
}

/* Discover hero */
.discover-hero {
  position: relative;
  border-radius: var(--radius-md);
  padding: 14px 16px 16px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
  color: #f8fafc;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.discover-hero::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(245, 197, 66, 0.35) 0%, transparent 70%);
  pointer-events: none;
}

.discover-hero__eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 6px;
  position: relative;
}

.discover-hero h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.2;
  position: relative;
}

.discover-hero__lede {
  margin: 0 0 12px;
  font-size: 0.84rem;
  opacity: 0.88;
  line-height: 1.4;
  position: relative;
  font-weight: 500;
}

.discover-hero p:not(.discover-hero__lede) {
  margin: 0 0 12px;
  font-size: 0.9rem;
  opacity: 0.9;
  line-height: 1.45;
  position: relative;
  font-weight: 500;
}

.discover-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font: inherit;
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  min-height: 44px;
  background: linear-gradient(120deg, var(--hk-gold), #fff4cc);
  color: #422006;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cta-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.cta-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.mission-block {
  margin-bottom: 12px;
}

.mission-block .section-subtitle {
  margin-bottom: 6px;
}

.discover-statstrip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.discover-statstrip__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
}

.discover-statstrip__item--mini {
  flex: 0 0 auto;
}

.discover-statstrip__n {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark);
  font-feature-settings: "tnum" 1;
  line-height: 1.1;
}

.discover-statstrip__l {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 2px;
}

.discover-statstrip__sep {
  width: 1px;
  height: 22px;
  background: var(--border-soft);
  flex: 0 0 auto;
  opacity: 0.7;
}

.trails-block {
  margin-top: 4px;
  margin-bottom: 8px;
}

.trails-block .trail-card {
  margin-bottom: 8px;
}

.trails-block .trail-card:last-of-type {
  margin-bottom: 0;
}

.panel-fold,
.data-health {
  margin-top: 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  background: var(--surface);
  font-size: 0.86rem;
  color: var(--text-muted);
}

.panel-fold summary,
.data-health summary {
  cursor: pointer;
  padding: 10px 2px;
  font-weight: 700;
  color: var(--text-dark);
  list-style: none;
}

.panel-fold summary::-webkit-details-marker,
.data-health summary::-webkit-details-marker {
  display: none;
}

.panel-fold summary::after,
.data-health summary::after {
  content: "▸";
  float: right;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.panel-fold[open] summary::after,
.data-health[open] summary::after {
  transform: rotate(90deg);
}

.panel-fold__hint {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.panel-fold__badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: linear-gradient(120deg, rgba(196, 30, 58, 0.12), rgba(245, 197, 66, 0.2));
  color: var(--text-dark);
  font-size: 0.8rem;
  font-weight: 800;
}

.panel-fold__body {
  padding: 0 2px 10px;
  border-top: 1px solid var(--border-soft);
}

.data-health {
  margin-top: 8px;
  border-style: dashed;
  background: rgba(248, 250, 252, 0.9);
}

.data-health[open] summary,
.panel-fold[open] summary {
  border-bottom: 0;
}

.mission-block .section-subtitle,
.trails-block > .section-subtitle,
.section-subtitle {
  margin-top: 0;
  margin-bottom: 6px;
}

.mission-card-inner {
  padding: 8px 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: var(--radius-sm);
  background: #fff;
}

.mission-block .mission-card-inner + .mission-card-inner {
  margin-top: 6px;
}

.stats-grid--tight {
  margin: 6px 0 0;
  gap: 8px;
}

.stats-grid--tight .transport-card,
.stats-grid--tight .stat-card {
  padding: 10px;
  box-shadow: none;
}

.stats-grid--tight .stat-number,
.stats-grid--tight .passport-number {
  font-size: 1.15rem;
}

.stats-grid--tight .transport-card-note {
  font-size: 0.72rem;
}

.empty-state--tight {
  padding: 10px 12px;
  font-size: 0.86rem;
}

.action-row--tight {
  margin-top: 6px;
}

.reward-list--tight {
  padding-left: 16px;
  margin: 0;
  font-size: 0.88rem;
}

.reward-list--tight li + li {
  margin-top: 4px;
}

.side-header--tight h2 {
  font-size: 1.2rem;
  margin: 2px 0 4px;
}

.side-copy--tight {
  font-size: 0.86rem;
  line-height: 1.4;
  margin: 0;
}

.passport-card.passport-card--hero {
  display: block;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.passport-card--hero:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.passport-hero-top {
  margin-bottom: 8px;
}

.passport-hero-level {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.passport-hero-xp-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
}

.xp-bar--hero {
  height: 6px;
}

.passport-hero-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}

.passport-hero-stats b {
  color: var(--text-dark);
  font-weight: 800;
}

.passport-hero-dot {
  margin: 0 6px;
  opacity: 0.45;
}

.stamp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stamp-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1px solid var(--border-soft);
  font-size: 0.75rem;
  color: var(--text-dark);
  max-width: 100%;
}

.stamp-chip__n {
  font-weight: 800;
  color: var(--hk-red);
  font-size: 0.78rem;
}

.stamp-chip__r {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.data-health__body {
  padding: 0 2px 10px;
  border-top: 1px solid var(--border-soft);
}

/* Stats, grids */
.stats-grid,
.passport-grid,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.stat-card,
.passport-card,
.detail-card,
.trail-card,
.passport-badge,
.planner-day-card,
.transport-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-sm);
}

.stat-card,
.passport-card,
.transport-card {
  padding: 14px 14px;
  display: grid;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover,
.passport-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-number,
.passport-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-dark);
  font-feature-settings: "tnum" 1;
}

.transport-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.transport-card-label {
  font-weight: 800;
  color: var(--text-dark);
}

.transport-card-note {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.trail-card {
  width: 100%;
  text-align: left;
  padding: 14px;
  cursor: pointer;
  margin-bottom: 10px;
  border: 1px solid transparent;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.trail-card:hover,
.nearby-item:hover,
.planner-stop:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.trail-card.is-active {
  border-color: rgba(196, 30, 58, 0.45);
  box-shadow: 0 0 0 2px rgba(196, 30, 58, 0.12), var(--shadow-md);
}

.trail-top,
.trail-stats,
.planner-day-header,
.planner-stop-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
  align-items: center;
}

.trail-card h3,
.planner-day-card h3 {
  margin: 10px 0 6px;
  font-size: 1.05rem;
  color: var(--text-dark);
  font-weight: 800;
}

.trail-theme,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 0.78rem;
  font-weight: 700;
  margin-right: 6px;
  margin-bottom: 6px;
}

.chip--hidden {
  background: var(--hidden-bg);
  color: var(--hidden);
}

.detail-card {
  padding: 14px;
  margin-top: 10px;
}

.detail-grid .detail-card {
  margin-top: 0;
}

.nearby-item,
.planner-stop {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 4px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 8px;
  background: #fff;
  cursor: pointer;
  min-height: 44px;
  font-family: inherit;
}

.planner-stop-media {
  width: 100%;
  height: 110px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: rgba(226, 232, 240, 0.6);
}

.planner-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nearby-name {
  font-weight: 700;
  color: var(--text-dark);
}

.passport-badge {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

/* Achievement cards */
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.achievement-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  transition: transform 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
}

.achievement-card--locked {
  opacity: 0.55;
  filter: grayscale(0.2);
}

.achievement-card--unlocked {
  background: linear-gradient(180deg, #fffdf8, #fff);
  border-color: rgba(196, 30, 58, 0.25);
  box-shadow: var(--shadow-md);
}

.achievement-card__icon {
  font-size: 1.4rem;
  line-height: 1;
}

.achievement-card__title {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-dark);
}

.achievement-card__desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.passport-xp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(120deg, rgba(196, 30, 58, 0.08), rgba(245, 197, 66, 0.12));
  border: 1px solid var(--border-soft);
}

.xp-bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: rgba(203, 213, 225, 0.7);
  overflow: hidden;
  margin-top: 6px;
  max-width: 200px;
}

.xp-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--hk-red), var(--hk-gold));
  border-radius: var(--radius-pill);
  transition: width 0.35s ease;
}

.place-hero-wrap {
  width: 100%;
  height: 180px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 10px;
  background: rgba(226, 232, 240, 0.5);
}

.place-detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 4px;
}

.place-detail-media {
  width: 100%;
  min-height: 160px;
  max-height: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(226, 232, 240, 0.5);
}

.place-detail-media .place-hero-img {
  width: 100%;
  height: 100%;
  min-height: 160px;
  object-fit: cover;
  display: block;
}

.place-detail-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.place-detail-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-dark);
}

.place-detail-subtitle {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.35;
}

.place-visit-worthiness {
  margin: 4px 0 2px;
}

.visit-worthiness-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  max-width: 100%;
}

.visit-worthiness-badge__emoji {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1;
}

.visit-worthiness-badge__text {
  min-width: 0;
}

.visit-worthiness-badge--must_see {
  background: rgba(34, 197, 94, 0.14);
  color: #166534;
}

.visit-worthiness-badge--nearby {
  background: rgba(59, 130, 246, 0.14);
  color: #1d4ed8;
}

.visit-worthiness-badge--extra_time {
  background: rgba(234, 179, 8, 0.16);
  color: #a16207;
}

.visit-worthiness-badge--skip_detour {
  background: rgba(148, 163, 184, 0.2);
  color: #475569;
}

.popup-visit-worthiness {
  margin: 4px 0 6px;
}

.place-detail-desc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
  max-height: 9.5em;
  overflow-y: auto;
}

.place-detail-copy .place-meta {
  margin: 2px 0 0;
  font-size: 0.82rem;
}

.hk-popup .popup-desc {
  margin: 0 0 6px;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.place-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mission-progress-wrap {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.mission-card-inner {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
}

.mission-progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 10px;
  font-size: 0.86rem;
  color: var(--text-muted);
  font-weight: 500;
}

.mission-progress-bar {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: var(--radius-pill);
  background: rgba(203, 213, 225, 0.65);
  overflow: hidden;
}

.mission-progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(120deg, var(--hk-red), #e9b949);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

/* Toast host & variants */
.toast-host {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 12000;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  max-width: min(420px, calc(100% - 32px));
  pointer-events: none;
}

.reward-toast {
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 12px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  line-height: 1.3;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.reward-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.reward-toast--levelup {
  background: linear-gradient(120deg, #7c3aed, #4f46e5);
  border-color: rgba(255, 255, 255, 0.2);
  font-size: 0.95rem;
}

.reward-toast--mission {
  background: linear-gradient(120deg, #0d9488, #0f766e);
}

.reward-toast--success {
  background: linear-gradient(120deg, var(--hk-red), #9f1239);
}

/* Celebration overlay */
.celebration-root {
  position: absolute;
  inset: 0;
  z-index: 13000;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.celebration-root[aria-hidden="false"] {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.celebration-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.celebration-card {
  position: relative;
  max-width: 380px;
  width: 100%;
  padding: 28px 24px;
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-lg);
  text-align: center;
  border: 1px solid var(--border-soft);
  z-index: 1;
  animation: celebrate-in 0.4s ease;
}

@keyframes celebrate-in {
  from {
    transform: scale(0.9) translateY(12px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.celebration-card h3 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-dark);
}

.celebration-card p {
  margin: 0 0 18px;
  color: var(--text-muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

.celebration-emoji {
  font-size: 2.5rem;
  line-height: 1;
  margin-bottom: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .celebration-card {
    animation: none;
  }
}

.reward-list {
  padding-left: 18px;
}

.reward-list li + li {
  margin-top: 8px;
}

.empty-state {
  padding: 16px;
  border: 1px dashed var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.9rem;
}

.ghost-btn,
.action-btn {
  color: var(--text-dark);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  min-height: 44px;
  box-sizing: border-box;
}

.action-btn.is-active,
.planner-btn {
  background: linear-gradient(120deg, rgba(196, 30, 58, 0.98), rgba(200, 120, 40, 0.95));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(196, 30, 58, 0.25);
}

.planner-form {
  display: grid;
  gap: 10px;
}

.planner-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.planner-switch {
  margin: 4px 0 8px;
}

.planner-results {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.planner-day-card {
  padding: 14px;
  background: linear-gradient(180deg, #fff, var(--planner-bg));
}

.planner-hours {
  font-weight: 800;
  color: var(--text-dark);
}

.planner-meta {
  font-size: 0.9rem;
  padding: 0 2px;
}

.planner-stops {
  display: grid;
  gap: 8px;
}

.planner-legs {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.planner-leg-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 8px 10px;
  border: 1px dashed var(--border-soft);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.7);
}

.planner-stop-meta {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.hk-cluster-outer.small .hk-cluster {
  width: 28px;
  height: 28px;
}

.hk-cluster-outer.medium .hk-cluster {
  width: 34px;
  height: 34px;
}

.hk-cluster-outer.large .hk-cluster {
  width: 40px;
  height: 40px;
}

.hk-cluster {
  background: var(--hk-red);
  border: 3px solid var(--hk-gold);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  box-shadow: var(--shadow-md);
}

.hk-popup {
  min-width: 270px;
  max-width: 360px;
  font-family: inherit;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid var(--border-soft) !important;
  padding: 0 !important;
}

.hk-popup .leaflet-popup-content {
  margin: 14px 16px !important;
  min-width: 220px;
}

.hk-popup .title {
  font-weight: 800;
  margin-bottom: 2px;
  color: var(--hk-red);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hk-popup .name {
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text-dark);
  font-size: 1.05rem;
  line-height: 1.25;
}

.hk-popup .meta,
.hk-popup .addr {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.4;
}

.btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #fff;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.btn:hover {
  filter: brightness(1.05);
}

.btn--gmaps {
  background: #d93025;
  color: #fff !important;
}

.btn--osm {
  background: #475569;
  color: #fff !important;
}

.leaflet-control-layers-expanded {
  font: 12px var(--font-sans);
}

.hk-marker-wrap {
  background: transparent;
  border: none;
}

.hk-marker {
  position: relative;
  width: 44px;
  height: 44px;
}

.hk-marker img {
  width: 44px;
  height: 44px;
  display: block;
}

.hk-marker--visited::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(
    circle at 35% 30%,
    rgba(255, 236, 160, 0.55),
    rgba(201, 163, 82, 0.35) 55%,
    transparent 72%
  );
  box-shadow:
    inset 0 0 0 2px var(--gold-foil),
    0 0 6px var(--gold-soft);
}

.hk-marker--visited img {
  filter: saturate(1.15) brightness(1.05);
}

.transport-node-mtr {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

.transport-node-light-rail {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

.leaflet-top.leaflet-right {
  top: calc(118px + env(safe-area-inset-top, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
}

.leaflet-top.leaflet-right .leaflet-control {
  margin-top: 0;
}

/* Hide old standalone side-toggle; JS may leave node absent */
.side-toggle {
  display: none;
}

@media (max-width: 1100px) {
  .hk-header {
    left: max(16px, env(safe-area-inset-left, 0px));
    right: max(16px, env(safe-area-inset-right, 0px));
    max-width: none;
  }

  .filter-bar {
    left: max(16px, env(safe-area-inset-left, 0px));
    width: min(400px, calc(100% - 32px - env(safe-area-inset-left, 0px)));
  }

  .side-panel {
    right: max(16px, env(safe-area-inset-right, 0px));
  }

  .leaflet-top.leaflet-right {
    top: calc(128px + env(safe-area-inset-top, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
  }
}

@media (max-width: 860px) {
  :root {
    --header-offset: 92px;
    --panel-top-offset: 0px;
  }

  .hk-header {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    min-height: auto;
    padding: 6px 10px;
    gap: 6px 8px;
  }

  .hk-header .brand-block {
    flex: 1 1 140px;
    min-width: 0;
  }

  .hk-header .hk-subtitle {
    display: none;
  }

  .hk-header .progress-pill {
    order: 3;
  }

  .header-actions {
    width: auto;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 6px;
  }

  .side-panel-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .guide-btn[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.28);
    border-color: rgba(255, 255, 255, 0.55);
  }

  .side-panel {
    top: auto;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: min(72dvh, 560px);
    max-height: min(72vh, 560px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(100%);
    max-width: none;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.12);
    transition:
      transform var(--motion-base) var(--motion-ease),
      max-height var(--motion-base) var(--motion-ease);
  }

  .side-panel--expanded {
    max-height: min(88dvh, 720px);
    max-height: min(88vh, 720px);
  }

  .side-panel::before {
    display: none;
  }

  .side-panel-sheet-handle {
    display: block;
  }

  .side-panel.is-open {
    transform: translateY(0);
  }

  .place-detail-hero {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .place-detail-media {
    min-height: 180px;
    max-height: 200px;
  }

  .place-detail-title {
    font-size: 1.45rem;
  }

  .place-detail-desc {
    max-height: none;
  }

  .place-reviews-scroll {
    max-height: min(32dvh, 220px);
    max-height: min(32vh, 220px);
  }

  .side-panel--expanded .place-reviews-scroll {
    max-height: min(48dvh, 360px);
    max-height: min(48vh, 360px);
  }

  .stats-grid,
  .passport-grid,
  .detail-grid,
  .planner-grid,
  .achievement-grid {
    grid-template-columns: 1fr;
  }

  .leaflet-top.leaflet-right {
    top: calc(88px + env(safe-area-inset-top, 0px));
    right: max(8px, env(safe-area-inset-right, 0px));
  }

  .toast-host {
    bottom: max(16px, env(safe-area-inset-bottom, 0));
  }
}

/* i18n / header controls */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.header-mini-select {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hk-inline-select {
  font: inherit;
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(15, 23, 42, 0.42);
  color: #fff;
  max-width: 130px;
}

@media (max-width: 860px) {
  .header-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .hk-inline-select {
    max-width: 112px;
    font-size: 0.74rem;
  }
}

.passport-share-row {
  margin-bottom: 10px;
}

.planner-stop-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 0.76rem;
}

.planner-stop-links span {
  opacity: 0.85;
}

.planner-stop-links .btn {
  flex: 0 0 auto;
  font-size: 0.72rem;
  padding: 4px 10px;
}

.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.52);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  /* Shell uses .hk-shell { pointer-events: none }; overlay must capture clicks */
  pointer-events: auto;
}

.onboarding-card {
  max-width: 400px;
  width: 100%;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-lg);
}

.onboarding-card h2 {
  margin: 0 0 var(--space-2);
  font-size: 1.35rem;
}

.onboarding-card__lead {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  line-height: 1.45;
  font-size: 0.95rem;
}

.discover-hero__sub.muted {
  color: var(--text-muted);
  margin-top: 6px;
}

.hk-legal-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.75);
  background: linear-gradient(to top, rgba(15, 23, 42, 0.42), transparent);
  pointer-events: none;
}

.hk-legal-footer a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: underline;
  text-underline-offset: 2px;
  pointer-events: auto;
}

.hk-legal-footer__sep {
  opacity: 0.6;
}

@media (max-width: 520px) {
  .hk-legal-footer {
    font-size: 0.68rem;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
}

.account-feedback {
  margin: 0 0 var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.35;
}

.account-feedback--ok {
  color: #065f46;
  background: #d1fae5;
}

.account-feedback--err {
  color: #991b1b;
  background: #fee2e2;
}

.field-group--inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0;
}

/* ----- Boot overlay (first paint) ----- */
.hk-boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px))
    max(24px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  background: linear-gradient(165deg, #0f172a 0%, #1e293b 42%, var(--hk-red-deep) 100%);
  color: #f8fafc;
  text-align: center;
  font-family: var(--font-sans);
  transition:
    opacity var(--motion-slow) var(--motion-ease),
    visibility 0s linear 0s;
}

.hk-boot-overlay.hk-boot-overlay--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--motion-slow) var(--motion-ease),
    visibility 0s linear var(--motion-slow);
}

.hk-boot-overlay__inner {
  max-width: 320px;
  width: 100%;
}

.hk-boot-overlay__logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background-image: url("../img/logo_bauhinia_circular.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-color: transparent;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.hk-boot-overlay__title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.hk-boot-overlay__lead {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.88;
  line-height: 1.45;
}

.hk-boot-overlay__bar {
  margin-top: 22px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.hk-boot-overlay__bar-fill {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--hk-gold), #fff4cf);
  animation: hkBootBar 1.05s ease-in-out infinite;
}

@keyframes hkBootBar {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hk-boot-overlay__bar-fill {
    animation: none;
    width: 100%;
    opacity: 0.45;
  }
}

/* ----- Load failure ----- */
.hk-load-error {
  position: fixed;
  inset: 0;
  z-index: 20001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px))
    max(20px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  background: rgba(15, 23, 42, 0.52);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.hk-load-error[hidden] {
  display: none !important;
}

.hk-load-error__card {
  max-width: 380px;
  width: 100%;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(153, 27, 27, 0.35);
}

.hk-load-error__msg {
  margin: 0 0 var(--space-3);
  font-size: 0.95rem;
  line-height: 1.45;
  color: #991b1b;
}

.hk-load-error .planner-btn {
  width: 100%;
  justify-content: center;
}
