@import url("tokens.css");

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 14px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}
.muted { color: var(--ink-2); }
.latin { font-style: italic; color: var(--ink-2); font-size: 13px; }
.kicker { color: var(--muted); font-size: 12px; font-weight: 500; }

/* ——— Header ——— */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.nav {
  width: 100%;
  max-width: var(--wrap);
  min-height: 72px;
  margin-inline: auto;
  padding-inline: var(--page-gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 20px; color: var(--ink); flex: 0 0 auto;
}
.brand-logo { width: 30px; height: 30px; object-fit: contain; flex: 0 0 30px; }
.nav-end {
  display: flex; align-items: center; gap: 8px 22px; margin-left: auto;
}
.nav-explore { position: relative; }
.nav-explore-btn, .nav-login {
  border: 0; background: none; padding: 0;
  height: 40px; color: var(--ink); font-size: 15px; font-weight: 500;
}
.nav-explore-btn {
  display: inline-flex; align-items: center; gap: 4px;
}
.nav-explore-btn:hover, .nav-login:hover { color: var(--ink-2); }
.nav-chevron { display: block; opacity: .7; }
.nav-dropdown {
  display: none;
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 168px; padding: 8px 0;
  background: var(--surface); border-radius: 12px;
  box-shadow: 0 8px 28px rgba(25, 27, 38, .12);
  border: 1px solid var(--line); z-index: 40;
}
.nav-explore:hover .nav-dropdown,
.nav-explore.open .nav-dropdown,
.nav-explore:focus-within .nav-dropdown { display: block; }
.nav-dropdown a {
  display: block; padding: 10px 16px; font-size: 14px; font-weight: 500; color: var(--ink);
}
.nav-dropdown a:hover, .nav-dropdown a.active { background: var(--canvas); color: var(--accent); }
.nav-upload {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border: 0; border-radius: var(--pill);
  background: var(--accent); color: #fff; font-weight: 600; font-size: 14px;
}
.nav-upload:hover { background: var(--accent-hover); }
.nav-user { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.avatar { width: 32px; height: 32px; object-fit: cover; border-radius: 50%; background: var(--surface-subtle); }
.nav-menu {
  display: none; width: 36px; height: 36px; border: 0; background: transparent;
  font-size: 20px; color: var(--ink);
}

/* ——— Buttons ——— */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 18px; border: 0; border-radius: var(--pill);
  background: var(--ink); color: #fff; font-weight: 600; font-size: 14px;
  transition: background var(--fast) var(--ease);
}
.button:hover { background: #2c3e50; }
.button.accent { background: var(--accent); }
.button.accent:hover { background: var(--accent-hover); }
.button.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.button.secondary:hover { background: var(--surface-subtle); }
.button.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.button.ghost {
  background: rgba(255,255,255,.18); color: #fff; backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.35);
}
.button.ghost:hover { background: #fff; color: var(--ink); }
.button:disabled { opacity: .55; cursor: not-allowed; }

/* ——— Search pill ——— */
.search-pill {
  display: flex; align-items: stretch; height: 56px;
  background: #fff; border-radius: var(--pill); box-shadow: var(--shadow-search); overflow: hidden;
}
.search-pill .search-cat {
  display: flex; align-items: center; gap: 6px;
  padding: 0 16px 0 20px; border: 0; background: transparent;
  color: var(--ink); font-weight: 500; font-size: 14px; white-space: nowrap;
  border-right: 1px solid var(--line);
}
.search-pill input {
  flex: 1; border: 0; outline: 0; background: transparent;
  padding: 0 16px; font-size: 16px; min-width: 0;
}
.search-pill input::placeholder { color: var(--muted); }
.search-pill .search-submit {
  width: 56px; border: 0; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 18px;
}
.search-pill .search-submit:hover { background: var(--accent-hover); }
.search-pill .search-submit svg, .nav-search button svg { display: block; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  display: inline-flex; align-items: center;
  padding: 6px 14px; border-radius: var(--pill);
  background: rgba(255,255,255,.18); color: #fff;
  font-size: 13px; font-weight: 500; backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.2);
}
.chip:hover { background: rgba(255,255,255,.32); }
.chip-light {
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line);
  backdrop-filter: none;
}
.chip-light:hover, .chip-light.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.ribbon {
  display: flex; gap: 8px; overflow-x: auto; padding: 14px 0;
  scrollbar-width: none;
}
.ribbon::-webkit-scrollbar { display: none; }
.ribbon a, .ribbon button {
  flex: 0 0 auto; padding: 8px 14px; border: 0; border-radius: var(--pill);
  background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500;
}
.ribbon a.active, .ribbon button.active, .ribbon a:hover, .ribbon button:hover {
  background: var(--ink); color: #fff;
}

/* ——— Hero (search-centric, video backdrop) ——— */
.hero {
  position: relative; overflow: hidden;
  width: 100%;
  margin: 16px 0 0;
  height: clamp(380px, 42vh, 480px);
  display: flex; align-items: center; justify-content: center;
  color: #fff; text-align: center;
  border-radius: 16px;
}
.hero-video, .hero-overlay { position: absolute; inset: 0; }
.hero-video { width: 100%; height: 100%; object-fit: cover; }
.hero-overlay { background: rgba(17, 20, 24, .42); }
.hero-copy { position: relative; z-index: 2; width: min(760px, 100%); padding-inline: 20px; }
.hero h1 {
  margin: 0 0 10px; font-size: clamp(22px, 4.2vw, 40px);
  font-weight: 700; line-height: 1.2; letter-spacing: -.02em;
}
.hero h1 em { font-style: normal; color: #fff; }
.hero-intro { margin: 0 auto 22px; max-width: 520px; font-size: 16px; line-height: 1.5; color: rgba(255,255,255,.88); font-weight: 400; }
.hero .search-pill { margin: 0 auto 16px; }
.hero-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* ——— Home CTA strip (Pixabay-style) ——— */
.home-cta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 28px 0 8px;
}
.home-cta-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 100%;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.home-cta-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface-subtle); color: var(--ink);
  display: grid; place-items: center; flex: 0 0 auto;
}
.home-cta-icon svg { width: 20px; height: 20px; display: block; }
.home-cta-card h2 {
  margin: 14px 0 0;
  font-size: 18px; font-weight: 700; line-height: 1.3; letter-spacing: -.02em;
}
.home-cta-card p {
  margin: 8px 0 0;
  color: var(--ink-2); font-size: 14px; line-height: 1.55;
  flex: 1;
}
.home-cta-card .button {
  width: 100%;
  margin-top: 18px;
  min-height: 44px;
}
.home-cta-card .button:active { transform: scale(0.985); }
.button.quiet {
  background: #f2f2f2; color: var(--ink);
}
.button.quiet:hover { background: #e8e8e8; }

/* ——— Masonry ——— */
.masonry { column-count: 4; column-gap: var(--gap); }
.masonry-card {
  display: block; break-inside: avoid; margin-bottom: var(--gap);
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--surface-subtle); cursor: pointer;
}
.masonry-card .card-cover,
.masonry-card > img {
  width: 100%; height: auto; display: block;
  transition: transform .35s var(--ease), opacity .3s ease;
}
.masonry-card .card-overlay {
  position: absolute; inset: 0;
  background: var(--overlay-card-hover);
  opacity: 0; transition: opacity .25s var(--ease);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 12px; color: #fff; pointer-events: none;
}
.masonry-card .card-overlay-top,
.masonry-card .card-overlay-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.masonry-card .card-overlay-bottom {
  flex-direction: column; align-items: flex-start; gap: 6px;
}
.masonry-card .card-name { font-size: 13px; font-weight: 600; text-shadow: 0 1px 8px rgba(0,0,0,.45); }
.masonry-card .card-author {
  display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%;
}
.masonry-card .card-place {
  display: inline-flex; align-items: center; gap: 4px;
  flex: 0 1 auto; max-width: min(58%, 160px); min-width: 0; margin-left: auto;
  height: 32px; padding: 0 10px 0 8px;
  border: 0; border-radius: 8px;
  font-size: 11px; font-weight: 600; line-height: 1;
  color: #fff; background: rgba(255,255,255,.22);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.masonry-card .card-place svg {
  flex: 0 0 12px; width: 12px; height: 12px; opacity: .92;
}
.masonry-card .card-place-text {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.masonry-card .card-avatar,
.masonry-card .card-avatar-fallback {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 22px;
  object-fit: cover; background: rgba(255,255,255,.28);
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.45);
}
.masonry-card .card-avatar-fallback {
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; line-height: 1;
}
.masonry-card .card-meta {
  font-size: 12px; opacity: .95; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.masonry-card .card-heart {
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255,255,255,.22); backdrop-filter: blur(8px);
  display: grid; place-items: center; font-size: 14px;
}
@media (hover: hover) {
  .masonry-card:hover .card-overlay { opacity: 1; }
  .masonry-card:hover .card-cover,
  .masonry-card:hover > img { transform: scale(1.02); }
}
@media (hover: none) {
  .masonry-card .card-overlay { opacity: 1; }
}

.feed-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 20px 0 12px;
}
.feed-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.feed-head span { color: var(--muted); font-size: 13px; }

/* ——— Page chrome ——— */
.page-hero { padding: 28px 0 8px; }
.page-hero h1 { margin: 0 0 8px; font-size: clamp(22px, 3vw, 28px); font-weight: 700; letter-spacing: -.02em; }
.page-hero p { margin: 0 0 18px; color: var(--ink-2); max-width: 560px; font-size: 15px; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 8px 0 16px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  border: 0; background: var(--surface); color: var(--ink-2);
  border-radius: var(--pill); padding: 8px 14px; font-size: 13px; font-weight: 500;
}
.pill.active, .pill:hover { background: var(--ink); color: #fff; }
a.pill { display: inline-flex; align-items: center; }

.input, .select, textarea.input {
  width: 100%; min-height: 42px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); padding: 8px 12px; outline: 0;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--accent); }
.filter-layout { display: grid; grid-template-columns: 240px 1fr; gap: 28px; padding: 8px 0 48px; }
.filter-panel { background: var(--surface); border-radius: 12px; padding: 18px; height: fit-content; }
.filter-panel label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
.date-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.results-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; color: var(--muted); font-size: 13px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 10px; padding: 28px 0 48px; }
.suggest {
  position: absolute; left: 0; right: 0; top: 48px; z-index: 6;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(25,27,38,.08); overflow: hidden;
}
.suggest button {
  display: block; width: 100%; padding: 10px 14px; text-align: left;
  border: 0; background: transparent;
}
.suggest button:hover { background: var(--canvas); }

/* ——— Detail / lightbox-ish ——— */
.detail-layout {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .9fr);
  gap: 28px; padding: 24px 0 64px;
}
.detail-hero {
  background: var(--canvas); border-radius: var(--radius); overflow: hidden;
  display: grid; place-items: center; position: relative;
}
.detail-photo {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 600px;
  object-fit: contain;
}
.detail-hero .card-badge { z-index: 1; }
.thumbs { display: flex; justify-content: center; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumb {
  flex: 0 0 72px; height: 72px; object-fit: cover; border-radius: 6px;
  cursor: pointer; opacity: .7; border: 2px solid transparent;
}
.thumb.active, .thumb:hover { opacity: 1; border-color: var(--accent); }
.id-panel {
  margin-top: 24px;
  background: var(--surface);
  border-radius: 12px;
  padding: 8px 22px 22px;
}
.id-community { padding: 18px 0; border-bottom: 1px solid var(--line); }
.id-community-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.id-community-head h3, .id-compose h3 { margin: 0; font-size: 14px; font-weight: 600; }
.id-community-name { display: block; font-size: 16px; font-weight: 600; }
.id-community-meta { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.id-activity { padding: 0; }
.id-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.id-item:last-child { border-bottom: 0; }
.id-avatar {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  background: var(--surface-subtle); flex: 0 0 40px;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.id-avatar img { width: 100%; height: 100%; object-fit: cover; }
.id-item-who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-bottom: 4px; }
.id-item-who a { font-weight: 600; }
.id-item-taxon { display: block; font-size: 15px; font-weight: 600; }
.id-item-note { margin: 6px 0 0; color: var(--ink-2); font-size: 13px; }
.id-item time { display: block; margin-top: 6px; font-size: 12px; }
.id-badge {
  padding: 1px 7px; border-radius: var(--pill); background: var(--canvas);
  font-size: 11px; font-weight: 600; color: var(--ink-2);
}
.id-mine { font-size: 12px; color: var(--muted); padding-top: 8px; }
.id-empty { padding: 16px 0; }
.id-compose { padding-top: 18px; }
.id-compose h3 { margin-bottom: 10px; }
.id-suggest { position: relative; margin-bottom: 10px; }
.id-compose textarea.input { min-height: 68px; margin-bottom: 12px; resize: vertical; }
.id-compose-actions { display: flex; justify-content: flex-end; }
.detail-title { font-size: clamp(20px, 2.4vw, 24px); font-weight: 600; line-height: 1.3; margin: 6px 0 8px; }
.observer-card {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0 4px; padding: 10px 12px;
  border-radius: 12px; background: var(--canvas);
  transition: background var(--fast) var(--ease);
}
.observer-card:hover { background: #ececec; }
.observer-avatar {
  width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
  flex: 0 0 44px; background: var(--surface-subtle);
}
.observer-avatar.fallback {
  display: grid; place-items: center;
  font-size: 16px; font-weight: 600; color: var(--ink); background: #e4e6eb;
}
.observer-info { flex: 1; min-width: 0; }
.observer-info strong { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; }
.observer-info span { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-2); }
.observer-go { font-size: 12px; color: var(--accent); font-weight: 600; flex: 0 0 auto; }
.detail-side { background: var(--surface); border-radius: 12px; padding: 8px 22px 22px; }
.detail-block { padding: 18px 0; border-bottom: 1px solid var(--line); }
.detail-block:last-child { border-bottom: 0; }
.detail-block h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.detail-fold > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  cursor: pointer; font-size: 14px; font-weight: 600; list-style: none;
}
.detail-fold > summary::-webkit-details-marker,
.detail-fold > summary::marker { display: none; content: none; }
.detail-fold > summary::after {
  content: ''; width: 6px; height: 6px; flex: 0 0 auto;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg); opacity: .5;
  transition: transform var(--fast) var(--ease);
}
.detail-fold[open] > summary { margin-bottom: 10px; }
.detail-fold[open] > summary::after { transform: rotate(225deg); margin-top: 3px; }
.data-list { display: grid; grid-template-columns: 72px 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.data-list dt { color: var(--muted); }
.data-list dd { margin: 0; }
.notice {
  background: #e8f8f1; color: #0b5c3c; border-radius: 8px; padding: 12px 14px; font-size: 13px;
}
.progress { height: 6px; background: var(--surface-subtle); border-radius: var(--pill); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); }
.taxonomy { display: flex; flex-wrap: wrap; gap: 6px; }
.taxonomy span { padding: 4px 10px; background: var(--canvas); border-radius: var(--pill); font-size: 12px; }
.id-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.id-row:last-child { border-bottom: 0; }
.id-row strong { display: block; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.card-badge {
  position: absolute; left: 12px; top: 12px; padding: 4px 10px;
  border-radius: var(--pill); background: var(--accent); color: #fff; font-size: 12px; font-weight: 600;
}

/* ——— Profile ——— */
.profile-cover {
  padding: 28px 0 20px; display: grid; grid-template-columns: 88px 1fr auto;
  gap: 20px; align-items: center;
}
.profile-avatar {
  width: 88px; height: 88px; object-fit: cover; border-radius: 50%; background: var(--surface-subtle);
}
.profile-name { font-size: clamp(22px, 3vw, 28px); font-weight: 700; margin: 0 0 6px; }
.profile-stats { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 10px; }
.stat strong { display: block; font-size: 20px; font-weight: 700; }
.stat span { color: var(--muted); font-size: 12px; }
.badge-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.badge {
  min-width: 96px; padding: 12px; background: var(--surface); border-radius: var(--radius); text-align: center;
}
.badge-icon { font-size: 18px; color: var(--accent); }
.badge small { display: block; font-size: 12px; margin-top: 4px; font-weight: 600; }
.collection-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.collection-cell {
  aspect-ratio: 1; position: relative; overflow: hidden; border-radius: var(--radius); background: var(--surface-subtle);
}
.collection-cell img { width: 100%; height: 100%; object-fit: cover; }
.collection-cell .cell-label {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  font-size: 12px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.5); font-weight: 500;
}
.collection-cell.state-blank { display: grid; place-items: center; color: var(--muted); font-size: 22px; }

/* ——— Cities / ranks compact ——— */
.city-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.city-card {
  min-width: 160px; padding: 14px; background: var(--surface); border-radius: var(--radius);
}
.city-card strong { display: block; font-size: 16px; }
.city-card span { color: var(--muted); font-size: 12px; }
.rank-list { display: grid; gap: 0; background: var(--surface); border-radius: 12px; overflow: hidden; }
.rank-row {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px;
  min-height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line);
}
.rank-row:last-child { border-bottom: 0; }
.rank-number { color: var(--muted); font-size: 12px; font-weight: 600; }
.rank-name { font-weight: 600; }
.rank-value { font-size: 13px; color: var(--ink-2); }

.section { padding: 8px 0 36px; }
.section-title { font-size: 18px; font-weight: 600; margin: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 12px 0 14px; }

.activity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-bottom: 36px;
}
.activity-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.activity-cover { width: 100%; height: 140px; object-fit: cover; }
.activity-body { padding: 14px 16px 16px; }
.activity-body h2 { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.activity-body p { margin: 0 0 8px; color: var(--ink-2); font-size: 13px; }

.empty, .error {
  padding: 48px 20px; text-align: center; color: var(--muted);
  background: var(--surface); border-radius: 12px;
}
.error { color: var(--danger); }
.skeleton { background: linear-gradient(90deg, #ececec, #f7f7f7, #ececec); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }
.masonry-skel { height: 220px; margin-bottom: var(--gap); break-inside: avoid; }

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  margin-top: 48px;
  padding: 80px 0;
  color: var(--ink);
}
.footer-inner {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}
.footer-brand {
  flex: 1 1 0;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.footer-brand .brand { font-size: 22px; }
.footer-brand .brand-logo { width: 32px; height: 32px; flex-basis: 32px; }
.footer-desc {
  margin: 0;
  max-width: 36em;
  font-size: 14px;
  line-height: 20px;
  color: rgba(25, 27, 38, 0.64);
}
.footer-cols {
  display: flex;
  gap: 24px;
  flex: 0 0 auto;
}
.footer-col {
  width: 200px;
  flex: 0 0 200px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.footer-col h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}
.footer-col ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 12px;
}
.footer-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 400; line-height: 21px;
  color: rgba(25, 27, 38, 0.64); cursor: default;
}
.footer-link:hover { color: var(--ink); }
.footer-badge {
  display: inline-flex; align-items: center; justify-content: center;
  height: 16px; padding: 0 6px; border-radius: 4px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
}
.footer-live {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--muted);
}
.footer-live i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--danger); display: block;
}

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(25, 27, 38, .45); padding: 20px;
}
.modal {
  width: min(400px, 100%); background: var(--surface); border-radius: 16px;
  padding: 28px; position: relative; box-shadow: 0 16px 48px rgba(0,0,0,.16);
}
.modal-close { position: absolute; right: 12px; top: 10px; border: 0; background: none; font-size: 22px; color: var(--muted); }
.group-modal {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 28px 24px;
  position: relative;
  box-shadow: 0 16px 48px rgba(0,0,0,.16);
}
.group-modal h2 { margin: 0 28px 8px 0; font-size: 20px; font-weight: 700; }
.group-modal p { margin: 0 0 18px; color: var(--ink-2); font-size: 14px; line-height: 1.6; }
.group-modal .button { width: 100%; }
.qr { width: 200px; height: 200px; margin: 16px auto; object-fit: contain; }

.login-modal {
  width: min(820px, 100%);
  min-height: 480px;
  display: grid;
  grid-template-columns: 0.42fr 0.58fr;
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,.16);
}
.login-visual {
  position: relative;
  min-height: 480px;
  background: #1a1c18 center / cover no-repeat;
}
.login-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.18) 0%, rgba(0,0,0,.12) 40%, rgba(0,0,0,.55) 100%);
}
.login-visual-copy {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 52px;
  z-index: 1;
  color: #fff;
}
.login-visual-copy strong {
  display: block;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.login-visual-copy p {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255,255,255,.88);
}
.login-credit {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 16px;
  z-index: 1;
  color: rgba(255,255,255,.62);
  font-size: 11px;
  font-weight: 400;
}
.login-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 36px 40px 28px;
}
.login-panel h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.login-panel .login-lead {
  margin: 0 0 20px;
  color: var(--ink-2);
  font-size: 14px;
}
.login-qr {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 220px;
}
.login-qr .qr { width: 216px; height: 216px; margin: 0; }
.login-status {
  margin: 8px 0 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.login-panel .button { width: 100%; min-height: 44px; }
.login-legal {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
.login-legal a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 720px) {
  .login-modal { grid-template-columns: 1fr; min-height: 0; }
  .login-visual { min-height: 160px; }
  .login-visual-copy { left: 20px; right: 20px; bottom: 36px; }
  .login-visual-copy strong { font-size: 22px; }
  .login-credit { left: 20px; right: 20px; bottom: 12px; }
  .login-panel { padding: 24px 22px 20px; }
}
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translateX(-50%);
  padding: 10px 16px; background: var(--ink); color: #fff; border-radius: var(--pill); font-size: 13px;
}

.cover-fallback {
  min-height: 160px; display: grid; place-items: center; color: var(--muted); font-size: 12px; background: var(--surface-subtle);
}

@media (min-width: 1600px) { .masonry { column-count: 5; } }
@media (max-width: 1199px) { .masonry { column-count: 3; } }
@media (max-width: 1000px) {
  .detail-layout, .filter-layout { grid-template-columns: 1fr; }
  .collection-grid { grid-template-columns: repeat(4, 1fr); }
  .footer-inner { flex-wrap: wrap; gap: 40px 24px; }
  .footer-brand { flex: 1 1 100%; }
  .footer-cols { width: 100%; justify-content: space-between; }
  .footer-col { flex: 1 1 0; width: auto; }
  .home-cta, .activity-grid { grid-template-columns: 1fr; }
}
@media (max-width: 899px) {
  .masonry { column-count: 2; }
  .home-cta, .activity-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .nav { min-height: 56px; gap: 10px; }
  .nav-explore, .nav-user-name { display: none; }
  .site-header.nav-open .nav-explore { display: block; position: static; }
  .site-header.nav-open .nav-explore-btn { display: none; }
  .site-header.nav-open .nav-dropdown {
    display: flex; flex-direction: column; position: absolute;
    left: 0; right: 0; top: 56px; min-width: 0; border-radius: 0;
    border: 0; border-bottom: 1px solid var(--line);
    box-shadow: none; padding: 8px var(--page-gutter) 16px;
    background: var(--surface);
  }
  .nav-end { gap: 8px; }
  .nav-upload { padding: 0 14px; height: 36px; }
  .nav-menu { display: grid; place-items: center; }
  .hero { height: clamp(320px, 52vh, 400px); margin-top: 12px; border-radius: 12px; }
  .hero-intro { font-size: 14px; }
  .search-pill { height: 48px; }
  .search-pill input { font-size: 14px; }
  .search-pill .search-cat { display: none; }
  .profile-cover { grid-template-columns: 64px 1fr; }
  .profile-avatar { width: 64px; height: 64px; }
  .profile-cover .button { grid-column: span 2; }
  .collection-grid { grid-template-columns: repeat(3, 1fr); }
  .site-footer { padding: 48px 0 56px; margin-top: 28px; }
  .footer-inner { flex-direction: column; gap: 32px; }
  .footer-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 24px; width: 100%; }
  .footer-col { width: auto; flex: none; }
  .footer-desc { max-width: none; }
}
/* ——— Butterfly selector ——— */
.bs-backdrop { z-index: 55; padding: 16px; }
.bs-panel {
  --bs-alias: #c97b3c;
  position: relative;
  display: flex; flex-direction: column;
  width: min(760px, 100%);
  height: min(80vh, 860px);
  background: var(--surface);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,.16);
}
.bs-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 44px 12px 20px; flex-shrink: 0;
}
.bs-header h2 { margin: 0; font-size: 18px; font-weight: 700; }
.bs-search { position: relative; padding: 0 20px 12px; flex-shrink: 0; }
.bs-search .input { padding-right: 36px; background: var(--canvas); border: 0; }
.bs-clear {
  position: absolute; right: 28px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1;
}
.bs-families {
  display: flex; gap: 8px; overflow-x: auto; padding: 0 20px 12px;
  flex-shrink: 0; border-bottom: 1px solid var(--line);
}
.bs-family {
  flex: 0 0 auto; border: 0; border-radius: var(--pill);
  padding: 6px 12px; background: var(--canvas); color: var(--ink-2); font-size: 13px;
}
.bs-family.active { background: var(--accent); color: #fff; font-weight: 600; }
.bs-stats {
  padding: 8px 20px; flex-shrink: 0;
  font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--canvas);
}
.bs-meta {
  display: block; width: 100%; border: 0; background: none;
  padding: 6px 20px 10px; font-size: 12px; color: var(--muted); text-align: center;
}
.bs-meta:hover { color: var(--ink); }
.bs-split { flex: 1; min-height: 0; display: flex; overflow: hidden; }
.bs-genus {
  width: 168px; flex-shrink: 0; overflow-y: auto; background: var(--canvas);
  border-right: 1px solid var(--line);
}
.bs-genus-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  width: 100%; border: 0; background: transparent; text-align: left;
  padding: 12px 12px; font-size: 13px; border-bottom: 1px solid rgba(25,27,38,.04);
}
.bs-genus-item span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-count {
  flex-shrink: 0; font-size: 11px; color: var(--muted);
  background: rgba(25,27,38,.06); padding: 1px 6px; border-radius: var(--pill);
}
.bs-genus-item.active {
  background: #fff; box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 700; color: var(--accent);
}
.bs-genus-item.active .bs-count { background: rgba(0,171,107,.12); color: var(--accent); }
.bs-species { flex: 1; min-width: 0; overflow-y: auto; }
.bs-species-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; background: rgba(0,171,107,.05); border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
}
.bs-species-item, .bs-hit {
  display: block; width: 100%; border: 0; background: transparent; text-align: left;
  padding: 12px 16px; border-bottom: 1px solid rgba(25,27,38,.04);
}
.bs-species-item:hover, .bs-hit:hover { background: rgba(0,171,107,.04); }
.bs-hit-main { display: flex; align-items: center; gap: 8px; }
.bs-hit.is-genus { background: rgba(0,171,107,.04); box-shadow: inset 3px 0 0 var(--accent); }
.bs-hit.is-alias { background: rgba(201,123,60,.06); box-shadow: inset 3px 0 0 var(--bs-alias); }
.bs-tag {
  flex-shrink: 0; font-size: 11px; font-weight: 700; color: #fff;
  background: var(--accent); padding: 1px 6px; border-radius: 4px;
}
.bs-tag.alias { background: var(--bs-alias); }
.bs-hint { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-2); }
.bs-alias-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--bs-alias); }
.bs-alias-row, .bs-alias-brief {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 8px; font-size: 12px; color: var(--bs-alias);
}
.bs-chip { background: rgba(25,27,38,.05); border-radius: 4px; padding: 2px 6px; color: var(--ink-2); }
.bs-chip.matched { background: rgba(201,123,60,.16); color: var(--bs-alias); font-weight: 600; }
.bs-results { flex: 1; min-height: 0; overflow-y: auto; }
.bs-trunc { padding: 16px; text-align: center; }
.bs-state { padding: 40px 16px; text-align: center; color: var(--muted); }
.bs-state.full { width: 100%; }
.protect-tag {
  font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; flex-shrink: 0;
}
.protect-tag.protect-1 { background: rgba(255,59,48,.12); color: #ff3b30; }
.protect-tag.protect-2 { background: rgba(255,149,0,.12); color: #ff9500; }
.bs-sheet {
  position: absolute; inset: 0; z-index: 2;
  background: rgba(25,27,38,.4); display: flex; align-items: flex-end;
}
.bs-sheet-panel {
  width: 100%; max-height: 70%; background: var(--surface);
  border-radius: 16px 16px 0 0; display: flex; flex-direction: column;
}
.bs-sheet-body { overflow-y: auto; padding: 0 20px 24px; }
.bs-now { padding: 12px 14px; background: rgba(0,171,107,.06); border-radius: 8px; margin-bottom: 16px; }
.bs-now strong, .bs-ver strong { display: block; margin-top: 6px; }
.bs-history { padding: 12px 0; border-bottom: 1px solid var(--line); }
.bs-history-head { display: flex; align-items: center; gap: 8px; }
.bs-kind { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: rgba(201,123,60,.14); color: var(--bs-alias); }
.bs-kind.kind-merged { background: rgba(224,83,61,.12); color: #e0533d; }
.bs-kind.kind-common { background: var(--canvas); color: var(--ink-2); }
.bs-ver { padding: 12px 0; border-bottom: 1px solid var(--line); }
.bs-foot { margin-top: 16px; }
.bs-trigger {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; margin-bottom: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); text-align: left;
}
.bs-trigger:hover { background: var(--canvas); }
@media (max-width: 719px) {
  .bs-backdrop { padding: 0; align-items: end; }
  .bs-panel { width: 100%; height: 85vh; border-radius: 16px 16px 0 0; }
  .bs-genus { width: 132px; }
}

/* ——— Upload ——— */
.up-gate, .up-empty {
  margin: 48px auto; max-width: 480px; text-align: center;
  padding: 48px 24px; background: var(--surface);
  border: 1px solid var(--ink-08); border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.up-gate h1, .up-empty h2, .up-bar h1 {
  margin: 0 0 8px; font-size: 22px; font-weight: 600; color: var(--ink);
}
.up-gate p, .up-empty p { margin: 0 0 24px; }
.up-bar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; padding: 24px 0 16px; flex-wrap: wrap;
}
.up-bar p { margin: 0; }
.up-bar-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.up-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  align-items: start; gap: 16px; padding-bottom: 48px;
}
.up-progress {
  position: sticky; top: 72px; z-index: 20;
  margin-bottom: 16px; padding: 8px 16px;
  border: 1px solid var(--ink-08); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-card);
}
.up-progress-text {
  display: flex; align-items: center; flex-wrap: wrap; gap: 16px;
  margin-bottom: 8px; color: var(--ink-64); font-size: 12px;
}
.up-progress-text strong { color: var(--ink); font-weight: 600; }
.up-progress-track {
  height: 4px; border-radius: var(--pill);
  background: var(--ink-08); overflow: hidden;
}
.up-progress-track i {
  display: block; height: 100%; border-radius: var(--pill);
  background: var(--accent); transition: width .3s ease-in-out;
}
.up-restore {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  margin-bottom: 16px; padding: 8px 16px;
  border: 1px solid var(--ink-08); border-radius: var(--radius);
  background: var(--ink-04); color: var(--ink-64); font-size: 12px;
}
.up-restore .up-text-btn { margin: 0 0 0 16px; }
.up-restore.is-error {
  border-color: var(--danger-ink); background: var(--surface); color: var(--danger-ink);
}
.up-restore.is-error .up-text-btn { color: var(--danger-ink); }
.up-select-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 16px;
  margin-bottom: 16px; padding: 8px 16px;
  border: 1px solid var(--ink-08); border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .3s ease-in-out;
}
.up-select-bar.is-active { border-color: var(--ink-24); }
.up-select-bar .up-check { color: var(--ink-88); }
.up-batch-date {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink-64); font-size: 12px;
}
.up-batch-date .up-input { width: 140px; color: var(--ink-88); font-size: 14px; }
.up-card.is-selected { border-color: var(--ink-24); }
.up-card-head .up-check { gap: 8px; }
.up-card {
  display: flex; flex-direction: column; gap: 16px;
  padding: 16px; background: var(--surface);
  border: 1px solid var(--ink-08); border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: border-color .3s ease-in-out;
}
.up-card:hover { border-color: var(--ink-24); }
.up-card-head { display: flex; align-items: center; justify-content: space-between; }
.up-badge {
  padding: 4px 12px; border-radius: var(--pill);
  background: var(--ink-04); color: var(--ink-64); font-size: 12px;
}
.up-icon-btn {
  width: 24px; height: 24px; border: 0; padding: 0;
  background: transparent; color: var(--ink-64); font-size: 20px; line-height: 1;
  transition: color .3s ease-in-out;
}
.up-icon-btn:hover { color: var(--ink); }

/* 照片是卡片主体：没有照片时整块就是投放区 */
.up-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.up-photo {
  position: relative; aspect-ratio: 1;
  border-radius: var(--radius); overflow: hidden; background: var(--surface-subtle);
}
.up-photo img { width: 100%; height: 100%; object-fit: cover; }
.up-photo-mask {
  position: absolute; inset: 0; display: grid; place-items: center;
  gap: 8px; align-content: center;
  background: var(--ink-64); color: #fff; font-size: 12px;
}
.up-photo-mask.is-error { background: rgba(201, 42, 42, .72); }
.up-photo-retry {
  padding: 4px 12px; border: 1px solid rgba(255, 255, 255, .35);
  border-radius: var(--pill); background: rgba(255, 255, 255, .18);
  color: #fff; font-size: 12px;
}
.up-photo-retry:hover { background: #fff; color: var(--ink); }
.up-photo-del {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px;
  border: 0; border-radius: 50%; background: var(--ink-64); color: #fff;
  opacity: 0; font-size: 16px; line-height: 1; transition: opacity .15s ease-in-out;
}
.up-photo:hover .up-photo-del, .up-photo-del:focus-visible { opacity: 1; }
.up-photo-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; aspect-ratio: 1; padding: 8px;
  border: 1px dashed var(--ink-24); border-radius: var(--radius);
  background: transparent; color: var(--ink-64); font-size: 12px; text-align: center;
  transition: border-color .3s ease-in-out, color .3s ease-in-out;
}
.up-photo-add:hover { border-color: var(--ink); color: var(--ink); }
.up-photo-plus { font-size: 24px; line-height: 1; }
.up-photo-hint { display: none; }
.up-photos.is-empty .up-photo-add { grid-column: 1 / -1; aspect-ratio: 16 / 9; }
.up-photos.is-empty .up-photo-hint { display: block; }

.up-ai {
  display: flex; align-items: center; gap: 8px; width: 100%;
  margin: 0; padding: 8px 12px; border: 0; border-radius: var(--radius);
  background: var(--ink-04); color: var(--ink-88); font-size: 12px; text-align: left;
  transition: background .1s ease-in;
}
button.up-ai:hover { background: var(--ink-08); }
.up-ai.is-idle { color: var(--ink-64); }
.up-ai strong { font-size: 14px; font-weight: 600; }
.up-ai-tag {
  flex: 0 0 auto; padding: 0 8px; border-radius: var(--pill);
  background: var(--surface); color: var(--ink-64);
}

/* 字段：一条分隔线一行，取代层层描边的输入框 */
.up-rows { margin: 0; }
.up-row {
  display: grid; grid-template-columns: 56px 1fr; gap: 4px 16px;
  padding: 8px 0; border-top: 1px solid var(--ink-08);
}
.up-row dt { color: var(--ink-64); font-size: 12px; line-height: 20px; }
.up-req { margin-left: 4px; color: var(--danger-ink); }
.up-row.is-missing dt { color: var(--danger-ink); }
.up-row.is-missing .muted, .up-row.is-missing .up-input { color: var(--danger-ink); }
.up-photos.is-missing .up-photo-add {
  border-color: var(--danger-ink); color: var(--danger-ink);
}
.up-row dd { margin: 0; min-width: 0; }
.up-row .muted { color: var(--ink-64); }
.up-pick {
  position: relative; display: flex; flex-direction: column;
  align-items: flex-start; gap: 4px;
  width: 100%; padding: 0 16px 0 0; border: 0;
  background: none; color: var(--ink-88); text-align: left;
  transition: color .3s ease-in-out;
}
.up-pick::after {
  content: ''; position: absolute; right: 4px; top: 6px; width: 6px; height: 6px;
  border-right: 1.6px solid var(--ink-24); border-bottom: 1.6px solid var(--ink-24);
  transform: rotate(-45deg);
  transition: border-color .3s ease-in-out;
}
.up-pick:hover { color: var(--ink); }
.up-pick:hover::after { border-color: var(--ink-64); }
.up-pick strong { font-weight: 600; }
.up-pick .latin { font-size: 12px; color: var(--ink-64); }
.up-input {
  width: 100%; padding: 0; border: 0; background: transparent;
  color: var(--ink-88); font-size: 14px;
}
.up-input::placeholder { color: var(--ink-64); }
.up-input.is-empty { color: var(--ink-64); }
textarea.up-input { resize: vertical; }
.up-pick:focus-visible, .up-input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.up-text-btn {
  margin-top: 4px; padding: 0; border: 0; background: none;
  color: var(--ink-64); font-size: 12px; text-decoration: underline;
  transition: color .3s ease-in-out;
}
.up-text-btn:hover { color: var(--ink); }
.up-check {
  display: flex; align-items: center; gap: 8px;
  color: var(--ink-64); font-size: 12px; line-height: 20px;
}
.up-fold {
  margin: -8px 0 0; padding-top: 8px; border-top: 1px solid var(--ink-08);
}
.up-fold > summary { color: var(--ink-64); font-weight: 400; }
.up-fold > summary:hover { color: var(--ink); }
.up-fold[open] > summary { margin-bottom: 0; }
.up-fold .up-row:first-child { border-top: 0; }
.up-add-card {
  align-self: stretch; min-height: 160px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  border: 1px dashed var(--ink-24); border-radius: var(--radius);
  background: transparent; color: var(--ink-64);
  transition: border-color .3s ease-in-out, color .3s ease-in-out;
}
.up-add-card:hover { border-color: var(--ink); color: var(--ink); }
.up-map-modal, .up-ai-modal {
  background: var(--surface); border-radius: var(--radius);
  padding: 24px; position: relative; box-shadow: 0 4px 12px rgba(25, 27, 38, .08);
}
.up-map-modal {
  width: min(1280px, calc(100vw - 48px));
  height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
}
.up-ai-modal { width: min(560px, 100%); }
.up-map-modal h2, .up-ai-modal h2 { margin: 0 32px 8px 0; font-size: 18px; font-weight: 600; }
.up-map-modal p { margin: 0 0 16px; flex: 0 0 auto; }
.up-map-search { position: relative; z-index: 8; margin: 0 0 16px; flex: 0 0 auto; }
.up-map-search > .muted { margin: 8px 0 0; }
.up-map-hits {
  position: absolute; left: 0; right: 0; top: 48px; z-index: 9;
  max-height: 240px; overflow-y: auto;
  background: var(--surface); border: 1px solid rgba(25, 27, 38, .08);
  border-radius: var(--radius); box-shadow: 0 4px 12px rgba(25, 27, 38, .08);
}
.up-map-hit {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  width: 100%; padding: 8px 16px; border: 0; border-bottom: 1px solid rgba(25, 27, 38, .08);
  background: transparent; text-align: left;
}
.up-map-hit:last-child { border-bottom: 0; }
.up-map-hit:hover, .up-map-hit.active { background: rgba(25, 27, 38, .04); }
/* 地图内部控件带高 z-index，这里自成层叠上下文，避免盖住搜索下拉 */
.up-map-stage {
  position: relative; z-index: 0; isolation: isolate;
  flex: 1 1 auto; min-height: 0;
  border-radius: var(--radius); overflow: hidden;
}
.up-map-frame {
  width: 100%; height: 100%;
  border: 0; background: var(--canvas);
}
.up-map-onmap {
  position: absolute; left: 16px; bottom: 56px; z-index: 4;
  max-width: calc(100% - 120px); padding: 8px 16px;
  background: rgba(255, 255, 255, .92); border-radius: var(--radius);
  font-size: 12px; color: rgba(25, 27, 38, .88);
  box-shadow: 0 4px 12px rgba(25, 27, 38, .08);
  pointer-events: none;
}
.up-map-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 16px; flex-wrap: wrap; flex: 0 0 auto;
}
.up-map-preview { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.up-ai-top { display: flex; flex-direction: column; gap: 4px; margin: 0 0 16px; }
.up-ai-hero {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  margin: 0 0 16px; padding: 16px;
  border-radius: var(--radius); background: var(--ink-04);
}
.up-ai-verdict {
  padding: 4px 12px; border-radius: var(--pill);
  background: var(--surface); color: var(--ink-64); font-size: 12px;
}
.up-ai-verdict.is-confident { color: var(--accent); font-weight: 600; }
.up-ai-name { font-size: 22px; font-weight: 600; line-height: 36px; }
.up-ai-score { color: var(--ink-64); font-size: 12px; }
.up-ai-hero .button { margin-top: 8px; }
.up-near {
  display: flex; flex-direction: column; gap: 4px;
  margin: 0 0 16px; padding: 8px 12px;
  border-radius: var(--radius); background: var(--ink-04); font-size: 12px;
}
.up-near-list { color: var(--ink-88); }
.up-label { margin: 0 0 8px; color: var(--ink-64); font-size: 12px; }
.up-candidate {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; padding: 8px 0; border: 0; border-bottom: 1px solid rgba(25, 27, 38, .08);
  background: transparent; text-align: left;
}
.up-candidate:hover { color: var(--ink); }
.up-candidate span { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 719px) {
  .up-bar { align-items: stretch; }
  .up-bar-actions .button { flex: 1 1 auto; white-space: nowrap; }
  .up-map-modal { width: calc(100vw - 16px); height: calc(100vh - 16px); max-height: calc(100vh - 16px); padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
