:root {
  color-scheme: light;
  --bg: #fff7fb;
  --surface: #ffffff;
  --surface-strong: #fff0f6;
  --ink: #22242a;
  --muted: #6d7280;
  --line: #eadde5;
  --rose: #d93669;
  --rose-dark: #a91f4a;
  --mint: #2f9d85;
  --sky: #3a75c4;
  --gold: #f3a53f;
  --shadow: 0 18px 45px rgba(112, 45, 76, 0.12);
  --page-bg:
    radial-gradient(circle at top left, rgba(217, 54, 105, 0.12), transparent 30rem),
    linear-gradient(180deg, #fff7fb 0%, #f8fbff 100%);
  --topbar-bg: rgba(255, 247, 251, 0.88);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page-bg);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.theme-night {
  --bg: #10131d;
  --surface: #171c2b;
  --surface-strong: #232a3d;
  --ink: #f6f2f6;
  --muted: #b7bfce;
  --line: rgba(218, 226, 244, 0.16);
  --rose: #f06a98;
  --rose-dark: #ff8ab0;
  --mint: #65d1bd;
  --sky: #88b8ff;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.26);
  --page-bg:
    radial-gradient(circle at 80% 8%, rgba(136, 184, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 12% 22%, rgba(240, 106, 152, 0.12), transparent 26rem),
    linear-gradient(180deg, #10131d 0%, #171c2b 100%);
  --topbar-bg: rgba(16, 19, 29, 0.88);
}

body.theme-night .topbar {
  border-bottom-color: var(--line);
}

body.theme-night input,
body.theme-night select,
body.theme-night textarea,
body.theme-night .weather-chip,
body.theme-night .weather-select-label {
  background: #151a29;
  color: var(--ink);
}

body.theme-night option {
  background: #151a29;
  color: var(--ink);
}

body.theme-night .locked-state,
body.theme-night .panel,
body.theme-night .empty-state,
body.theme-night .story-card,
body.theme-night .photo-card,
body.theme-night .markdown-preview-wrap,
body.theme-night .trip-group,
body.theme-night .trip-city-group,
body.theme-night .trip-place-item,
body.theme-night .login-card {
  background: rgba(23, 28, 43, 0.82);
}

body.theme-night .markdown-toolbar button {
  background: rgba(240, 106, 152, 0.14);
  border-color: rgba(240, 106, 152, 0.24);
  color: var(--rose-dark);
}

body.theme-night .markdown-body {
  color: var(--ink);
}

body.theme-night .story-card p,
body.theme-night .photo-body p,
body.theme-night .photo-excerpt,
body.theme-night .markdown-body p,
body.theme-night .markdown-body li,
body.theme-night .markdown-body blockquote {
  color: #d7deea;
}

body.theme-night .story-excerpt,
body.theme-night .story-meta,
body.theme-night .photo-meta {
  color: #aeb8c9;
}

body.theme-night .markdown-body code {
  background: rgba(255, 255, 255, 0.1);
}

body.theme-night .weather-city-card {
  border-color: rgba(218, 226, 244, 0.16);
}

body.theme-night .weather-city-card p {
  color: var(--ink);
}

body.theme-night .md-color-rose {
  color: #ff8ab0;
}

body.theme-night .md-color-sky {
  color: #9fc7ff;
}

body.theme-night .md-color-mint {
  color: #7fe0d0;
}

body.theme-night .map-board,
body.theme-night .ocean {
  background: #141b2b;
  fill: #141b2b;
}

body.theme-night .world-country,
body.theme-night .map-region path,
body.theme-night .map-region ellipse,
body.theme-night .admin-city {
  fill: rgba(23, 28, 43, 0.74);
}

body.theme-night .map-hint,
body.theme-night .map-toolbar,
body.theme-night .map-tool {
  background: rgba(23, 28, 43, 0.76);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 22px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid rgba(234, 221, 229, 0.85);
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

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

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
}

.nav-links {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: clamp(12px, 3vw, 32px);
  color: var(--muted);
}

.nav-links a:hover {
  color: var(--rose-dark);
}

.site-search {
  flex: 0 1 240px;
}

.site-search input {
  min-height: 38px;
  border-color: rgba(234, 221, 229, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0 14px;
}

.session-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 150px;
}

.user-badge {
  max-width: 120px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 72px;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.75fr);
  gap: 18px;
  align-items: stretch;
}

.intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(26px, 6vw, 68px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(217, 54, 105, 0.13), rgba(47, 157, 133, 0.1)),
    var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--rose-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  max-width: 780px;
  margin-bottom: 18px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(26px, 4vw, 40px);
  letter-spacing: 0;
}

.inline-add {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-right: 10px;
  border: 1px solid rgba(217, 54, 105, 0.2);
  border-radius: 999px;
  background: rgba(255, 240, 246, 0.86);
  color: var(--rose-dark);
  cursor: pointer;
  font: inherit;
  font-size: 22px;
  font-weight: 900;
  vertical-align: 0.08em;
}

.inline-add:hover {
  background: var(--surface-strong);
}

h3 {
  margin-bottom: 18px;
  font-size: 20px;
}

.intro-copy {
  max-width: 620px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--rose);
  color: white;
}

.button.primary:hover {
  background: var(--rose-dark);
}

.button.soft {
  border-color: rgba(47, 157, 133, 0.22);
  background: rgba(47, 157, 133, 0.1);
  color: #116b59;
}

.button.ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.66);
  color: var(--ink);
}

.button.danger {
  min-height: 34px;
  padding: 0 12px;
  border-color: rgba(217, 54, 105, 0.24);
  background: rgba(217, 54, 105, 0.08);
  color: var(--rose-dark);
  font-size: 13px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.entry-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 138px;
  padding: 16px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 240, 246, 0.9), rgba(237, 248, 255, 0.82)),
    var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow);
}

.entry-toggle strong {
  font-size: 18px;
  line-height: 1.35;
}

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

.entry-toggle.is-open {
  border-color: rgba(217, 54, 105, 0.24);
  background: rgba(255, 255, 255, 0.78);
}

.stats-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.stats-panel > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 108px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stats-panel span {
  color: var(--rose-dark);
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.stats-panel small {
  margin-top: 8px;
  color: var(--muted);
}

.love-clock-card {
  position: relative;
  overflow: hidden;
  min-height: 176px;
  background:
    radial-gradient(circle at 88% 16%, rgba(243, 165, 63, 0.28), transparent 88px),
    linear-gradient(145deg, rgba(217, 54, 105, 0.13), rgba(58, 117, 196, 0.08)),
    var(--surface);
}

.love-clock-card .eyebrow {
  margin-bottom: 10px;
}

.love-clock-card span {
  color: var(--rose-dark);
  font-size: 44px;
}

.love-clock-hero {
  min-height: 430px;
}

.love-clock-hero span {
  margin: 6px 0 10px;
  font-size: clamp(56px, 8vw, 96px);
}

.love-clock-hero small {
  font-size: 17px;
}

.love-clock-hero .clock-grid {
  width: min(100%, 580px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.love-clock-hero .clock-grid strong {
  padding: 12px 14px;
  font-size: 18px;
}

.love-clock-hero .intro-copy {
  position: relative;
  z-index: 1;
  margin: 20px 0 0;
  max-width: 640px;
}

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

.clock-grid strong {
  min-width: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 15px;
}

.orbit {
  position: absolute;
  right: -34px;
  bottom: -40px;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(217, 54, 105, 0.18);
  border-radius: 50%;
  animation: spin 14s linear infinite;
}

.orbit i {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--rose);
}

.orbit i:first-child {
  top: 18px;
  left: 22px;
}

.orbit i:last-child {
  right: 18px;
  bottom: 28px;
  background: var(--mint);
}

.weather-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 430px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.92), transparent 76px),
    linear-gradient(145deg, rgba(58, 117, 196, 0.14), rgba(217, 54, 105, 0.08)),
    var(--surface);
  box-shadow: var(--shadow);
}

.weather-card::after {
  position: absolute;
  right: -20px;
  bottom: -34px;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.48);
  content: "";
}

.weather-pair {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  flex: 1;
}

.weather-city-card {
  display: grid;
  gap: 7px;
  align-content: center;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
}

.weather-city-card span {
  color: var(--sky);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.weather-city-card small {
  margin-top: 0;
  color: var(--muted);
  font-size: 13px;
}

.weather-city-card p:not(.eyebrow) {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #3c3f48;
  line-height: 1.6;
}

.weather-city-card strong {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 13px;
}

.weather-controls {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.weather-chip,
.weather-controls select,
.weather-select-label {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(217, 54, 105, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.weather-select-label {
  display: inline-flex;
  align-items: center;
  padding-left: 0;
}

.weather-chip {
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
}

.weather-controls select {
  min-width: 92px;
  border: 0;
  background: transparent;
  padding: 0 26px 0 12px;
}

.weather-clear {
  background:
    radial-gradient(circle at 86% 20%, rgba(243, 165, 63, 0.32), transparent 72px),
    linear-gradient(145deg, rgba(243, 165, 63, 0.18), rgba(255, 240, 246, 0.92)),
    var(--surface);
}

.weather-rain {
  background:
    radial-gradient(circle at 86% 20%, rgba(58, 117, 196, 0.24), transparent 72px),
    linear-gradient(145deg, rgba(58, 117, 196, 0.2), rgba(237, 248, 255, 0.96)),
    var(--surface);
}

.weather-snow {
  background:
    radial-gradient(circle at 86% 20%, rgba(255, 255, 255, 0.95), transparent 74px),
    linear-gradient(145deg, rgba(206, 230, 246, 0.7), rgba(255, 255, 255, 0.96)),
    var(--surface);
}

.weather-cloud {
  background:
    radial-gradient(circle at 86% 20%, rgba(109, 114, 128, 0.14), transparent 74px),
    linear-gradient(145deg, rgba(234, 221, 229, 0.68), rgba(248, 251, 255, 0.98)),
    var(--surface);
}

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

.content-section,
.editor-section {
  margin-top: 66px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.locked-state,
.panel,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.locked-state {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  color: var(--muted);
}

.locked-state strong {
  color: var(--ink);
}

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

.form-panel {
  padding: 22px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 112px;
  padding: 12px;
  resize: vertical;
}

.markdown-editor {
  display: grid;
  gap: 10px;
}

.markdown-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.markdown-toolbar button {
  border: 1px solid rgba(217, 54, 105, 0.18);
  border-radius: 8px;
  background: rgba(255, 240, 246, 0.82);
  color: var(--rose-dark);
  cursor: pointer;
  font-weight: 900;
  padding: 8px 11px;
}

.markdown-toolbar button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.toolbar-color {
  width: 42px;
  min-height: 38px;
  padding: 4px;
  border-radius: 8px;
  cursor: pointer;
}

.markdown-preview-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.preview-label {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 8px 12px;
  text-transform: uppercase;
}

.markdown-preview {
  min-height: 96px;
  padding: 12px;
}

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

.markdown-body {
  color: #282b33;
  line-height: 1.85;
}

.markdown-body > *:first-child {
  margin-top: 0;
}

.markdown-body > *:last-child {
  margin-bottom: 0;
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 1.15em 0 0.45em;
  line-height: 1.35;
}

.markdown-body p,
.markdown-body ul,
.markdown-body blockquote,
.markdown-body pre {
  margin: 0 0 0.9em;
}

.markdown-body ul {
  padding-left: 1.4em;
}

.markdown-body blockquote {
  border-left: 3px solid rgba(217, 54, 105, 0.42);
  color: var(--muted);
  padding: 3px 0 3px 14px;
}

.markdown-body code {
  border-radius: 6px;
  background: rgba(28, 32, 43, 0.07);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
  padding: 2px 5px;
}

.markdown-body pre {
  overflow-x: auto;
  border-radius: 8px;
  background: #20242e;
  color: #f8f3f7;
  padding: 12px;
}

.markdown-body pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.markdown-body a {
  color: var(--rose-dark);
  font-weight: 800;
}

.md-color {
  font-weight: 800;
}

.md-color-rose {
  color: var(--rose-dark);
}

.md-color-sky {
  color: var(--sky);
}

.md-color-mint {
  color: var(--mint);
}

.md-color-gold {
  color: var(--gold);
}

.markdown-body .md-center {
  text-align: center;
}

.markdown-body .md-center > * {
  text-align: center;
}

.markdown-body img {
  display: block;
  width: min(100%, var(--md-img-width, 760px));
  max-height: 70vh;
  object-fit: contain;
  border-radius: 8px;
  margin: 12px auto;
}

.md-gallery {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

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

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

.md-gallery-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.md-gallery img {
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: 1;
  object-fit: cover;
  margin: 0;
}

@media (max-width: 720px) {
  .md-gallery,
  .md-gallery-2,
  .md-gallery-3,
  .md-gallery-4 {
    grid-template-columns: 1fr;
  }

  .md-gallery img {
    aspect-ratio: auto;
  }
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(217, 54, 105, 0.55);
  box-shadow: 0 0 0 4px rgba(217, 54, 105, 0.12);
}

.story-list {
  display: grid;
  gap: 16px;
}

.story-card {
  display: grid;
  gap: 14px;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.story-summary,
.photo-summary {
  cursor: pointer;
  list-style: none;
}

.story-summary::-webkit-details-marker,
.photo-summary::-webkit-details-marker {
  display: none;
}

.story-summary {
  display: grid;
  gap: 12px;
  padding: 22px 24px;
}

.story-meta,
.photo-meta,
.trip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.tag {
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--rose-dark);
  padding: 4px 10px;
  font-weight: 800;
}

.city-tag {
  background: rgba(47, 157, 133, 0.12);
  color: #116b59;
}

.story-card p,
.photo-excerpt {
  margin: 0;
  color: #3c3f48;
  line-height: 1.8;
  white-space: pre-wrap;
}

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

.story-card[open] .story-excerpt {
  display: none;
}

.story-body {
  border-top: 1px solid rgba(234, 221, 229, 0.72);
  padding: 18px 24px 4px;
}

.expand-hint {
  justify-self: start;
  border: 1px solid rgba(217, 54, 105, 0.16);
  border-radius: 999px;
  background: rgba(255, 240, 246, 0.72);
  color: var(--rose-dark);
  font-size: 0;
  font-weight: 900;
  padding: 5px 11px;
}

.expand-hint::before {
  content: "展开";
  font-size: 12px;
}

details[open] > summary .expand-hint::before {
  content: "收起";
}

.card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 0 24px 20px;
}

.photo-wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.photo-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.photo-summary {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 13px;
  padding: 12px;
}

.photo-card .photo-thumb {
  aspect-ratio: 1;
  border-radius: 8px;
}

.photo-summary-body {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
}

.photo-summary-body h3 {
  margin: 0;
}

.photo-summary-body .expand-hint {
  margin-top: 2px;
}

.photo-card .photo-full {
  display: none;
  aspect-ratio: auto;
  max-height: 72vh;
  object-fit: contain;
  border-top: 1px solid rgba(234, 221, 229, 0.72);
  background: #fff8fb;
}

.photo-card[open] .photo-full {
  display: block;
}

.photo-body {
  display: grid;
  gap: 10px;
  padding: 15px;
}

.photo-body .card-actions {
  padding: 0;
}

.trip-card .card-actions {
  padding: 0;
}

.photo-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 26px;
  color: var(--muted);
}

.trip-layout {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.trip-layout > :not(.city-bubble-cloud) {
  position: relative;
  z-index: 1;
}

.map-board {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5fbff;
  box-shadow: var(--shadow);
  cursor: grab;
}

.map-board.dragging {
  cursor: grabbing;
}

.map-toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(234, 221, 229, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 25px rgba(34, 36, 42, 0.08);
  backdrop-filter: blur(10px);
}

.map-tool {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.map-tool.text {
  min-width: 54px;
  padding: 0 10px;
  font-size: 13px;
}

.world-map {
  display: block;
  width: 100%;
  min-height: 520px;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.world-map *:focus,
.world-map *:focus-visible {
  outline: none;
}

.ocean {
  fill: #edf8ff;
}

.map-lines path {
  fill: none;
  stroke: rgba(58, 117, 196, 0.1);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.map-region path,
.map-region ellipse {
  fill: #ffffff;
  stroke: rgba(58, 117, 196, 0.18);
  stroke-width: 0.85;
  vector-effect: non-scaling-stroke;
  transition:
    fill 180ms ease,
    stroke 180ms ease,
    filter 180ms ease;
}

.map-region:hover path,
.map-region:hover ellipse {
  fill: #fff0f6;
}

.world-country-layer {
  pointer-events: none;
}

.world-country {
  fill: rgba(255, 255, 255, 0.92);
  stroke: rgba(58, 117, 196, 0.16);
  stroke-width: 0.45;
  vector-effect: non-scaling-stroke;
}

body.theme-night .world-country,
body.theme-night .map-lines path,
body.theme-night .admin-city {
  stroke: rgba(136, 184, 255, 0.24);
}

body.theme-night .admin-city.visited {
  fill: rgba(240, 106, 152, 0.28);
  stroke: rgba(255, 138, 176, 0.7);
}

.world-regions.fallback-hidden {
  display: none;
}

.map-region.visited path,
.map-region.visited ellipse {
  fill: rgba(255, 240, 246, 0.7);
  stroke: rgba(217, 54, 105, 0.42);
}

.china-admin-layer {
  pointer-events: auto;
}

.admin-city {
  fill: rgba(255, 255, 255, 0.76);
  stroke: rgba(58, 117, 196, 0.14);
  stroke-width: 0.42;
  vector-effect: non-scaling-stroke;
  transition:
    fill 180ms ease,
    stroke 180ms ease,
    filter 180ms ease;
}

.admin-city:hover {
  fill: rgba(255, 240, 246, 0.82);
  stroke: rgba(217, 54, 105, 0.38);
  stroke-width: 0.65;
}

.admin-city.visited {
  fill: rgba(217, 54, 105, 0.24);
  stroke: rgba(169, 31, 74, 0.42);
  stroke-width: 0.72;
  filter: drop-shadow(0 8px 12px rgba(217, 54, 105, 0.1));
}

.admin-city.loading-mark {
  fill: rgba(47, 157, 133, 0.08);
  stroke-dasharray: 4 5;
}

.china-city-layer {
  pointer-events: auto;
}

.china-city-dot {
  cursor: pointer;
}

.china-city-dot .city-halo {
  fill: rgba(217, 54, 105, 0.1);
  stroke: rgba(217, 54, 105, 0.16);
  stroke-width: 0.48;
  vector-effect: non-scaling-stroke;
  opacity: 0.34;
  animation: cityPulse 2.8s ease-in-out infinite;
}

.china-city-dot .city-core {
  fill: var(--rose);
  stroke: white;
  stroke-width: 0.95;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 8px 14px rgba(217, 54, 105, 0.3));
}

.china-city-dot text {
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 1.05;
  fill: var(--ink);
  font-size: 2.9px;
  font-weight: 900;
}

body.theme-night .china-city-dot text {
  stroke: rgba(16, 19, 29, 0.96);
  stroke-width: 1.45;
  fill: #fff7fb;
}

body.theme-night .china-city-dot .city-core,
body.theme-night .svg-pin circle {
  stroke: #fff7fb;
}

.china-city-dot.visited .city-halo {
  opacity: 0.16;
}

.map-board.map-wide .china-city-dot text,
.map-board.map-wide .svg-pin text {
  opacity: 0;
}

.map-board.map-wide .china-city-dot,
.map-board.map-wide .svg-pin {
  opacity: 0.58;
}

.map-board.map-world .china-city-dot,
.map-board.map-world .svg-pin {
  opacity: 0.28;
}

@keyframes cityPulse {
  50% {
    transform: scale(1.14);
    opacity: 0.64;
  }
}

.city-bubble-cloud {
  position: absolute;
  inset: -86px -28px -72px;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.city-bubble {
  position: absolute;
  left: var(--bubble-left);
  top: var(--bubble-top);
  transform: translate(-50%, -50%);
  min-height: 28px;
  border: 1px solid rgba(217, 54, 105, 0.12);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.2) 36%),
    rgba(255, 240, 246, 0.48);
  color: rgba(169, 31, 74, 0.62);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  padding: 7px 13px;
  box-shadow:
    inset 0 1px 8px rgba(255, 255, 255, 0.65),
    0 16px 34px rgba(112, 45, 76, 0.08);
  opacity: 0.72;
  backdrop-filter: blur(8px);
  animation: bubbleFloat var(--bubble-duration, 11s) ease-in-out infinite;
  animation-delay: var(--bubble-delay);
}

.city-bubble:hover {
  opacity: 0.9;
}

.city-bubble:nth-child(3n) {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.18) 36%),
    rgba(230, 249, 244, 0.5);
  color: rgba(17, 107, 89, 0.62);
}

.city-bubble:nth-child(4n) {
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.18) 36%),
    rgba(237, 248, 255, 0.54);
  color: rgba(58, 117, 196, 0.62);
}

@keyframes bubbleFloat {
  0%,
  100% {
    transform: translate(-50%, -50%);
  }

  50% {
    transform: translate(
      calc(-50% + var(--bubble-drift-x, 14px)),
      calc(-50% + var(--bubble-drift-y, -24px))
    );
  }
}

.svg-pin {
  pointer-events: none;
}

.svg-pin circle {
  fill: var(--rose);
  stroke: white;
  stroke-width: 0.95;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 7px 12px rgba(217, 54, 105, 0.28));
}

.svg-pin text {
  paint-order: stroke;
  stroke: rgba(34, 36, 42, 0.84);
  stroke-width: 1;
  fill: white;
  font-size: 2.9px;
  font-weight: 800;
}

body.theme-night .svg-pin text {
  stroke: rgba(16, 19, 29, 0.98);
  stroke-width: 1.45;
  fill: #fff7fb;
}

.map-hint {
  position: absolute;
  left: 16px;
  bottom: 12px;
  z-index: 2;
  margin: 0;
  max-width: calc(100% - 32px);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  padding: 8px 10px;
  font-size: 13px;
}

.pin {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 4px;
  width: max-content;
  max-width: 180px;
  transform: translate(-14px, -28px);
}

.pin-dot {
  width: 28px;
  height: 28px;
  border: 4px solid white;
  border-radius: 50% 50% 50% 0;
  background: var(--rose);
  box-shadow: 0 8px 20px rgba(217, 54, 105, 0.24);
  transform: rotate(-45deg);
}

.pin span {
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(34, 36, 42, 0.84);
  color: white;
  font-size: 12px;
  font-weight: 800;
}

.trip-side {
  display: grid;
  gap: 16px;
  width: min(520px, 100%);
}

.trip-side .form-panel {
  padding: 16px;
}

.trip-side textarea {
  min-height: 92px;
}

.trip-side .coord-row {
  grid-template-columns: 1fr;
}

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

.trip-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.trip-group,
.trip-city-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.trip-group summary,
.trip-city-group summary {
  cursor: pointer;
  list-style: none;
}

.trip-group summary::-webkit-details-marker,
.trip-city-group summary::-webkit-details-marker {
  display: none;
}

.trip-group > summary {
  padding: 13px 14px;
  color: var(--rose-dark);
  font-size: 18px;
  font-weight: 900;
}

.trip-city-group {
  margin: 0 10px 10px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: none;
}

.trip-city-group > summary {
  padding: 10px 12px;
  color: var(--ink);
  font-weight: 800;
}

.trip-place-list {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.trip-place-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface);
}

.trip-place-item strong {
  font-size: 14px;
}

.trip-place-item .card-actions {
  justify-content: flex-start;
  padding: 0;
}

.trip-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.trip-card p {
  margin-bottom: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.login-dialog {
  width: min(420px, calc(100% - 28px));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.login-dialog::backdrop {
  background: rgba(34, 36, 42, 0.48);
  backdrop-filter: blur(6px);
}

.login-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.icon-button {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  color: var(--muted);
  font-size: 22px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100% - 36px));
  padding: 13px 16px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
}

@media (max-width: 880px) {
  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
  }

  .brand {
    grid-column: 1 / 2;
    grid-row: 1;
  }

  .nav-links {
    grid-column: 1 / -1;
    grid-row: 3;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
    overflow: visible;
    color: var(--ink);
  }

  .nav-links a {
    border: 1px solid rgba(234, 221, 229, 0.88);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.62);
    padding: 8px 10px;
    text-align: center;
    font-size: 14px;
  }

  .site-search {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    flex: none;
  }

  .session-actions {
    grid-column: 3 / 4;
    grid-row: 1;
    justify-self: end;
    min-width: 0;
    flex: none;
  }

  .dashboard,
  .editor-grid,
  .trip-layout,
  .trip-list {
    grid-template-columns: 1fr;
  }

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

  .love-clock-card {
    grid-column: 1 / -1;
  }

  .love-clock-hero {
    min-height: 340px;
  }

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

  .map-board {
    min-height: 420px;
  }

  .world-map {
    min-height: 420px;
  }
}

@media (max-width: 560px) {
  main {
    width: min(100% - 22px, 1180px);
    padding-top: 20px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 12px;
  }

  .brand {
    min-width: 0;
  }

  .brand small {
    display: none;
  }

  .session-actions {
    grid-column: 2 / 3;
    gap: 6px;
  }

  .user-badge {
    display: none;
  }

  .button {
    min-height: 38px;
    padding: 0 13px;
  }

  .nav-links {
    gap: 6px;
  }

  .nav-links a {
    padding: 8px 6px;
    font-size: 12px;
  }

  .story-summary {
    padding: 18px;
  }

  .story-body {
    padding: 16px 18px 4px;
  }

  .card-actions {
    padding: 0 18px 18px;
  }

  .photo-summary {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
  }

  .photo-body {
    padding: 12px;
  }

  .stats-panel,
  .photo-wall {
    grid-template-columns: 1fr;
  }

  .intro,
  .form-panel {
    padding: 18px;
  }

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

  .love-clock-hero .clock-grid strong {
    font-size: 15px;
  }

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

  .map-board {
    min-height: 340px;
  }

  .world-map {
    min-height: 340px;
  }

  .map-toolbar {
    left: 12px;
    right: auto;
  }
}
