:root {
  color-scheme: light;
  --bg: #f4f2ec;
  --panel: #fffdf8;
  --ink: #19201d;
  --muted: #68706a;
  --line: #d8d2c3;
  --map-land: #dbe9df;
  --map-active: #d65047;
  --map-border: #ffffff;
  --accent: #126a5a;
  --gold: #c7923f;
  --shadow: 0 18px 60px rgba(23, 31, 28, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 0;
}

.map-page .app-shell {
  grid-template-columns: 1fr;
}

.map-stage {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  padding: 28px;
}

.map-page .map-stage {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.08;
}

h2 {
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.15;
}

h3 {
  margin-bottom: 12px;
  font-size: 15px;
}

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

.search-box {
  width: min(320px, 42vw);
  height: 42px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
}

.search-box span {
  color: var(--muted);
  font-size: 13px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

#resetView {
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.map-canvas {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #eef4f1 0%, #f9f5ea 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.status-row {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.detail-panel {
  min-height: 100vh;
  border-left: 1px solid var(--line);
  background: var(--panel);
  padding: 28px 24px;
  overflow-y: auto;
}

.place-page {
  min-height: 100vh;
}

.place-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
}

.place-rail {
  min-height: 100vh;
  padding: 28px 24px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.back-link {
  display: inline-flex;
  align-items: center;
  height: 36px;
  margin-bottom: 28px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 800;
}

.place-content {
  min-width: 0;
  padding: 28px;
}

.place-content .media-section:first-child {
  padding-top: 0;
}

.place-content .media-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.place-content .video-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.place-head {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.place-head p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.upload-link {
  display: inline-flex;
  align-items: center;
  height: 40px;
  margin-top: 18px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--map-active);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

.upload-note {
  max-width: 760px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  line-height: 1.7;
}

.upload-note code {
  color: var(--ink);
  font-size: 13px;
}

.media-section {
  padding-top: 22px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.section-head h2 {
  margin-bottom: 0;
}

.view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.view-toggle button {
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.view-toggle button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.media-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.media-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e6e1d4;
}

.media-caption {
  min-height: 42px;
  padding: 9px 10px 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.media-caption strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 13px;
}

.media-caption p {
  margin: 6px 0 0;
}

.photo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.photo-meta span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(18, 106, 90, 0.1);
  color: var(--accent);
  font-weight: 700;
}

.grouped-media {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.spot-group {
  min-width: 0;
}

.spot-group h3 {
  margin-bottom: 10px;
}

.video-list {
  display: grid;
  gap: 12px;
}

.video-card video {
  display: block;
  width: 100%;
  max-height: 240px;
  background: #111;
}

.empty-state {
  min-height: 86px;
  align-items: center;
}

.empty-state::before {
  content: "暂无已上传影像";
  min-height: 86px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  background: rgba(244, 242, 236, 0.55);
}

.media-grid:not(.empty-state)::before,
.video-list:not(.empty-state)::before {
  content: none;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .place-layout {
    grid-template-columns: 1fr;
  }

  .place-rail {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .map-stage {
    min-height: 66vh;
    padding: 18px;
  }

  .detail-panel {
    min-height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .place-content .media-grid,
  .place-content .video-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .topbar {
    display: grid;
  }

  .toolbar {
    width: 100%;
  }

  .search-box {
    width: 100%;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 24px;
  }

  .map-stage {
    grid-template-rows: auto 58vh auto;
  }

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

  .place-content {
    padding: 18px;
  }

  .place-content .media-grid,
  .place-content .video-list {
    grid-template-columns: 1fr;
  }
}

.admin-form {
  max-width: 720px;
  display: grid;
  gap: 16px;
}

.admin-form label {
  display: grid;
  gap: 8px;
}

.admin-form label span {
  color: var(--ink);
  font-weight: 800;
}

.admin-form input,
.admin-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.admin-form textarea {
  resize: vertical;
}

.admin-form button {
  justify-self: start;
  height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.admin-status {
  min-height: 24px;
  color: var(--accent);
}

.admin-status.error {
  color: var(--map-active);
}

