:root {
  --ink: #17231f;
  --muted: #68736f;
  --line: #dfe5e2;
  --panel: #ffffff;
  --soft: #f5f7f6;
  --accent: #0a6b4f;
  --accent-dark: #07533e;
  --available: #087f5b;
  --unavailable: #a96f6f;
  --unknown: #69736f;
  --not-yet: #8b9490;
  --shadow: 0 10px 30px rgba(22, 38, 32, 0.10);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: #eef2f0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand-block { display: flex; align-items: center; gap: 12px; }

/* v72: approved filled cabin polygon */
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
}
.brand-cabin-svg {
  width: 38px;
  height: 38px;
  display: block;
  overflow: visible;
}
.brand-cabin-svg .brand-cabin-shape {
  fill: currentColor;
}
.brand-cabin-svg .brand-cabin-door {
  fill: var(--accent);
}
.legend-cabin-svg {
  width: 17px;
  height: 16px;
  display: block;
  overflow: visible;
  flex: 0 0 auto;
}
.legend-cabin-svg path {
  fill: currentColor;
}
.legend-cabin-svg.available { color: var(--available); opacity: 1; }
.legend-cabin-svg.unavailable { color: var(--unavailable); opacity: .72; }
.legend-cabin-svg.not-yet { color: var(--not-yet); opacity: .88; }
.legend-cabin-svg.unknown { color: #8d9692; }
.legend-cabin-svg.unknown path { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linejoin: round; }

.cabin-marker-wrapper { background: transparent !important; border: 0 !important; }
.map-cabin-icon {
  width: 28px;
  height: 28px;
  display: block;
  overflow: visible;
  color: var(--unknown);
  filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.28));
}
.map-cabin-icon.filled .cabin-polygon {
  fill: currentColor;
  stroke: none;
}
.map-cabin-icon.hollow .cabin-polygon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.map-cabin-icon.available { color: var(--available); opacity: 1; }
.map-cabin-icon.unavailable { color: var(--unavailable); opacity: .72; }
.map-cabin-icon.not-yet { color: var(--not-yet); opacity: .88; }
.map-cabin-icon.unknown,
.map-cabin-icon.loading {
  color: #8d9692;
  opacity: .95;
}

.brand { font-weight: 800; letter-spacing: -0.02em; font-size: 23px; }
.tagline { color: var(--muted); font-size: 14px; margin-top: 2px; }
.prototype-pill {
  background: #edf7f3; color: var(--accent-dark); border: 1px solid #cfe8de;
  border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 700;
}

main { height: calc(100vh - 72px); display: flex; flex-direction: column; min-height: 0; }

.initial-load-status {
  position: fixed;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px));
  z-index: 1800;
  pointer-events: none;
  transition: opacity .24s ease, transform .24s ease;
}
.initial-load-status.hidden {
  display: block !important;
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
  pointer-events: none;
}
.initial-load-card {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #cfe8de;
  border-radius: 16px;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.initial-load-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #d5e9e1;
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: initial-load-spin .8s linear infinite;
}
.initial-load-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.initial-load-copy strong {
  font-size: 13px;
  line-height: 1.2;
}
.initial-load-copy span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}
.initial-load-progress {
  height: 6px;
  margin-top: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: #e5eeea;
}
.initial-load-progress-bar {
  height: 100%;
  width: 8%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .28s ease;
}
@keyframes initial-load-spin { to { transform: rotate(360deg); } }

.search-panel {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) repeat(2, minmax(150px, .8fr)) minmax(300px, 1.25fr) auto;
  gap: 10px;
  align-items: end;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 11px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.field > span small { font-size: 9px; font-weight: 650; text-transform: none; letter-spacing: 0; }
.field input, .field select {
  width: 100%; height: 43px; border: 1px solid #cfd7d3; border-radius: 9px;
  padding: 0 11px; background: #fff; color: var(--ink); outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10,107,79,.10); }
.access-options {
  min-height: 43px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.access-option { position: relative; display: inline-flex; cursor: pointer; }
.access-option input { position: absolute; opacity: 0; pointer-events: none; }
.access-option span {
  display: inline-flex; align-items: center; justify-content: center; height: 35px;
  padding: 0 10px; border: 1px solid #cfd7d3; border-radius: 999px;
  background: #fff; color: #4d5a55; font-size: 12px; font-weight: 700;
  transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
}
.access-option:hover span { border-color: #aebbb5; background: #f8faf9; }
.access-option input:focus-visible + span { box-shadow: 0 0 0 3px rgba(10,107,79,.12); border-color: var(--accent); }
.access-option input:checked + span { background: #e7f6f0; border-color: #8fc9b7; color: var(--accent-dark); }
.primary-button, .book-button {
  border: 0; border-radius: 9px; background: var(--accent); color: white;
  font-weight: 750; text-decoration: none; cursor: pointer;
}
.primary-button { height: 43px; padding: 0 17px; }
.primary-button:hover, .book-button:hover { background: var(--accent-dark); }
.primary-button:disabled { background: #b8c2bd; color: #eef3f1; cursor: not-allowed; }
.primary-button:disabled:hover { background: #b8c2bd; }


.book-button.availability-calendar-button {
  background: #fff;
  color: var(--accent-dark);
  border: 2px solid #9eb7ae;
  box-shadow: none;
}
.book-button.availability-calendar-button:hover {
  background: #f4f8f6;
  border-color: var(--accent);
  color: var(--accent-dark);
}

.book-button.disabled,
.book-button.disabled:hover {
  background: #c9cfcc;
  color: #66706c;
  cursor: not-allowed;
  pointer-events: none;
}
.secondary-button {
  border: 1px solid #ccd5d1; border-radius: 8px; background: white; color: var(--ink);
  cursor: pointer; font-weight: 650;
}
.secondary-button:hover { border-color: #aebbb5; background: #f8faf9; }

.toolbar {
  min-height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px; background: #fff; border-bottom: 1px solid var(--line); gap: 20px;
}
.muted { color: var(--muted); margin-left: 8px; font-size: 13px; }
.toolbar-actions { display: flex; gap: 12px; align-items: center; }
.toggle-label { display: flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; }
.toolbar .secondary-button { padding: 7px 10px; font-size: 12px; }

.split-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(470px, 47%) 1fr; }
.results-pane { overflow-y: auto; padding: 16px; background: var(--soft); }
.results-list { display: grid; gap: 13px; max-width: 760px; margin: 0 auto; }
.cabin-card {
  display: grid; grid-template-columns: 190px 1fr; min-height: 188px;
  background: white; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(22,38,32,.04);
}
.cabin-media { position: relative; min-width: 0; min-height: 188px; overflow: hidden; background: #d7dfdb; }
/* Photos fill the card without their natural aspect ratio stretching its height. */
.cabin-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: #d7dfdb; }
.cabin-content { padding: 15px 16px 13px; min-width: 0; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.area-chip { font-size: 11px; font-weight: 700; color: #5d6863; }
.availability-badge { border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.availability-badge.available { background: #e7f6f0; color: var(--available); }
.availability-badge.unavailable { background: #f2e8e8; color: #986262; }
.availability-badge.not-yet { background: #ecefed; color: #69736f; }
.availability-badge.unknown, .availability-badge.loading { background: #edf0ef; color: var(--unknown); }
.cabin-name { margin: 7px 0 6px; font-size: 20px; letter-spacing: -.025em; }
.cabin-meta { color: var(--muted); font-size: 13px; min-height: 20px; }
.availability-detail { margin-top: 8px; font-size: 13px; font-weight: 650; }
.availability-detail.available { color: var(--available); }
.availability-detail.unavailable { color: var(--unavailable); }
.availability-detail.not-yet { color: #69736f; }
.availability-detail.loading, .availability-detail.unknown { color: var(--unknown); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.card-actions .secondary-button { padding: 8px 11px; font-size: 12px; }
.book-button { display: inline-flex; align-items: center; padding: 8px 11px; font-size: 12px; }
.checked-time { margin-top: 8px; color: #8a9490; font-size: 10px; }
.status-message .checked-time { margin-top: 4px; color: inherit; opacity: 0.78; font-size: 11px; }
.status-message { max-width: 760px; margin: 0 auto 12px; padding: 11px 13px; border-radius: 9px; background: #fff7df; border: 1px solid #efdea7; color: #6d5a1e; font-size: 13px; }
.hidden { display: none !important; }
.empty-state { padding: 45px 20px; text-align: center; color: var(--muted); }

.map-pane { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #dce7e2; }
.map-search-button {
  position: absolute; z-index: 600; top: 14px; left: 50%; transform: translateX(-50%);
  border: 1px solid #c7d0cc; border-radius: 999px; padding: 9px 15px; background: white;
  box-shadow: var(--shadow); cursor: pointer; font-weight: 750; color: var(--ink);
}
.map-search-button.ready { background: var(--accent); border-color: var(--accent); color: white; }
.map-search-button.ready:hover { background: var(--accent-dark); }
.map-legend {
  position: absolute; z-index: 500; bottom: 18px; right: 18px;
  display: flex; gap: 12px; align-items: center; padding: 8px 10px;
  background: rgba(255,255,255,.94); border: 1px solid #d7dfdb; border-radius: 8px;
  box-shadow: 0 3px 10px rgba(0,0,0,.08); font-size: 11px;
}
.map-legend span { display: inline-flex; align-items: center; gap: 4px; }

.cabin-marker-wrapper { background: transparent !important; border: 0 !important; }
.leaflet-div-icon { background: transparent; border: 0; }
.leaflet-popup-content-wrapper { border-radius: 10px; }
.leaflet-popup-content { margin: 11px 13px; font-size: 12px; }
.popup-name { font-weight: 800; font-size: 13px; margin-bottom: 4px; }

@media (max-width: 980px) {
  .search-panel { grid-template-columns: 1fr 1fr; }
  .search-panel .primary-button { grid-column: span 2; }
  .split-layout { grid-template-columns: 1fr; grid-template-rows: 48% 52%; }
  .results-pane { order: 2; }
  .map-pane { order: 1; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 14px; height: 64px; }
  main { height: calc(100vh - 64px); }
  .prototype-pill { display: none; }
  .search-panel { padding: 10px; gap: 8px; }
  .toolbar { padding: 8px 10px; align-items: flex-start; }
  .toolbar-actions { flex-direction: column; align-items: flex-end; gap: 7px; }
  .split-layout { display: block; overflow-y: auto; }
  .map-pane { height: 45vh; position: relative; }
  #map { position: absolute; }
  .results-pane { overflow: visible; }
  .cabin-card { grid-template-columns: 118px 1fr; min-height: 174px; }
  .cabin-name { font-size: 17px; }
  .card-actions { gap: 6px; }
  .map-legend { display: none; }
}


/* v10: map fully restored to the original v2 treatment. */
.popup-status { margin-top: 4px; font-weight: 700; }
.secondary-button:disabled { opacity: .55; cursor: default; }
.cabin-media { position: relative; }
.cabin-image.hidden { display: none; }
.cabin-image.hidden + .image-placeholder { display: flex; }
.image-placeholder {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  color: #62716a;
  text-align: center;
  font-size: 11px;
  font-weight: 650;
  background: linear-gradient(145deg, #e4ece8, #ccd9d3);
}
.image-placeholder svg { width: 54px; height: 54px; fill: none; stroke: #65776e; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }


/* v12: explicit, always-reliable cabin detail drawer */
.cabin-card { cursor: pointer; }
.cabin-card:focus-visible { outline: 3px solid rgba(10,107,79,.25); outline-offset: 2px; }
.detail-open { overflow: hidden; }
.detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(18, 29, 25, .42);
  justify-content: flex-end;
  align-items: stretch;
}
.detail-overlay.open { display: flex; }
.detail-panel {
  width: min(500px, 94vw);
  height: 100%;
  overflow-y: auto;
  background: #fff;
  position: relative;
  box-shadow: -18px 0 50px rgba(0,0,0,.20);
}
.detail-close {
  position: absolute;
  z-index: 5;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.95);
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 9px rgba(0,0,0,.14);
}
.detail-media { height: 260px; background: #d7dfdb; overflow: hidden; }
.detail-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-content { padding: 22px 24px 30px; }
.detail-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.detail-area { font-size: 11px; font-weight: 750; color: var(--muted); margin-bottom: 5px; }
.detail-topline h2 { margin: 0; font-size: 27px; letter-spacing: -.03em; }
.detail-availability { margin-top: 10px; font-size: 13px; font-weight: 700; }
.detail-availability.available { color: var(--available); }
.detail-availability.unavailable { color: var(--unavailable); }
.detail-availability.not-yet { color: #69736f; }
.detail-availability.loading, .detail-availability.unknown { color: var(--unknown); }
.detail-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}
.detail-fact { background: #fff; min-height: 70px; padding: 12px 13px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.detail-fact span { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.detail-fact strong { font-size: 13px; }
.detail-top-actions { margin-top: 12px; }
.detail-topline > div:first-child { min-width: 0; flex: 1; }
.detail-topline-right { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; flex-shrink: 0; }
.detail-external-link {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9f8;
  color: #53645c;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  text-decoration: none;
}
.detail-external-link:hover, .detail-external-link:focus-visible {
  background: #edf3ef;
  color: var(--ink);
  text-decoration: underline;
}
.detail-top-actions .book-button { padding: 10px 13px; font-size: 13px; }
.detail-actions { margin-top: 22px; }
.detail-actions .book-button { padding: 11px 14px; font-size: 13px; }
@media (max-width: 640px) {
  .detail-panel { width: 100%; }
  .detail-media { height: 220px; }
  .detail-content { padding: 18px 16px 26px; }
  .detail-topline { flex-wrap: wrap; }
  .detail-topline-right { margin-left: auto; }
}


/* v14: detail gallery + working availability calendar */
.detail-media { position: relative; cursor: pointer; }
.photo-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 38px;
  height: 46px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.92);
  color: #173028;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.photo-prev { left: 12px; }
.photo-next { right: 12px; }
.photo-nav:disabled { display: none; }
.photo-count {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 4;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(20,31,27,.72);
  color: white;
  font-size: 11px;
  font-weight: 750;
}
.detail-section { margin-top: 22px; }
.detail-section h3 { margin: 0 0 9px; font-size: 16px; letter-spacing: -.01em; }
.detail-description { margin: 0; color: #53615b; font-size: 13px; line-height: 1.55; }
.calendar-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.calendar-heading h3 { margin-bottom: 0; }
.calendar-heading strong { font-size: 12px; color: #5f6b66; }
.calendar-month-nav { display: inline-flex; align-items: center; gap: 7px; }
.calendar-month-nav strong { min-width: 112px; text-align: center; }
.calendar-nav-button {
  width: 30px;
  height: 30px;
  border: 1px solid #d7dfdb;
  border-radius: 999px;
  background: #fff;
  color: #1a3129;
  display: inline-grid;
  place-items: center;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 2px;
}
.calendar-nav-button:hover { background: #f3f6f4; }
.calendar-nav-button:focus-visible { outline: 2px solid #1a3129; outline-offset: 2px; }
.calendar-nav-button:disabled { opacity: .45; cursor: wait; }

.calendar-legend { display: flex; flex-wrap: wrap; gap: 10px 13px; margin: 11px 0; color: #64716c; font-size: 10px; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.calendar-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; border: 1px solid transparent; }
.calendar-key.available { background: #dff3e9; border-color: #8fcdb2; }
.calendar-key.unavailable { background: #f0e7e7; border-color: #c9a8a8; }
.calendar-key.not-yet { background: #e5e8e6; border-color: #bac2be; }
.calendar-weekdays, .availability-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.calendar-weekdays { margin-bottom: 5px; }
.calendar-weekdays span { text-align: center; color: #8a9490; font-size: 9px; font-weight: 750; text-transform: uppercase; }
.calendar-day {
  min-height: 52px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 5px;
  padding: 6px 7px;
  border: 1px solid #e3e8e5;
  background: #f7f9f8;
  color: #4f5b56;
  font-size: 11px;
  font-weight: 750;
  position: relative;
  overflow: hidden;
}
.calendar-day.empty { visibility: hidden; }
.calendar-day.available { background: #e6f5ee; border-color: #b8dfcd; color: #126f53; }
.calendar-day.unavailable { background: #f2eaea; border-color: #dbc6c6; color: #8d6666; }
.calendar-day.not-yet { background: #e8ebe9; border-color: #cbd1ce; color: #626c67; }
.calendar-day.unknown { background: #f6f7f6; color: #a0a8a4; }
.calendar-day.selected { box-shadow: inset 0 0 0 2px #1a3129; }
.calendar-day-number { font-size: 11px; line-height: 1; }
.calendar-release { align-self: stretch; text-align: left; font-size: 8px; line-height: 1.1; font-weight: 700; color: #757f7a; }
.calendar-note { margin-top: 8px; color: #87918d; font-size: 10px; line-height: 1.45; }
@media (max-width: 640px) {
  .calendar-day { min-height: 46px; padding: 5px; gap: 4px; }
  .calendar-release { font-size: 7px; }
  .photo-nav { width: 36px; height: 42px; }
}


/* v16: selectable detail calendar */
.calendar-day:not(.empty):not(:disabled) { cursor: pointer; }
.calendar-day:not(.empty):not(:disabled):hover { filter: brightness(.97); border-color: #8f9c96; }
.calendar-day:focus-visible { outline: 2px solid #1a3129; outline-offset: 2px; }
.calendar-day.past { opacity: .42; cursor: default; }
.calendar-day.current-search { box-shadow: inset 0 0 0 1.75px #9ca7a2; }
.calendar-day.selected { box-shadow: inset 0 0 0 2px #1a3129; }
.calendar-day.range-start,
.calendar-day.range-end { box-shadow: inset 0 0 0 3px #1a3129; }
.calendar-release { white-space: nowrap; }
.calendar-missing { font-size: 9px; line-height: 1.05; text-align: left; color: #65716b; }
.calendar-selection-bar {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e4e9e6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.calendar-selection-text { color: #5f6b66; font-size: 11px; line-height: 1.35; font-weight: 650; }


/* v25: Recreation.gov handoff feedback */
.booking-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 5000;
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: 10px;
  background: #173028;
  color: #fff;
  box-shadow: 0 8px 26px rgba(0,0,0,.22);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}


/* v27: reliable Recreation.gov handoff */
.booking-handoff-note {
  margin-top: 7px;
  color: #66736d;
  font-size: 10.5px;
  line-height: 1.35;
}
.detail-top-actions .booking-handoff-note {
  max-width: 330px;
  margin-top: 7px;
  font-size: 11px;
}

/* v28: repeat booking handoff guidance below the bottom popup button */
.detail-actions .booking-handoff-note {
  max-width: 360px;
  margin-top: 8px;
  font-size: 11px;
}

/* v33: preserve lower booking-note height in all unavailable calendar states */
.booking-handoff-note.layout-placeholder {
  visibility: hidden;
  pointer-events: none;
}

/* v34: emphasize the manual Recreation.gov date-entry instruction */
.booking-handoff-note strong {
  font-weight: 800;
}


/* v42: intuitive two-click main-search range calendar with editable date inputs */
.field input[type="date"] { cursor: text; }
.field input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  pointer-events: none;
}
.main-date-popover {
  position: fixed;
  z-index: 2600;
  width: 390px;
  max-width: calc(100vw - 24px);
  padding: 14px;
  border: 1px solid #d7dfdb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(22, 38, 32, .18);
}
.main-date-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.main-date-popover-header > strong {
  font-size: 14px;
  letter-spacing: -.01em;
}
.main-date-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: #f2f5f3;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.main-date-close:hover { background: #e8edea; }
.main-date-calendar-heading {
  align-items: center;
  margin-bottom: 10px;
}
.main-date-calendar-heading .calendar-month-nav { margin-left: auto; }
.main-date-calendar .main-date-day {
  min-height: 48px;
  align-items: flex-end;
  justify-content: flex-start;
  background: #fff;
  border-color: #e0e6e3;
  color: #35423d;
}
.main-date-calendar .main-date-day:hover:not(:disabled) {
  background: #fffaf0;
  border-color: #dcc46f;
}
.main-date-calendar .main-date-day.in-range {
  background: #fff8dc;
  border-color: #ead89b;
}
.main-date-calendar .main-date-day.selected,
.main-date-calendar .main-date-day.range-start,
.main-date-calendar .main-date-day.range-end {
  background: #fff1a8;
  border-color: #d7b63f;
  color: #5c4a00;
  box-shadow: inset 0 0 0 2px #9b7b12;
}
.main-date-calendar .main-date-day.past {
  background: #f3f5f4;
  border-color: #e4e8e6;
  color: #a0a8a4;
  opacity: .72;
}
@media (max-width: 640px) {
  .main-date-popover { padding: 12px; }
  .main-date-calendar .main-date-day { min-height: 44px; padding: 5px; }
}
.main-date-popover {
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}


/* v69: booking handoff modal */
.booking-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 4200;
  background: rgba(18, 29, 25, .46);
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.booking-modal.open { display: flex; }
.booking-modal-card {
  width: min(430px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
}
.booking-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #f2f5f3;
  color: var(--ink);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.booking-modal-eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.booking-modal-card h2 {
  margin: 0 34px 10px 0;
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: -.03em;
}
.booking-modal-dates {
  margin: 0 0 10px;
  font-weight: 750;
  color: var(--available);
}
.booking-modal-instructions {
  margin: 0;
  color: #4f5d57;
  line-height: 1.45;
}
.booking-modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.booking-modal-actions .secondary-button,
.booking-modal-actions .book-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
}
body.booking-modal-open { overflow: hidden; }

/* v69: booking date note is now plain text, not a bold instruction block */
.booking-handoff-note strong { font-weight: inherit; }

/* v70: cleaner booking handoff copy */
.booking-modal-instructions strong {
  font-weight: 850;
}
.booking-modal-dates {
  margin-top: 12px;
}


/* Attribution for cabin-specific archival photos supplied by BLM Alaska. */


/* v23: choose an area OR one specific cabin before choosing dates. */
.location-choice-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 15px;
}
.location-choice-row > .field-location { width: 100%; }
.location-choice-or {
  color: var(--muted); font-size: 12px; font-weight: 700;
  text-align: center; padding-bottom: 13px; text-transform: uppercase;
}
.field-cabin-search { position: relative; z-index: 1400; }

.search-field-label {
  font-size: 11px; font-weight: 750; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.cabin-search-control { position: relative; }
.field .cabin-search-control input {
  height: 43px; width: 100%; padding: 0 48px 0 41px;
  -webkit-appearance: none; appearance: none;
}
.cabin-search-control input::-webkit-search-cancel-button { display: none; }
.cabin-search-icon {
  position: absolute; width: 18px; height: 18px; left: 14px; top: 12px;
  color: #76857d; pointer-events: none;
}
.cabin-search-clear {
  position: absolute; right: 7px; top: 5px; height: 33px; width: 34px;
  border: 0; background: transparent; color: #65736d;
  font-size: 25px; line-height: 1; cursor: pointer; border-radius: 8px;
}
.cabin-search-clear:hover, .cabin-search-clear:focus-visible { background: #eef4f0; color: var(--accent-dark); }
.cabin-search-suggestions {
  list-style: none; margin: 0; padding: 5px; position: absolute;
  top: calc(100% + 5px); left: 0; right: 0; z-index: 1500;
  max-height: min(338px, 45vh); overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border: 1px solid #cfdad3; border-radius: 11px;
  box-shadow: 0 14px 34px rgba(19, 47, 36, .16);
}
.cabin-search-option {
  display: flex; align-items: center; gap: 12px; min-height: 48px;
  padding: 8px 11px; border-radius: 7px; cursor: pointer;
}
.cabin-search-option.active, .cabin-search-option:hover { background: #eaf5ef; }
.cabin-search-option .cabin-search-result-text { display: flex; flex-direction: column; min-width: 0; }
.cabin-search-option strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cabin-search-option svg.cabin-search-result-icon {
  width: 23px; height: 23px; flex-shrink: 0; color: var(--available);
  fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round;
}
@media (max-width: 640px) {
  .location-choice-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .location-choice-or { padding: 0; }
}

.cabin-search-no-results { padding: 12px; color: var(--muted); font-size: 13px; }

 .date-search-row { grid-column: span 3; display: grid; grid-template-columns: minmax(120px, .65fr) repeat(2, minmax(130px, 1fr)); gap: 10px; align-items: end; min-width: 0; }
.date-search-row:has(#stayNightsField:not(.hidden)) { grid-template-columns: minmax(120px, .65fr) 105px repeat(2, minmax(130px, 1fr)); }
.flexible-dates-hint { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.matching-stays { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.matching-stays button { border: 1px solid #b5d9ca; border-radius: 7px; background: #edf7f2; color: var(--accent-dark); padding: 7px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.matching-stays button:hover, .matching-stays button:focus-visible { background: #d7eee3; }
.matching-stays button[aria-pressed="true"] { border: 2px solid var(--accent); }
.detail-matching-stays { margin: 18px 0; }
.detail-matching-stays strong { display: block; }
@media (max-width: 980px) {
  .date-search-row { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .date-search-row:has(#stayNightsField:not(.hidden)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #stayNightsField { width: auto; }
}
@media (max-width: 640px) { .date-search-row { gap: 8px; } }

.stay-nights-control { position: relative; }
.stay-nights-control #stayNights { padding-right: 57px; appearance: textfield; }
.stay-nights-control #stayNights::-webkit-inner-spin-button,
.stay-nights-control #stayNights::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stay-nights-unit { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .04em; pointer-events: none; }

/* Errors share one accessible popup and shake the initiating control. */
.error-modal { z-index: 4500; }
body.error-modal-open { overflow: hidden; }
.error-shake { animation: error-shake .45s ease-in-out; }
@keyframes error-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
@media (prefers-reduced-motion: reduce) {
  .error-shake { animation: none; }
}

/* Small feedback and support controls in the header. */
.header-right { display: flex; align-items: center; gap: 14px; }
.header-actions { display: flex; align-items: center; gap: 7px; }
.header-action {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 6px 11px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--accent-dark);
  font: inherit; font-size: 12px; font-weight: 700; text-decoration: none;
  cursor: pointer; white-space: nowrap;
}
.header-action:hover:not(:disabled) { background: #edf7f3; border-color: var(--accent-dark); }
.header-action:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 3px; }
.header-action:disabled { color: var(--muted); cursor: default; }
@media (max-width: 980px) { .header-right .prototype-pill { display: none; } }
@media (max-width: 640px) {
  .topbar { gap: 8px; }
  .header-right { flex-shrink: 0; }
  .header-actions { flex-direction: column; gap: 3px; }
  .header-action { min-height: 26px; padding: 3px 8px; font-size: 11px; }
  .brand-block { gap: 8px; min-width: 0; }
  .brand { font-size: 20px; }
  .tagline { font-size: 12px; }
}

.calendar-day.non-reservable { background: #e8ebe9; border-color: #cbd1ce; color: #626c67; }

/* Ko-fi is loaded only when the visitor opens the donation dialog. */
.donation-modal {
  width: min(480px, calc(100vw - 28px));
  height: min(760px, calc(100dvh - 28px));
  max-height: calc(100dvh - 28px); max-width: calc(100vw - 28px);
  padding: 0; border: 0; border-radius: 18px; background: #fff;
  color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.22);
}
.donation-modal[open] { display: flex; flex-direction: column; }
.donation-modal::backdrop { background: rgba(18,29,25,.46); }
.donation-modal-header { position: relative; padding: 20px 24px 10px; flex-shrink: 0; }
.donation-modal-header h2 { margin: 0 32px 8px 0; font-size: 22px; line-height: 1.2; }
.donation-modal-header p { margin: 0; color: var(--muted); font-size: 14px; }
.donation-frame { width: 100%; flex: 1; min-height: 0; border: 0; }
.donation-loading { margin: 0; padding: 8px 24px; color: var(--muted); font-size: 13px; }
.donation-modal-footer { flex-shrink: 0; padding: 10px 24px 16px; text-align: center; }
.donation-modal-footer a { color: var(--accent-dark); font-size: 12px; }
body.donation-modal-open { overflow: hidden; }

/* Support note stays directly below the header's Donate control. */
:root { --site-header-height: 88px; }
.topbar { height: var(--site-header-height); }
main { height: calc(100vh - var(--site-header-height)); }
.header-actions { flex-wrap: wrap; flex-direction: row; justify-content: flex-end; max-width: 330px; }
.header-support-note { flex-basis: 100%; margin: 0; font-size: 11px; line-height: 1.35; color: var(--muted); text-align: right; }
.booking-support { display: flex; align-items: center; gap: 14px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.booking-support .header-action { flex-shrink: 0; }
.booking-support p { flex: 1; margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.booking-modal-card { max-height: calc(100dvh - 36px); overflow-y: auto; }
@media (max-width: 1100px) { .header-right .prototype-pill { display: none; } }
@media (max-width: 760px) {
  :root { --site-header-height: 124px; }
  .topbar { flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; }
  .header-right { width: 100%; justify-content: flex-end; }
  .header-actions { max-width: none; width: 100%; gap: 5px 7px; }
}

.initial-load-status { top: calc(var(--site-header-height) + 14px); }

@media (max-width: 640px) {
  .brand-mark { width: 48px; height: 48px; flex-shrink: 0; }
  .brand-cabin-svg { width: 35px; height: 35px; }
}

.access-help { color: var(--muted); font-size: 10px; line-height: 1.3; }

#donateButton, #bookingModalDonate { background: var(--accent); border-color: var(--accent); color: #fff; }
#donateButton:hover:not(:disabled), #bookingModalDonate:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }

/* v91: phone layout uses document scrolling and one cabin view at a time. */
.mobile-view-switch, .mobile-date-display, .mobile-search-or { display: none; }
@media (max-width: 760px) {
  html, body { height: auto; min-height: 100%; }
  body { overflow-x: clip; }
  main { height: auto; min-height: 0; }
  .topbar { height: auto; padding: 12px 14px; gap: 9px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-cabin-svg { width: 29px; height: 29px; }
  .brand { font-size: 20px; line-height: 1.15; }
  .tagline { font-size: 12px; margin-top: 3px; }
  .header-actions { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; align-items: center; }
  .header-action { min-height: 44px; padding: 8px 10px; font-size: 13px; }
  .header-support-note { grid-column: 1; grid-row: 1; text-align: left; font-size: 11px; }
  #feedbackButton { grid-column: 2; grid-row: 1; }
  #donateButton { grid-column: 3; grid-row: 1; }
  .search-panel { grid-template-columns: minmax(0, 1fr); padding: 12px; gap: 12px; }
  .location-choice-row { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .location-choice-or { display: none; }
  .mobile-search-or { display: inline; }
  .field > span, .search-field-label { font-size: 11px; }
  .field input, .field select, .cabin-search-control input { font-size: 16px; height: 46px; min-width: 0; max-width: 100%; }
  .field input[type="date"] { display: none; }
  .mobile-date-display { display: flex; align-items: center; justify-content: center; width: 100%; min-width: 0; height: 46px; padding: 0 6px; border: 1px solid #cbd5d0; border-radius: 10px; background: #fff; color: var(--ink); font-size: 16px; white-space: nowrap; cursor: pointer; }
  .mobile-date-display:focus-visible { outline: 3px solid #8fc9b7; outline-offset: 2px; }
  .date-search-row, .date-search-row:has(#stayNightsField:not(.hidden)) { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .date-search-row > .field:first-child { grid-column: 1 / -1; }
  .date-search-row:has(#stayNightsField:not(.hidden)) > .field:first-child { grid-column: auto; }
  .stay-nights-control { height: 46px; }
  .field-access { grid-column: 1 / -1; }
  .access-options { gap: 6px; }
  .access-option span { height: 44px; font-size: 14px; padding: 0 11px; }
  .access-help { font-size: 11px; }
  .search-panel .primary-button { grid-column: 1 / -1; height: 48px; font-size: 16px; }
  .cabin-search-clear { width: 44px; height: 44px; top: 1px; right: 1px; }
  .mobile-view-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; position: sticky; top: 0; z-index: 1200; padding: 8px 12px; background: #fff; border-block: 1px solid var(--line); scroll-margin-top: 0; }
  .mobile-view-switch button { min-height: 44px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--accent-dark); font: inherit; font-weight: 750; }
  .mobile-view-switch button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
  .mobile-view-switch button:focus-visible { outline: 3px solid #8fc9b7; outline-offset: 2px; }
  .toolbar { flex-wrap: wrap; gap: 10px; padding: 12px; min-height: 0; }
  .toolbar > div:first-child { flex-basis: 100%; }
  #dateSummary { display: block; margin: 3px 0 0; font-size: 12px; }
  .toolbar-actions { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; gap: 8px; }
  .toggle-label { min-height: 44px; font-size: 13px; }
  .toggle-label input { width: 20px; height: 20px; }
  .secondary-button, .book-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .split-layout { display: block; overflow: visible; flex: none; }
  .results-pane { overflow: visible; padding: 12px; }
  .map-pane { height: 60svh; min-height: 300px; max-height: 540px; position: relative; }
  body[data-mobile-view="list"] .map-pane, body[data-mobile-view="map"] .results-pane { display: none; }
  .map-search-button { max-width: calc(100% - 24px); min-height: 44px; font-size: 13px; white-space: normal; }
  .map-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 10px; left: 10px; right: 10px; bottom: 10px; padding: 7px; font-size: 10px; }
  .map-legend span { white-space: nowrap; }
  .cabin-card { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .cabin-media { height: 180px; min-height: 0; }
  .cabin-content { padding: 14px; }
  .cabin-name { font-size: 22px; }
  .cabin-meta, .status-message { font-size: 14px; }
  .card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .card-actions .book-button { flex-basis: 100%; }
  .main-date-popover { max-height: calc(100dvh - 24px); overflow-y: auto; padding: 12px; }
  .main-date-close, .calendar-nav-button { width: 44px; height: 44px; flex-shrink: 0; }
  .calendar-weekdays, .availability-calendar { gap: 3px; }
  .main-date-calendar .main-date-day, .calendar-day { min-height: 44px; padding: 5px; }
  .detail-panel { width: 100%; height: 100dvh; overscroll-behavior: contain; }
  .detail-content { padding: 16px 14px calc(24px + env(safe-area-inset-bottom)); }
  .detail-topline { flex-wrap: wrap; gap: 10px; }
  .detail-topline > div:first-child { flex-basis: 100%; }
  .detail-topline-right { flex-direction: row; flex-wrap: wrap; justify-content: space-between; width: 100%; align-items: center; }
  .detail-close { width: 44px; height: 44px; }
  .detail-external-link { min-height: 36px; font-size: 12px; white-space: normal; }
  .detail-fact { padding: 10px; }
  .detail-description { font-size: 14px; }
  .booking-modal { padding: 12px; }
  .booking-modal-card { padding: 22px 18px; max-height: calc(100dvh - 24px); }
  .booking-modal-actions { flex-wrap: wrap; }
  .booking-modal-actions > * { flex: 1 1 100%; min-height: 44px; }
  .booking-support { gap: 10px; }
  .donation-modal-header { padding: 18px 16px 10px; }
  .donation-modal-header p { font-size: 13px; }
}

