.map-page {
  background: #f3f1e9;
  overflow: hidden;
}

.map-layout {
  display: grid;
  height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr);
}

.map-header {
  display: flex;
  align-items: center;
  gap: 24px;
  justify-content: space-between;
  padding: 8px 32px;
  border-bottom: 1px solid #dfe2dc;
  background: #fff;
}

.map-header .header-button {
  padding: 8px 12px;
  border: 1px solid #b8d2c0;
  border-radius: 5px;
  background: #eaf5ed;
  color: #1d5a35;
  font-weight: 700;
  text-decoration: none;
}

.map-upload {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 14px;
  margin-right: auto;
}

#gpx-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.upload-button {
  display: inline-block;
  padding: 9px 14px;
  border: 1px solid #b8d2c0;
  border-radius: 5px;
  background: #eaf5ed;
  color: #1d5a35;
  cursor: pointer;
  font-weight: 700;
}

.hike-upload {
  background: #f3f8f4;
}

.simulation-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #315c42;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.simulation-toggle input {
  accent-color: #257044;
}

.simulation-toggle:has(input:disabled) {
  color: #9ba9a0;
}

.map-status {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  color: #557261;
  font-size: 0.85rem;
  line-height: 1.25;
  white-space: normal;
}

.map-panel {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) 9px minmax(140px, var(--poi-panel-height, 220px));
  overflow: hidden;
  background: #fff;
}

#route-map {
  position: relative;
  min-height: 0;
  touch-action: none;
}

.simulation-device {
  position: relative;
  z-index: 1000;
  top: 0;
  right: 0;
  width: 128px;
  aspect-ratio: 361 / 593;
  overflow: hidden;
  border-radius: 21px;
  background: transparent;
  box-shadow: 0 3px 10px rgb(0 0 0 / 25%);
  pointer-events: none;
}

.simulation-devices {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 8px;
  width: max-content;
}

.simulation-devices[hidden] {
  display: none;
}

.simulation-devices > .simulation-device {
  flex: 0 0 auto;
}

.simulation-device[hidden] {
  display: none;
}

.simulation-device img {
  position: relative;
  width: 284%;
  max-width: none;
  mix-blend-mode: multiply;
  transform: translate(-33.5%, -8.33%);
}

.simulation-device.hiking {
  width: 112px;
  aspect-ratio: 387 / 606;
  border-radius: 22px;
}

.simulation-device.hiking .watch-alert {
  top: 28%;
}

.simulation-device.watch-reference::before {
  top: 25%;
  height: 49%;
}

.simulation-device .notification-panel strong {
  font-size: 0.65rem;
}

.simulation-device .notification-panel em {
  font-size: 0.58rem;
}

.simulation-device .notification-panel {
  top: 52%;
  height: 40%;
}

.simulation-device.completion .watch-alert strong,
.simulation-device.completion .notification-panel strong {
  font-size: 0.48rem;
}

.simulation-device.completion .watch-alert em,
.simulation-device.completion .notification-panel em {
  font-size: 0.46rem;
}

.simulation-device.hiking img {
  width: 291%;
  transform: translate(-33.8%, -10.4%);
}

#poi-resizer {
  cursor: ns-resize;
  touch-action: none;
}

#poi-resizer::after {
  display: block;
  width: 44px;
  height: 3px;
  margin: 3px auto;
  border-radius: 2px;
  background: #b8c6bb;
  content: "";
}

#poi-list {
  overflow: auto;
  padding: 0 32px 18px;
  border-top: 1px solid #dfe2dc;
}

.poi-timeline {
  position: relative;
  width: max(100%, 720px);
  min-height: 60px;
}

.poi-list-item {
  display: flex;
  align-items: center;
  gap: 3px;
  position: absolute;
  bottom: 30px;
  z-index: 2;
  max-width: 124px;
  overflow: hidden;
  padding: 4px 7px;
  border: 1px solid #cfe0d3;
  border-radius: 4px;
  background: #f7fbf8;
  color: #274e35;
  cursor: pointer;
  font-size: 0.78rem;
  line-height: 1.35;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translate(-50%, calc(var(--stack-index) * -34px));
  transition: transform 120ms ease;
}

.poi-list-item:hover {
  z-index: 10;
  transform: translate(-50%, calc(var(--stack-index) * -34px));
}

.poi-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.poi-list-item small {
  flex: none;
  color: #557261;
  font-size: 0.68rem;
}

.poi-list-item::after {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 2px;
  height: 21px;
  background: #257044;
  content: "";
}

.poi-list-item.edge-start {
  transform: translate(0, calc(var(--stack-index) * -34px));
}

.poi-list-item.edge-start::after {
  left: 0;
}

.poi-list-item.edge-end {
  transform: translate(-100%, calc(var(--stack-index) * -34px));
}

.poi-list-item.edge-end::after {
  left: 100%;
}

.poi-list-item strong {
  display: block;
  color: #17251e;
}

.weather-warning {
  position: absolute;
  bottom: 0;
  z-index: 1;
  height: 18px;
  min-width: 16px;
  overflow: hidden;
  box-sizing: border-box;
  padding: 0 8px;
  border-color: #efc49b;
  border: 1px solid #efc49b;
  border-radius: 5px;
  background: #fff8ef;
  color: #8f4c0c;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  white-space: nowrap;
}

.weather-warning.weather-rain {
  border-color: #35657d;
  background-color: #4c7f9a;
  background-image: repeating-linear-gradient(
    115deg,
    transparent 0 7px,
    rgb(255 255 255 / 45%) 8px 9px,
    transparent 10px 17px
  );
  color: #fff;
}

.weather-warning.weather-snow {
  border-color: #8ab6c6;
  background-color: #b9dce8;
  background-image: radial-gradient(#fff 1px, transparent 1.5px);
  background-size: 7px 7px;
  color: #214b5b;
}

.weather-warning.weather-default {
  background-color: #e9bb78;
}

.weather-base-bar {
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 18px;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: #dcecf6;
  color: #234b63;
  cursor: pointer;
  font: inherit;
  font-size: 0.68rem;
  line-height: 18px;
  text-align: center;
  white-space: nowrap;
}

.weather-base-bar.weather-rain {
  background-color: #6e9fba;
  background-image: repeating-linear-gradient(
    120deg,
    rgb(255 255 255 / 18%) 0,
    rgb(255 255 255 / 18%) 2px,
    transparent 2px,
    transparent 8px
  );
  color: #fff;
}

.weather-base-bar.weather-snow {
  background-color: #cfe8f4;
  background-image: radial-gradient(#fff 1px, transparent 1.5px);
  background-size: 7px 7px;
}

.poi-icon {
  display: inline-grid;
  width: 1.4em;
  place-items: center;
  color: #29784a;
}

.poi-marker {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #29784a;
  box-shadow: 0 1px 4px rgb(23 37 30 / 35%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
}

.route-direction-arrow {
  background: transparent;
}

.route-direction-arrow span {
  display: block;
  color: #257044;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 14px;
  text-align: center;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff;
}

.poi-marker.settlement {
  background: #2d70a9;
}

.poi-marker.peak {
  background: #a56a22;
}

.weather-marker {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #df7c21;
  box-shadow: 0 1px 4px rgb(23 37 30 / 35%);
  color: #fff;
  font-weight: 800;
}

@media (max-width: 700px) {
  .map-layout {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .map-header {
    gap: 12px;
    padding: 0 20px;
  }

  .map-header > a:last-child {
    display: none;
  }

  .map-upload {
    flex-wrap: wrap;
    gap: 8px;
  }

  .map-status {
    flex-basis: 100%;
  }

  #poi-list {
    padding: 0 20px 14px;
  }

  .poi-list-title {
    margin-bottom: 8px;
  }

  .poi-list-item {
    padding: 8px 12px;
  }
}
