.map-game .atlas { view-transition-name: trip-map; }
.map-game #modes { grid-template-columns: 1fr 1.35fr 1.15fr 1fr; }
.map-game #modes button { min-width: 0; }

.map-game .maphead {
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding-block: 4px;
}
.maphead .map-hint { margin-inline-start: auto; }
.maphead .map-sound-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
  color: #315a46;
  font-size: .875rem;
  white-space: nowrap;
}
.maphead .map-sound-toggle[aria-pressed=false] { color: #6d6355; }
.map-sound-toggle[aria-pressed=true] .sound-muted,
.map-sound-toggle[aria-pressed=false] .sound-playing { display: none; }
@media (max-width: 540px) {
  .maphead .map-hint { display: none; }
}

.map-key {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 9px 16px 0;
  background: #fffdf5;
  color: #405645;
  font-size: .85rem;
}
.map-key span { display: inline-flex; align-items: center; gap: 6px; }
.map-key-dot { width: 8px; height: 8px; border-radius: 50%; background: #435c45; }

.map-game .travel-house,
#map .travel-pin .travel-house {
  width: 23px;
  height: 23px;
  border: 1.5px solid #a74a33;
  border-radius: 50%;
  background: #fff9e9 url("travel-house.svg") center / 16px no-repeat;
  box-shadow: 0 0 0 2px #fffdf3;
}
.map-key .travel-house { width: 17px; height: 17px; background-size: 12px; box-shadow: none; }

#map .travel-pin {
  z-index: 7;
  width: 32px;
  height: 32px;
  min-height: 32px;
}
#map .travel-pin[aria-pressed=true] { z-index: 9; }
#map .travel-pin[aria-pressed=true] .travel-house {
  background-color: #fff1cb;
  box-shadow: 0 0 0 2px #fffdf3, 0 0 0 4px #9b4330;
}
#map .pin > i { position: relative; }
#map .pin > i::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2px solid #dfbc6f;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
@media (any-hover: hover) {
  #map .pin.pin-hovered:not([aria-pressed=true]) > i::after { opacity: .9; }
}
#map .pin:focus-visible:not([aria-pressed=true]) > i::after {
  border-color: #935b1c;
  opacity: 1;
}
@media (prefers-reduced-motion: no-preference) {
  #map .pin > i::after { transition: opacity 140ms ease-out; }
}
.travel-pill {
  border-radius: 12px;
  color: #8d3828;
  background: #fff1e7;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}
.travel-pill { display: inline-block; padding: 1px 6px; }
#map .travel-pin[aria-pressed=true] .pin-label { left: 46%; bottom: calc(100% + 2px); }

#map .map-mascot {
  position: absolute;
  z-index: 12;
  margin-top: -28px;
  margin-left: -35px;
  width: 31px;
  height: 31px;
  pointer-events: none;
}

.map-game #results[data-mode=travel-mode],
.map-game #results[data-mode=all]:has(details) { grid-template-columns: 1fr; }
.map-game #results details {
  margin: 0;
  min-width: 0;
  border: 1px solid #dbd2bb;
  border-radius: 8px;
  background: #fffaf0;
}
.map-game #results summary {
  min-height: 44px;
  padding: 10px;
  color: #345843;
  font-weight: 700;
}
.province-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 82px), 1fr));
  gap: 6px;
  padding: 0 7px 8px;
}

.map-game #card { scroll-margin-top: 14px; }
.map-game #card .clan-population {
  font-weight: 700;
  margin: 8px 0 14px;
}
.clan-population a {
  display: block;
  margin-top: 2px;
  color: #4a6255;
  font-size: .83rem;
  font-weight: 400;
  text-underline-offset: 3px;
}

.clan-travel {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
  padding: 12px;
  border: 1px solid #d1d9c6;
  border-radius: 12px;
  background: #eef2e6;
}
.map-game #card .clan-travel h4 { margin: 0; padding: 0; border: 0; }
.clan-travel a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  text-underline-offset: 3px;
}
.clan-travel .start-town-trip {
  justify-content: center;
  padding: 8px 16px;
  border-radius: 9px;
  background: #974731;
  color: #fffdf6;
  font-weight: 700;
  text-decoration: none;
}
.start-town-trip:hover { background: #813c2c; }
.clan-travel-links { display: flex; flex-wrap: wrap; gap: 0 14px; }

@media (max-width: 800px) {
  .map-game .desk {
    grid-template-columns: minmax(0,1fr);
    grid-template-areas: "atlas" "finder" "story";
  }
  #map .pin { width: 36px; height: 36px; min-height: 36px; }
}
@media (max-width: 460px) {
  .map-game #modes { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .map-game #results:has(details) { max-height: 210px; }
}
