/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Comic Sans MS", "Quicksand", "Nunito", "Trebuchet MS",
               "PingFang TC", "PingFang SC", "Hiragino Sans", "Microsoft JhengHei",
               "Microsoft YaHei", system-ui, sans-serif;
  background: linear-gradient(180deg, #cdf0ff 0%, #e8faff 40%, #fffaea 100%);
  color: #2d3142;
  min-height: 100vh;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: #1d6fb8; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.2rem;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  position: sticky; top: 0; z-index: 50;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 0;
  font-size: 1.4rem;
  font-weight: 800;
  color: #ff7a59;
  padding: 0.2rem 0.4rem;
  border-radius: 12px;
}
.brand:hover { background: #fff4ee; }
.brand-emoji { font-size: 1.7rem; }

.main-nav { display: flex; gap: 0.4rem; flex-wrap: wrap; flex: 1; }
.main-nav button {
  background: #fff7e8;
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 0.5rem 1rem;
  font-weight: 700;
  color: #2d3142;
  font-size: 0.95rem;
  transition: transform 0.1s ease, background 0.15s;
}
.main-nav button:hover { background: #ffe9c2; }
.main-nav button:active { transform: scale(0.96); }
.main-nav button.active { background: #ffd18a; border-color: #ff9b3a; }

.lang-picker select {
  padding: 0.5rem 0.8rem;
  border-radius: 14px;
  border: 2px solid #b1d9ff;
  background: #f0f8ff;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1d3a5f;
}

/* ---------- Main / views ---------- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}
.section-title {
  font-size: 1.6rem;
  margin: 1.6rem 0 0.8rem;
  color: #1d3a5f;
}
.lead { font-size: 1.1rem; }

/* ---------- Buttons ---------- */
.btn {
  border: 0;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.2px;
  transition: transform 0.1s ease, box-shadow 0.15s;
  box-shadow: 0 4px 0 rgba(0,0,0,0.08);
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 0 rgba(0,0,0,0.08); }
.btn-primary { background: #ff7a59; color: #fff; }
.btn-back {
  background: #fff7e8;
  color: #1d3a5f;
  margin-bottom: 1rem;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  border: 2px solid transparent;
}

/* ---------- Bird grid ---------- */
.bird-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1rem;
}
.bird-card {
  background: #fff;
  border-radius: 22px;
  padding: 0.6rem;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
  display: block;
  text-decoration: none;
}
.bird-card:hover {
  transform: translateY(-3px);
  border-color: #ffb672;
  box-shadow: 0 8px 18px rgba(0,0,0,0.1);
}
.bird-card .photo {
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: #eef6ff;
  position: relative;
  margin-bottom: 0.5rem;
}
.bird-card .photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.bird-card:hover .photo img { transform: scale(1.05); }
.bird-card .name {
  font-weight: 800;
  font-size: 1.05rem;
  color: #1d3a5f;
  margin: 0 0.2rem 0.2rem;
}
.bird-card .pronunciation {
  font-size: 0.85rem;
  color: #6c7a91;
  margin: 0 0.2rem 0.15rem;
  font-style: italic;
}
.bird-card .english-name {
  font-size: 0.85rem;
  color: #4a90e2;
  margin: 0 0.2rem 0.15rem;
  font-weight: 700;
}
.bird-card .latin {
  font-size: 0.8rem;
  color: #6c7a91;
  font-style: italic;
  margin: 0 0.2rem 0.4rem;
}

/* ---------- Stats bar ---------- */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1rem;
}
.stats-bar .stat {
  background: #fff;
  border-radius: 16px;
  padding: 0.55rem 1rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  border-left: 5px solid #ff7a59;
}
.stats-bar .stat:nth-child(2) { border-left-color: #4a90e2; }
.stats-bar .stat:nth-child(3) { border-left-color: #4ec3a6; }
.stats-bar .stat-num {
  font-weight: 800;
  font-size: 1.6rem;
  color: #1d3a5f;
  line-height: 1;
}
.stats-bar .stat-label {
  font-size: 0.95rem;
  color: #6c7a91;
  font-weight: 600;
}

.filter-status {
  font-size: 0.95rem;
  color: #6c7a91;
  margin: -0.3rem 0 0.8rem;
  font-weight: 600;
}

/* ---------- Filter row ---------- */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem;
  margin: 0.4rem 0 1rem;
}
.filter-row input[type="search"] {
  flex: 1 1 220px;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 2px solid #b1d9ff;
  font-size: 1rem;
  background: #fff;
}
.chip-row { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip {
  background: #fff;
  border: 2px solid #b1d9ff;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: #1d3a5f;
}
.chip.active { background: #ff7a59; border-color: #ff7a59; color: #fff; }

/* ---------- Detail ---------- */
.bird-detail {
  background: #fff;
  border-radius: 26px;
  padding: 1.5rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.07);
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
}
.bird-detail .photo {
  aspect-ratio: 4/3;
  border-radius: 18px;
  overflow: hidden;
  background: #eef6ff;
  position: relative;
}
.bird-detail .photo img { width: 100%; height: 100%; object-fit: cover; }
.bird-detail h1 {
  margin: 0 0 0.2rem;
  font-size: 2rem;
  color: #1d3a5f;
}
.bird-detail .pronunciation.big {
  font-style: italic;
  color: #6c7a91;
  font-size: 1.05rem;
  margin: 0.2rem 0 0.1rem;
}
.bird-detail .english-name.big {
  color: #4a90e2;
  font-weight: 800;
  font-size: 1.1rem;
  margin: 0.1rem 0 0.1rem;
}
.bird-detail .latin {
  font-style: italic;
  color: #6c7a91;
  margin: 0 0 1rem;
}
.bird-detail .description { font-size: 1.1rem; }
.bird-detail .facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  margin: 1rem 0;
}
.bird-detail .fact {
  background: #fff7e8;
  padding: 0.6rem 0.8rem;
  border-radius: 14px;
}
.bird-detail .fact-label {
  font-weight: 800;
  font-size: 0.8rem;
  color: #b35a00;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 0.1rem;
}
.bird-detail .where ul {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
}
.bird-detail .where li { padding: 0.15rem 0; }
.bird-detail .photo-credit {
  font-size: 0.78rem;
  color: #6c7a91;
  margin-top: 0.3rem;
}
.bird-detail .photo-credit a { color: inherit; text-decoration: underline; }
.bird-detail .actions { margin-top: 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.bird-detail .learn-more {
  background: #4ec3a6;
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
  display: inline-block;
}

/* ---------- Quiz ---------- */
.quiz-area {
  background: #fff;
  border-radius: 26px;
  padding: 1.5rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.07);
  text-align: center;
}
.quiz-photo {
  width: min(360px, 100%);
  aspect-ratio: 4/3;
  margin: 0 auto 1rem;
  border-radius: 18px;
  overflow: hidden;
  background: #eef6ff;
}
.quiz-photo img { width: 100%; height: 100%; object-fit: cover; }
.quiz-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; max-width: 480px; margin: 0 auto; }
.quiz-options button {
  background: #fff7e8;
  border: 3px solid transparent;
  border-radius: 16px;
  padding: 0.7rem 1rem;
  font-weight: 800;
  font-size: 1rem;
  color: #1d3a5f;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  align-items: center;
  line-height: 1.2;
}
.quiz-options button .opt-pron {
  font-weight: 500;
  font-style: italic;
  color: #6c7a91;
  font-size: 0.85rem;
}
.quiz-options button small {
  font-weight: 600;
  color: #4a90e2;
  font-size: 0.8rem;
}
.quiz-options button.right { background: #c7f0d8; border-color: #4ec3a6; }
.quiz-options button.wrong { background: #ffd6d0; border-color: #ff7a59; }
.quiz-options button:disabled { cursor: default; opacity: 0.85; }

.quiz-status { font-size: 1.1rem; margin: 0.5rem 0 1rem; font-weight: 700; color: #1d3a5f; }
.quiz-feedback { font-size: 1.4rem; font-weight: 800; min-height: 2rem; margin: 0.6rem 0; }
.quiz-feedback.correct { color: #2c8a5d; }
.quiz-feedback.wrong { color: #c2492f; }

.quiz-final {
  display: flex; flex-direction: column; align-items: center; gap: 0.8rem;
  font-size: 1.2rem;
}
.quiz-final .score-badge {
  background: #fff3c2;
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  font-weight: 800;
  color: #8a6300;
  font-size: 1.6rem;
  box-shadow: inset 0 0 0 3px #ffd870;
}

/* ---------- Spots ---------- */
.spots-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 0.6rem;
}
@media (max-width: 720px) {
  .spots-list { grid-template-columns: 1fr; }
}
.spot-card {
  background: #fff;
  border-radius: 22px;
  padding: 1rem 1.1rem;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  border-top: 8px solid #4ec3a6;
}
.spot-card:nth-child(3n) { border-top-color: #ff7a59; }
.spot-card:nth-child(3n+1) { border-top-color: #4a90e2; }
.spot-card h3 {
  margin: 0 0 0.3rem;
  color: #1d3a5f;
  font-size: 1.15rem;
}
.spot-title-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.spot-title-link:hover {
  color: #ff7a59;
  text-decoration: underline;
}
.spot-title-link .map-pin {
  font-size: 0.85em;
  opacity: 0.7;
}
.spot-card .region {
  font-size: 0.85rem;
  color: #6c7a91;
  margin-bottom: 0.4rem;
}
.spot-card p { margin: 0; }
.birds-here-label {
  margin-top: 0.9rem;
  margin-bottom: 0.5rem;
  font-weight: 800;
  font-size: 0.78rem;
  color: #b35a00;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.birds-thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.bird-thumb {
  background: none;
  border: 0;
  padding: 0.3rem;
  cursor: pointer;
  text-align: center;
  font: inherit;
  color: inherit;
  border-radius: 12px;
  transition: transform 0.12s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
}
.bird-thumb:hover {
  transform: translateY(-2px);
  background: #fff7e8;
}
.bird-thumb .photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  background: #eef6ff;
  margin-bottom: 0.4rem;
  border: 3px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.bird-thumb .photo img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.bird-thumb .thumb-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1d3a5f;
  line-height: 1.2;
  display: block;
}
.bird-thumb .thumb-pron {
  font-size: 0.78rem;
  font-style: italic;
  color: #6c7a91;
  line-height: 1.15;
  display: block;
  margin-top: 0.1rem;
}
.bird-thumb .photo.photo-fallback .fallback-emoji {
  font-size: 2rem;
}
.bird-detail .related-birds {
  grid-column: 1 / -1;
  border-top: 2px dashed #f1e6d0;
  padding-top: 1rem;
  margin-top: 0.4rem;
}
.bird-detail .related-birds .birds-thumbs {
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem;
}
.bird-detail .related-birds .bird-thumb .photo {
  width: 112px;
  height: 112px;
  margin-bottom: 0.5rem;
}
.bird-detail .related-birds .bird-thumb .photo.photo-fallback .fallback-emoji {
  font-size: 2.6rem;
}
.bird-detail .related-birds .bird-thumb .thumb-name {
  font-size: 1.05rem;
  line-height: 1.25;
}
.bird-detail .related-birds .bird-thumb .thumb-pron {
  font-size: 0.88rem;
}
@media (max-width: 720px) {
  .bird-detail .related-birds .birds-thumbs {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---------- About ---------- */
.about-content {
  background: #fff;
  border-radius: 22px;
  padding: 1.4rem;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}
.about-content h2 { color: #1d3a5f; margin-top: 1rem; }
.sources { padding-left: 1.2rem; }
.sources li { margin: 0.3rem 0; }
.small { font-size: 0.9rem; color: #6c7a91; margin-top: 1rem; }

/* ---------- Feedback ---------- */
.feedback-section {
  margin-top: 1.5rem;
  background: #fff;
  border-radius: 22px;
  padding: 1.4rem;
  box-shadow: 0 3px 10px rgba(0,0,0,0.05);
  border-top: 8px solid #4ec3a6;
}
.feedback-section h2 { margin: 0 0 0.4rem; color: #1d3a5f; }
.feedback-section .lead { margin-top: 0; }
.feedback-form { margin-top: 0.8rem; }
.feedback-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 2px solid #e6e1d4;
  border-radius: 16px;
  padding: 0.8rem 1rem;
  font: inherit;
  font-size: 1rem;
  color: #1d3a5f;
  background: #fffbf2;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.15s;
}
.feedback-form textarea:focus {
  outline: none;
  border-color: #4ec3a6;
  background: #fff;
}
.feedback-form .hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.feedback-form .cf-turnstile-mount { margin: 0.7rem 0; }
.feedback-form button[type="submit"] { margin-top: 0.5rem; }
.feedback-status {
  margin: 0.7rem 0 0;
  font-weight: 700;
  min-height: 1.2em;
}
.feedback-status.ok { color: #2c8a5d; }
.feedback-status.err { color: #c2492f; }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 1.2rem;
  background: #fff;
  color: #6c7a91;
  font-size: 0.85rem;
  margin-top: 2rem;
}

/* ---------- Photo fallback ---------- */
.photo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-fallback img { display: none; }
.fallback-emoji {
  font-size: 4rem;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.15));
}

/* ---------- Loading state ---------- */
.skeleton {
  background: linear-gradient(90deg, #eef6ff 25%, #dde9f5 50%, #eef6ff 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .bird-detail { grid-template-columns: 1fr; }
  .bird-detail h1 { font-size: 1.5rem; }
  .quiz-options { grid-template-columns: 1fr; }
  .main-nav { order: 3; width: 100%; }
  .lang-picker { margin-left: auto; }
}
