:root {
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --bg: #f5f5f7;
  --spa: #0a8f86;
  --spa-hotel: #8a3ffc;
  --kallbadhus: #1f6feb;
  --relax: #c46200;
  --home: #1d1d1f;
  --accent: #0071e3;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  z-index: 1001; /* above the home sheet's scrim, so the chip closes it */
}

header h1 {
  white-space: nowrap;
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.legend {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}

.legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.dot.spa {
  background: var(--spa);
}

.dot.spa-hotel {
  background: var(--spa-hotel);
}

.dot.kallbadhus {
  background: var(--kallbadhus);
}

.dot.relax {
  background: var(--relax);
}

.legend .short {
  display: none;
}

.dot.home {
  background: var(--home);
}

@media (max-width: 480px) {
  /* title and home button on the first row, the legend on its own row under them */
  header {
    flex-wrap: wrap;
    row-gap: 4px;
  }

  header .legend {
    order: 3;
    flex-basis: 100%;
    font-size: 12px;
    gap: 8px;
    flex-wrap: nowrap;
  }

  /* the short hotel label and nowrap keep the legend on one line */
  .legend .long {
    display: none;
  }

  .legend .short {
    display: inline;
  }
}

#map {
  flex: 1;
}

#status {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 64px;
  z-index: 600;
  font-size: 13px;
  max-width: calc(100% - 24px);
}

#status[data-state="loading"] {
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

#status[data-state="error"] {
  background: #fff4f4;
  color: #a1001c;
  border: 1px solid #ffd0d6;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

#status[data-state="ready"] {
  display: none;
}

/* markers */
.pin svg {
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}

/* popups */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.leaflet-popup-content {
  margin: 14px 16px;
  width: min(280px, calc(100vw - 80px)) !important;
}

.card h2 {
  font-size: 17px;
  margin: 4px 0 6px;
  letter-spacing: -0.01em;
}

.card p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.4;
  color: #3a3a3c;
}

.addr {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}

.kind {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
}

.kind.spa {
  background: var(--spa);
}

.kind.spa-hotel {
  background: var(--spa-hotel);
}

.kind.kallbadhus {
  background: var(--kallbadhus);
}

.kind.relax {
  background: var(--relax);
}

.card ul {
  margin: 0 0 8px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.45;
  color: #3a3a3c;
}

.dinner {
  background: var(--bg);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 8px;
}

.dinner b {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 2px;
}

.actions {
  display: flex;
  gap: 8px;
}

.btn {
  flex: 1;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.btn.primary {
  background: var(--accent);
  color: #fff !important;
}

.btn.secondary {
  background: #e8f0fe;
  color: var(--accent) !important;
}

.source {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}

.source a {
  color: var(--muted);
}

.scroll {
  max-height: 46vh;
  overflow: auto;
}

@media (max-width: 480px) {
  .scroll {
    max-height: 300px;
  }
}

/* photo at the top of the card, full bleed */
.photo {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #e5e5ea;
  overflow: hidden;
  margin: -14px -16px 10px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo .kind {
  position: absolute;
  left: 10px;
  bottom: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.leaflet-container .photo .credit {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 11px;
  text-decoration: none;
  backdrop-filter: blur(4px);
}

.card.has-photo .scroll {
  max-height: 34vh;
}

@media (max-width: 480px) {
  .photo {
    aspect-ratio: auto;
    height: 120px;
  }

  .card.has-photo .scroll {
    max-height: 200px;
  }
}

/* close button readable over a photo */
.leaflet-container .leaflet-popup:has(.photo) a.leaflet-popup-close-button {
  z-index: 2;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  line-height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  font-size: 18px;
}

/* row icons */
.ico {
  flex: none;
  color: var(--muted);
}

.addr,
.source {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.addr .ico,
.source .ico {
  margin-top: -1px;
}

.source .ico {
  width: 13px;
  height: 13px;
}

/* one icon per offering line, tinted with the place's category */
.offer.lines ul {
  list-style: none;
  padding-left: 0;
}

.offer.lines li {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  margin-bottom: 2px;
}

.offer.lines li .ico {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--spa);
  flex: none;
}

.card.spa-hotel .offer.lines li .ico {
  color: var(--spa-hotel);
}

.card.kallbadhus .offer.lines li .ico {
  color: var(--kallbadhus);
}

.card.relax .offer.lines li .ico {
  color: var(--relax);
}

.dinner b {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dinner b .ico {
  width: 14px;
  height: 14px;
}

/* drive time row */
.trip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink);
  margin: 0 0 8px;
}

.trip svg {
  flex: none;
  color: var(--muted);
}

.trip b {
  font-weight: 600;
}

.trip .km {
  color: var(--muted);
}

.trip.pending,
.trip.missing {
  color: var(--muted);
}

.leaflet-control-attribution {
  font-size: 11px;
}

[hidden] {
  display: none !important;
}

/* the home button: right end of the title bar */
.home-chip {
  margin-left: auto;
  flex-shrink: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  max-width: 230px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.home-chip::after {
  content: "";
  position: absolute;
  inset: -8px -2px; /* 46 px hit area */
}

.home-chip .ico {
  color: var(--home);
  width: 15px;
  height: 15px;
}

.home-chip b {
  font-weight: 600;
}

.home-chip .town {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.home-chip .chev {
  display: inline-flex;
}

.home-chip .chev .ico {
  width: 12px;
  height: 12px;
  color: var(--muted);
}

.home-chip.custom {
  border-color: #b9d4f5;
  background: #f2f7fe;
}

.home-chip:hover {
  border-color: #c7c7cc;
}

/* the home sheet: a panel under the header, a bottom sheet on phones */
#home-sheet {
  position: absolute;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  left: 16px;
  width: 380px;
  max-width: calc(100% - 32px);
  max-height: calc(100% - 80px);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  font-size: 14px;
}

#home-scrim {
  position: absolute;
  inset: 0;
  z-index: 999;
  background: transparent;
}

.handle {
  display: none;
  width: 36px;
  height: 5px;
  margin: 8px auto 0;
  border-radius: 3px;
  background: #d1d1d6;
}

@media (max-width: 480px) {
  .home-chip {
    font-size: 12px;
  }

  #home-sheet {
    top: auto !important;
    left: 0 !important;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    max-height: 82%;
    border-radius: 18px 18px 0 0;
  }

  #home-scrim {
    background: rgba(0, 0, 0, 0.18);
  }

  .handle {
    display: block;
  }
}

.sheet-in {
  padding: 14px 16px 16px;
  overflow: auto;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -10px -12px -10px 0;
  border: 0;
  border-radius: 22px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.x span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background: var(--bg);
  font-size: 15px;
}

.lead {
  margin: 2px 0 12px;
  font-size: 13px;
  color: var(--muted);
}

form.search {
  display: flex;
  gap: 8px;
}

.field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--bg);
}

.field:focus-within {
  border-color: var(--accent);
  background: #fff;
}

.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  outline: none;
}

.btn.small {
  flex: none;
  padding: 0 16px;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.btn.ghost {
  border: 0;
  background: none;
  color: var(--accent) !important;
  font-family: inherit;
  cursor: pointer;
}

.locate {
  width: 100%;
  gap: 6px;
  margin-top: 8px;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.locate .ico {
  color: var(--accent);
}

.msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.msg.err {
  padding: 8px 10px;
  border: 1px solid #ffd0d6;
  border-radius: 10px;
  background: #fff4f4;
  color: #a1001c;
}

.msg.warn {
  padding: 8px 10px;
  border: 1px solid #ffe2a8;
  border-radius: 10px;
  background: #fff8e6;
  color: #7a4b00;
}

.spinner {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 1px;
  border: 2px solid #d1d1d6;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

ul.results {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

ul.results li + li {
  border-top: 1px solid var(--line);
}

ul.results button {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  border: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

ul.results button:hover,
ul.results button:focus-visible {
  background: #f2f7fe;
}

ul.results b {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

ul.results small {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--muted);
}

.now {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.now .addr {
  margin-bottom: 4px;
  font-size: 14px;
  color: var(--ink);
}

.now .tag {
  margin-left: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-top: 6px;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
}

.reset .ico {
  color: var(--accent);
}

.credit {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
}

.credit a {
  color: var(--muted);
}

/* toast after home moved; #status stays the places banner */
#home-toast {
  position: absolute;
  left: 50%;
  top: 64px;
  transform: translateX(-50%);
  z-index: 900;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: min(420px, calc(100% - 24px));
  padding: 10px 12px 10px 14px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16);
  font-size: 13px;
}

#home-toast .ico {
  margin-top: 1px;
  color: var(--home);
}

#home-toast.warn .ico {
  color: #b26a00;
}

#home-toast p {
  margin: 0;
  line-height: 1.35;
}

#home-toast p.warn {
  margin-top: 4px;
  color: #7a4b00;
}

#home-toast .tx {
  flex: none;
  width: 28px;
  height: 28px;
  margin: -4px -4px 0 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

@media (max-width: 480px) {
  #home-toast {
    top: auto;
    bottom: 30px;
    width: calc(100% - 24px);
    max-width: none;
  }
}

/* home popup */
.card button.btn {
  width: 100%;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}
