/* A continuous illustrated town, with native controls above the same art. */
.site-header .town-only-nav {
  margin-left: auto;
  margin-right: 20px;
}
.site-header .town-only-nav a {
  white-space: nowrap;
}
.main:has(.town-experience) {
  max-width: 1440px;
}
.town-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0 16px;
}
.town-heading h1 {
  font-size: clamp(23px, 2.6vw, 34px);
  margin: 0;
}
.town-heading p {
  margin: 4px 0 0;
  color: var(--muted);
}
.town-experience {
  --town-cream: #fffbea;
  --town-green: #456c52;
}
.town-map-guide {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px 18px;
  background: #f1eedc;
  border: 1px solid #d8d3b8;
  border-radius: 20px 20px 0 0;
}
.town-guide-text {
  min-width: 0;
}
.town-guide-name {
  color: var(--town-green);
  font-weight: 700;
  font-size: 14px;
}
.town-guide-text p {
  margin: 3px 0 0;
  min-height: 1.5em;
  color: #52604b;
  font-size: 16px;
}
.town-guide-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.town-guide-actions .button {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 15px;
}
.town-guide-actions [aria-pressed='true'] {
  color: var(--town-cream);
  background: var(--town-green);
}
.town-canvas {
  container-type: inline-size;
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  aspect-ratio: 1672/941;
  background: #e2eacb;
  overflow: hidden;
  isolation: isolate;
}
.town-landscape {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}
.town-places {
  position: absolute;
  inset: 0;
}
.town-place {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  height: var(--h);
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--town-green);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  overflow: visible;
}
.town-place-art {
  display: none;
}
.town-added-art {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.town-place-contour {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.town-place-contour path {
  fill: transparent;
  stroke: transparent;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
  stroke-linecap: round;
  transition:
    stroke 140ms,
    fill 140ms;
}
.town-place-label {
  position: absolute;
  left: var(--lx);
  top: var(--ly);
  width: var(--lw);
  height: var(--lh);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  background: var(--town-cream);
  border: 1px solid #e4d8b2;
  border-radius: 999px;
  box-shadow: 0 2px 0 #d5d5b8;
  font-family: var(--body);
  font-size: clamp(13px, 2.1cqw, 27px);
  line-height: 1.12;
  white-space: nowrap;
  transition:
    box-shadow 140ms,
    background 140ms;
  pointer-events: none;
}
.town-place-label strong {
  font-weight: 700;
}
.town-resume .town-place-label {
  background: var(--town-green);
  color: var(--town-cream);
  border-color: #456c52;
  font-size: clamp(16px, 2.7cqw, 36px);
  box-shadow: 0 3px 0 #36533d;
}
.town-place-description {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.town-place:hover .town-place-contour path,
.town-place:focus-visible .town-place-contour path,
.town-place.is-selected .town-place-contour path {
  stroke: #456c52;
  fill: #f5e5a314;
  filter: drop-shadow(0 0 2px #fffde9);
}
.town-place:focus-visible {
  outline: none;
}
.town-place:focus-visible .town-place-contour path {
  stroke-width: 4;
}
.town-place:hover .town-place-label,
.town-place:focus-visible .town-place-label,
.town-place.is-selected .town-place-label {
  box-shadow:
    0 0 0 2px #456c52,
    0 3px 0 #36533d;
}
.town-place.guide-cue {
  outline: none;
  animation: none;
  box-shadow: none;
}
.town-place.guide-cue .town-place-contour path {
  stroke: #bc7d2b;
  stroke-width: 4;
  fill: #f4ce6a30;
  filter: drop-shadow(0 0 3px #fff9db);
}
.town-place.guide-cue .town-place-label {
  box-shadow:
    0 0 0 3px #b97b2b,
    0 3px 0 #8d662d;
}
.town-current-task {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-radius: 0 0 20px 20px;
  border: 1px solid #d8dfc6;
  background: #f0f3e5;
  color: #65715a;
  font-size: 14px;
}
.town-current-task > span:first-child {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.town-current-task strong {
  color: #405640;
  font-weight: 600;
}
.town-task-label {
  padding-right: 12px;
  border-right: 1px solid #c5ceb5;
}
.town-encounters {
  white-space: nowrap;
}
@media (max-height: 700px) and (min-width: 601px) {
  .town-canvas {
    max-width: 100%;
  }
}
@media (max-width: 760px) {
  .site-header .town-only-nav {
    display: none;
  }
  .town-heading {
    margin: 6px 0 12px;
  }
  .town-guide-text p {
    font-size: 14px;
  }
  .town-map-guide {
    padding: 12px;
  }
  .town-current-task {
    padding: 12px;
    font-size: 13px;
  }
  .town-encounters {
    display: none;
  }
}
@media (max-width: 600px) and (orientation: portrait) {
  .town-heading h1 {
    font-size: 24px;
  }
  .town-heading p {
    font-size: 14px;
  }
  .town-map-guide {
    display: block;
    border-radius: 18px 18px 0 0;
  }
  .town-guide-text p {
    min-height: 3em;
  }
  .town-guide-actions {
    margin-top: 10px;
    justify-content: flex-end;
  }
  .town-canvas {
    max-width: none;
    aspect-ratio: auto;
    overflow: visible;
    background:
      radial-gradient(ellipse at 10% 35%, #d7e2b8 0 35%, transparent 36%),
      radial-gradient(ellipse at 100% 70%, #d8e5c0 0 35%, transparent 36%), #e4ecd6;
  }
  .town-landscape {
    display: none;
  }
  .town-places {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 8px 0;
    padding: 12px 4px 18px;
  }
  .town-places:before {
    content: '';
    position: absolute;
    left: 46%;
    top: 5%;
    height: 90%;
    width: 8%;
    border-radius: 50%;
    background: #f7efcc;
    transform: rotate(8deg);
    pointer-events: none;
  }
  .town-place {
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 110px;
    aspect-ratio: var(--ratio);
  }
  .town-place-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
  }
  .town-place-label {
    font-size: 15px;
    min-height: 32px;
    border-width: 1px;
  }
  .town-resume .town-place-label {
    font-size: 20px;
  }
  .town-place-contour path {
    stroke-width: 2;
  }
  .town-place.guide-cue .town-place-contour path {
    stroke-width: 3;
  }
  .town-current-task > span:first-child {
    gap: 5px 9px;
  }
  .town-task-label {
    border: 0;
    padding: 0;
  }
  .town-current-task > span:first-child > span:last-child {
    width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  .town-place-contour path,
  .town-place-label {
    transition: none;
  }
}
/* Keep the illustrated home inside the main iPad landscape viewport. */
.main:has(.town-experience) {
  padding-top: 12px;
  padding-bottom: 12px;
}
.town-heading {
  margin: 8px 0 12px;
}
.town-heading h1 {
  line-height: 1.25;
}
.town-heading p {
  font-size: 15px;
  line-height: 1.5;
}
.town-map-guide {
  padding-block: 10px;
}
.town-guide-name {
  line-height: 1.2;
}
.town-guide-text p {
  line-height: 1.45;
}
.town-current-task {
  padding-block: 8px;
  line-height: 1.5;
}
.app-shell:has(.town-experience) .site-footer {
  padding-block: 7px;
  font-size: 12px;
  line-height: 1.5;
}
@media (min-width: 601px) and (min-height: 900px) {
  .town-experience {
    max-width: min(100%, calc((100svh - 345px) * 1.777));
    margin-inline: auto;
  }
  .town-canvas {
    max-width: 100%;
  }
}

/* Short landscape stories keep the compact town navigation on one row.
   Reserve height for readable paragraphs and the existing touch controls. */
@media (min-width: 900px) and (max-width: 1200px) and (max-height: 760px) {
  .app-shell:has(.story-reading-stage) .site-header {
    min-height: 76px;
    flex-wrap: nowrap;
  }
  .app-shell:has(.story-reading-stage) .site-header .town-only-nav {
    order: 0;
    width: auto;
    margin-left: auto;
    margin-right: 12px;
  }
}
