:root {
  /* Pokémon-ish palette: red / yellow / blue on warm cream, black ink lines */
  --red: #e3352b;
  --red-deep: #a71d16;
  --yellow: #ffcb05;
  --yellow-deep: #e0a400;
  --blue: #2a5bd7;
  --blue-deep: #1c3f9e;
  --ink: #16171f;
  --ink-2: #3b3d4a;
  --muted: #6f7183;
  --paper: #fff8e4;
  --surface: #fffdf6;
  --surface-2: #fdf1cf;
  --line: #1b1c24;
  --line-soft: #e2d6b6;
  --radius: 14px;
  --shadow: 0 3px 0 var(--line);
  --font: "Segoe UI", ui-sans-serif, system-ui, "Noto Sans TC", "PingFang TC",
          "Microsoft JhengHei", "Hiragino Sans", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
}

.app {
  display: grid;
  grid-template-columns: 372px 1fr;
  height: 100%;
  min-height: 0;
}

/* ---------------- sidebar ---------------- */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 12px;
  padding: 20px 18px 12px;
  background:
    radial-gradient(circle at 1px 1px, rgba(27, 28, 36, .055) 1px, transparent 0) 0 0 / 12px 12px,
    var(--paper);
  border-right: 3px solid var(--line);
  z-index: 500;
}

.brand { position: relative; padding-left: 4px; }
.brand .ball {
  position: absolute; right: 2px; top: 0;
  width: 42px; height: 42px; border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--surface) 0 5px, var(--line) 5px 8px, transparent 8px),
    linear-gradient(var(--red) 0 46%, var(--line) 46% 54%, #ffffff 54% 100%);
  border: 3px solid var(--line);
  box-shadow: 0 2px 0 rgba(27,28,36,.18);
}
.eyebrow {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--red);
}
.brand h1 {
  margin: 2px 0 0;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: -.01em;
  line-height: 1.1;
  color: var(--ink);
}
.brand .sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); font-weight: 600; }

/* search */
.search-wrap { position: relative; display: flex; align-items: center; }
.search-ico {
  position: absolute; left: 13px; width: 16px; height: 16px;
  fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round;
  pointer-events: none;
}
#search {
  width: 100%;
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  padding: 11px 40px 11px 36px;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
#search::placeholder { color: #9a9bad; font-weight: 500; }
#search:focus { outline: none; box-shadow: var(--shadow), 0 0 0 4px rgba(255, 203, 5, .6); }
.icon-btn {
  appearance: none; cursor: pointer;
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--surface);
  font: inherit; font-size: 12px; font-weight: 700; color: var(--ink);
  display: grid; place-items: center; line-height: 1;
}
.icon-btn:hover { background: var(--yellow); }
.clear { position: absolute; right: 8px; border-color: transparent; background: transparent; }
.clear[hidden] { display: none; }

/* search results */
.results {
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  max-height: 46vh;
  overflow-y: auto;
  padding: 6px;
  margin-top: -4px;
}
.results[hidden] { display: none; }
.res-group { margin: 4px 2px 2px; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.res {
  display: flex; align-items: center; gap: 8px; width: 100%;
  appearance: none; border: 0; background: transparent; font: inherit;
  text-align: left; padding: 7px 8px; border-radius: 9px; cursor: pointer; color: var(--ink);
}
.res:hover, .res:focus-visible { background: var(--surface-2); outline: none; }
.res .nm { font-weight: 700; font-size: 13.5px; }
.res .en { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.res .tag { margin-left: auto; font-size: 10px; font-weight: 800; color: var(--blue-deep); background: #e7edff; border-radius: 999px; padding: 2px 7px; }
.res .sw { width: 12px; height: 12px; border-radius: 3px; border: 1.5px solid var(--line); flex: none; }

/* segmented mode switch */
.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.seg-btn {
  appearance: none; cursor: pointer; font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 6px 6px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 700; font-size: 13px; line-height: 1.15;
  box-shadow: 0 2px 0 var(--line);
}
.seg-btn small { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.seg-btn[aria-pressed="true"] { background: var(--yellow); color: var(--ink); box-shadow: none; transform: translateY(2px); }
.seg-btn[aria-pressed="true"] small { color: var(--red-deep); }

/* panes */
.pane { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; gap: 8px; }
.pane[hidden] { display: none; }

.place-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.place-head h2 { margin: 1px 0 0; font-size: 20px; font-weight: 900; line-height: 1.15; }
.place-head h2 .muted { font-size: 12px; font-weight: 600; color: var(--muted); }
.kicker { margin: 0; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.mini-btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 800;
  border: 2px solid var(--line); border-radius: 999px; padding: 5px 10px;
  background: var(--surface); color: var(--ink); white-space: nowrap;
}
.mini-btn:hover { background: var(--yellow); }

.season { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.s-btn {
  appearance: none; cursor: pointer; font: inherit; font-weight: 800; font-size: 12.5px;
  border: 2px solid var(--line); border-radius: 999px; padding: 6px 8px;
  background: var(--surface); color: var(--ink-2);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.s-btn small { font-size: 9.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.s-btn[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue-deep); }
.s-btn[aria-pressed="true"] small { color: #dfe6ff; }

.radius { display: flex; gap: 6px; }
.r-btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 12px; font-weight: 800;
  border: 2px solid var(--line); border-radius: 999px; padding: 4px 12px;
  background: var(--surface); color: var(--ink-2);
}
.r-btn[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue-deep); }

.near-sum { margin: 2px 0 0; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.near-sum b { color: var(--red-deep); font-size: 15px; }

/* lists */
.sp-list, .cell-list {
  list-style: none; margin: 0; padding: 0 4px 0 0;
  overflow-y: auto; min-height: 0; flex: 1 1 auto;
  scrollbar-width: thin;
}
.sp-list li, .cell-list li { border-bottom: 1px solid var(--line-soft); }
.sp-row, .cell-row {
  display: flex; align-items: center; gap: 9px; width: 100%;
  appearance: none; border: 0; background: transparent; font: inherit;
  text-align: left; padding: 8px 8px; border-radius: 10px; cursor: pointer; color: var(--ink);
}
.sp-row:hover, .sp-row:focus-visible, .cell-row:hover { background: var(--surface-2); outline: none; }
.sp-row .sw, .cell-row .sw { width: 14px; height: 16px; border-radius: 4px; border: 2px solid var(--line); flex: none; }
.nm { flex: 1; min-width: 0; }
.nm .zh { font-weight: 800; font-size: 14px; display: block; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nm .en { font-weight: 600; font-size: 11.5px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { font-size: 11.5px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.num small { display: block; font-weight: 700; color: var(--muted); font-size: 10px; text-align: right; }

.empty { padding: 16px 8px; color: var(--muted); font-size: 12.5px; }

/* species card */
.sp-card {
  border: 3px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 10px 12px 11px;
  box-shadow: var(--shadow);
}
.sp-card .sp-photo { display: block; margin: -4px -6px 9px; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); background: var(--surface-2); }
.sp-card .sp-photo img { display: block; width: 100%; height: 118px; object-fit: cover; }
.sp-card h2 { margin: 1px 0 0; font-size: 20px; font-weight: 900; line-height: 1.15; }
.sp-card .latin { margin: 1px 0 8px; font-size: 11.5px; font-style: italic; color: var(--muted); font-weight: 600; }
.sp-card .hint { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }
.cmp { display: grid; grid-template-columns: 56px 1fr 52px; align-items: center; gap: 3px 8px; padding: 3px 4px; border-radius: 8px; cursor: pointer; }
.cmp.active { background: var(--surface-2); }
.cmp-label { font-size: 11.5px; font-weight: 800; color: var(--ink-2); }
.bar { height: 9px; border-radius: 999px; background: #efe6c9; border: 2px solid var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--red); border-radius: 999px; }
.cmp[data-season="breeding"] .bar i { background: var(--blue); }
.cmp-val { font-size: 11.5px; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--muted); text-align: right; }
.cmp.active .cmp-val { color: var(--ink); }

/* hotspots */
.hot { display: flex; align-items: center; gap: 8px; width: 100%; appearance: none; border: 0; background: transparent;
  font: inherit; text-align: left; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.hot:hover { background: var(--surface-2); }
.hot .rank { width: 20px; height: 20px; border-radius: 50%; background: var(--yellow); border: 2px solid var(--line);
  display: grid; place-items: center; font-size: 11px; font-weight: 900; flex: none; }

.credit { margin: 0; padding-top: 8px; border-top: 2px dashed var(--line-soft); }
.credit p { margin: 0 0 3px; font-size: 10px; line-height: 1.45; color: var(--muted); font-weight: 600; }

/* ---------------- map ---------------- */
.map-wrap { position: relative; min-width: 0; min-height: 0; background: #eef3f6; }
#map { position: absolute; inset: 0; background: #eef3f6; }
.leaflet-container { font: var(--font); }
.leaflet-tile-pane { filter: saturate(.5) brightness(1.03) contrast(.96); }
.atlas-grid { image-rendering: auto; }
.home-btn {
  font: inherit; font-weight: 900; font-size: 13px; cursor: pointer;
  background: var(--yellow); color: var(--ink);
  border: 3px solid var(--line); border-radius: 10px;
  padding: 7px 12px; box-shadow: 0 2px 0 var(--line);
}
.home-btn:hover { background: #ffd83d; }
.leaflet-control-zoom a {
  color: var(--ink) !important; width: 34px !important; height: 34px !important; line-height: 32px !important;
  font-size: 20px !important; font-weight: 800;
  border: 3px solid var(--line) !important; background: var(--surface) !important;
  box-shadow: 0 2px 0 var(--line);
}
.leaflet-control-zoom a:hover { background: var(--yellow) !important; }
.leaflet-control-attribution { font-size: 10px !important; background: rgba(255, 248, 228, .9) !important; font-weight: 600; }
.leaflet-control-attribution a { color: var(--blue-deep); }
.leaflet-control-scale-line { border-color: var(--line) !important; font-weight: 800; background: rgba(255,248,228,.85); }

.legend {
  position: absolute; left: 14px; bottom: 14px; z-index: 450;
  background: rgba(255, 253, 246, .96);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 9px 11px 10px;
  min-width: 172px;
}
.legend h3 { margin: 0 0 3px; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.legend .lg-title { font-size: 12.5px; font-weight: 900; margin: 0 0 6px; }
.legend .lg-title span { font-weight: 700; color: var(--muted); font-size: 10.5px; }
.lg-row { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; color: var(--ink-2); }
.lg-row + .lg-row { margin-top: 3px; }
.sw { width: 16px; height: 12px; border-radius: 3px; border: 1.5px solid var(--line); flex: none; }
.lg-note { margin: 7px 0 0; font-size: 10px; color: var(--muted); max-width: 180px; line-height: 1.4; font-weight: 600; }

.readout {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 450; pointer-events: none;
  background: var(--ink); color: var(--yellow);
  font-size: 12px; font-weight: 800; padding: 7px 13px; border-radius: 999px;
  border: 2px solid var(--yellow);
  opacity: 0; transition: opacity .15s ease; white-space: nowrap; max-width: 92%;
  overflow: hidden; text-overflow: ellipsis;
}
.readout.on { opacity: 1; }

.sheet-toggle { display: none; }
.panel-close { display: none; }

/* cell sheet */
.cell-sheet {
  position: absolute; z-index: 700;
  right: 12px; bottom: 38px; width: 320px; max-height: min(62vh, 560px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 0 var(--line);
  padding: 12px 14px 8px;
  margin: 0;
}
.cell-sheet[hidden] { display: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sheet-head h2 { margin: 2px 0 0; font-size: 18px; font-weight: 900; }
.sheet-sub { margin: 5px 0 7px; font-size: 12px; font-weight: 700; color: var(--muted); }
.cell-list { border-top: 2px dashed var(--line-soft); }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .panel {
    position: absolute; inset: auto 0 0 0; z-index: 800;
    height: 72vh; border-right: 0; border-top: 3px solid var(--line);
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
    transition: transform .22s ease;
    padding: 26px 14px 8px;
  }
  .brand { display: none; }
  .credit p + p { display: none; }
  .credit p { font-size: 9.5px; margin-bottom: 0; }
  .panel.open { transform: none; }
  .panel-close {
    display: block; position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
    z-index: 5; font: inherit; font-size: 11px; font-weight: 800;
    border: 2px solid var(--line); border-radius: 999px; background: var(--surface);
    color: var(--ink); padding: 2px 12px; cursor: pointer;
  }
  .sheet-toggle {
    display: block; position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
    z-index: 650; font: inherit; font-size: 14px; font-weight: 900;
    background: var(--yellow); color: var(--ink); border: 3px solid var(--line);
    padding: 9px 20px; border-radius: 999px; box-shadow: var(--shadow); cursor: pointer;
  }
  .legend { bottom: 64px; padding: 7px 9px; min-width: 0; }
  .legend .lg-note { display: none; }
  .cell-sheet { left: 10px; right: 10px; width: auto; bottom: 10px; max-height: 56vh; }
  .brand h1 { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------------- view switch ---------------- */
.view-switch {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 600; display: flex; gap: 4px;
  background: var(--surface); border: 3px solid var(--line);
  border-radius: 999px; padding: 4px; box-shadow: var(--shadow);
}
.v-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 900; font-size: 13px; color: var(--ink-2);
  border-radius: 999px; padding: 6px 16px; display: flex; align-items: baseline; gap: 5px;
}
.v-btn small { font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.v-btn[aria-selected="true"] { background: var(--red); color: #fff; }
.v-btn[aria-selected="true"] small { color: #ffd9d6; }

/* ---------------- bird strip (map view) ---------------- */
.bird-strip {
  position: absolute; left: 14px; right: 14px; bottom: 30px; z-index: 480;
  background: rgba(255, 253, 246, .97);
  border: 3px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 9px 10px 10px;
}
.bird-strip[hidden] { display: none; }
.strip-title { margin: 0 0 7px 2px; font-size: 12px; font-weight: 900; color: var(--ink); }
.strip-title span { color: var(--muted); font-weight: 700; }
.strip-track {
  display: flex; gap: 9px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: thin;
}
.bird-card {
  flex: 0 0 auto; width: 132px; appearance: none; cursor: pointer;
  background: var(--surface); border: 3px solid var(--line); border-radius: 13px;
  padding: 0 0 6px; text-align: left; font: inherit; color: var(--ink);
  overflow: hidden; box-shadow: 0 2px 0 rgba(27,28,36,.22);
  transition: transform .12s ease, box-shadow .12s ease;
}
.bird-card:hover { transform: translateY(-3px); box-shadow: 0 5px 0 rgba(27,28,36,.25); }
.bird-card .ph { display: block; height: 84px; background: var(--surface-2); overflow: hidden; }
.bird-card .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bird-card .ph .none { display: grid; place-items: center; height: 100%; font-size: 26px; }
.bird-card .bd { display: block; padding: 5px 7px 0; }
.bird-card .bd b { display: block; font-size: 12.5px; font-weight: 900; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bird-card .bd em { display: block; font-style: normal; font-size: 10px; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bird-card .badge {
  display: inline-block; margin: 4px 7px 0; font-size: 9.5px; font-weight: 900;
  background: var(--yellow); border: 2px solid var(--line); border-radius: 999px; padding: 1px 6px;
}
.zoom-hint {
  position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%);
  z-index: 470; background: rgba(22,23,31,.9); color: var(--yellow);
  font-size: 12px; font-weight: 800; padding: 8px 14px; border-radius: 999px;
  border: 2px solid var(--yellow); pointer-events: none;
}
.zoom-hint[hidden] { display: none; }

/* list thumbnails */
.sp-row .ph, .hot .ph {
  width: 38px; height: 38px; border-radius: 10px; overflow: hidden; flex: none;
  border: 2px solid var(--line); background: var(--surface-2); display: grid; place-items: center;
}
.hot .ph { width: 34px; height: 34px; border-radius: 50%; }
.sp-row .ph img, .hot .ph img { width: 100%; height: 100%; object-fit: contain; display: block; background: #f1eee3; }
.sp-row .ph .none, .hot .ph .none { font-size: 15px; }

@media (max-width: 880px) {
  .view-switch { top: 8px; padding: 3px; }
  .v-btn { padding: 5px 12px; font-size: 12px; }
  .bird-strip { left: 8px; right: 8px; bottom: 64px; padding: 7px 8px 8px; }
  .bird-card { width: 108px; }
  .bird-card .ph { height: 66px; }
  .zoom-hint { bottom: 66px; }
}

.photo-credit { margin: 6px 0 0; font-size: 9px; line-height: 1.35; color: var(--muted); font-weight: 600; }
.photo-credit a { color: var(--blue-deep); text-decoration: none; }
@media (max-width: 880px) {
  .view-switch { top: 58px; padding: 3px; }
  .v-btn { padding: 5px 12px; font-size: 12px; }
  .v-btn small { display: none; }
  .home-btn { font-size: 12px; padding: 5px 10px; }
}

.lg-grad { height: 10px; border-radius: 999px; border: 2px solid var(--line); margin: 2px 0 3px; }
.lg-scale { display: flex; justify-content: space-between; font-size: 10px; font-weight: 800; color: var(--muted); }

/* ---------- source switch ---------- */
.source-switch {
  position: absolute; top: 58px; left: 50%; transform: translateX(-50%);
  z-index: 600; display: flex; gap: 4px;
  background: var(--surface); border: 3px solid var(--line);
  border-radius: 999px; padding: 3px; box-shadow: var(--shadow);
}
.source-switch[hidden] { display: none; }
.src-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 11.5px; color: var(--ink-2);
  border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.src-btn[aria-pressed="true"] { background: var(--blue); color: #fff; }

.home-link { font-weight: 800; color: var(--blue-deep); text-decoration: none; }
.home-link:hover { text-decoration: underline; }
.back-btn { align-self: flex-start; margin-bottom: 2px; }

/* full species names */
.sp-row .nm .zh, .sp-row .nm .en { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; }
.bird-card .bd b, .bird-card .bd em { white-space: normal; line-height: 1.25; }
.bird-card .bd { min-height: 46px; }

@media (max-width: 880px) {
  .source-switch { top: 104px; }
  .back-home { display: none; }
}
.leaflet-tile-pane { filter: saturate(.85) brightness(1.02); }
.coffee-link { display: inline-block; margin-top: 4px; font-weight: 800; color: var(--red); text-decoration: none; }
.coffee-link:hover { text-decoration: underline; }
.basemap-btn {
  position: absolute; left: 12px; top: 58px; z-index: 620;
  font: inherit; font-weight: 800; font-size: 11.5px; cursor: pointer;
  background: var(--surface); color: var(--ink);
  border: 3px solid var(--line); border-radius: 999px;
  padding: 5px 12px; box-shadow: 0 2px 0 var(--line);
}
.basemap-btn:hover { background: var(--yellow); }

/* whole bird visible, blurred backdrop instead of white bars */
.ph, .sp-photo { position: relative; overflow: hidden; background-size: cover; background-position: center; }
.ph::before, .sp-photo::before {
  content: ''; position: absolute; inset: -14px;
  background-image: inherit; background-size: cover; background-position: center;
  filter: blur(14px) saturate(1.15) brightness(.92); opacity: .75;
}
.ph img, .sp-photo img { position: relative; z-index: 1; }
.bird-card .ph { height: 96px; }
.bird-card .ph img { width: 100%; height: 100%; object-fit: contain; }
.sp-card .sp-photo img { height: 150px; object-fit: contain; }
.sp-card .sp-photo { display: block; margin: -4px -6px 9px; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); }
.credit .tip { font-size: 11.5px; color: var(--ink-2); font-weight: 700; }

/* thumbnails: whole bird, blurred edges instead of white bars */
.sp-row .ph, .hot .ph { background-size: cover; background-position: center; }
.sp-row .ph::before, .hot .ph::before {
  content: ''; position: absolute; inset: -8px;
  background-image: inherit; background-size: cover; background-position: center;
  filter: blur(6px) brightness(.95); opacity: .8;
}
.sp-row .ph img, .hot .ph img { position: relative; z-index: 1; background: transparent; }

/* metric switch (species / records) */
.metric-switch {
  position: absolute; top: 104px; left: 50%; transform: translateX(-50%);
  z-index: 600; display: flex; gap: 4px;
  background: var(--surface); border: 3px solid var(--line);
  border-radius: 999px; padding: 3px; box-shadow: var(--shadow);
}
.metric-switch[hidden] { display: none; }
.m-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 800; font-size: 11.5px; color: var(--ink-2);
  border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.m-btn[aria-pressed="true"] { background: var(--red); color: #fff; }
@media (max-width: 880px) { .metric-switch { top: 140px; } }
.cmp-line { margin: 2px 0 4px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.cmp-line b { color: var(--red-deep); font-size: 15px; }

.wiki { margin: 7px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--ink-2); }
.wiki-links { margin: 5px 0 0; font-size: 10.5px; font-weight: 800; }
.wiki-links a { color: var(--blue-deep); text-decoration: none; }
.wiki-links a:hover { text-decoration: underline; }

.dove { display: inline-block; width: 44px; height: 44px; vertical-align: middle; }
.dove svg { width: 100%; height: 100%; display: block; }

.eb-tabs { display: flex; gap: 6px; padding: 6px 2px 8px; }
.eb-tab {
  appearance: none; cursor: pointer; font: inherit; font-weight: 800; font-size: 11.5px;
  border: 2px solid var(--line); border-radius: 999px; padding: 3px 10px;
  background: var(--surface); color: var(--ink-2);
}
.eb-tab[aria-pressed="true"] { background: var(--red); color: #fff; }
.eb-feed { border: 0; }
.feed-row {
  display: flex; align-items: center; gap: 9px; width: 100%;
  appearance: none; border: 0; background: transparent; font: inherit;
  text-align: left; padding: 7px 6px; border-radius: 10px; cursor: pointer; color: var(--ink);
}
.feed-row:hover { background: var(--surface-2); }
.feed-row .num { text-align: right; }

/* recent sightings feed */
.feed-row .ph { width: 44px; height: 44px; border-radius: 10px; flex: none; border: 2px solid var(--line); overflow: hidden; }
.feed-row .nm { min-width: 0; }
.feed-row .nm .zh { font-size: 13px; }
.feed-row .nm .en { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.feed-row .num { font-size: 11px; text-align: right; white-space: nowrap; }
.feed-row .num small { display: block; font-size: 9.5px; color: var(--muted); }
.sp-stats { margin: 6px 0 0; font-size: 11px; font-weight: 800; color: var(--blue-deep); }
.rank { width: 20px; height: 20px; border-radius: 50%; background: var(--yellow); border: 2px solid var(--line);
  display: grid; place-items: center; font-size: 11px; font-weight: 900; flex: none; }

#pane-species { overflow-y: auto; }
#pane-species .sp-card { flex: 0 0 auto; }
#pane-species .sp-list { flex: 0 0 auto; overflow: visible; }
.wiki { font-size: 12px; line-height: 1.55; }

/* species facts table */
.sp-facts { margin: 8px 0 2px; display: grid; gap: 4px; }
.sp-facts > div { display: grid; grid-template-columns: 66px 1fr; gap: 8px; align-items: baseline; }
.sp-facts dt {
  font-size: 10px; font-weight: 800; letter-spacing: .04em; color: var(--muted);
  background: var(--surface-2); border: 1.5px solid var(--line-soft); border-radius: 999px;
  padding: 1px 6px; text-align: center;
}
.sp-facts dd { margin: 0; font-size: 12px; font-weight: 700; color: var(--ink); }
