:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f6f7f8;
  --ink: #111418;
  --ink-soft: #545b66;
  --ink-faint: #5f6670;
  --accent: #c2410c;
  --accent-dark: #9a3412;
  --accent-soft: #ffedd5;
  --line: #e6e8eb;
  --line-strong: #d3d6da;
  --danger: #c0334a;
  --radius: 12px;
  --radius-sm: 9px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html {
  height: 100%;
}
body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 2000;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 40px);
  flex: 1;
}
.container.narrow { max-width: 820px; }

/* ---------- Brand / header ---------- */
.brandbar {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 18px 0 6px;
}
.logo-pin {
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 3px;
  transform: rotate(45deg);
  background: var(--accent);
  position: relative;
}
.logo-pin::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--bg);
}
.brandbar h1 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.brandbar h1 a { color: inherit; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 48px 0 12px;
}
.hero h2 {
  font-size: clamp(1.9rem, 5vw, 2.7rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 8px 0 12px;
  color: var(--ink);
}
.hero p {
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 500px;
  margin: 0 auto;
}

/* ---------- Cards / panels ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.stack { display: grid; gap: 14px; }
.actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 32px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 640px) {
  .actions-grid { grid-template-columns: 1fr 1fr; }
}

.card-title {
  font-size: 0.98rem;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.card-sub {
  color: var(--ink-faint);
  font-size: 0.88rem;
  margin: 0 0 12px;
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  width: 100%;
  color: #fff;
  background: var(--accent);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { background: #7c2d12; }
.btn.secondary {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
}
.btn.secondary:hover { background: var(--surface-soft); }
.btn.danger {
  color: #9f1239;
  border-color: #fda4af;
}
.btn.danger:hover { background: #fff1f2; }
.btn.ghost {
  width: auto;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  padding: 8px 12px;
}
.btn.small { width: auto; padding: 9px 13px; font-size: 0.88rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Inputs ---------- */
.field { display: grid; gap: 6px; }
.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.input {
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  width: 100%;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input::placeholder { color: var(--ink-faint); }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.code-input {
  letter-spacing: 0.28em;
  font-weight: 600;
  text-align: center;
}
.row { display: flex; gap: 10px; align-items: stretch; }
.row .input { flex: 1; }

/* ---------- Share link ---------- */
.share-bar {
  text-align: center;
  padding: 8px 0 18px;
}
.share-bar .share-label {
  font-size: 0.82rem;
  color: var(--ink-faint);
  margin: 0 0 8px;
}
.room-warning {
  max-width: 620px;
  margin: 10px auto 0;
  color: var(--ink-soft);
  font-size: 0.8rem;
  line-height: 1.45;
}
.share-link-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 6px 6px 16px;
  flex-wrap: wrap;
  justify-content: center;
}
.share-code {
  font-family: 'SFMono-Regular', ui-monospace, Menlo, Consolas, monospace;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  color: var(--ink);
  white-space: nowrap;
}
.share-sep {
  color: var(--ink-faint);
}
.share-link-wrap a {
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(60vw, 440px);
}

/* ---------- Room layout (3 columns) ---------- */
.room-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 1024px) {
  .room-grid {
    grid-template-columns: 1.1fr 360px 1.1fr;
    align-items: stretch;
  }
}
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.col-head {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin: 0;
}
#map {
  width: 100%;
  height: 340px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  z-index: 0;
}
@media (min-width: 1024px) { #map { height: 100%; min-height: 560px; } }

/* ---------- Google Places results + tabs ---------- */
.places-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 340px;
}
.places-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.tabs {
  display: inline-flex;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  align-self: flex-start;
}
.tab {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-soft);
  background: transparent;
  border-radius: 999px;
  padding: 7px 16px;
}
.tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.tab:focus-visible { outline-offset: 2px; }
.places-results {
  overflow: auto;
  padding: 2px;
  gap: 8px;
  display: grid;
  align-content: start;
  max-height: 540px;
}
.places-state {
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0;
}
.place-card {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 12px;
}
.place-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(0,0,0,0.04); }
.place-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 700;
}
.place-copy { min-width: 0; }
.place-name { font-size: 0.95rem; font-weight: 700; line-height: 1.3; margin: 0; }
.place-meta,
.place-address,
.place-attribution {
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.4;
  margin: 3px 0 0;
}
.place-attribution { font-size: 0.74rem; }
.place-open {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
  max-width: 110px;
}
.provider-disclosure {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.45;
}
.provider-disclosure p { margin: 4px 0 0; }
.provider-disclosure details { margin-top: 8px; }
.provider-disclosure summary {
  color: var(--ink);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}
.gmp-attribution {
  color: #5e5e5e;
  font-family: Roboto, sans-serif;
  font-size: 0.75rem;
  font-style: normal;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1.4;
  margin: 0;
  white-space: nowrap;
}
.search-attribution { text-align: right; }

/* ---------- People list ---------- */
.people-count { font-size: 0.82rem; color: var(--ink-faint); }
.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.section-row .card-title { margin: 0; }
.people { display: grid; gap: 8px; }
.person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
}
.person .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 0.82rem;
  flex: 0 0 auto;
}
.person .pname { font-weight: 500; font-size: 0.92rem; }
.muted { color: var(--ink-faint); font-size: 0.88rem; }
.field-help {
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.4;
  margin: 0;
}
.search-status {
  min-height: 1.1em;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.4;
  margin: 0;
}
.location-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

/* ---------- Notice ---------- */
.notice {
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.88rem;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink-soft);
}
.notice.error { background: #fcecef; color: var(--danger); border-color: #f0c7cf; }
.notice.hidden, .hidden { display: none !important; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 1000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Search results ---------- */
.search-wrap { position: relative; }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  overflow: hidden;
  z-index: 500;
  max-height: 240px;
  overflow-y: auto;
}
.search-results button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 13px;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.search-results button:last-child { border-bottom: none; }
.search-results button:hover { background: var(--surface-soft); }
.search-results button:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: -3px;
  background: #eff6ff;
}

/* ---------- Pin marker animation ---------- */
@keyframes pin-drop {
  0% { transform: translateY(-220px) scale(0.6); opacity: 0; }
  70% { transform: translateY(0) scale(1.05); opacity: 1; }
  85% { transform: translateY(-8px) scale(0.98); }
  100% { transform: translateY(0) scale(1); }
}
.leaflet-marker-icon.drop { animation: pin-drop 0.5s cubic-bezier(0.2, 0.7, 0.3, 1); }
.leaflet-control-attribution a {
  color: #075985;
  text-decoration: underline;
}

/* ---------- Footer ---------- */
footer.site-footer {
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.82rem;
  padding: 28px 0 32px;
  border-top: 1px solid var(--line);
  margin-top: auto;
}
footer.site-footer .links { margin-bottom: 8px; }
footer.site-footer a { margin: 0 8px; color: var(--ink-soft); }

/* ---------- Legal pages ---------- */
.legal { line-height: 1.65; color: var(--ink-soft); }
.legal h2 { color: var(--ink); letter-spacing: -0.02em; }
.legal h3 { color: var(--ink); margin-top: 24px; }
.legal ul { padding-left: 20px; }

@media (max-width: 480px) {
  .container { padding-left: 12px; padding-right: 12px; }
  .share-link-wrap {
    width: 100%;
    border-radius: var(--radius);
    padding: 8px;
  }
  .share-link-wrap a {
    max-width: 100%;
    flex-basis: 100%;
    order: 3;
  }
  .places-toolbar { align-items: stretch; }
  .places-toolbar .tabs,
  .places-toolbar .btn { width: 100%; }
  .tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .place-card {
    grid-template-columns: 28px minmax(0, 1fr);
  }
  .place-open {
    grid-column: 2;
    text-align: left;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
