:root {
  --bg: #fbfaf3;
  --surface: #ffffff;
  --surface-soft: #f2f5f9;
  --text: #20252d;
  --muted: #77808d;
  --line: #dfe4ec;
  --accent: #2f7df6;
  --accent-strong: #1764df;
  --sunny: #ffd84d;
  --mint: #55c7b8;
  --danger: #df3f48;
  --shadow: 0 18px 42px rgba(34, 44, 59, 0.14);
  --soft-shadow: 0 8px 24px rgba(34, 44, 59, 0.09);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  min-height: 100vh;
  max-width: 520px;
  margin: 0 auto;
  background:
    radial-gradient(circle at 9% 130px, rgba(255, 216, 77, 0.22) 0 18px, transparent 19px),
    radial-gradient(circle at 92% 210px, rgba(85, 199, 184, 0.16) 0 24px, transparent 25px),
    linear-gradient(180deg, #fffefa 0%, #f7f9fb 100%);
  position: relative;
  overflow: hidden;
}

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

.app::before {
  width: 140px;
  height: 190px;
  right: -52px;
  top: 112px;
  background:
    radial-gradient(circle at 36px 36px, rgba(255, 216, 77, 0.34) 0 10px, transparent 11px),
    radial-gradient(circle at 88px 96px, rgba(47, 125, 246, 0.12) 0 8px, transparent 9px),
    radial-gradient(circle at 42px 150px, rgba(85, 199, 184, 0.18) 0 12px, transparent 13px);
}

.app::after {
  width: 160px;
  height: 120px;
  left: -56px;
  top: 360px;
  opacity: 0.45;
  background:
    radial-gradient(ellipse at 22px 24px, #ffd84d 0 10px, transparent 11px),
    radial-gradient(ellipse at 72px 54px, #ffd84d 0 8px, transparent 9px),
    radial-gradient(ellipse at 120px 88px, #ffd84d 0 9px, transparent 10px);
}

.app-header {
  padding: max(22px, env(safe-area-inset-top)) 18px 12px;
  background: rgba(251, 252, 254, 0.92);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(223, 228, 236, 0.72);
}

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

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

.header-actions,
.map-controls {
  display: flex;
  gap: 10px;
}

.icon-btn,
.zoom-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface);
  color: #323943;
  box-shadow: 0 2px 10px rgba(42, 48, 60, 0.08);
  border: 1px solid rgba(223, 228, 236, 0.9);
}

.icon-btn svg,
.zoom-btn svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.2;
}

.search-shell {
  margin-top: 18px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.search-shell svg {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
}

.search-shell input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

.map-stage {
  height: min(56vh, 520px);
  min-height: 390px;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  touch-action: pan-y;
  background:
    radial-gradient(circle at 84% 18%, rgba(255, 216, 77, 0.22) 0 34px, transparent 35px),
    radial-gradient(circle at 82% 70%, rgba(121, 188, 230, 0.42), transparent 30%),
    linear-gradient(145deg, #fff8d9 0%, #e9f6ed 48%, #d8ecf8 100%);
}

.map-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 980px;
  height: 720px;
  transform-origin: 0 0;
  will-change: transform;
}

.china-map {
  width: 980px;
  height: 720px;
  position: absolute;
  left: 0;
  top: 0;
}

.land {
  fill: #edf2e8;
  stroke: #9eb99c;
  stroke-width: 2.2;
}

.province-line {
  fill: none;
  stroke: rgba(104, 148, 167, 0.42);
  stroke-width: 1.2;
  stroke-dasharray: 5 7;
}

.river {
  fill: none;
  stroke: rgba(80, 158, 204, 0.42);
  stroke-width: 2;
}

.sea-label {
  fill: rgba(46, 101, 139, 0.62);
  font-size: 18px;
  font-weight: 650;
}

.city-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  display: grid;
  justify-items: center;
  gap: 4px;
  color: #3b6ebc;
  background: transparent;
  min-width: 68px;
  min-height: 72px;
  padding: 10px 8px 0;
  z-index: 3;
  touch-action: manipulation;
}

.pin-dot {
  width: 22px;
  height: 28px;
  border-radius: 14px 14px 14px 3px;
  transform: rotate(-45deg);
  background: #5b91e5;
  border: 3px solid #fff;
  box-shadow: 0 3px 8px rgba(39, 73, 125, 0.26);
  position: relative;
}

.pin-dot::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.pin-label {
  padding: 3px 8px 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 2px 8px rgba(34, 44, 59, 0.08);
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
  color: #2b3441;
  white-space: nowrap;
}

.city-pin.active .pin-dot {
  width: 38px;
  height: 48px;
  background: var(--accent);
  border-width: 4px;
}

.city-pin.active .pin-label {
  color: #fff;
  background: var(--accent);
}

.map-hint {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: #4d5967;
  font-size: 12px;
  box-shadow: var(--soft-shadow);
}

.rabbit-sticker {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 86px;
  height: 84px;
  z-index: 2;
  filter: drop-shadow(0 8px 16px rgba(174, 137, 29, 0.18));
  pointer-events: none;
}

.rabbit-sticker svg {
  width: 100%;
  height: 100%;
}

.city-sheet {
  position: relative;
  z-index: 6;
  margin-top: -54px;
  padding: 18px 14px 112px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), #ffffff),
    radial-gradient(circle at 94% 28px, rgba(255, 216, 77, 0.22), transparent 54px);
  border-radius: 8px 8px 0 0;
  box-shadow: var(--shadow);
}

.selected-city {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  align-items: center;
  gap: 14px;
}

.city-cover {
  width: 74px;
  height: 74px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-soft);
}

.selected-city h2 {
  margin: 0 0 5px;
  font-size: 26px;
  line-height: 1.1;
}

.muted {
  color: var(--muted);
}

.outline-btn {
  height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid rgba(47, 125, 246, 0.42);
  color: var(--accent);
  background: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.photo-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(128px, 35%);
  gap: 10px;
  overflow-x: auto;
  padding: 18px 0 16px;
  scrollbar-width: none;
}

.photo-strip::-webkit-scrollbar,
.city-tabs::-webkit-scrollbar {
  display: none;
}

.memory-card {
  position: relative;
  min-height: 116px;
  aspect-ratio: 1 / 0.82;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: 0 1px 0 rgba(34, 44, 59, 0.04);
}

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

.date-chip {
  position: absolute;
  left: 7px;
  bottom: 7px;
  max-width: calc(100% - 14px);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.88);
  color: #222831;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.city-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(152px, 42%);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.city-tab {
  min-width: 0;
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f9fafc;
}

.city-tab.active {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(47, 125, 246, 0.14) inset;
}

.city-tab img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
}

.city-tab strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.city-tab span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.section-title {
  margin: 22px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title h3 {
  margin: 0;
  font-size: 20px;
}

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

.memory-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.memory-row img {
  width: 92px;
  height: 76px;
  border-radius: 8px;
  object-fit: cover;
}

.memory-row h4 {
  margin: 0 0 6px;
  font-size: 16px;
}

.memory-row p {
  margin: 3px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.row-actions {
  display: grid;
  gap: 6px;
}

.mini-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-soft);
  color: #4e5966;
}

.mini-btn.danger {
  color: var(--danger);
}

.fab {
  width: 66px;
  height: 66px;
  position: fixed;
  right: max(18px, calc((100vw - 520px) / 2 + 18px));
  bottom: calc(22px + env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 28px rgba(47, 125, 246, 0.36);
  z-index: 30;
}

.fab svg {
  width: 34px;
  height: 34px;
}

.empty {
  padding: 28px 18px;
  border: 1px dashed #c9d1dd;
  border-radius: 8px;
  text-align: center;
  color: var(--muted);
  background: #fbfcfe;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(22, 29, 38, 0.26);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.drawer {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 45;
  width: min(100%, 520px);
  max-height: 88vh;
  transform: translate(-50%, 102%);
  background: #fff;
  border-radius: 8px 8px 0 0;
  box-shadow: var(--shadow);
  padding: 12px 18px calc(18px + env(safe-area-inset-bottom));
  transition: transform 0.24s ease;
  overflow-y: auto;
}

.drawer.open {
  transform: translate(-50%, 0);
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-handle {
  width: 66px;
  height: 5px;
  border-radius: 999px;
  background: #c6cbd3;
  margin: 0 auto 18px;
}

.drawer-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.drawer-title h2 {
  margin: 0;
  font-size: 24px;
}

.save-btn {
  color: var(--accent);
  background: transparent;
  font-size: 18px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.field {
  min-height: 66px;
  display: grid;
  grid-template-columns: 36px 76px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
}

.field + .field {
  border-top: 1px solid var(--line);
}

.field svg {
  width: 24px;
  height: 24px;
  color: #697280;
}

.field label {
  font-size: 17px;
  font-weight: 650;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #5e6672;
  background: transparent;
  text-align: right;
}

.field textarea {
  min-height: 54px;
  resize: vertical;
  text-align: left;
  padding: 8px 0;
}

.photo-field {
  align-items: start;
}

.photo-tools {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.upload-box {
  width: 86px;
  height: 72px;
  border: 1px dashed #b9c1cc;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #3b424c;
  background: #fbfcfe;
}

.preview-image {
  width: 116px;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 380px) {
  h1 {
    font-size: 30px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
  }

  .selected-city {
    grid-template-columns: 64px 1fr;
  }

  .selected-city .outline-btn {
    grid-column: 1 / -1;
  }

  .memory-row {
    grid-template-columns: 78px 1fr;
  }

  .memory-row img {
    width: 78px;
    height: 70px;
  }

  .row-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
  }
}
