:root {
  --bg: #f5f7fb;
  --ink: #101624;
  --muted: #5d6678;
  --line: rgba(16, 22, 36, 0.08);
  --accent: #1a73e8;
  --accent-soft: rgba(26, 115, 232, 0.15);
  --card: rgba(255, 255, 255, 0.82);
  --shadow: 0 12px 32px rgba(16, 22, 36, 0.08);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Sora", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% -10%, #dbe9ff 0%, transparent 40%),
    radial-gradient(circle at 90% -20%, #ffe8dc 0%, transparent 36%), var(--bg);
}

.app-shell {
  isolation: isolate;
  max-width: 1320px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 22px 18px 28px;
  display: grid;
  gap: 14px;
  grid-template-rows: auto auto 1fr;
}

.glass {
  backdrop-filter: blur(14px);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: var(--radius);
  padding: 10px 12px 10px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2f8cff, #7bb0ff);
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.controls {
  position: relative;
  z-index: 4000;
  overflow: visible;
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.controls-backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 4500;
}

.controls-backdrop.hidden {
  display: none;
}

.control-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

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

.ghost-chip {
  background: rgba(255, 255, 255, 0.6);
}

.expand-panel {
  position: fixed;
  right: 22px;
  top: 128px;
  min-width: min(460px, calc(100vw - 36px));
  max-width: min(560px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  box-shadow: 0 20px 45px rgba(16, 22, 36, 0.18);
  z-index: 5000;
}

#sortPanel {
  min-width: 210px;
  max-width: 260px;
}

.expand-panel.hidden {
  display: none;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.radius-wrap {
  display: grid;
  align-items: center;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 4px 8px;
}

.radius-wrap label,
.radius-wrap output {
  font-size: 0.78rem;
  color: var(--muted);
}

#radius {
  accent-color: var(--accent);
  width: 100%;
}

.content {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr minmax(320px, 400px);
}

.map,
.list-panel,
.result {
  position: relative;
  z-index: 1;
}

.leaflet-container,
.leaflet-pane,
.leaflet-control {
  z-index: 1 !important;
}

.card {
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: #fff;
}

.map {
  min-height: 62vh;
  filter: saturate(1.02) contrast(1.01);
}

.leaflet-container {
  background: linear-gradient(180deg, #eef3f9, #f7f9fc);
}

.list-panel {
  display: grid;
  grid-template-rows: auto 1fr;
}

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.list-head h2 {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.results {
  margin: 0;
  padding: 8px;
  list-style: none;
  overflow: auto;
}

.result {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 8px;
  display: grid;
  gap: 8px;
  transition: transform 120ms ease, box-shadow 120ms ease;
  cursor: pointer;
}

.result:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(16, 22, 36, 0.06);
}

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

.tag {
  border-radius: 999px;
  font-size: 0.72rem;
  padding: 4px 8px;
  background: #eef4ff;
  color: #1f4e91;
}

.badge {
  color: var(--muted);
  font-size: 0.72rem;
}

.title {
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.result-media {
  height: 82px;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #edf2fb;
}

.result-media img,
.result-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-open {
  justify-self: start;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 5px 10px;
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.icon-btn {
  border: 1px solid var(--line);
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.icon-btn.active {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.icon {
  font-size: 1rem;
}

.ghost {
  background: transparent;
}

.fab {
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #1a73e8, #5398ff);
  color: #fff;
  font: inherit;
  font-size: 1.18rem;
  box-shadow: 0 14px 30px rgba(26, 115, 232, 0.36);
  cursor: pointer;
}

.fab-stack {
  position: fixed;
  right: 26px;
  bottom: 24px;
  display: grid;
  gap: 10px;
}

.fab-ghost {
  background: #ffffff;
  color: #2a3243;
  border: 1px solid var(--line);
  box-shadow: 0 10px 20px rgba(16, 22, 36, 0.16);
}

.compose-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
}

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

.compose-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 22, 36, 0.44);
  backdrop-filter: blur(4px);
}

.compose-card {
  position: relative;
  width: min(660px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 28px 70px rgba(16, 22, 36, 0.24);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 2px 4px;
}

.compose-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.compose-grid {
  display: grid;
  gap: 9px;
}

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

.field-row.tight {
  display: grid;
  grid-template-columns: 1fr auto;
}

.field-row.tight-3 {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(105px, auto) minmax(140px, 1fr);
  gap: 8px;
}

.field-label {
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 2px;
}

.field-input {
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 40px;
  background: #fff;
  padding: 0 12px;
  font: inherit;
}

.media-upload {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.82rem;
  cursor: pointer;
}

.media-preview {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-bottom: 4px;
}

.media-chip {
  min-width: 70px;
  height: 56px;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #f0f3f8;
}

.media-chip img,
.media-chip video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.picker-map {
  height: 220px;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.picked-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.field-error {
  display: block;
  font-size: 0.72rem;
  color: #d32f2f;
  padding: 3px 4px 0;
}

.field-input.invalid {
  border-color: #d32f2f;
}

.save-btn {
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #1a73e8, #5398ff);
  color: #fff;
  min-height: 44px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.report-card {
  width: min(520px, calc(100vw - 24px));
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 7000;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.78rem;
  color: #fff;
  background: rgba(16, 22, 36, 0.88);
  box-shadow: 0 12px 24px rgba(16, 22, 36, 0.28);
}

.toast.hidden {
  display: none;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
}

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

.gallery-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 24, 0.88);
  backdrop-filter: blur(2px);
}

.gallery-shell {
  position: relative;
  z-index: 1;
  width: min(980px, calc(100vw - 26px));
  height: min(78dvh, 760px);
}

.gallery-stage {
  width: 100%;
  height: 100%;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #0e1420;
  touch-action: pan-y;
  user-select: none;
}

.gallery-stage img,
.gallery-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-nav {
  position: absolute;
  top: calc(50% - 20px);
  border: 0;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #1c2332;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-prev {
  left: 10px;
}

.gallery-next {
  right: 10px;
}

.gallery-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.96);
}

.gallery-count {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.9);
}

.leaflet-popup-content-wrapper {
  border-radius: 14px;
  font-family: "Sora", sans-serif;
  box-shadow: 0 14px 28px rgba(16, 22, 36, 0.12);
}

.leaflet-popup-tip {
  box-shadow: none;
}

.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: 0 8px 18px rgba(16, 22, 36, 0.14) !important;
  border-radius: 12px !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  border: 0 !important;
  width: 34px !important;
  height: 34px !important;
  line-height: 34px !important;
  color: #2b3344 !important;
}

.report-pin-shell {
  background: transparent;
  border: 0;
  width: 36px;
  height: 36px;
  display: inline-block;
}

.report-pin-svg {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 8px 14px rgba(16, 22, 36, 0.22));
  transform: translateZ(0);
}

.empty {
  color: var(--muted);
  font-size: 0.84rem;
  padding: 20px 10px;
  text-align: center;
}

.card-menu-wrap {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.card-dots-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  width: 32px;
  height: 28px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -1px;
}

.card-dots-btn:hover {
  background: #f4f6fb;
  color: var(--ink);
}

.card-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(16, 22, 36, 0.14);
  z-index: 9999;
  min-width: 150px;
  overflow: hidden;
  padding: 4px 0;
}

.card-menu.hidden {
  display: none;
}

.card-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 9px 14px;
  font: inherit;
  font-size: 0.82rem;
  color: var(--ink);
  cursor: pointer;
}

.card-menu-item:hover {
  background: #f4f6fb;
}

.card-menu-item.flag-open {
  color: #c0392b;
}

@media (max-width: 980px) {
  .content {
    grid-template-columns: 1fr;
  }

  .map {
    min-height: 48vh;
  }

  .fab-stack {
    right: 18px;
    bottom: 18px;
  }

  .expand-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;
    max-width: none;
    min-width: 0;
    border-radius: 16px;
    z-index: 1250;
  }
}
