:root {
  color-scheme: light;
  --ink: #18201f;
  --muted: #65706d;
  --line: #dce3e0;
  --surface: #ffffff;
  --surface-soft: #f4f7f6;
  --brand: #126b5b;
  --brand-dark: #0d584b;
  --factory: #d85343;
  --subway: #157a70;
  --shadow: 0 10px 30px rgba(24, 32, 31, 0.15);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  background: #dce7e3;
}

button,
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

button,
summary {
  font: inherit;
}

button:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(18, 107, 91, 0.28);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 2000;
  padding: 10px 14px;
  color: #ffffff;
  background: var(--brand-dark);
  border-radius: 4px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.map-shell,
#map {
  position: relative;
  width: 100%;
  height: 100%;
}

#map {
  z-index: 1;
  background: #dce7e3;
}

.leaflet-container {
  font-family: inherit;
  cursor: grab;
}

.leaflet-container:active {
  cursor: grabbing;
}

.leaflet-control-container {
  display: none;
}

.leaflet-tile {
  image-rendering: auto;
}

.brand-bar {
  position: absolute;
  z-index: 500;
  top: max(22px, env(safe-area-inset-top));
  left: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  padding: 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(220, 227, 224, 0.92);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(24, 32, 31, 0.12);
  backdrop-filter: blur(10px);
}

.brand-bar__logo {
  display: block;
  width: 44px;
  height: 44px;
}

.place-panel {
  position: absolute;
  z-index: 500;
  bottom: 24px;
  left: 24px;
  width: min(390px, calc(100vw - 48px));
  padding: 22px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(220, 227, 224, 0.96);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.place-panel__eyebrow {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  margin-right: 7px;
  background: var(--factory);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(216, 83, 67, 0.13);
}

.place-panel__code {
  margin-left: auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.place-panel h1 {
  margin: 13px 0 9px;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 760;
  letter-spacing: 0;
}

.place-panel__address {
  margin: 0;
  color: #4f5b58;
  font-size: 14px;
  line-height: 1.65;
}

.nearby {
  display: flex;
  align-items: center;
  min-height: 52px;
  margin-top: 17px;
  padding: 9px 10px;
  background: var(--surface-soft);
  border: 1px solid #e4eae8;
  border-radius: 6px;
}

.nearby__icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  color: #ffffff;
  background: var(--subway);
  border-radius: 4px;
}

.nearby__icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.2;
}

.nearby__text {
  display: flex;
  min-width: 0;
  margin-left: 10px;
  flex-direction: column;
  gap: 3px;
}

.nearby__text strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nearby__text span {
  color: var(--muted);
  font-size: 12px;
}

.nearby__action {
  min-width: 44px;
  min-height: 36px;
  margin-left: auto;
  padding: 0 7px;
  color: var(--brand-dark);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.nearby__action:hover {
  background: #e5eeeb;
}

.place-panel__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 13px;
}

.action-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.action-button svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-right: 8px;
  stroke-width: 2.2;
}

.action-button--secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: #cfd8d5;
}

.action-button--secondary:hover {
  background: var(--surface-soft);
}

.action-button--primary {
  color: #ffffff;
  background: var(--brand);
}

.action-button--primary:hover {
  background: var(--brand-dark);
}

.navigation-menu {
  position: relative;
  min-width: 0;
}

.navigation-menu summary {
  list-style: none;
}

.navigation-menu summary::-webkit-details-marker {
  display: none;
}

.navigation-menu .action-button__chevron {
  width: 15px;
  height: 15px;
  margin-right: 0;
  margin-left: 8px;
  transition: transform 180ms ease;
}

.navigation-menu:not([open]) .action-button__chevron {
  transform: rotate(180deg);
}

.navigation-menu__list {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  left: 0;
  overflow: hidden;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(24, 32, 31, 0.18);
}

.navigation-menu__list a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 11px;
  color: var(--ink);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.navigation-menu__list a:hover {
  color: var(--brand-dark);
  background: var(--surface-soft);
}

.map-controls {
  position: absolute;
  z-index: 500;
  top: max(22px, env(safe-area-inset-top));
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-controls__group,
.map-controls__single {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(207, 216, 213, 0.95);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(24, 32, 31, 0.14);
}

.map-controls button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.97);
  border: 0;
  cursor: pointer;
}

.map-controls__group button + button {
  border-top: 1px solid var(--line);
}

.map-controls button:hover {
  color: var(--brand-dark);
  background: var(--surface-soft);
}

.map-controls button:disabled,
.map-controls button:disabled:hover {
  color: #89918f;
  background: rgba(244, 247, 246, 0.96);
  cursor: not-allowed;
  opacity: 0.62;
}

.map-controls svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.map-attribution {
  position: absolute;
  z-index: 500;
  right: 8px;
  bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  color: #5e6966;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 3px;
  font-size: 10px;
  line-height: 1.25;
}

.map-attribution a {
  color: inherit;
  text-decoration: none;
}

.map-attribution a:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.embed-open-map {
  display: none;
}

.map-loading {
  position: absolute;
  z-index: 900;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 13px;
  color: #34403d;
  background: #edf2f0;
  font-size: 13px;
  font-weight: 650;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.map-loading__mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 7px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 0 0 7px rgba(18, 107, 91, 0.1);
  animation: loading-pulse 1.2s ease-in-out infinite;
}

.map-loading__mark img {
  display: block;
  width: 44px;
  height: 44px;
}

.map-loading.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.map-loading.is-error {
  color: #7d2f28;
}

.map-loading.is-error .map-loading__mark {
  border-color: rgba(216, 83, 67, 0.45);
  box-shadow: 0 0 0 7px rgba(216, 83, 67, 0.1);
  animation: none;
}

.toast {
  position: absolute;
  z-index: 1000;
  top: 26px;
  left: 50%;
  max-width: min(360px, calc(100vw - 40px));
  padding: 10px 14px;
  color: #ffffff;
  background: rgba(24, 32, 31, 0.92);
  border-radius: 5px;
  box-shadow: 0 6px 18px rgba(24, 32, 31, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 13px;
  font-weight: 650;
  text-align: center;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.factory-marker,
.station-marker {
  background: transparent;
  border: 0;
}

.marker-layout {
  position: relative;
  display: flex;
  align-items: center;
  width: max-content;
  height: 48px;
  filter: drop-shadow(0 5px 8px rgba(24, 32, 31, 0.2));
}

.marker-pin {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #ffffff;
  background: var(--factory);
  border: 3px solid #ffffff;
  border-radius: 50% 50% 50% 8px;
  transform: rotate(-45deg);
}

.marker-pin::after {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: rgba(216, 83, 67, 0.24);
  border-radius: 50%;
  content: "";
}

.marker-pin svg {
  width: 19px;
  height: 19px;
  transform: rotate(45deg);
  stroke-width: 2.2;
}

.marker-label {
  display: flex;
  min-width: 0;
  max-width: min(190px, calc(100vw - 96px));
  margin-left: 7px;
  padding: 7px 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(220, 227, 224, 0.96);
  border-radius: 5px;
  flex-direction: column;
  gap: 2px;
  line-height: 1.2;
}

.marker-label strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marker-label span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.station-marker .marker-layout {
  height: 38px;
  filter: drop-shadow(0 3px 6px rgba(24, 32, 31, 0.17));
}

.station-marker .marker-pin {
  width: 32px;
  height: 32px;
  background: var(--subway);
  border-width: 2px;
  border-radius: 50%;
  transform: none;
}

.station-marker .marker-pin::after {
  display: none;
}

.station-marker .marker-pin svg {
  width: 16px;
  height: 16px;
  transform: none;
}

.station-marker .marker-label {
  padding: 6px 9px;
}

.station-marker .marker-label strong {
  font-size: 12px;
}

@keyframes loading-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.94);
  }
}

@media (max-width: 720px) {
  .brand-bar {
    top: max(12px, env(safe-area-inset-top));
    left: 12px;
    width: 50px;
    height: 50px;
    padding: 6px;
  }

  .brand-bar__logo {
    width: 36px;
    height: 36px;
  }

  .map-controls {
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    gap: 8px;
  }

  .map-controls button {
    width: 42px;
    height: 42px;
  }

  .place-panel {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 18px 18px calc(16px + env(safe-area-inset-bottom));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .place-panel::before {
    display: block;
    width: 38px;
    height: 4px;
    margin: -8px auto 12px;
    background: #c7cfcc;
    border-radius: 2px;
    content: "";
  }

  .place-panel h1 {
    margin-top: 10px;
    font-size: 19px;
  }

  .nearby {
    margin-top: 13px;
  }

  .map-attribution {
    right: auto;
    bottom: auto;
    top: max(68px, calc(env(safe-area-inset-top) + 58px));
    left: 12px;
  }

  .toast {
    top: max(64px, calc(env(safe-area-inset-top) + 54px));
  }

  .marker-label strong {
    font-size: 12px;
  }

  .station-marker .marker-layout {
    flex-direction: row-reverse;
    transform: translateX(-126px);
  }

  .station-marker .marker-label {
    margin-right: 7px;
    margin-left: 0;
  }
}

@media (max-width: 360px), (max-height: 650px) {
  .place-panel {
    padding: 14px 14px calc(12px + env(safe-area-inset-bottom));
  }

  .place-panel::before {
    margin-bottom: 9px;
  }

  .place-panel h1 {
    margin: 8px 0 5px;
    font-size: 17px;
  }

  .place-panel__address {
    font-size: 13px;
    line-height: 1.5;
  }

  .nearby {
    min-height: 44px;
    margin-top: 9px;
    padding: 6px 8px;
  }

  .nearby__icon {
    width: 30px;
    height: 30px;
  }

  .place-panel__actions {
    margin-top: 9px;
  }

  .action-button {
    min-height: 42px;
    padding: 0 9px;
    font-size: 13px;
  }
}

html.is-embed .place-panel {
  display: none;
}

html.is-embed .brand-bar {
  top: 16px;
  left: 16px;
  width: 50px;
  height: 50px;
  padding: 6px;
}

html.is-embed .brand-bar__logo {
  width: 36px;
  height: 36px;
}

html.is-embed .map-controls {
  top: 16px;
  right: 16px;
  gap: 8px;
}

html.is-embed .map-controls button {
  width: 40px;
  height: 40px;
}

html.is-embed .station-marker .marker-layout {
  flex-direction: row;
  transform: none;
}

html.is-embed .station-marker .marker-label {
  margin-right: 0;
  margin-left: 7px;
}

html.is-embed .embed-open-map {
  position: absolute;
  z-index: 500;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  max-width: calc(100vw - 32px);
  min-height: 40px;
  padding: 0 13px;
  color: #ffffff;
  background: var(--brand);
  border-radius: 6px;
  box-shadow: 0 5px 18px rgba(24, 32, 31, 0.18);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

html.is-embed .embed-open-map span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html.is-embed .embed-open-map:hover {
  background: var(--brand-dark);
}

html.is-embed .embed-open-map svg {
  width: 17px;
  height: 17px;
  margin-right: 7px;
  stroke-width: 2.2;
}

html.is-embed .map-attribution {
  top: auto;
  right: 8px;
  bottom: 6px;
  left: auto;
}

html.is-embed .toast {
  top: 16px;
}

@media (max-width: 480px) {
  html.is-embed .station-marker .marker-layout {
    flex-direction: row-reverse;
    transform: translateX(-126px);
  }

  html.is-embed .station-marker .marker-label {
    margin-right: 7px;
    margin-left: 0;
  }

  html.is-embed .map-attribution {
    right: auto;
    bottom: 64px;
    left: 16px;
  }
}

@media (max-height: 420px) {
  html.is-embed .brand-bar {
    top: 10px;
    left: 10px;
    width: 44px;
    height: 44px;
    padding: 5px;
  }

  html.is-embed .brand-bar__logo {
    width: 32px;
    height: 32px;
  }

  html.is-embed .map-controls {
    top: 10px;
    right: 10px;
    gap: 6px;
  }

  html.is-embed .map-controls button {
    width: 38px;
    height: 38px;
  }

  html.is-embed .embed-open-map {
    bottom: 10px;
    left: 10px;
    min-height: 38px;
    padding: 0 11px;
  }

  html.is-embed .map-attribution {
    right: auto;
    bottom: 56px;
    left: 10px;
  }
}

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