:root {
  --bg-1: #f4efe4;
  --bg-2: #dce5eb;
  --ink: #152026;
  --muted: #42555f;
  --line: rgba(21, 32, 38, 0.14);
  --card: rgba(255, 255, 255, 0.82);
  --accent: #b25a3c;
  --accent-deep: #7d3b28;
  --ok: #2f7c59;
  --warn: #b25a3c;
  --busy: #971e2d;
  --free: #2f7c59;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  font-family: "IBM Plex Sans", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 0%, var(--bg-2), transparent 42%),
    radial-gradient(circle at 85% 80%, #edd9cc, transparent 36%),
    linear-gradient(140deg, var(--bg-1), #e5ebee 70%);
  overflow: hidden;
}

.backdrop {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(20px);
  opacity: 0.45;
}

.back-a {
  width: 320px;
  height: 320px;
  top: -90px;
  right: -70px;
  background: #f0b291;
}

.back-b {
  width: 260px;
  height: 260px;
  bottom: -100px;
  left: -60px;
  background: #9eb5c5;
}

.topbar {
  position: fixed;
  z-index: 700;
  bottom: 12px;
  left: 16px;
  width: fit-content;
  max-width: calc(100vw - 32px);
  padding: 12px 16px 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(5px);
  box-shadow: 0 12px 30px rgba(12, 28, 36, 0.12);
}

h1 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.05rem, 2.2vw, 1.45rem);
  line-height: 1;
  letter-spacing: 0.02em;
}

.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;
}

.topbar p {
  margin: 0;
  font-size: 0.865rem;
  line-height: 1.25;
  color: var(--muted);
}

.topbar p + p {
  margin-top: 4px;
}

.top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.top-links a {
  color: var(--muted);
  font-size: 0.845rem;
  text-decoration: none;
  border-bottom: 1px dotted rgba(21, 32, 38, 0.3);
}

.top-links a:hover {
  color: var(--ink);
  border-bottom-color: rgba(21, 32, 38, 0.55);
}

.layout {
  position: fixed;
  inset: 0;
}

.map-card,
.panel .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(12, 28, 36, 0.1);
  backdrop-filter: blur(5px);
}

.map-card {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  background: transparent;
}

#map {
  width: 100vw;
  height: 100vh;
}

#map .leaflet-tile-pane {
  filter: grayscale(1) contrast(1.04);
}

#map.zoom-select-mode,
#map.zoom-select-mode .leaflet-pane,
#map.zoom-select-mode .leaflet-interactive {
  cursor: zoom-in !important;
}

#map.select-spot-mode,
#map.select-spot-mode .leaflet-pane,
#map.select-spot-mode .leaflet-interactive {
  cursor: pointer !important;
}

#map.zoom-select-mode.occupied-hover-mode,
#map.zoom-select-mode.occupied-hover-mode .leaflet-pane,
#map.zoom-select-mode.occupied-hover-mode .leaflet-interactive {
  cursor: pointer !important;
}

#map.leaflet-dragging,
#map.leaflet-dragging .leaflet-pane,
#map.leaflet-dragging .leaflet-interactive {
  cursor: grabbing !important;
}

#map.leaflet-grabbing,
#map.leaflet-grabbing .leaflet-pane,
#map.leaflet-grabbing .leaflet-interactive,
body.leaflet-drag-target #map,
body.leaflet-drag-target #map .leaflet-pane,
body.leaflet-drag-target #map .leaflet-interactive {
  cursor: grabbing !important;
}

#map.dragging-mode,
#map.dragging-mode .leaflet-pane,
#map.dragging-mode .leaflet-interactive,
#map.dragging-mode .leaflet-container,
#map.dragging-mode * {
  cursor: grabbing !important;
}

.leaflet-tooltip.cluster-counter {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  margin: 0;
  padding: 0;
}

.leaflet-tooltip.spot-tooltip {
  background: rgba(21, 32, 38, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f5f7f8;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

.leaflet-tooltip.spot-tooltip::before {
  border-right-color: rgba(21, 32, 38, 0.95);
}

.panel {
  position: absolute;
  z-index: 800;
  top: 16px;
  right: 16px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  display: grid;
  gap: 12px;
  align-content: start;
}

.panel .card {
  padding: 14px 14px 16px;
}

#userCard {
  padding: 8px 10px;
}

.user-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.user-email {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.user-logout {
  padding: 6px 9px;
  font-size: 0.8rem;
  line-height: 1;
  white-space: nowrap;
}

h2 {
  margin: 0 0 10px;
  font-size: 1.06rem;
}

.auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.95rem;
  font-weight: 300;
  line-height: 1;
  padding-bottom: 2px;
  margin-right: -7px;
  margin-top: -7px;
}

.card-close:hover {
  transform: none;
  background: rgba(21, 32, 38, 0.08);
  color: var(--ink);
}

.card-close:focus-visible {
  outline: 2px solid rgba(21, 32, 38, 0.25);
  outline-offset: 1px;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  margin: 6px 0 8px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 32, 38, 0.04);
  overflow: hidden;
}

.auth-switch .btn-outline {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.88rem;
  transform: none;
}

.auth-switch .btn-outline:hover {
  transform: none;
  background: rgba(21, 32, 38, 0.05);
  color: var(--ink);
}

h3 {
  margin: 8px 0 6px;
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 600;
}

.stack {
  display: grid;
  gap: 8px;
}

input,
textarea,
button,
label {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 11px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

button {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--accent-deep);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.9);
}

.btn-outline.active {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(21, 32, 38, 0.16);
}

.hidden {
  display: none;
}

.note {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.92rem;
}

.note.busy {
  background: rgba(151, 30, 45, 0.1);
  color: var(--busy);
}

.note.free {
  background: rgba(47, 124, 89, 0.11);
  color: var(--free);
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 10px 0 0;
}

.message {
  position: fixed;
  z-index: 1200;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(680px, calc(100vw - 24px));
  width: max-content;
  font-size: 0.92rem;
  color: var(--ink);
  margin: 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(12, 28, 36, 0.14);
  text-align: center;
}

.message.error {
  color: var(--busy);
  border-color: rgba(151, 30, 45, 0.24);
  background: rgba(255, 244, 246, 0.96);
}

.message:empty {
  display: none;
}

.modal-overlay {
  position: fixed;
  z-index: 1300;
  inset: 0;
  background: rgba(10, 18, 24, 0.42);
  display: grid;
  place-items: center;
  padding: 14px;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  width: min(640px, calc(100vw - 28px));
  max-height: min(80vh, 760px);
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 36px rgba(7, 16, 22, 0.2);
  padding: 12px 12px 14px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal-body {
  margin-top: 8px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.4;
}

.modal-body p {
  margin: 0 0 8px;
}

.details-empty {
  color: var(--muted);
  font-size: 0.93rem;
}

.details-coords-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 8px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transform: none;
  text-align: left;
  border-radius: 10px;
  font-weight: 400;
}

#createCard .details-coords-row {
  margin-bottom: 12px;
}

.details-coords-row .details-empty {
  margin: 0;
  color: inherit;
  font-weight: 400;
}

.details-coords-row:focus-visible {
  outline: 2px solid rgba(21, 32, 38, 0.24);
  outline-offset: 2px;
}

.coords-pin {
  color: inherit;
  line-height: 1;
}

.details-coords-row:hover {
  transform: none;
  background: rgba(21, 32, 38, 0.08);
  color: var(--ink);
}

.detail-grid {
  display: grid;
  gap: 8px;
  font-size: 0.94rem;
}

.detail-grid strong {
  color: var(--muted);
  font-weight: 600;
}

.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: rise 420ms ease forwards;
}

.delay-1 {
  animation-delay: 90ms;
}

.delay-2 {
  animation-delay: 170ms;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .topbar {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 11px 15px 11px 13px;
  }

  .panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 90px;
    width: calc(100vw - 24px);
    max-height: none;
    overflow-y: visible;
  }

  #userCard {
    order: 99;
  }
}
