:root {
  --bg-0: #05030a;
  --bg-1: #130822;
  --bg-2: #2a1450;
  --surface-0: rgba(17, 12, 30, 0.8);
  --surface-1: rgba(26, 15, 44, 0.9);
  --surface-2: rgba(48, 27, 78, 0.8);
  --border: rgba(170, 130, 255, 0.28);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.74);
  --highlight: #8b5cf6;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(94, 55, 182, 0.35), transparent 48%),
    radial-gradient(circle at 80% 20%, rgba(124, 69, 226, 0.25), transparent 42%),
    linear-gradient(145deg, var(--bg-0), var(--bg-1) 55%, var(--bg-2));
  overflow: hidden;
}

.backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 90% 80%, rgba(87, 39, 170, 0.33), transparent 45%),
    radial-gradient(circle at 25% 65%, rgba(69, 0, 145, 0.18), transparent 48%);
  filter: blur(0.5px);
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  opacity: 0.15;
  pointer-events: none;
  background-image: linear-gradient(
      to right,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px
    ),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(41, 24, 70, 0.72), rgba(14, 10, 26, 0.95));
  box-shadow: var(--shadow);
  animation: float-in 300ms ease-out both;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-family: "Syne", sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
}

h2 {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
}

.auth-layout {
  flex: 1;
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(460px, 100%);
  padding: 28px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--surface-2), var(--surface-0));
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  animation: rise-in 360ms ease-out both;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
}

.main-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 410px) 1fr;
  gap: 16px;
}

.panel {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding-right: 4px;
}

.panel::-webkit-scrollbar {
  width: 8px;
}

.panel::-webkit-scrollbar-thumb {
  background: rgba(180, 146, 255, 0.4);
  border-radius: 999px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(140deg, var(--surface-1), rgba(16, 10, 29, 0.92));
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  gap: 12px;
  animation: rise-in 360ms ease-out both;
}

.card-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.point-form {
  display: grid;
  gap: 10px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.helper-actions {
  display: flex;
}

.photo-source-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.image-name {
  margin: 0;
}

.image-editor {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(194, 167, 255, 0.35);
  border-radius: 12px;
  background: rgba(10, 7, 19, 0.75);
  padding: 10px;
}

.image-editor-canvas-wrap {
  border-radius: 10px;
  border: 1px solid rgba(194, 167, 255, 0.35);
  overflow: hidden;
  background: rgba(4, 2, 9, 0.9);
}

.image-editor-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}

label {
  font-size: 0.84rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

input,
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(194, 167, 255, 0.35);
  background: rgba(14, 9, 26, 0.92);
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
}

input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(200, 176, 255, 0.9);
  box-shadow: 0 0 0 3px rgba(131, 87, 231, 0.28);
}

input[type="file"] {
  padding: 8px 10px;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 1px solid rgba(225, 211, 255, 0.42);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(86, 52, 152, 0.5);
  color: #fff;
  cursor: pointer;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.button {
  border: 1px solid rgba(216, 198, 255, 0.38);
  border-radius: 12px;
  background: linear-gradient(130deg, #7f4dea, #512794);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
  box-shadow: 0 10px 24px rgba(88, 50, 162, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

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

.button-outline {
  background: rgba(22, 14, 38, 0.75);
  box-shadow: none;
}

.button-small {
  padding: 8px 10px;
  font-size: 0.88rem;
}

.message {
  min-height: 1.1rem;
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.message.success {
  color: #a8ffbf;
}

.message.error {
  color: #ff9aa6;
}

.points-list {
  display: grid;
  gap: 10px;
}

.point-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--tag-color, var(--highlight));
  border-radius: 12px;
  background: rgba(15, 10, 27, 0.88);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.point-meta {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.point-select {
  display: inline-flex;
  align-items: center;
}

.point-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.point-id {
  overflow-wrap: anywhere;
}

.point-tag {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.point-coords {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.point-created {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.point-actions {
  display: flex;
  gap: 8px;
}

.empty-state {
  margin: 0;
  color: var(--muted);
  padding: 8px 2px;
}

.map-wrapper {
  position: relative;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: rise-in 360ms ease-out both;
}

.map-canvas {
  width: 100%;
  height: 100%;
  min-height: 560px;
}

.leaflet-container {
  background: #0b0617;
  font-family: "Space Grotesk", sans-serif;
}

.leaflet-tile-pane {
  filter: saturate(0.8) hue-rotate(245deg) brightness(0.55) contrast(1.1);
}

.leaflet-control-attribution,
.leaflet-control-attribution a {
  color: rgba(255, 255, 255, 0.76) !important;
}

.leaflet-control-attribution {
  background: rgba(13, 8, 23, 0.72) !important;
}

.leaflet-control-zoom a {
  background: rgba(22, 14, 38, 0.92) !important;
  border-color: rgba(194, 167, 255, 0.35) !important;
  color: #ffffff !important;
}

.leaflet-control-zoom a:hover {
  background: rgba(44, 26, 74, 0.95) !important;
}

.map-hint {
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(12, 8, 21, 0.8);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.map-info {
  min-width: 220px;
  max-width: 260px;
  color: #111;
  font-family: "Space Grotesk", sans-serif;
}

.map-info strong {
  display: block;
  margin-bottom: 4px;
}

.map-info p {
  margin: 0 0 6px;
  font-size: 0.88rem;
  line-height: 1.35;
}

.map-info img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
  border-radius: 8px;
}

.hidden {
  display: none !important;
}

.list-page {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.list-page::-webkit-scrollbar {
  width: 8px;
}

.list-page::-webkit-scrollbar-thumb {
  background: rgba(180, 146, 255, 0.4);
  border-radius: 999px;
}

.list-card {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes float-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .main-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(420px, 58vh);
  }

  .map-canvas {
    min-height: 420px;
  }

  .panel {
    overflow: visible;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px;
    gap: 12px;
  }

  .topbar {
    padding: 12px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .auth-card,
  .card {
    padding: 14px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .point-actions {
    flex-wrap: wrap;
  }

  .map-hint {
    left: 10px;
    right: 10px;
    text-align: center;
  }
}
