:root {
  --bg: #ced7b9;
  --text: #344238;
  --panel: rgba(245, 248, 238, 0.78);
  --panel-border: rgba(94, 118, 89, 0.22);
  --page-pad: clamp(0.75rem, 2vw, 1.5rem);
  --frame-pad: clamp(0.3rem, 0.9vw, 0.55rem);
  --map-max-height: 70dvh;
  --content-max: 1080px;
  --map-content-max: 1680px;
  color-scheme: only light;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  color: var(--text);
  background-color: var(--bg) !important;
  background-image: none !important;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.75rem, 2vh, 1.5rem);
  padding: var(--page-pad);
  padding-bottom: calc(var(--page-pad) + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
  overflow-y: auto;
}

header {
  width: 100%;
  max-width: var(--content-max);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(1.4rem, 2.8vw, 2.2rem);
  letter-spacing: 0.03em;
  font-weight: 650;
  text-transform: uppercase;
  padding: 0.45rem 1rem 0.55rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 0.65rem;
  backdrop-filter: blur(2px);
}

.city-tag {
  display: inline-block;
  font-family: inherit;
  font-size: clamp(0.78rem, 1.25vw, 0.9rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: none;
  color: #4b624e;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(94, 118, 89, 0.3);
  border-radius: 999px;
  padding: 0.16rem 0.58rem;
}

main {
  width: 100%;
  max-width: var(--map-content-max);
  min-height: clamp(300px, 72dvh, 820px);
  display: grid;
  place-items: center;
}

[id] {
  scroll-margin-top: 0.75rem;
}

.map-wrap {
  display: inline-block;
  width: auto;
  max-width: calc(100vw - (var(--page-pad) * 2));
  max-height: 100%;
  padding: var(--frame-pad);
  border-radius: 14px;
  border: 1px solid rgba(106, 123, 95, 0.18);
  background: linear-gradient(
    180deg,
    rgba(236, 242, 223, 0.55) 0%,
    rgba(224, 232, 208, 0.48) 100%
  );
  line-height: 0;
}

.map-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  overflow: hidden;
}

.map-stage > img {
  width: auto;
  height: auto;
  max-width: min(
    1800px,
    calc(var(--map-content-max) - (var(--frame-pad) * 2) - 2px),
    calc(100vw - (var(--page-pad) * 2) - (var(--frame-pad) * 2) - 2px)
  );
  max-height: var(--map-max-height);
  object-fit: contain;
  border-radius: 10px;
  display: block;
}

.quick-links {
  width: 100%;
  max-width: var(--content-max);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.quick-links button {
  display: inline-block;
  color: #2f4a33;
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.48rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(94, 118, 89, 0.34);
  background: rgba(245, 248, 238, 0.84);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.quick-links button:hover,
.quick-links button:focus-visible {
  background: rgba(245, 248, 238, 1);
  border-color: rgba(74, 100, 70, 0.54);
  outline: none;
}

.quick-links button[aria-pressed="true"] {
  background: rgba(233, 241, 221, 0.98);
  border-color: rgba(72, 99, 66, 0.58);
}

.quick-links button.car-toggle-inline {
  padding: 0.24rem 0.52rem;
  line-height: 0;
}

.quick-links button.car-toggle-inline img {
  display: block;
  width: 34px;
  height: auto;
  border-radius: 0;
  pointer-events: none;
}

.info-sections {
  width: 100%;
  max-width: var(--content-max);
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  align-content: start;
  gap: clamp(0.6rem, 1.4vw, 1rem);
}

.info-sections.visible {
  display: grid;
  margin-bottom: clamp(0.5rem, 1.4vh, 1rem);
}

.info-card {
  display: none;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 0.75rem;
  padding: clamp(0.7rem, 1.3vw, 1rem);
  line-height: 1.45;
}

.info-card.active {
  display: block;
  grid-column: 1 / -1;
  align-self: start;
}

.info-card.info-card--stack {
  background: transparent;
  border: none;
  padding: 0;
}

.info-card h2,
.info-subcard h2 {
  margin: 0 0 0.45rem;
  font-size: clamp(1rem, 1.7vw, 1.2rem);
  letter-spacing: 0.01em;
}

.info-card p,
.info-subcard p {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.info-card-stack {
  display: grid;
  gap: 0.65rem;
}

.info-subcard {
  min-width: 0;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 0.65rem;
  padding: clamp(0.65rem, 1.2vw, 0.95rem);
}

.whatsapp-media-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.7rem, 2vw, 1rem);
  flex-wrap: wrap;
  margin-top: 0.9rem;
  margin-bottom: 0.8rem;
}

.whatsapp-media-row img {
  display: block;
  height: auto;
  border-radius: 0.45rem;
}

.whatsapp-logo {
  width: min(174px, 33vw);
}

.whatsapp-qr {
  width: min(174px, 33vw);
}

.whatsapp-join-text {
  margin-top: 0.9rem;
  margin-bottom: 0;
  text-align: center;
  word-break: break-all;
}

.whatsapp-join-text a {
  color: #2f4a33;
  font-weight: 600;
}

.doc-list,
.calendar-list {
  margin: 0;
  padding-left: 1.1rem;
}

.doc-list li,
.calendar-list li {
  margin: 0.35rem 0;
}

.doc-list a {
  color: #2f4a33;
  font-weight: 600;
}

.doc-list span,
.calendar-list span {
  color: #4e6251;
  font-size: 0.9rem;
}

.calendar-list .calendar-details {
  color: #2f4a33;
  font-size: 0.98rem;
  font-weight: 600;
}

.calendar-list .calendar-details a {
  color: #2f4a33;
  text-decoration-thickness: 1.5px;
}

.board-grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.board-grid th,
.board-grid td {
  text-align: left;
  padding: 0.4rem 0.3rem;
  border-bottom: 1px dashed rgba(94, 118, 89, 0.3);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.board-grid th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #4d644f;
}

.path-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 150ms ease;
}

.path-overlay use {
  fill: none;
  stroke: #27461f;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.92;
}

.map-stage.debug-path-visible .path-overlay {
  opacity: 1;
}

.houses-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  overflow: visible;
}

.house-hotspot {
  fill: rgba(235, 244, 225, 0.01);
  cursor: default;
  outline: none;
}

.house-hotspot:hover,
.house-hotspot:focus-visible {
  fill: rgba(235, 244, 225, 0.01);
}

.house-highlight {
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(241, 239, 212, 0.28));
}

.house-highlight[hidden] {
  display: none;
}

.house-highlight-glow {
  fill: rgba(237, 240, 205, 0.22);
}

.house-highlight-dot {
  fill: rgba(248, 245, 228, 0.82);
}

.car-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
  overflow: visible;
}

.car-sprite {
  filter: drop-shadow(0 2px 1px rgba(41, 57, 44, 0.28));
}

.path-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.car-debug-panel {
  position: fixed;
  right: clamp(0.45rem, 1.2vw, 0.8rem);
  bottom: clamp(0.45rem, 1.2vw, 0.8rem);
  z-index: 20;
  display: none;
  gap: 0.45rem;
  padding: 0.55rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(94, 118, 89, 0.4);
  background: rgba(245, 248, 238, 0.95);
  box-shadow: 0 4px 16px rgba(49, 69, 43, 0.2);
  line-height: 1.2;
}

.car-debug-panel.visible {
  display: grid;
}

.house-tooltip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 18;
  max-width: min(18rem, calc(100vw - 1.5rem));
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(255, 251, 239, 0.7);
  border-radius: 0.8rem;
  background: rgba(53, 69, 47, 0.94);
  box-shadow: 0 10px 28px rgba(34, 44, 30, 0.24);
  color: #f8f5ea;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.3;
  pointer-events: none;
  opacity: 0;
  transform: translate(-9999px, -9999px);
  transition: opacity 140ms ease;
}

.house-tooltip.visible {
  opacity: 1;
}

.car-debug-title {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: center;
}

.car-debug-grid {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 0.45rem;
}

.car-debug-item {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 0.35rem;
  border: 1px dashed rgba(94, 118, 89, 0.35);
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.6);
}

.car-debug-item img {
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
  border-radius: 0;
  display: block;
}

.car-debug-label {
  font-size: 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: #3f5042;
}

@media (max-width: 820px) {
  body {
    gap: 0.6rem;
    padding: clamp(0.45rem, 2.8vw, 0.85rem);
    padding-bottom: calc(clamp(0.45rem, 2.8vw, 0.85rem) + env(safe-area-inset-bottom, 0px));
  }

  h1 {
    font-size: clamp(1.1rem, 5vw, 1.45rem);
    padding: 0.4rem 0.65rem 0.5rem;
  }

  .map-hero {
    width: 100%;
    max-width: 100%;
    min-height: 0;
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .map-wrap {
    width: max-content;
    max-width: none;
  }

  .map-stage {
    max-width: none;
  }

  .map-stage > img {
    width: auto;
    height: clamp(320px, calc(100svh - 190px), 820px);
    max-width: none;
    max-height: none;
  }

  .info-sections {
    grid-template-columns: 1fr;
  }

  .city-tag {
    letter-spacing: 0.08em;
  }

  .whatsapp-logo,
  .whatsapp-qr {
    width: min(152px, 37vw);
  }
}
