html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #eef3f8;
  font-family: system-ui, -apple-system, "Microsoft YaHei", sans-serif;
}

/* 深色主题基础变量 */
:root {
  --dark-bg: #121212;
  --dark-panel: #1e1e1e;
  --dark-panel-soft: #252525;
  --dark-input: #2d2d2d;
  --dark-border: #3a3a3a;
  --dark-text: #e0e0e0;
  --dark-text-muted: #94a3b8;
  --dark-accent: #00e5ff;
  --wishlist-pink: #ff4081;
  --dark-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

#counter {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #1f2937;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16);
  pointer-events: none;
  user-select: none;
}

.counter-item {
  white-space: nowrap;
}

.counter-visited {
  color: #ff2d55;
}

.counter-wishlist {
  color: #2f80ff;
}

.counter-sep {
  color: #d1d5db;
}

.counter-divider {
  width: 1px;
  height: 16px;
  background: #e5e7eb;
}

.filter-toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
}

.filter-toggle input {
  margin: 0;
  cursor: pointer;
}

.filter-toggle input#filter-visited {
  accent-color: #ff2d55;
}

.filter-toggle input#filter-wishlist {
  accent-color: #2f80ff;
}

#error {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 30;
  max-width: 82vw;
  padding: 12px 20px;
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.88);
  color: #fff;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  transform: translate(-50%, -50%);
}

#error[hidden] {
  display: none;
}

/* 想去（wishlist）蓝色星标：包在高德 Marker 的 content 里 */
.wishlist-marker {
  line-height: 0;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(17, 24, 39, 0.35));
}

/* 地点详情面板：固定在地图右下角 */
.detail-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 25;
  width: min(320px, calc(100vw - 32px));
  max-height: 60vh;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 18px 40px 18px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.97);
  color: #1f2937;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.24);
}

.detail-panel[hidden] {
  display: none;
}

.detail-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: #eef1f5;
  color: #4b5563;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.detail-close:hover {
  background: #e2e6ec;
}

.detail-type {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 45, 85, 0.12);
  color: #ff2d55;
  font-size: 12px;
  font-weight: 600;
}

.detail-type.is-wishlist {
  background: rgba(47, 128, 255, 0.12);
  color: #2f80ff;
}

/* 逆地理编码得到的省 / 市，旧数据没有该字段时整行隐藏 */
.detail-location {
  margin: 0 0 4px;
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.detail-location[hidden] {
  display: none;
}

.detail-title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  word-break: break-word;
}

.detail-story {
  margin: 0 0 12px;
  color: #374151;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 新版 logs：卡片列表，一条记录对应一次追加的日期 / 文字 / 照片 */
.detail-logs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 14px;
}

.detail-logs[hidden] {
  display: none;
}

.detail-log {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #eef1f5;
  border-left: 3px solid #ffd700;
  border-radius: 10px;
  background: #f9fbfd;
}

.detail-log-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.detail-log-date {
  margin: 0;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.detail-log-delete {
  flex: none;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 45, 85, 0.35);
  border-radius: 8px;
  background: rgba(255, 45, 85, 0.08);
  color: #ff2d55;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  touch-action: manipulation;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.detail-log-delete:hover {
  background: rgba(255, 45, 85, 0.14);
}

.detail-log-delete:active {
  background: rgba(255, 45, 85, 0.2);
  transform: scale(0.97);
}

.detail-log-content {
  margin: 0 0 8px;
  color: #374151;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-log .detail-gallery {
  max-width: 100%;
  margin-bottom: 0;
}

/* 详情图片画廊：每次打开时用临时链接动态渲染 */
.detail-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  grid-auto-rows: 96px;
  gap: 8px;
  margin: 0 0 12px;
}

.detail-gallery[hidden] {
  display: none;
}

.detail-gallery-item {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  border-radius: 8px;
  background: #eef1f5;
  object-fit: cover;
}

.detail-created {
  margin: 0;
  color: #9ca3af;
  font-size: 12px;
}

/* A4：想去详情里的打卡入口 */
.detail-checkin {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: #2f80ff;
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  touch-action: manipulation;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.detail-checkin:hover {
  background: #1f6fe5;
}

.detail-checkin:active {
  background: #1a5fcc;
  transform: scale(0.97);
}

.detail-checkin[hidden] {
  display: none;
}

.detail-delete {
  margin-top: 14px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 45, 85, 0.4);
  border-radius: 8px;
  background: rgba(255, 45, 85, 0.08);
  color: #ff2d55;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.detail-delete:hover {
  background: rgba(255, 45, 85, 0.14);
}

.detail-delete[hidden] {
  display: none;
}

/* ===== 添加地点表单弹窗（仅登录后打开） ===== */
.place-form-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 16px;
}

.place-form-modal[hidden] {
  display: none;
}

.place-form-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
}

.place-form {
  position: relative;
  z-index: 1;
  width: min(380px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 24px 22px 22px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.place-form-title {
  margin: 0 0 18px;
  color: #1f2937;
  font-size: 18px;
  font-weight: 600;
}

.place-form-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #eef1f5;
  color: #4b5563;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.place-form-close:hover {
  background: #e2e6ec;
}

.place-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

/* 打卡模式下隐藏类型 / 标题字段 */
.place-form-field[hidden] {
  display: none;
}

.place-form-label {
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
}

.place-form-types {
  display: flex;
  gap: 18px;
}

.place-form-type {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #374151;
  font-size: 14px;
  cursor: pointer;
}

.place-form-type input[value="visited"] {
  accent-color: #ff2d55;
}

.place-form-type input[value="wishlist"] {
  accent-color: #2f80ff;
}

.place-form-input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d8dee7;
  border-radius: 10px;
  background: #f9fbfd;
  color: #1f2937;
  font: inherit;
  font-size: 14px;
  outline: none;
}

.place-form-input:focus {
  border-color: #2f80ff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 128, 255, 0.15);
}

.place-form-textarea {
  min-height: 96px;
  resize: vertical;
}

.place-form-file {
  color: #4b5563;
  font: inherit;
  font-size: 13px;
}

.place-form-file::file-selector-button {
  min-height: 44px;
  margin-right: 10px;
  padding: 7px 12px;
  border: none;
  border-radius: 8px;
  background: #eef1f5;
  color: #374151;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  touch-action: manipulation;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.place-form-file::file-selector-button:hover {
  background: #e2e6ec;
}

.place-form-file::file-selector-button:active {
  background: #d8dee7;
}

.place-photos-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}

.place-photos-preview:empty {
  display: none;
}

.place-photos-preview-item {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: #eef1f5;
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.15);
  object-fit: cover;
}

.place-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.place-form-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.place-form-btn-cancel {
  background: #eef1f5;
  color: #4b5563;
}

.place-form-btn-cancel:hover {
  background: #e2e6ec;
}

.place-form-btn-save {
  background: #2f80ff;
  color: #fff;
}

.place-form-btn-save:hover {
  background: #1f6fe5;
}

/* ===== 登录状态区域（右上角） ===== */
.auth-area {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  max-width: calc(100vw - 32px);
  font-size: 14px;
  user-select: none;
}

.auth-logged-out,
.auth-logged-in {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-logged-out[hidden],
.auth-logged-in[hidden] {
  display: none;
}

.auth-logged-in {
  padding: 6px 6px 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16);
}

.auth-user-email {
  max-width: 220px;
  overflow: hidden;
  color: #1f2937;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-btn {
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.auth-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.auth-btn-login {
  padding: 9px 18px;
  background: rgba(255, 255, 255, 0.94);
  color: #1f2937;
  font-size: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16);
}

.auth-btn-login:hover {
  background: #fff;
}

.auth-btn-logout {
  padding: 7px 12px;
  background: #eef1f5;
  color: #4b5563;
  font-size: 12px;
}

.auth-btn-logout:hover {
  background: #e2e6ec;
}

/* ===== 邮箱验证码登录弹窗 ===== */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 16px;
}

.auth-modal[hidden] {
  display: none;
}

.auth-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
}

.auth-form {
  position: relative;
  z-index: 1;
  width: min(360px, 100%);
  box-sizing: border-box;
  padding: 24px 22px 22px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.auth-form-title {
  margin: 0 0 18px;
  color: #1f2937;
  font-size: 18px;
  font-weight: 600;
}

.auth-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #eef1f5;
  color: #4b5563;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.auth-modal-close:hover {
  background: #e2e6ec;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.auth-label {
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
}

.auth-input {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d8dee7;
  border-radius: 10px;
  background: #f9fbfd;
  color: #1f2937;
  font: inherit;
  font-size: 14px;
  outline: none;
}

.auth-input:focus {
  border-color: #2f80ff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 128, 255, 0.15);
}

.auth-code-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.auth-code-row .auth-input {
  flex: 1;
  min-width: 0;
}

.auth-btn-secondary {
  padding: 0 14px;
  background: #eef1f5;
  color: #374151;
  font-size: 13px;
  white-space: nowrap;
}

.auth-btn-secondary:hover {
  background: #e2e6ec;
}

.auth-btn-primary {
  width: 100%;
  margin-top: 4px;
  padding: 11px 16px;
  background: #2f80ff;
  color: #fff;
  font-size: 15px;
}

.auth-btn-primary:hover {
  background: #1f6fe5;
}

.auth-message {
  margin: 0 0 12px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.5;
}

.auth-message.is-error {
  color: #b42318;
}

.auth-message.is-success {
  color: #067647;
}

.auth-message[hidden] {
  display: none;
}

/* ===== 触控热区与按压反馈（视觉尺寸不变） ===== */
/* 复选框视觉较小，用伪元素把标签热区扩到 44px 高 */
.filter-toggle::after {
  position: absolute;
  top: 50%;
  right: -4px;
  left: -4px;
  height: 44px;
  content: "";
  transform: translateY(-50%);
}

.auth-btn,
.place-form-btn,
.detail-delete {
  min-height: 44px;
  touch-action: manipulation;
}

.place-form-type {
  min-height: 44px;
  touch-action: manipulation;
}

/* 关闭类小图标按钮保持原视觉尺寸，热区扩到 44×44 */
.detail-close::after,
.place-form-close::after,
.auth-modal-close::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  content: "";
  transform: translate(-50%, -50%);
}

.auth-btn,
.place-form-btn,
.detail-delete,
.detail-close,
.place-form-close,
.auth-modal-close {
  transition: background-color 0.15s ease, transform 0.1s ease, filter 0.1s ease;
}

/* 触摸/点击反馈，避免只依赖 hover */
.auth-btn:active,
.place-form-btn:active,
.detail-delete:active {
  filter: brightness(0.95);
  transform: scale(0.96);
}

.detail-close:active,
.place-form-close:active,
.auth-modal-close:active {
  background: #d8dee7;
}

.filter-toggle:active,
.place-form-type:active {
  opacity: 0.65;
}

/* ===== 窄屏（宽度 < 768px）适配 ===== */
@media (max-width: 767px) {
  .place-form,
  .auth-form {
    width: 90vw;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
  }

  .detail-panel {
    right: 5vw;
    bottom: 12px;
    width: 90vw;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
  }

  /* iOS 输入框字号小于 16px 时会自动放大页面 */
  .place-form-input,
  .auth-input {
    font-size: 16px;
  }

  /* 图片画廊改为横向滑动，避免撑破窄屏容器 */
  .detail-gallery {
    display: flex;
    gap: 8px;
    padding-bottom: 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .detail-gallery-item {
    flex: 0 0 72%;
    width: 72%;
    max-width: 72%;
    height: 150px;
  }
}

@media (max-width: 560px) {
  .auth-area {
    top: 62px;
    right: 12px;
  }

  .auth-user-email {
    max-width: 150px;
  }
}

/* ===== 深色主题（Dark Mode） ===== */
html,
body {
  background: var(--dark-bg);
  color: var(--dark-text);
}

#map {
  background: #0b1220;
}

/* 左上角统计与筛选 */
#counter {
  background: rgba(30, 30, 30, 0.85);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.counter-visited {
  color: var(--dark-accent);
}

.counter-wishlist {
  color: var(--wishlist-pink);
}

.counter-sep {
  color: #4b5563;
}

.counter-divider {
  background: #3a3a3a;
}

.filter-toggle {
  color: #cbd5e1;
}

.filter-toggle input#filter-visited {
  accent-color: var(--dark-accent);
}

.filter-toggle input#filter-wishlist {
  accent-color: var(--wishlist-pink);
}

#error {
  background: rgba(127, 29, 29, 0.95);
  color: #fee2e2;
  box-shadow: var(--dark-shadow);
}

/* 详情面板 */
.detail-panel {
  background: var(--dark-panel);
  color: var(--dark-text);
  border: 1px solid var(--dark-border);
  box-shadow: var(--dark-shadow);
}

.detail-close {
  background: #2d2d2d;
  color: #e5e7eb;
}

.detail-close:hover {
  background: #3a3a3a;
}

.detail-close:active {
  background: #4b5563;
}

.detail-type {
  background: rgba(0, 229, 255, 0.14);
  color: var(--dark-accent);
}

.detail-type.is-wishlist {
  background: rgba(255, 64, 129, 0.15);
  color: var(--wishlist-pink);
}

.detail-title {
  color: #ffffff;
}

.detail-location {
  color: var(--dark-text-muted);
}

.detail-story,
.detail-log-content {
  color: #d1d5db;
}

.detail-created {
  color: var(--dark-text-muted);
}

.detail-log {
  background: var(--dark-panel-soft);
  border-color: var(--dark-border);
  border-left-color: var(--dark-accent);
}

.detail-log-date {
  color: var(--dark-text-muted);
}

.detail-gallery-item {
  background: #2d2d2d;
}

.detail-delete,
.detail-log-delete {
  border-color: rgba(255, 45, 85, 0.35);
  background: rgba(255, 45, 85, 0.12);
  color: #ff7a90;
}

.detail-delete:hover,
.detail-log-delete:hover {
  background: rgba(255, 45, 85, 0.2);
}

.detail-log-delete:active {
  background: rgba(255, 45, 85, 0.28);
}

.detail-checkin {
  background: var(--dark-accent);
  color: #062a33;
}

.detail-checkin:hover {
  background: #67e8f9;
}

.detail-checkin:active {
  background: #06b6d4;
}

/* 添加地点 / 登录弹窗 */
.place-form-backdrop,
.auth-modal-backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.place-form,
.auth-form {
  background: var(--dark-panel);
  color: var(--dark-text);
  border: 1px solid var(--dark-border);
  box-shadow: var(--dark-shadow);
}

.place-form-title,
.auth-form-title {
  color: #ffffff;
}

.place-form-close,
.auth-modal-close {
  background: #2d2d2d;
  color: #e5e7eb;
}

.place-form-close:hover,
.auth-modal-close:hover {
  background: #3a3a3a;
}

.place-form-close:active,
.auth-modal-close:active {
  background: #4b5563;
}

.place-form-label,
.auth-label {
  color: #cbd5e1;
}

.place-form-type {
  color: #d1d5db;
}

.place-form-type input[value="visited"] {
  accent-color: var(--dark-accent);
}

.place-form-type input[value="wishlist"] {
  accent-color: var(--wishlist-pink);
}

.place-form-input,
.auth-input {
  background: var(--dark-input);
  border-color: #3f3f3f;
  color: #f3f4f6;
  color-scheme: dark;
}

.place-form-input::placeholder,
.auth-input::placeholder {
  color: #6b7280;
}

.place-form-input:focus,
.auth-input:focus {
  border-color: var(--dark-accent);
  background: #303030;
  box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.18);
}

.place-form-input:-webkit-autofill,
.auth-input:-webkit-autofill {
  -webkit-text-fill-color: #f3f4f6;
  -webkit-box-shadow: 0 0 0 1000px var(--dark-input) inset;
}

.place-form-file {
  color: var(--dark-text-muted);
}

.place-form-file::file-selector-button {
  background: #2d2d2d;
  color: #e5e7eb;
}

.place-form-file::file-selector-button:hover {
  background: #3a3a3a;
}

.place-form-file::file-selector-button:active {
  background: #4b5563;
}

.place-form-btn-cancel {
  background: #2d2d2d;
  color: #cbd5e1;
}

.place-form-btn-cancel:hover {
  background: #3a3a3a;
}

.place-form-btn-save {
  background: var(--dark-accent);
  color: #062a33;
}

.place-form-btn-save:hover {
  background: #67e8f9;
}

/* 登录区域与登录弹窗按钮 */
.auth-logged-in {
  background: rgba(30, 30, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.auth-user-email {
  color: #e5e7eb;
}

.auth-btn-login {
  background: rgba(30, 30, 30, 0.9);
  color: var(--dark-accent);
  border: 1px solid rgba(34, 211, 238, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.auth-btn-login:hover {
  background: #2d2d2d;
}

.auth-btn-logout {
  background: #2d2d2d;
  color: #cbd5e1;
}

.auth-btn-logout:hover {
  background: #3a3a3a;
}

.auth-btn-secondary {
  background: #2d2d2d;
  color: #e5e7eb;
}

.auth-btn-secondary:hover {
  background: #3a3a3a;
}

.auth-btn-primary {
  background: var(--dark-accent);
  color: #062a33;
}

.auth-btn-primary:hover {
  background: #67e8f9;
}

.auth-message {
  color: #cbd5e1;
}

.auth-message.is-error {
  color: #fca5a5;
}

.auth-message.is-success {
  color: #6ee7b7;
}

/* 深色滚动条 */
.detail-panel,
.place-form,
.auth-form {
  scrollbar-color: #4b5563 #1e1e1e;
  scrollbar-width: thin;
}

.detail-panel::-webkit-scrollbar,
.place-form::-webkit-scrollbar,
.auth-form::-webkit-scrollbar {
  width: 8px;
}

.detail-panel::-webkit-scrollbar-track,
.place-form::-webkit-scrollbar-track,
.auth-form::-webkit-scrollbar-track {
  background: #1e1e1e;
}

.detail-panel::-webkit-scrollbar-thumb,
.place-form::-webkit-scrollbar-thumb,
.auth-form::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 4px;
}

/* ===== 旅行回忆微电影：照片浮层 ===== */
.tour-photo-card {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 250;
  display: flex;
  flex-direction: column;
  width: min(360px, 80vw);
  max-height: 68vh;
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 18px;
  background: rgba(18, 24, 38, 0.9);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65), 0 0 36px rgba(0, 229, 255, 0.14);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transform: translate(-50%, -46%) scale(0.94);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}

.tour-photo-card.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.tour-photo-media {
  width: 100%;
  max-height: 38vh;
  overflow: hidden;
  border-radius: 12px;
  background: #0b1220;
}

.tour-photo-media img {
  display: block;
  width: 100%;
  max-height: 38vh;
  object-fit: cover;
}

.tour-photo-media.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  color: #64748b;
  font-size: 13px;
}

.tour-photo-caption {
  padding: 12px 6px 4px;
}

.tour-photo-date {
  color: var(--dark-accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.tour-photo-city {
  margin: 4px 0 0;
  color: #ffffff;
  font-size: 22px;
  font-weight: 600;
}

.tour-photo-text {
  max-height: 3.2em;
  margin: 8px 0 0;
  overflow: hidden;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 560px) {
  .tour-photo-card {
    width: min(360px, 86vw);
  }
}

/* 微电影飞机标记 */
.tour-plane-marker {
  line-height: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.85));
}

.tour-plane-marker svg {
  display: block;
}

/* 播放 / 停止回忆按钮 */
.tour-play-btn {
  position: fixed;
  top: 64px;
  left: 16px;
  z-index: 210;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid rgba(0, 229, 255, 0.45);
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.14);
  color: var(--dark-accent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.tour-play-btn:hover {
  background: rgba(0, 229, 255, 0.24);
}

.tour-play-btn:active {
  transform: scale(0.96);
}

.tour-play-btn.is-playing {
  background: var(--wishlist-pink);
  border-color: var(--wishlist-pink);
  color: #1a0a10;
}

.tour-play-btn.is-playing:hover {
  background: #ff6a9a;
}

/* ===== UI 弹窗过渡动画 ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

@keyframes counterSlideIn {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.ui-anim-in {
  animation: fadeInUp 0.3s ease-out both;
}

.ui-anim-out {
  animation: fadeOutDown 0.3s ease-out both;
  pointer-events: none;
}

#counter {
  animation: counterSlideIn 0.5s ease-out both;
}

/* ===== 右下角背景音乐按钮 ===== */
.bgm-toggle {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(0, 229, 255, 0.45);
  border-radius: 50%;
  background: rgba(18, 24, 38, 0.72);
  color: var(--dark-accent);
  font-family: inherit;
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 229, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.bgm-toggle:hover {
  background: rgba(0, 229, 255, 0.18);
}

.bgm-toggle:active {
  transform: scale(0.94);
}

.bgm-toggle.is-playing {
  background: rgba(0, 229, 255, 0.28);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 26px rgba(0, 229, 255, 0.28);
}

/* ===== 左侧相册堆叠 ===== */
.photo-stack {
  position: fixed;
  left: 20px;
  top: 54%;
  z-index: 23;
  width: 120px;
  height: 120px;
  transform: translateY(-50%);
  cursor: pointer;
  transition: transform 0.25s ease;
}

.photo-stack[hidden] {
  display: none;
}

.photo-stack:hover {
  transform: translateY(-50%) scale(1.04);
}

.photo-stack-card {
  position: absolute;
  top: 0;
  left: 0;
  width: 120px;
  height: 120px;
  box-sizing: border-box;
  border: 3px solid #f8fafc;
  border-radius: 8px;
  background: #1e1e1e;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  object-fit: cover;
  transition: top 0.25s ease, transform 0.25s ease;
}

.photo-stack-card:nth-child(1) {
  z-index: 3;
  transform: rotate(-2deg);
}

.photo-stack-card:nth-child(2) {
  top: 15px;
  z-index: 2;
  transform: rotate(1.5deg);
}

.photo-stack-card:nth-child(3) {
  top: 30px;
  z-index: 1;
  transform: rotate(-1deg);
}

.photo-stack:hover .photo-stack-card:nth-child(1) {
  transform: rotate(-3deg) translateX(-4px);
}

.photo-stack:hover .photo-stack-card:nth-child(2) {
  top: 20px;
  transform: rotate(2deg);
}

.photo-stack:hover .photo-stack-card:nth-child(3) {
  top: 40px;
  transform: rotate(-2deg) translateX(-2px);
}

/* ===== 相册全屏浮层 ===== */
#album-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: rgba(15, 20, 30, 0.95);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  color: #e0e0e0;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease, visibility 0s linear 0s;
}

#album-modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.album-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 80px;
  box-sizing: border-box;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.album-title {
  margin: 0;
  color: #ffffff;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.album-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(0, 229, 255, 0.4);
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.08);
  color: #00e5ff;
  font: inherit;
  font-size: 18px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.album-close:hover {
  background: rgba(0, 229, 255, 0.18);
}

.album-close:active {
  transform: scale(0.94);
}

.album-content {
  flex: 1;
  min-height: 0;
  height: calc(100vh - 80px);
  box-sizing: border-box;
  padding: 20px;
  overflow-y: auto;
  color: #cbd5e1;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: rgba(100, 130, 170, 0.55) #0f141e;
  scrollbar-width: thin;
}

.album-content::-webkit-scrollbar {
  width: 8px;
}

.album-content::-webkit-scrollbar-track {
  background: #0f141e;
}

.album-content::-webkit-scrollbar-thumb {
  background: rgba(100, 130, 170, 0.55);
  border-radius: 4px;
}

.album-content::-webkit-scrollbar-thumb:hover {
  background: rgba(140, 170, 210, 0.72);
}

.album-empty {
  margin: 0;
  padding: 18vh 16px;
  color: #94a3b8;
  font-size: 15px;
  line-height: 1.6;
  text-align: center;
}

.album-city + .album-city {
  margin-top: 30px;
}

.album-city-title {
  margin: 0 0 12px;
  color: #e5e7eb;
  font-size: 16px;
  font-weight: 600;
}

.album-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.album-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  object-fit: cover;
  transition: transform 0.2s ease;
}

.album-photo:hover {
  transform: scale(1.05);
}

body.album-open {
  overflow: hidden;
}

body.album-open #map {
  pointer-events: none;
}

@media (max-width: 560px) {
  .album-header {
    padding: 14px 16px;
  }

  .album-content {
    padding: 16px;
  }

  .album-title {
    font-size: 18px;
  }
}

/* ===== 相册图片放大预览 ===== */
#image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  cursor: zoom-out;
  transition: opacity 0.25s ease, visibility 0s linear 0s;
}

#image-lightbox.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

#lightbox-img {
  display: block;
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

body.lightbox-open {
  overflow: hidden;
}
