:root {
  --bg: #f6f3ea;
  --card: #fffdfa;
  --text: #253229;
  --muted: #6d7a70;
  --line: #e4dece;
  --green: #2f6f4e;
  --green-soft: #e7f2e8;
  --yellow: #e8b84d;
  --danger: #9a3d32;
  --shadow: 0 8px 24px rgba(40, 52, 43, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

button, input, select, textarea {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  background: var(--green);
  color: white;
  cursor: pointer;
}

button.secondary {
  background: #eef0e7;
  color: var(--text);
}

button.ghost {
  background: transparent;
  color: var(--green);
  padding: 8px;
}

button.danger {
  background: #f4e4df;
  color: var(--danger);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.app-shell {
  max-width: 560px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px 88px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.page-title {
  font-size: 22px;
  font-weight: 750;
  margin: 0;
}

.home-title {
  margin: 56px 0 4px;
  font-size: 34px;
  text-align: center;
  letter-spacing: .03em;
}

.home-subtitle {
  margin: 0 0 28px;
  color: var(--muted);
  text-align: center;
  font-size: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.audio-card {
  background: var(--card);
  padding: 12px;
}

.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.section-title { margin: 18px 0 8px; font-size: 17px; }

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--text);
  padding: 12px;
  min-height: 44px;
}

textarea {
  min-height: 150px;
  resize: vertical;
}

.bird-row {
  display: grid;
  grid-template-columns: 58px 1fr 44px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.bird-row:last-child { border-bottom: 0; }
.bird-row-last { border-bottom: 0; }
.bird-main { min-width: 0; cursor: pointer; }
.bird-name { font-weight: 700; font-size: 17px; }
.bird-taxonomy { color: var(--muted); font-size: 13px; margin-top: 2px; }

.bird-swipe-container {
  margin-bottom: 0;
  border-radius: 0;
}

.bird-swipe-card {
  background: var(--card);
}

.bird-swipe-delete {
  border-radius: 14px;
}


.thumb {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  object-fit: cover;
  background: #e8eadf;
  display: grid;
  place-items: center;
  font-size: 26px;
}

.check-zone {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  cursor: pointer;
}

.bird-icon {
  width: 28px;
  height: 28px;
}

.bird-outline path {
  fill: transparent;
  stroke: #bcc9b8;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bird-solid path {
  fill: var(--green);
  stroke: var(--green);
  stroke-width: 0.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.check-zone:hover .bird-outline path {
  stroke: var(--green);
}

.checked-row { background: linear-gradient(90deg, transparent, var(--green-soft)); }



.hero-image {
  width: 100%;
  min-height: 260px;
  border-radius: 22px;
  overflow: hidden;
  background: #e8eadf;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
}

.hero-image img {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.image-counter {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.image-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.image-nav span {
  color: var(--muted);
  font-size: 13px;
  min-width: 32px;
  text-align: center;
}

.detail-name {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 16px;
  align-items: baseline;
  margin: 8px 0 4px;
}
.detail-name h1 {
  margin: 0;
  font-weight: 400;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.name-right { text-align: right; white-space: nowrap; font-size: 15px; color: var(--muted); grid-column: 2; grid-row: 2; }
.taxonomy-left {
  font-size: 15px;
  color: var(--muted);
  grid-column: 1;
  grid-row: 2;
}
.detail-line {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}
.latin { font-style: italic; color: var(--muted); white-space: nowrap; }
.detail-tags { color: var(--muted); }
.detail-text { color: var(--text); }

details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

details[open] summary { margin-bottom: 10px; }
summary { font-weight: 700; cursor: pointer; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100%);
  background: rgba(255, 253, 250, .95);
  border-top: 1px solid var(--line);
  padding: 10px 16px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  backdrop-filter: blur(10px);
}

.note-panel {
  position: fixed;
  inset: auto 0 0 0;
  max-width: 560px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--line);
  padding: 16px;
  box-shadow: 0 -12px 34px rgba(0,0,0,.14);
  z-index: 30;
}

.match-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.pill {
  display: inline-block;
  padding: 4px 8px;
  margin: 3px;
  border-radius: 999px;
  background: #eef0e7;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.iucn-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  flex: 0 0 auto;
}

.iucn-badge-cr { background: #d92d20; color: #fff; }
.iucn-badge-en { background: #f38744; color: #fff; }
.iucn-badge-vu { background: #f4d35e; color: #1f2937; }
.iucn-badge-nt { background: #b7e4a5; color: #1f2937; }

.error { color: var(--danger); }
.success { color: var(--green); }

.fab {
  position: fixed;
  right: calc(50% - 280px);
  bottom: 32px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 28px;
  font-weight: 700;
  background: var(--green);
  color: white;
  box-shadow: 0 6px 20px rgba(47,111,78,.35);
  display: grid;
  place-items: center;
  z-index: 10;
  padding: 0;
}
@media (max-width: 592px) { .fab { right: 12px; } }

.list-card { display: flex; align-items: center; padding-right: 40px; cursor: pointer; }

.search-results { margin-top: 8px; max-height: 320px; overflow-y: auto; }
.add-bird-item {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.add-bird-item:hover { background: var(--green-soft); }
.add-bird-item.is-added {
  color: var(--muted);
  background: #f5f3ed;
}

.add-bird-item.is-added strong,
.add-bird-item.is-added .muted {
  color: var(--muted);
}

.add-bird-item.is-added:hover { background: #f0ece2; }
.add-bird-item.just-added {
  background: #e6f3df;
  transition: background-color .2s ease;
}

.add-bird-item.just-added:hover { background: #dcefd3; }

select option:disabled {
  color: var(--muted);
  background: #f0ece2;
}

.month-grid, .filter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.filter-grid {
  grid-template-columns: repeat(3, 1fr);
}

.month-grid .pill.active, .filter-grid .pill.active {
  background: var(--green) !important;
  color: white !important;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 12px;
  min-height: 44px;
  cursor: pointer;
}

.dropdown-arrow {
  color: var(--muted);
  font-size: 12px;
  margin-left: 8px;
}

.dropdown-panel {
  position: absolute;
  z-index: 20;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(0,0,0,.14);
  padding: 8px;
  max-height: 280px;
  overflow-y: auto;
  width: calc(100% - 32px);
  max-width: 528px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
}

.dropdown-item:hover { background: var(--green-soft); }
.dropdown-item input { width: auto; min-height: auto; cursor: pointer; }

.dropdown-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 16px;
}

.modal-box {
  background: var(--card);
  border-radius: 22px;
  padding: 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}

.modal-box h3 { margin: 0 0 8px; font-size: 19px; }
.modal-box p { color: var(--muted); margin: 0 0 4px; }

.loc-history {
  margin-top: 8px;
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.preview-list {
  margin-top: 8px;
  line-height: 1.6;
  color: var(--muted);
}

#locInput { width: 100%; }

#locSuggest:empty { display: none; }

.swipe-card {
  position: relative;
  z-index: 1;
  margin-bottom: 0;
  transition: transform 0.2s ease;
  touch-action: pan-y;
  cursor: pointer;
}

.swipe-card.swiping {
  transition: none;
  cursor: grabbing;
}

.swipe-card.swiping,
.swipe-card.swiping * {
  user-select: none;
}

.swipe-delete {
  position: absolute;
  right: 0;
  top: 50%;
  width: 64px;
  height: 56px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 0;
}

.swipe-delete-icon {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e59b9b;
  display: block;
}

.swipe-delete-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
  transform: translate(-50%, -50%);
}

.swipe-container {
  position: relative;
  overflow: hidden;
  margin-bottom: 10px;
  border-radius: 20px;
}

audio {
  width: 100%;
  max-width: 100%;
  height: 36px;
}
