/* —— 空态 / 加载 / 错误三态 —— */
.empty {
  display: grid; justify-items: center; align-content: center;
  gap: 4px;
  margin: auto;
  padding: 24px 16px;
  text-align: center;
  min-width: 0;
}
.empty-icon {
  display: grid; place-items: center;
  width: 72px; height: 72px;
  margin-bottom: 8px;
  border-radius: 50%;
  background-color: var(--md-primary-container);
  color: var(--md-on-primary-container);
}
.empty-icon svg { width: 32px; height: 32px; }
.empty h2 { font-size: var(--md-headline-size); line-height: var(--md-headline-line); font-weight: 400; }
.empty p { color: var(--md-on-surface-variant); font-size: var(--md-body-size); line-height: var(--md-body-line); overflow-wrap: anywhere; }
/* 列表三态：加载中 / 空 / 错误（错误自带重试按钮，靠近动作，不只靠 toast） */
.state-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 8px 0;
  padding: 12px 16px;
  border-radius: var(--md-shape-md);
  background-color: var(--md-surface-container);
  color: var(--md-on-surface-variant);
  font-size: var(--md-body-size); line-height: var(--md-body-line);
  min-width: 0;
}
.state-note[role="status"]::before {
  content: "";
  width: 14px; height: 14px; flex: none;
  border: 2px solid var(--md-outline);
  border-top-color: var(--md-primary);
  border-radius: 50%;
  animation: md-spin .8s linear infinite;
}
.state-note--error {
  background-color: var(--md-error-container);
  color: var(--md-on-error-container);
}
.state-note--error::before { display: none; }
.state-note p { margin: 0; min-width: 0; flex: 1 1 160px; overflow-wrap: anywhere; }
.state-note button, .state-note .secondary { margin-left: auto; flex: none; }
.loading {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 16px;
  color: var(--md-on-surface-variant);
  font-size: var(--md-body-size);
}
/* 加载态骨架条（列表占位） */
.skeleton {
  height: 12px;
  border-radius: var(--md-shape-full);
  background-color: var(--md-surface-container-high);
  overflow: hidden;
}
.skeleton + .skeleton { margin-top: 8px; }
.error-state, .error {
  font-size: var(--md-body-size);
}
.error-state {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-radius: var(--md-shape-md);
  background-color: var(--md-error-container);
  color: var(--md-on-error-container);
}
.error-state .retry, .retry {
  margin-left: auto;
  min-height: 36px; padding: 0 14px;
  border-radius: var(--md-shape-full);
  background-color: transparent;
  color: inherit;
  font-weight: 500;
}

/* —— Snackbar（#toast 的新外观） —— */
.snackbar, .toast {
  position: absolute; z-index: 60;
  left: 50%;
  bottom: calc(160px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content; max-width: min(90%, 420px);
  padding: 12px 16px;
  border-radius: var(--md-shape-xs);
  background-color: var(--md-inverse-surface);
  color: var(--md-inverse-on-surface);
  font-size: var(--md-body-size); line-height: var(--md-body-line);
  box-shadow: var(--md-elev-2);
  overflow-wrap: anywhere;
}
#toast[hidden] { display: none !important; }

/* —— 消息横幅（顶部，inverse 配色，query 有 elevation） —— */
.message-banner, .banner {
  position: absolute; z-index: 50;
  top: max(8px, env(safe-area-inset-top));
  left: 12px; right: 12px;
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border: 0;
  border-radius: var(--md-shape-md);
  background-color: var(--md-inverse-surface);
  color: var(--md-inverse-on-surface);
  text-align: left;
  box-shadow: var(--md-elev-2);
  transform: translateY(-130%);
  opacity: 0;
  transition: transform var(--md-dur-long) var(--md-ease),
              opacity var(--md-dur-long) var(--md-ease);
  pointer-events: none;
  min-width: 0;
}
.message-banner.show, .banner.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.message-banner .avatar, .banner .avatar {
  background-color: var(--md-state-on-primary);
  color: var(--md-inverse-on-surface);
}
.banner-text { display: grid; min-width: 0; gap: 2px; flex: 1; }
.banner-text b { font-size: var(--md-body-size); line-height: var(--md-body-line); font-weight: 500; }
.banner-text span {
  color: var(--md-inverse-on-surface);
  opacity: .84;
  font-size: var(--md-label-size); line-height: var(--md-label-line);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* —— 弹层通用（原生 dialog：shape-xl + surface-container-high + elev-3） —— */
dialog {
  width: min(calc(100% - 32px), 440px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--md-shape-xl);
  background-color: var(--md-surface-container-high);
  color: var(--md-on-surface);
  box-shadow: var(--md-elev-3);
  overflow: auto;
  overscroll-behavior: contain;
}
dialog::backdrop {
  background-color: var(--md-scrim);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.dialog-body, .consent-card, .update-card, .crop-card, .place-card, .call-card {
  display: grid;
  gap: 12px;
  padding: 24px;
  text-align: left;
  min-width: 0;
}
.consent-card p, .update-card p, .crop-card p {
  color: var(--md-on-surface-variant);
  font-size: var(--md-body-size); line-height: var(--md-body-line);
}
.update-card h2, .consent-card h2, .crop-card h2, .place-card h2, .call-card h2 {
  font-size: var(--md-headline-size); line-height: var(--md-headline-line);
  font-weight: 400;
  overflow-wrap: anywhere;
}

/* —— 地点选择器 —— */
.place-card { padding: 24px; }
.place-list {
  display: grid; gap: 6px;
  max-height: 46vh;
  overflow: auto;
  overscroll-behavior: contain;
  min-width: 0;
}
.place-option {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 52px;
  padding: 10px 14px;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-shape-sm);
  background-color: transparent;
  color: var(--md-on-surface);
  text-align: left;
  min-width: 0;
  transition: background-color var(--md-dur) var(--md-ease),
              border-color var(--md-dur) var(--md-ease);
}
.place-option:active { background-color: var(--md-state-press); }
.place-option.active {
  border-color: var(--md-primary);
  background-color: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
}
.place-name {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.place-distance {
  flex: none;
  color: var(--md-on-surface-variant);
  font-size: var(--md-label-size); line-height: var(--md-label-line);
  white-space: nowrap;
}
.place-option.active .place-distance { color: var(--md-on-secondary-container); }
.place-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* —— 照片查看 / 头像裁剪 —— */
.photo-view { display: grid; gap: 12px; margin: 0; padding: 12px; }
.photo-view img {
  display: block; width: 100%;
  max-height: calc(100dvh - 180px);
  object-fit: contain;
  border-radius: var(--md-shape-md);
  background-color: var(--md-media-bg);
  opacity: var(--img-opacity);
  outline: var(--img-outline);
  outline-offset: -1px;
}
.photo-view .secondary { justify-self: end; }
.crop-viewport {
  position: relative;
  width: 100%; aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--md-shape-md);
  background-color: var(--md-media-bg);
  touch-action: none;
  cursor: grab;
}
.crop-viewport:active { cursor: grabbing; }
.crop-viewport img {
  position: absolute; left: 0; top: 0;
  max-width: none;
  user-select: none; -webkit-user-drag: none;
  pointer-events: none;
}
/* 裁剪遮罩：圆内清晰、圆外压暗（rgba 属遮罩，允许） */
.crop-mask {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(circle closest-side at 50% 50%,
    transparent 0 99%, rgba(20, 18, 24, .48) 99.5%);
  box-shadow: inset 0 0 0 1px var(--md-media-hairline);
}
.crop-mask::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .92);
}

/* —— 更新弹窗 —— */
.update-notes {
  display: grid; gap: 6px;
  margin: 0;
  padding-left: 20px;
  list-style: disc;
  max-height: 40vh; overflow: auto;
  color: var(--md-on-surface-variant);
  font-size: var(--md-body-size); line-height: var(--md-body-line);
}
.update-notes li { overflow-wrap: anywhere; }
.update-notes li::marker { color: var(--md-primary); }
.update-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.update-actions .primary { flex: 1 1 120px; }
.update-actions .secondary { flex: 1 1 80px; }
.update-actions .text-button { flex: none; margin-left: auto; white-space: nowrap; }

