* {
  box-sizing: border-box;
}

:root {
  --pink: #ff6b9d;
  --blue: #6BAEFF;
  --pink-dark: #e0507f;
  --bg: linear-gradient(90deg, #aee4ff 0%, #ffccd5 100%);
  --card-bg: linear-gradient(180deg, #aee4ff 0%, #ffccd5 100%);
  --text: #f2f2f7;
  --text-dim: #a3a3b8;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: white;
}

.header {
  position: relative;
  text-align: center;
  padding: 24px 16px 8px;
}

/* Placeholder for user photos: solid black "photo" card with a white frame.
   Swap background-image in on each .decor-photo once real photos are ready. */
.decor-photo {
  background-size: cover;
  background-position: center;
}

.header-decor {
  position: absolute;
  top: 14px;
  width: 56px;
  height: 72px;
}

.header-decor-left {
  background-image: url('assets/wlj_dog_25ydh.PNG');
  left: clamp(8px, 5vw, 60px);
  transform: rotate(8deg);
  width: 100px;
}

.header-decor-right {
  background-image: url('assets/mzc_cat_25ydh.PNG');
  right: clamp(8px, 5vw, 60px);
  transform: rotate(-8deg);
  width: 100px;
}

@media (max-width: 480px) {
  .header-decor {
    display: none;
  }
}

.header h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 4vw, 32px);
}

.subtitle {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.globe-container {
  position: relative;
  width: 100%;
  height: min(60vh, 560px);
  min-height: 320px;
  cursor: grab;
}

.globe-container:active {
  cursor: grabbing;
}

.map-svg {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.map-country {
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: 0.8;
}

.map-province {
  fill: #fdf6f0;
  stroke: var(--text-dim);
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
  opacity: 0.5;
}

.province-label {
  fill: white;
  font-size: 10px;
  font-weight: 500;
  text-anchor: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.2);
  stroke-width: 1.5px;
  stroke-linejoin: round;
}

.globe-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 14px;
  pointer-events: none;
}

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

.map-marker {
  cursor: pointer;
}

.marker-dot {
  fill: url(#markerGradient);
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.95)) drop-shadow(0 0 6px rgba(255, 224, 102, 0.85)) drop-shadow(0 0 12px rgba(255, 196, 0, 0.6));
  transform-origin: 0 0;
  animation: marker-pulse 1.8s ease-in-out infinite;
}

@keyframes marker-pulse {
  0%,
  100% {
    opacity: 0.8;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

.marker-badge-circle {
  fill: var(--pink);
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.4));
}

.marker-badge-text {
  fill: white;
  font-size: 9px;
  font-weight: 700;
  font-family: inherit;
}

.form-section {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.upload-form {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 20px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.upload-form h2,
.list-section h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.upload-form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.upload-form-heading h2 {
  margin: 0;
}

.form-decor {
  background-image: url('assets/lumu_orangebrown_scarf.PNG');
  flex-shrink: 0;
  width: 150px;
  height: 80px;
}

.upload-form label {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
}

.upload-form input[type="text"],
.upload-form input[type="file"] {
  background: #FAF8F5;
  border: 1px solid #D7D8EA;
  color: var(--text-dim);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

.upload-form input[type="text"]:focus {
  outline: none;
  border-color: #D7D8EA;
}

.photo-preview-wrap {
  margin-top: 4px;
}

.photo-preview-wrap.hidden {
  display: none;
}

.photo-preview {
  max-width: 100%;
  max-height: 220px;
  border-radius: 10px;
  display: block;
  object-fit: cover;
}

#submitBtn {
  margin-top: 14px;
  background: linear-gradient(135deg, #aee4ff 0%, #ffccd5 80%);
  color: white;
  border: 0.5px solid white;
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

#submitBtn:hover {
  opacity: 0.9;
}

#submitBtn:active {
  transform: scale(0.98);
}

#submitBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-status {
  min-height: 18px;
  font-size: 13px;
  margin: 4px 0 0;
  color: var(--text-dim);
}

.form-status.error {
  color: #ff6b6b;
}

.form-status.success {
  color: #6bffb0;
}

.list-section {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.marker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.marker-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.marker-list li:hover {
  background: #D7D8EA;
}

.marker-list img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.marker-list .marker-info {
  min-width: 0;
}

.marker-list .marker-address {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.marker-list .marker-date {
  font-size: 11px;
  color: var(--text-dim);
}

.marker-photo-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  margin-left: 2px;
}

.marker-list .empty {
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 0;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  background: linear-gradient(180deg, #aee4ff 0%, #ffccd5 100%);
  border-radius: 16px;
  padding: 16px;
  max-width: min(90vw, 480px);
  /* No overflow clipping here on purpose — .modal-decor needs to spill past
     these edges. The actual scrolling happens one level in, on .modal-scroll. */
  z-index: 1;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.modal-scroll {
  max-height: 90vh;
  overflow-y: auto;
}

.modal-decor {
  position: absolute;
  top: -22px;
  width: 64px;
  height: 82px;
  z-index: 3;
}

.modal-decor-left {
  background-image: url('assets/wlj_capybara.PNG');
  left: -16px;
  transform: rotate(12deg);
}

.modal-decor-right {
  background-image: url('assets/mzc_rabbit.PNG');
  top: auto;
  bottom: -22px;
  right: -16px;
  transform: rotate(12deg);
}

.modal-photo-wrap {
  position: relative;
}

.modal-img {
  width: 100%;
  border-radius: 10px;
  display: block;
  max-height: 60vh;
  object-fit: contain;
  background: #000;
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 4;
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-nav:hover {
  background: rgba(0, 0, 0, 0.65);
}

.modal-nav-prev {
  left: 8px;
}

.modal-nav-next {
  right: 8px;
}

.modal-caption {
  margin-top: 12px;
}

.modal-address {
  font-size: 15px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.modal-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.modal-date {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.modal-counter {
  font-size: 12px;
  font-weight: 600;
  color: white;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 8px;
  border-radius: 999px;
}

.modal-delete {
  margin-top: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: white;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}

.modal-delete:hover {
  background: rgba(0, 0, 0, 0.4);
}
