* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  color: #1f2937;
  background: #eef2f7;
  overflow: hidden;
}

.app-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

.map-logo-intro {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(50vw, 900px);
  transform: translate(-50%, -50%);
  transform-origin: center center;
  z-index: 420;
  pointer-events: none;
  opacity: 0.96;
  animation: logoIntroToCorner 4.3s cubic-bezier(0.32, 0.01, 0.12, 1) forwards;
}

.map-logo-intro img {
  display: block;
  width: 100%;
  height: auto;
}

@keyframes logoIntroToCorner {
  0% {
    top: 50%;
    left: 50%;
    width: min(50vw, 900px);
    transform: translate(-50%, -50%);
    opacity: 0.98;
  }

  69% {
    top: 50%;
    left: 50%;
    width: min(50vw, 900px);
    transform: translate(-50%, -50%);
    opacity: 0.98;
  }

  100% {
    top: calc(100% - 1rem - env(safe-area-inset-bottom));
    left: calc(1rem + env(safe-area-inset-left));
    width: clamp(140px, 17vw, 260px);
    transform: translate(0, -100%);
    opacity: 0.94;
  }
}

.floating-ui {
  position: absolute;
  top: calc(1rem + env(safe-area-inset-top));
  right: calc(1rem + env(safe-area-inset-right));
  z-index: 1200;
  display: grid;
  gap: 0.75rem;
  justify-items: end;
}

.leaflet-top,
.leaflet-bottom {
  z-index: 1100;
}

.leaflet-control-zoom {
  opacity: 1;
}

.toggle-btn,
.panel,
input,
select,
textarea,
button {
  border-radius: 14px;
  border: 1px solid #d1d5db;
}

.toggle-btn {
  min-height: 44px;
  padding: 0.75rem 1rem;
  background: #ffffff;
  color: #1f2937;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.24);
}

.toggle-btn:hover {
  transform: translateY(-1px);
}

.panel {
  width: min(340px, 92vw);
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 5.4rem);
  padding: 0.9rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(3px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.22);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;
}

.panel.hidden {
  display: none;
}

h1 {
  margin: 0;
  font-size: 1.25rem;
}

.subtitle {
  margin-top: 0.4rem;
  margin-bottom: 0;
  color: #374151;
  line-height: 1.25;
  font-size: 0.92rem;
}

.form {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.auth-box {
  margin-top: 0.7rem;
  padding: 0.55rem;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.auth-text {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  color: #374151;
}

.secondary-btn {
  margin-top: 0.55rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.83rem;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  cursor: pointer;
}

.privacy-warning {
  margin: 0.38rem 0 0;
  font-size: 0.79rem;
  line-height: 1.3;
  color: #374151;
}

.privacy-details {
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.65);
}

.privacy-details summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}

.consent-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem;
  align-items: start;
  font-size: 0.84rem;
  font-weight: 500;
}

.consent-row input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  margin-top: 0.1rem;
}

.privacy-link {
  color: #1d4ed8;
  font-size: 0.83rem;
  text-decoration: none;
}

.privacy-link:hover {
  text-decoration: underline;
}

label {
  font-size: 0.88rem;
  font-weight: 600;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.54rem;
  background: rgba(255, 255, 255, 0.95);
}

button[type='submit'] {
  padding: 0.7rem 0.9rem;
  background: #1d4ed8;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(29, 78, 216, 0.3);
}

button[type='submit']:hover {
  background: #1e40af;
}

.status {
  min-height: 1.1rem;
  margin-top: 0.75rem;
  font-size: 0.88rem;
}

.status.error {
  color: #b91c1c;
}

.status.ok {
  color: #166534;
}

.my-reports {
  margin-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
  padding-top: 0.55rem;
}

.my-reports h2 {
  margin: 0 0 0.45rem;
  font-size: 0.98rem;
}

.my-reports-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  max-height: 190px;
  overflow: auto;
}

.my-report-item {
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
}

.my-report-item p {
  margin: 0 0 0.35rem;
}

.my-report-delete {
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid #ef4444;
  background: #ef4444;
  color: #fff;
  font-size: 0.78rem;
  cursor: pointer;
}

.popup {
  max-width: 240px;
}

.popup h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.popup p {
  margin: 0.3rem 0;
}

.popup img {
  width: 100%;
  border-radius: 10px;
  margin-top: 0.4rem;
}

@media (max-width: 768px) {
  .map-logo-intro {
    animation-duration: 4.4s;
  }

  @keyframes logoIntroToCorner {
    0% {
      top: 50%;
      left: 50%;
      width: min(74vw, 560px);
      transform: translate(-50%, -50%);
      opacity: 0.98;
    }

    69% {
      top: 50%;
      left: 50%;
      width: min(74vw, 560px);
      transform: translate(-50%, -50%);
      opacity: 0.98;
    }

    100% {
      top: calc(100% - 0.85rem - env(safe-area-inset-bottom));
      left: calc(0.85rem + env(safe-area-inset-left));
      width: clamp(118px, 34vw, 186px);
      transform: translate(0, -100%);
      opacity: 0.94;
    }
  }

  .floating-ui {
    top: calc(0.75rem + env(safe-area-inset-top));
    right: calc(0.75rem + env(safe-area-inset-right));
    left: calc(0.75rem + env(safe-area-inset-left));
    justify-items: stretch;
  }

  .toggle-btn {
    justify-self: end;
    width: fit-content;
    min-width: 132px;
  }

  .panel {
    width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 1.5rem);
    max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 7rem);
    overflow: auto;
  }
}

@media (max-width: 430px) {
  .panel {
    padding: 0.85rem;
  }

  h1 {
    font-size: 1.1rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }
}
