:root {
  --ink: #171717;
  --muted: #65605c;
  --paper: #fffdf9;
  --lot: #e9e8e5;
  --lot-edge: #9c9891;
  --street: #7d050a;
  --pending: #f28c28;
  --sold: #c62828;
  --available: #277153;
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --shadow: 0 14px 38px rgba(43, 32, 27, 0.18);
}

*,
*::before,
*::after { box-sizing: border-box; }

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

.page {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: 0.7rem 0.9rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  font-weight: 800;
}

.header-text h1 {
  margin: 0.1rem 0 0;
  color: var(--street);
  font-size: 0.78rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.subtitle {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.legend {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.4rem 0.7rem;
  background: rgba(255, 253, 249, 0.94);
  border: 1px solid rgba(50, 35, 30, 0.12);
  border-radius: 10px;
}

.legend h2 {
  margin: 0;
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.legend ul {
  display: flex;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  white-space: nowrap;
}

.swatch {
  width: 13px;
  height: 13px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 2px;
}

.swatch--lot { background: var(--lot); }
.swatch--cabin { background: #f2d15a; border-color: #b08918; }
.swatch--yourte { background: #d4c4f0; border-color: #6b5b95; }
.swatch--pending { background: var(--pending); }
.swatch--sold { background: var(--sold); }
.swatch--blocked { background: #b8b3ab; }

.plan-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: #f7f5f1;
  border: 1px solid rgba(50, 35, 30, 0.16);
  border-radius: 13px;
  box-shadow: var(--shadow);
}

.plan {
  position: relative;
  width: 1180px;
  height: 690px;
  min-width: 1180px;
  margin: 0 auto;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.83);
}

.plan-title {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  white-space: nowrap;
}

.street {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: var(--street);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  white-space: nowrap;
}

.street--vertical {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.street--access {
  z-index: 4;
  transform: rotate(-7deg);
  transform-origin: 100% 50%;
  clip-path: polygon(0 13%, 100% 0, 100% 100%, 0 87%);
}

.lot-strip {
  position: absolute;
  display: flex;
  align-items: stretch;
  gap: var(--lot-gap, 5px);
  pointer-events: none;
}

.lot-strip--horizontal {
  flex-direction: row;
}

.lot-strip--vertical {
  flex-direction: column;
}

.lot {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--lot-edge);
  border-radius: 0;
  color: var(--ink);
  background: var(--lot);
  background-clip: border-box;
  font-family: var(--font-display);
  font-size: 0;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.12s ease, background 0.12s ease;
}

.lot-strip--horizontal .lot {
  height: 100%;
  width: auto;
}

.lot-strip--vertical .lot {
  width: 100%;
  height: auto;
}

.lot--accent {
  border-color: #8f5557;
  background: #bd7d7e;
}

.lot--cabin {
  border-color: #b08918;
  color: #5c4308;
  background: #f2d15a;
}

.lot--yourte {
  border-color: #6b5b95;
  color: #3d2f5c;
  background: #d4c4f0;
}

.lot--cabin .lot-icon,
.lot--yourte .lot-icon {
  font-size: 0.72rem;
  line-height: 1;
}

.lot--cabin .lot-new,
.lot--yourte .lot-new {
  font-size: 0.72rem;
}

@keyframes lot-border-blink {
  0%,
  100% {
    box-shadow: 0 0 0 0 transparent;
    outline: 2px solid transparent;
    outline-offset: 1px;
  }
  50% {
    box-shadow: 0 0 0 3px rgba(125, 29, 27, 0.45);
    outline: 3px solid #7d1d1b;
    outline-offset: 2px;
  }
}

.lot.lot--blink {
  z-index: 30;
  animation: lot-border-blink 0.55s ease-in-out 3;
}

.lot:hover,
.lot:focus-visible {
  z-index: 20;
  outline: none;
  transform: scale(1.13);
  box-shadow: 0 5px 12px rgba(60, 40, 20, 0.25);
}

.lot.pending {
  border-color: #9d6a00;
  background: var(--pending);
}

.lot.sold {
  border-color: #7e1111;
  color: #fff;
  background: var(--sold);
}

.lot.sold .lot-old { color: rgba(255, 255, 255, 0.75); }

.lot.blocked {
  border-color: #8a847c;
  color: #5c574f;
  background: #cfc9c0;
  opacity: 0.72;
}

.lot.blocked:hover,
.lot.blocked:focus-visible {
  transform: none;
  box-shadow: none;
}

.lot-new {
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.lot-old {
  color: #655f58;
  font-size: 0.52rem;
  font-weight: 600;
  line-height: 1;
}

.lot-divider {
  width: 70%;
  height: 1px;
  background: currentColor;
  opacity: 0.28;
  flex: 0 0 auto;
}

.lot--horizontal {
  flex-direction: row;
  gap: 3px;
  padding: 0 3px;
}

.lot--horizontal .lot-divider {
  width: 1px;
  height: 65%;
}

.parking,
.ice-zone,
.landmark { position: absolute; }

.parking {
  z-index: 2;
  display: grid;
  place-items: center;
  color: #fff;
  background: #bd7d7e;
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
}

.parking--access {
  z-index: 3;
  transform: rotate(-7deg);
  transform-origin: 100% 50%;
  font-size: 3.1rem;
}

.ice-zone {
  border-radius: 30px;
  background: #d4d4d4;
}

.landmark {
  z-index: 8;
  display: grid;
  place-items: center;
  border: 1px solid #bbb;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.landmark--accueil {
  border-color: #b08918;
  background: #fff6d8;
  color: #5c4308;
}

.landmark--toilets {
  border-color: #6b8cae;
  background: #eef5fb;
  font-size: 0.95rem;
  line-height: 1;
}

.overlay {
  position: fixed;
  z-index: 40;
  inset: 0;
  background: rgba(20, 16, 12, 0.46);
  backdrop-filter: blur(2px);
}

.popup {
  position: fixed;
  z-index: 50;
  top: 50%;
  left: 50%;
  width: min(380px, calc(100vw - 2rem));
  padding: 1.35rem 1.4rem 1.2rem;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(50, 35, 30, 0.12);
  border-radius: 15px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.popup-close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 1.4rem;
  cursor: pointer;
}

.popup-rue {
  margin: 0;
  color: var(--street);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.popup h2 {
  margin: 0.35rem 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
}

.popup-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.popup-status {
  margin: 0.8rem 0 0;
  padding: 0.5rem 0.65rem;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 600;
}

.popup-status--available { color: #16543b; background: #dcefe6; }
.popup-status--pending { color: #684600; background: #fff0bd; }
.popup-status--sold { color: #7e1111; background: #ffd9d9; }

.popup-price {
  margin: 0.8rem 0 1rem;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
}

.popup-actions { display: flex; gap: 0.55rem; }

.btn {
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: 9px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  flex: 1;
  color: #fff;
  background: var(--available);
}

.btn-ghost { color: var(--muted); background: transparent; }

.toast {
  position: fixed;
  z-index: 60;
  bottom: 1.1rem;
  left: 50%;
  padding: 0.7rem 1.1rem;
  transform: translateX(-50%);
  border-radius: 999px;
  color: #fff;
  background: #17221e;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
}

[hidden] { display: none !important; }

@media (max-width: 760px) {
  .page { padding: 0.55rem; }
  .header { align-items: flex-start; flex-direction: column; }
  .subtitle { display: none; }
  .legend { width: 100%; justify-content: space-between; }
  .legend ul { gap: 0.45rem; }
}
