:root {
  --bg: #f3f7fa;
  --land: #bdd6d2;
  --road: rgba(255, 255, 255, 0.98);
  --river: rgba(173, 205, 213, 0.74);
  --panel: rgba(255, 255, 255, 0.8);
  --line: rgba(77, 93, 93, 0.12);
  --text: #243746;
  --muted: #718082;
  --accent: #cc9441;
  --accent-soft: rgba(204, 148, 65, 0.16);
  --green: #9b7440;
  --green-soft: rgba(155, 116, 64, 0.12);
  --locked: #a5aea0;
  --bronze: #9d6844;
  --silver: #8e9aa3;
  --gold: #b98a1f;
  --platinum: #5f8f92;
  --obsidian: #2f3138;
  --shadow: 0 18px 38px rgba(89, 79, 66, 0.08);
  --sheet-height: min(58vh, 520px);
}

* {
  box-sizing: border-box;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

input, textarea, select {
  -webkit-user-select: auto;
  user-select: auto;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Hiragino Sans GB", "PingFang SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(173, 205, 213, 0.18), transparent 24%),
    radial-gradient(circle at top right, rgba(204, 148, 65, 0.08), transparent 22%),
    linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
}

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

.hidden {
  display: none !important;
}

.mobile-dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 1320;
  display: grid;
  grid-template-columns: repeat(3, minmax(124px, 1fr));
  gap: 10px;
  padding: 10px 12px;
  width: min(540px, calc(100vw - 32px));
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.42);
  box-shadow: 0 24px 44px rgba(46, 71, 84, 0.18);
  backdrop-filter: blur(24px) saturate(1.2);
}

.mobile-dock-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(33, 52, 71, 0.78);
  border-radius: 18px;
  min-height: 56px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.mobile-dock-button.active {
  background: rgba(255, 255, 255, 0.6);
  color: #244261;
}

.mobile-dock-button-primary {
  background: linear-gradient(180deg, #2f537d 0%, #284667 100%);
  color: #fffdfa;
  box-shadow: 0 14px 26px rgba(40, 70, 103, 0.26);
}

.mobile-dock-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.mobile-dock-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  height: 100vh;
  display: block;
  overflow: hidden;
  position: relative;
}

.app-loading {
  position: absolute;
  inset: 0;
  z-index: 1800;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.84), rgba(226, 232, 240, 0.78));
  backdrop-filter: blur(8px);
}

.app-loading.hidden {
  display: none;
}

.app-loading-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(80, 92, 94, 0.12);
  color: var(--text);
  font-size: 13px;
}

.app-loading-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(40, 70, 103, 0.16);
  border-top-color: #284667;
  border-radius: 4px;
  animation: spin 0.9s linear infinite;
}

.map-view {
  position: relative;
  padding: 0;
  min-width: 0;
  isolation: isolate;
}

.upload-button,
.upload-confirm {
  border: 1px solid rgba(80, 92, 94, 0.08);
  background: #284667;
  color: #fbfaf7;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(40, 70, 103, 0.16);
}

.small-label,
.meta-text {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.rail-card {
  background: var(--panel);
  border: 1px solid rgba(80, 92, 94, 0.08);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.map-canvas {
  height: 100vh;
  border-radius: 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
  background:
    radial-gradient(circle at 12% 14%, rgba(188, 214, 210, 0.38), transparent 24%),
    radial-gradient(circle at 78% 12%, rgba(204, 148, 65, 0.06), transparent 18%),
    linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
}

.map-canvas::before,
.map-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.map-canvas::before {
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.08), transparent 24%),
    radial-gradient(circle at 82% 74%, rgba(183, 211, 216, 0.04), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(240, 246, 250, 0.06));
}

.map-canvas::after {
  opacity: 0.08;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(92, 92, 92, 0.03) 0,
      rgba(92, 92, 92, 0.03) 1px,
      transparent 1px,
      transparent 6px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(92, 92, 92, 0.02) 0,
      rgba(92, 92, 92, 0.02) 1px,
      transparent 1px,
      transparent 7px
    );
}

.marker-label {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(80, 92, 94, 0.08);
  font-size: 10px;
  letter-spacing: 0.04em;
  max-width: 138px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 0 auto;
  margin-top: -1px;
}

.marker-label.hidden {
  display: none !important;
}

.portal-marker {
  width: auto !important;
  height: auto !important;
  min-width: 120px;
  min-height: 82px;
  margin: 0 !important;
  background: transparent !important;
  border: 0 !important;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  pointer-events: auto;
  overflow: visible !important;
}

.leaflet-pane,
.leaflet-top,
.leaflet-bottom {
  z-index: 400;
}

.leaflet-control-container {
  z-index: 500;
}

.portal-marker-shell {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 180px;
  min-width: 180px;
  padding-top: 4px;
  overflow: visible;
}

.portal-marker-droplet {
  --pin-pointer-width: 18px;
  --pin-pointer-height: 16px;
  width: 62px;
  height: 62px;
  border-radius: 4px;
  transform: none;
  border: 2px solid #1e3b61;
  background-color: rgba(255, 255, 255, 0.98);
  background-size: cover;
  background-position: center;
  display: block;
  box-shadow: 0 2px 10px rgba(23, 42, 64, 0.16);
  flex: 0 0 auto;
  position: relative;
}

.portal-marker-droplet::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(var(--pin-pointer-height) * -1 + 2px);
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: calc(var(--pin-pointer-width) / 2) solid transparent;
  border-right: calc(var(--pin-pointer-width) / 2) solid transparent;
  border-top: var(--pin-pointer-height) solid #1e3b61;
}

.portal-marker.zoom-9 .portal-marker-droplet,
.portal-marker.zoom-10 .portal-marker-droplet {
  width: 40px;
  height: 40px;
  border-width: 2px;
  box-shadow: 0 2px 7px rgba(23, 42, 64, 0.14);
}

.portal-marker.zoom-11 .portal-marker-droplet {
  width: 52px;
  height: 52px;
  border-width: 2px;
  box-shadow: 0 2px 8px rgba(23, 42, 64, 0.15);
}

.portal-marker.hot .portal-marker-droplet {
  width: 74px;
  height: 74px;
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(147, 103, 34, 0.2);
}

.portal-marker.hot .portal-marker-droplet::after {
  border-top-color: var(--accent);
}

.portal-marker.hot.zoom-9 .portal-marker-droplet,
.portal-marker.hot.zoom-10 .portal-marker-droplet {
  width: 48px;
  height: 48px;
  box-shadow: 0 2px 8px rgba(147, 103, 34, 0.17);
}

.portal-marker.hot.zoom-11 .portal-marker-droplet {
  width: 60px;
  height: 60px;
  box-shadow: 0 2px 9px rgba(147, 103, 34, 0.18);
}

.portal-marker.mine .portal-marker-droplet {
  border-color: #3d6289;
}

.portal-marker-pulse {
  position: absolute;
  top: -6px;
  width: 88px;
  height: 88px;
  border-radius: 4px;
  border: 1px solid rgba(211, 154, 59, 0.34);
  animation: pulse 2.8s infinite;
  pointer-events: none;
}

.leaflet-marker-pane {
  z-index: 450 !important;
}

.leaflet-marker-icon.portal-marker {
  overflow: visible !important;
}

.side-rail {
  position: fixed;
  left: 0;
  right: 0;
  margin: 0 auto;
  bottom: 92px;
  width: min(720px, calc(100vw - 32px));
  padding: 12px 0 4px;
  display: grid;
  gap: 12px;
  align-content: start;
  height: auto;
  max-height: calc(100vh - 100px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  transition: opacity 0.18s ease, transform 0.22s ease, height 0.16s linear;
  z-index: 1250;
  border-radius: 30px;
  background: rgba(229, 238, 247, 0.52);
  box-shadow: 0 26px 60px rgba(27, 48, 66, 0.2);
  backdrop-filter: blur(28px) saturate(1.18);
}

.sheet-handle {
  touch-action: none;
  cursor: default;
}

.app-shell.rail-empty .side-rail {
  display: none;
}

.side-rail.dragging {
  transition: opacity 0.18s ease, transform 0.22s ease; /* Disable height transition while dragging */
}

.app-shell.rail-collapsed .side-rail {
  opacity: 0;
  transform: translateY(calc(100% + 24px));
  pointer-events: none;
  overflow: hidden;
}

.rail-card {
  margin: 0 12px;
  border-radius: 22px;
  padding: 14px;
  min-height: 0;
  overflow: hidden;
  background: rgba(252, 255, 255, 0.64);
  box-shadow: 0 16px 28px rgba(27, 48, 66, 0.1);
}

.profile-head,
.card-heading,
.rank-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.profile-head {
  justify-content: start;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, #284667, #3d6289);
  color: white;
}

.profile-lines {
  margin-top: 10px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.hub-panel {
  display: grid;
  gap: 12px;
  max-height: min(66vh, 620px);
  overflow: auto;
  overscroll-behavior: contain;
}

.rail-card.hub-panel {
  overflow: auto;
}

.rank-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.rank-item {
  border-radius: 16px;
  padding: 10px 11px;
  border: 1px solid rgba(80, 92, 94, 0.08);
  background: rgba(246, 250, 254, 0.66);
  align-items: center;
}

.rank-podium-1 {
  background: linear-gradient(180deg, rgba(255, 247, 217, 0.9), rgba(255, 255, 255, 0.8));
  border-color: rgba(213, 161, 52, 0.24);
}

.rank-podium-2 {
  background: linear-gradient(180deg, rgba(242, 245, 250, 0.9), rgba(255, 255, 255, 0.8));
  border-color: rgba(143, 157, 175, 0.22);
}

.rank-podium-3 {
  background: linear-gradient(180deg, rgba(247, 233, 221, 0.9), rgba(255, 255, 255, 0.8));
  border-color: rgba(164, 117, 78, 0.24);
}

.rank-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.rank-main strong {
  line-height: 1.25;
}

.rank-leading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.rank-score {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.rank-score b {
  font-size: 14px;
  color: #8d5f1f;
}

.rank-badge {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  position: relative;
  border: 1px solid rgba(73, 90, 101, 0.24);
  background: rgba(236, 243, 249, 0.92);
  color: #4b6072;
  flex: 0 0 auto;
}

.rank-badge svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rank-badge-number {
  position: absolute;
  right: -4px;
  top: -4px;
  min-width: 13px;
  height: 13px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 3px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: #335273;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.rank-badge-1 {
  color: #a2771a;
  border-color: rgba(183, 134, 33, 0.3);
  background: rgba(255, 243, 198, 0.88);
}

.rank-badge-2 {
  color: #607385;
  border-color: rgba(116, 134, 151, 0.3);
  background: rgba(236, 241, 246, 0.92);
}

.rank-badge-3 {
  color: #885a32;
  border-color: rgba(145, 98, 62, 0.28);
  background: rgba(247, 233, 219, 0.9);
}

.tabs-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-button {
  border: 1px solid rgba(80, 92, 94, 0.08);
  background: rgba(245, 250, 255, 0.68);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: 0.18s ease;
}

.tab-button.active {
  background: #284667;
  color: #fbfaf7;
  border-color: transparent;
}

.auth-tabs {
  margin-bottom: 24px;
}

.auth-form-area {
  display: grid;
  gap: 16px;
}

.auth-form-area .coord-input {
  margin-top: 0; /* Override default margin since gap handles it */
}

.auth-form-area .section-line {
  margin: 4px 0;
}

.me-summary {
  justify-content: flex-start;
}

.me-menu {
  display: grid;
  gap: 8px;
}

.me-menu-item {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(80, 92, 94, 0.08);
  background: rgba(245, 252, 255, 0.78);
  color: var(--text);
  border-radius: 18px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  cursor: pointer;
}

.me-menu-item.danger strong {
  color: #9c5a52;
}

.me-menu-copy {
  display: grid;
  gap: 4px;
}

.me-menu-copy span {
  font-size: 13px;
  color: var(--muted);
}

.me-menu-arrow {
  font-size: 22px;
  color: rgba(36, 55, 70, 0.48);
  line-height: 1;
}

.rank-list {
  align-content: start;
  overflow: auto;
}

.floating-panel {
  position: fixed;
  top: 24px;
  bottom: 24px;
  width: 380px;
  padding: 16px;
  border-radius: 24px;
  background: rgba(238, 247, 255, 0.84);
  border: 1px solid rgba(80, 92, 94, 0.08);
  box-shadow: 0 20px 38px rgba(27, 48, 66, 0.14);
  z-index: 1300;
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
  backdrop-filter: blur(16px);
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(36, 55, 70, 0.18);
  backdrop-filter: blur(8px);
  z-index: 1400;
  display: grid;
  place-items: center;
}

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

.upload-modal {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 18px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(80, 92, 94, 0.08);
  box-shadow: 0 28px 54px rgba(83, 72, 58, 0.18);
  display: grid;
  gap: 14px;
  backdrop-filter: blur(18px);
}

.login-modal {
  width: min(420px, calc(100vw - 32px));
}

.upload-dropzone {
  border: 1px dashed rgba(80, 92, 94, 0.18);
  border-radius: 20px;
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 6px;
  background: rgba(248, 250, 252, 0.8);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.upload-dropzone.dragover {
  border-color: rgba(40, 70, 103, 0.38);
  background: rgba(244, 249, 250, 0.92);
  transform: translateY(-1px);
}

.manual-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.location-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.coord-input {
  width: 100%;
  margin-top: 6px;
  border: 1px solid rgba(80, 92, 94, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
}

.admin-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.admin-role-select {
  min-width: 112px;
  padding: 6px 8px;
  margin-top: 0;
}

.location-search-input {
  min-width: 0;
  margin-top: 0;
}

.search-button {
  width: auto;
  white-space: nowrap;
}

.mini-map {
  height: 240px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(80, 92, 94, 0.08);
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
}

.upload-confirm {
  width: 100%;
  justify-self: stretch;
}

.upload-confirm:disabled {
  opacity: 0.68;
  cursor: wait;
}

.upload-preview-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(80, 92, 94, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

.upload-preview-card img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  background: rgba(226, 232, 240, 0.9);
}

.upload-preview-meta {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
}

.upload-preview-meta strong,
.upload-preview-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-preview-meta span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}


#agentPanel {
  right: 24px;
}

#myWorksPanel {
  right: 24px;
}

.floating-header,
.section-line,
.agent-summary,
.owned-portal-item,
.photo-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.close-button,
.fold-button,
.author-link {
  border: 1px solid rgba(80, 92, 94, 0.08);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
}

.close-button {
  width: 34px;
  height: 34px;
  font-size: 20px;
}

.fold-button {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
}

.passkey-button {
  border-radius: 12px;
  background: rgba(236, 245, 255, 0.86);
}

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

.google-signin-container {
  min-height: 42px;
  display: grid;
  justify-content: center;
}

.floating-description,
.photo-note,
.owned-portal-item span,
.agent-meta span {
  color: var(--muted);
}

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

.photo-author-avatar {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(80, 92, 94, 0.18);
  box-shadow: 0 1px 4px rgba(22, 37, 56, 0.16);
  flex: 0 0 auto;
}

.photo-author-avatar-fallback {
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background-color: #2f537d;
}

.photo-capture-time {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(90, 104, 117, 0.9);
}

.section-block {
  display: grid;
  gap: 10px;
}

.editor-field {
  display: grid;
  gap: 6px;
}

.editor-modal-header {
  align-items: flex-start;
}

.editor-title-wrap {
  display: grid;
  gap: 6px;
}

.editor-title-wrap .small-label {
  margin: 0;
}

.editor-title-wrap h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.editor-field-label {
  padding-left: 2px;
}

.editor-section-line {
  justify-content: flex-start;
  align-items: flex-start;
}

.editor-section-copy {
  display: grid;
  gap: 4px;
}

.editor-section-copy h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.editor-section-copy .meta-text {
  padding-left: 2px;
}

.portal-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat-chip {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(80, 92, 94, 0.08);
  background: rgba(244, 248, 252, 0.82);
  display: grid;
  gap: 4px;
}

.stat-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.portal-meta-block {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.portal-meta-row {
  margin: 0;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-size: 13px;
  line-height: 1.4;
}

.portal-meta-label {
  font-size: 11px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 1px;
}

.portal-share-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.portal-share-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.portal-address-line {
  margin: 6px 0 0;
  font-size: 14px;
  color: rgba(44, 54, 56, 0.78);
  line-height: 1.4;
}

.portal-coord-line {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.portal-share-bar {
  margin-bottom: 12px;
  position: relative;
}

.portal-share-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(80, 92, 94, 0.1);
  background: rgba(255, 255, 255, 0.78);
  color: #2a3f56;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.build-info-heading {
  font-size: 26px;
  letter-spacing: -0.02em;
}

.build-info-current {
  display: grid;
  gap: 8px;
  padding: 14px 16px 15px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(250, 253, 255, 0.94), rgba(244, 249, 252, 0.92));
  border: 1px solid rgba(80, 92, 94, 0.1);
}

.build-info-current-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}

.build-info-current-line strong {
  font-size: 24px;
  line-height: 1.1;
}

.build-info-current-line span {
  font-size: 13px;
  color: var(--muted);
}

.build-info-release-name {
  font-size: 12px;
  color: rgba(44, 54, 56, 0.58);
}

.build-info-list {
  max-height: min(48vh, 430px);
  overflow: auto;
  padding-right: 4px;
}

.build-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.build-history-item {
  border-radius: 16px;
  border: 1px solid rgba(80, 92, 94, 0.1);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 4px 14px rgba(37, 57, 76, 0.06);
  overflow: hidden;
}

.build-history-trigger {
  width: 100%;
  border: 0;
  background: linear-gradient(90deg, rgba(226, 236, 245, 0.66), rgba(255, 255, 255, 0.92));
  color: #223648;
  text-align: left;
  padding: 12px 42px 12px 14px;
  font-family: "Avenir Next", "Hiragino Sans GB", "PingFang SC", sans-serif;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  position: relative;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.build-history-trigger:focus-visible {
  outline: 2px solid rgba(52, 92, 124, 0.34);
  outline-offset: -2px;
}

.build-history-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: rgba(60, 77, 98, 0.58);
  transition: transform 180ms ease;
}

.build-history-item.expanded .build-history-arrow {
  transform: translateY(-50%) rotate(90deg);
}

.build-history-detail {
  display: grid;
  gap: 10px;
  padding: 10px 14px 12px;
  border-top: 1px solid rgba(80, 92, 94, 0.08);
  background: linear-gradient(180deg, rgba(248, 251, 254, 0.8), rgba(255, 255, 255, 0.88));
}

.build-history-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  font-size: 13px;
}

.build-history-detail-head strong {
  font-size: 15px;
  line-height: 1.4;
}

.build-history-detail-head span {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.build-history-detail-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: rgba(44, 54, 56, 0.84);
  font-size: 13px;
  line-height: 1.5;
}

.build-history-empty {
  margin: 0;
  padding: 14px 16px;
  color: var(--muted);
  font-size: 13px;
}

#buildInfoModal .upload-modal {
  width: min(640px, calc(100vw - 28px));
  padding: 20px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(253, 254, 255, 0.96), rgba(246, 250, 253, 0.96));
}

.portal-share-trigger svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.portal-share-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 20;
  min-width: 180px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(251, 252, 253, 0.95);
  border: 1px solid rgba(80, 92, 94, 0.12);
  box-shadow: 0 18px 30px rgba(24, 36, 48, 0.16);
  backdrop-filter: blur(12px);
}

.portal-share-item {
  border: 0;
  border-radius: 10px;
  text-align: left;
  padding: 9px 10px;
  font-size: 13px;
  color: #26394d;
  background: rgba(241, 245, 249, 0.82);
  cursor: pointer;
}

.portal-share-item:hover {
  background: rgba(226, 236, 247, 0.88);
}

@media (max-width: 720px) {
  .portal-share-bar {
    margin-bottom: 10px;
  }

  #portalPanel[data-share-mode="fallback"] .portal-share-menu {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
    top: auto;
    border-radius: 20px;
    padding: 10px;
    background: rgba(248, 251, 255, 0.96);
    border: 1px solid rgba(128, 152, 176, 0.28);
    box-shadow: 0 24px 40px rgba(24, 36, 48, 0.18);
    backdrop-filter: blur(18px);
  }

  #portalPanel[data-share-mode="fallback"] .portal-share-item {
    padding: 12px 13px;
    border-radius: 12px;
    font-size: 14px;
  }
}

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

.photo-list.collapsed {
  display: none;
}

.photo-card {
  border: 1px solid rgba(80, 92, 94, 0.08);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(244, 248, 252, 0.84);
  position: relative;
  transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

.photo-card:hover {
  transform: translateY(-2px);
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.photo-media {
  position: relative;
}

.photo-meta-chip {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border-radius: 999px;
  background: rgba(18, 28, 39, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(6px);
  max-width: calc(100% - 20px);
}

.photo-meta-chip .photo-author-avatar {
  width: 20px;
  height: 20px;
  border-color: rgba(255, 255, 255, 0.38);
  box-shadow: none;
}

.photo-meta-chip-text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-card.mosaic-item {
  aspect-ratio: 1 / 1;
}

.photo-card.hero-item {
  aspect-ratio: 16 / 10;
}

.photo-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.64) 100%);
  color: white;
  pointer-events: none;
  display: grid;
  gap: 2px;
}

.photo-overlay * {
  pointer-events: auto;
}

.photo-overlay-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 5px;
  border-radius: 999px;
  background: rgba(18, 28, 39, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.22);
  width: fit-content;
  max-width: 100%;
}

.photo-overlay-chip .photo-author-avatar {
  width: 18px;
  height: 18px;
  border-color: rgba(255, 255, 255, 0.38);
  box-shadow: none;
}

.photo-overlay-author {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-overlay-meta {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.72);
}

.photo-overlay-like {
  justify-self: start;
  margin-top: 4px;
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(18, 28, 39, 0.62);
  color: rgba(255, 255, 255, 0.96);
}

.photo-overlay-like.liked {
  background: rgba(59, 120, 183, 0.35);
  border-color: rgba(155, 201, 245, 0.72);
  color: #fff;
}

.photo-mosaic {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.photo-mosaic .hero-item {
  grid-column: span 3;
}

.photo-mosaic .compact-hidden {
  display: none;
}

.photo-body {
  padding: 12px;
  display: grid;
  gap: 8px;
}

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

.like-button.liked {
  background: rgba(43, 92, 140, 0.14);
  border-color: rgba(43, 92, 140, 0.28);
  color: #244d77;
}

.like-button {
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.like-button.like-burst {
  animation: likeBurst 0.32s ease;
}

.profile-email-display {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(80, 92, 94, 0.1);
  background: rgba(255, 255, 255, 0.7);
  color: rgba(44, 54, 56, 0.88);
  font-size: 13px;
}

.profile-delete-account {
  margin-top: 10px;
  width: 100%;
  justify-content: center;
}

.author-link {
  padding: 6px 10px;
  font-size: 12px;
}

.subtle-link {
  border-color: rgba(80, 92, 94, 0.06);
  background: rgba(255, 255, 255, 0.72);
  color: rgba(44, 54, 56, 0.82);
}

.danger-link {
  color: #9c5a52;
  border-color: rgba(156, 90, 82, 0.12);
  background: rgba(255, 248, 246, 0.82);
}

.photo-rank {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.month-strip {
  display: grid;
  gap: 8px;
}

.month-slider-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.month-slider {
  width: 100%;
  accent-color: #284667;
}

.month-slider-value {
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
  min-width: 40px;
  text-align: right;
}

.month-chip {
  border: 1px solid rgba(80, 92, 94, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: rgba(44, 54, 56, 0.76);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: 0.18s ease;
}

.month-chip.active {
  background: #284667;
  color: #fbfaf7;
  border-color: transparent;
  box-shadow: 0 8px 16px rgba(40, 70, 103, 0.16);
}

.coord-inline-meta {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.agent-avatar {
  width: 54px;
  height: 54px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #284667, #3d6289);
  color: white;
  font-weight: 700;
  font-size: 22px;
}

.agent-meta {
  display: grid;
  gap: 6px;
}

.sheet-handle {
  display: grid;
  justify-items: center;
  padding: 4px 0 2px;
}

.sheet-handle span {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: rgba(51, 72, 86, 0.18);
}

.owned-portal-list {
  display: grid;
  gap: 8px;
}

.owned-portal-item {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(80, 92, 94, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

.editor-photo-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.editor-photo-thumb {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  object-fit: cover;
  display: block;
  background: rgba(226, 232, 240, 0.72);
}

.owned-portal-main {
  display: grid;
  gap: 4px;
}

.editor-photo-item .owned-portal-main {
  padding-top: 2px;
}

.editor-photo-item .owned-portal-main strong {
  font-size: 15px;
  line-height: 1.2;
}

.editor-photo-item .owned-portal-main span {
  line-height: 1.45;
}

.editor-photo-item .photo-head {
  justify-content: flex-start;
  gap: 8px;
  margin-top: 4px;
}

.editor-photo-actions .author-link {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
}

.editor-footer-actions {
  margin-top: 4px;
  align-items: center;
}

.editor-footer-actions .upload-confirm {
  width: auto;
  min-width: 128px;
  justify-self: auto;
}

.portal-rank-badge {
  min-width: 38px;
  text-align: center;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(211, 154, 59, 0.2);
  color: #9f6d21;
  font-weight: 700;
  font-size: 12px;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid rgba(80, 92, 94, 0.15);
  background: rgba(255, 255, 255, 0.82);
  color: #2a3d52;
}

.type-badge svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rank-score .type-badge {
  padding: 4px;
  min-width: 22px;
  min-height: 22px;
  justify-content: center;
}

.rank-score .type-badge span {
  display: none;
}

.type-badge-photo {
  background: rgba(74, 133, 193, 0.12);
  color: #2c5a88;
}

.type-badge-portal {
  background: rgba(211, 154, 59, 0.16);
  color: #94611d;
}

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

.showcase-card {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(80, 92, 94, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

.showcase-card img {
  width: 100%;
  height: 112px;
  object-fit: cover;
  display: block;
}

.photo-card img {
  cursor: zoom-in;
}

.lightbox-image {
  width: 100%;
  max-height: min(70vh, 720px);
  object-fit: contain;
  border-radius: 18px;
  background: rgba(226, 232, 240, 0.72);
  display: block;
}

.showcase-card div {
  padding: 8px 10px 10px;
  display: grid;
  gap: 4px;
}

.showcase-card span {
  font-size: 11px;
  color: var(--muted);
}

.rank-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.rank-leading {
  min-width: 0;
}

.rank-thumb {
  width: 58px;
  height: 58px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(80, 92, 94, 0.12);
  background: rgba(226, 232, 240, 0.75);
  flex-shrink: 0;
}

.rank-main strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.rank-main .meta-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-score b {
  white-space: nowrap;
}

.rank-tier-1 .rank-badge,
.rank-tier-2 .rank-badge,
.rank-tier-3 .rank-badge,
.rank-tier-4 .rank-badge,
.rank-tier-5 .rank-badge,
.rank-tier-6 .rank-badge {
  color: #2b4b6a;
}

.rank-tier-1 .rank-badge { color: #af7c1d; }
.rank-tier-2 .rank-badge { color: #6d7784; }
.rank-tier-3 .rank-badge { color: #8d5d3b; }
.rank-tier-4 .rank-badge { color: #316a75; }
.rank-tier-5 .rank-badge { color: #476d4a; }
.rank-tier-6 .rank-badge { color: #5c5c6a; }

.leaflet-control-zoom {
  margin-top: 98px !important;
  margin-left: 22px !important;
}

.leaflet-control-zoom a {
  width: 34px !important;
  height: 34px !important;
  line-height: 32px !important;
  border: 1px solid rgba(80, 92, 94, 0.08) !important;
  background: rgba(255, 255, 255, 0.78) !important;
  color: var(--text) !important;
  box-shadow: 0 10px 22px rgba(89, 79, 66, 0.08);
  backdrop-filter: blur(10px);
}

.leaflet-control-zoom a:hover {
  background: rgba(244, 248, 252, 0.96) !important;
}

.leaflet-control-attribution {
  display: none;
}

.leaflet-tile-pane {
  opacity: 1;
  filter: none;
}

.leaflet-container {
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
}


@keyframes pulse {
  0% {
    transform: scale(0.86);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.42);
    opacity: 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes likeBurst {
  0% { transform: scale(1); }
  35% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

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

  .side-rail {
    padding: 0 18px 18px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
    overflow: visible;
  }

  .side-rail .sheet-handle,
  .side-rail .rail-card {
    grid-column: 1 / -1;
  }

  #agentPanel {
    right: 18px;
    width: min(380px, calc(100vw - 36px));
  }

  #agentPanel {
    top: auto;
    bottom: 18px;
    max-height: 48vh;
  }
}

@media (max-width: 720px) {
  body {
    background: #edf3f5;
  }

  .map-view {
    padding: 0;
  }

  .map-canvas {
    min-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }

  .side-rail {
    position: fixed;
    left: 12px;
    right: 12px;
    margin: 0;
    bottom: calc(84px + env(safe-area-inset-bottom));
    width: auto;
    z-index: 1250;
    grid-template-columns: 1fr;
    grid-template-rows: none;
    align-content: start;
    gap: 10px;
    height: var(--sheet-height, auto);
    max-height: calc(100dvh - 100px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 0 4px;
    border-left: 0;
    border-radius: 30px;
    background: rgba(229, 238, 247, 0.66);
    box-shadow: 0 26px 60px rgba(46, 71, 84, 0.18);
    backdrop-filter: blur(26px) saturate(1.15);
    transform: translateY(0);
    transition: height 0.16s linear, transform 0.24s ease, opacity 0.2s ease;
  }

  .coord-input,
  .coord-input[type="text"],
  .coord-input[type="password"],
  .coord-input[type="email"],
  .coord-input[type="date"],
  .coord-input[type="datetime-local"],
  select.coord-input,
  textarea.coord-input {
    font-size: 16px;
  }
  
  .side-rail.dragging {
    transition: transform 0.24s ease, opacity 0.2s ease; /* Disable height transition while dragging */
  }

  .side-rail.rail-collapsed {
    transform: translateY(calc(100% + 100px));
    pointer-events: none;
    opacity: 0;
  }

  .sheet-handle {
    display: grid;
    justify-items: center;
    padding: 4px 0 2px;
    cursor: grab;
  }

  .sheet-handle span {
    width: 42px;
    height: 5px;
    border-radius: 999px;
    background: rgba(51, 72, 86, 0.18);
  }

  .app-shell.rail-collapsed .side-rail {
    opacity: 0;
    transform: translateY(calc(100% + 24px));
    padding: 12px 0 4px;
  }

  .rail-card {
    margin: 0 12px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(22px);
    overflow: visible;
  }

  .profile-card {
    order: 3;
  }

  .floating-panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: auto;
    max-height: min(70vh, 620px);
    border-radius: 30px;
    padding: 16px;
    box-shadow: 0 28px 64px rgba(46, 71, 84, 0.18);
    background: rgba(238, 247, 255, 0.78);
    backdrop-filter: blur(26px) saturate(1.12);
  }

  #portalPanel,
  #agentPanel,
  #myWorksPanel,
  #profilePanel {
    right: 12px;
  }

  .portal-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .upload-modal {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 24px);
    border-radius: 32px;
    padding: 16px;
  }

  .upload-preview-card {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .upload-preview-card img {
    width: 92px;
    height: 92px;
  }

  .mini-map {
    height: 220px;
  }

  .photo-card img {
    height: 164px;
  }

  .editor-photo-item {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .editor-photo-thumb {
    width: 64px;
    height: 64px;
  }

  .mobile-dock {
    left: 12px;
    right: 12px;
    width: auto;
    transform: none;
    bottom: calc(10px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mobile-dock-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: rgba(33, 52, 71, 0.78);
    border-radius: 18px;
    min-height: 56px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
  }

  .mobile-dock-button-primary {
    background: linear-gradient(180deg, #2f537d 0%, #284667 100%);
    color: #fffdfa;
    box-shadow: 0 14px 26px rgba(40, 70, 103, 0.26);
  }

  .mobile-dock-icon {
    width: 18px;
    height: 18px;
    display: grid;
    place-items: center;
  }

  .mobile-dock-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .leaflet-control-zoom {
    margin-top: 108px !important;
    margin-left: 14px !important;
  }
}
