/* Field-guide look: warm paper, deep forest green, a Caslon serif for
   headings, soft rounded cards. Layout is a single phone-width column even
   on desktop -- this is a phone-first app. */
:root {
  --ink: #1f2823;
  --ink-soft: #6c6f66;
  --paper: #f6f3ea;
  --paper-raised: #fffdf8;
  --paper-sunk: #ece8dc;
  --rule: #e5dfd0;
  --accent: #2f5747;
  --accent-deep: #23443a;
  --accent-soft: #e2ebe4;
  --good: #2f5747;
  --good-soft: #e2ebe4;
  --bad: #9a4433;
  --bad-soft: #f6e5df;
  --amber: #a3652b;
  --amber-soft: #f3e6d6;
  --serif: "Libre Caslon Text", Georgia, "Times New Roman", serif;
  --shadow: 0 1px 2px rgba(40, 45, 35, 0.05), 0 6px 18px rgba(40, 45, 35, 0.06);
  --radius: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

main#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 18px calc(96px + env(safe-area-inset-bottom));
}

a { color: var(--accent); }
button { font: inherit; color: inherit; }

.icon { width: 22px; height: 22px; flex: none; }
.eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.fine-print { font-size: 13px; color: var(--ink-soft); line-height: 1.5; }

/* --- buttons ---------------------------------------------------------- */
.primary-btn, .secondary-btn {
  display: block;
  width: 100%;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 14px;
  cursor: pointer;
  margin: 18px 0 0;
}
.primary-btn { border: none; background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.primary-btn:hover { background: var(--accent-deep); }
.secondary-btn { border: 1px solid var(--rule); background: var(--paper-raised); color: var(--accent); margin-top: 10px; }
.secondary-btn:hover { background: var(--accent-soft); }
.back-btn, .link-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 18px 0 12px;
  margin-left: -6px;
}
.round-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.92);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.round-btn .icon { width: 18px; height: 18px; }

/* --- home ------------------------------------------------------------- */
.hero {
  position: relative;
  margin: 0 -18px;
  height: 262px;
  overflow: hidden;
  background: linear-gradient(#f3f0e6, var(--paper) 60%);
}
.landscape { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 130px; }
.hero .landscape { height: 108px; }
.hero .landscape { opacity: 0.9; }
.hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--paper));
}
.hero-text { position: relative; z-index: 1; padding: 30px 22px 0; }
.wordmark {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.05;
}
.tagline { margin: 6px 0 14px; color: var(--ink-soft); font-size: 15px; }
.region-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: var(--ink);
}
.region-pill .icon { width: 18px; height: 18px; color: var(--ink-soft); }
.region-pill .chevron-down { transform: rotate(90deg); width: 16px; height: 16px; }
.region-pill select {
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: inherit;
  padding: 0 2px;
  cursor: pointer;
  max-width: 190px;
}

.stats-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: -26px 0 18px;
}
.stats-row.mini { margin: 4px 0 14px; }
.stat {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 8px;
  text-align: center;
}
.stat-icon { width: 24px; height: 24px; margin-bottom: 2px; }
.stat:nth-child(1) .stat-icon { color: #a8875a; }
.stat:nth-child(2) .stat-icon { color: #4e7a5e; }
.stat:nth-child(3) .stat-icon { color: #c29a3b; }
.stat-num { font-family: var(--serif); font-size: 24px; font-weight: 700; }
.stats-row.mini .stat-num { font-size: 20px; }
.stat-label { font-size: 12px; color: var(--ink-soft); line-height: 1.25; }

.action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  margin-bottom: 10px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  font-size: 17px;
  text-align: left;
  cursor: pointer;
}
.action-card > span { flex: 1; }
.action-card > .icon:first-child { color: var(--accent); width: 26px; height: 26px; }
.action-card .chevron { color: var(--ink-soft); width: 18px; height: 18px; }
.action-card:hover { border-color: var(--accent); }
.action-card.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.action-card.primary > .icon:first-child, .action-card.primary .chevron { color: #fff; }
.action-card.primary:hover { background: var(--accent-deep); }
.count {
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
  vertical-align: 2px;
}

.botd {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 8px 0 4px;
  padding: 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: linear-gradient(120deg, #f1eee2, #e8ede4);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
}
.botd-img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; flex: none; border: 3px solid var(--paper-raised); }
.botd-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.botd-name { font-family: var(--serif); font-size: 19px; font-style: italic; }
.botd-fact {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.botd .chevron { width: 18px; height: 18px; color: var(--ink-soft); }

.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 0 12px; }
.section-head h2, .section-title { font-family: var(--serif); font-size: 24px; margin: 0; }
.section-title { margin: 24px 0 6px; }
.view-all { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; text-decoration: none; }
.view-all .icon { width: 16px; height: 16px; }

/* level cards (Home and Bird Guide) */
.levels { display: flex; flex-direction: column; gap: 10px; }
.level-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-raised);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
}
.level-row:hover { border-color: var(--accent); }
.level-num {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--paper-sunk);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-soft);
}
.level-num.on { background: var(--accent); color: #fff; }
.level-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.level-name { font-weight: 600; font-size: 15px; }
.level-meta { font-size: 12.5px; color: var(--ink-soft); }
.level-bar { display: block; height: 7px; background: var(--paper-sunk); border-radius: 4px; overflow: hidden; margin-top: 2px; }
.level-bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.level-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; background: var(--paper-sunk); }
.level-row .chevron { width: 18px; height: 18px; color: var(--ink-soft); }
.avatar-empty { display: inline-block; }

/* --- bottom tab bar ------------------------------------------------------ */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--rule);
  z-index: 50;
}
.tabbar[hidden] { display: none; }
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: none;
  color: var(--ink-soft);
  font-size: 11.5px;
  padding: 4px 0;
  cursor: pointer;
}
.tab .icon { width: 24px; height: 24px; }
.tab.on { color: var(--accent); font-weight: 700; }

/* --- Bird Guide (browse) ------------------------------------------------ */
.page-head { padding-top: 28px; }
.page-title { font-family: var(--serif); font-size: 32px; font-weight: 700; margin: 0; line-height: 1.1; }
.page-sub { margin: 6px 0 0; color: var(--ink-soft); font-size: 15px; }
.tabs { display: flex; gap: 22px; margin: 18px 0 16px; border-bottom: 1px solid var(--rule); }
.tabs a {
  padding: 8px 2px 10px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 15px;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
}
.tabs a.on { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }

.guide-hero {
  position: relative;
  display: block;
  height: 176px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(#e9ede4, #dfe5dc);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
}
.guide-hero .landscape { height: 110px; }
.guide-hero-text { position: relative; display: flex; flex-direction: column; padding: 18px 20px; }
.guide-hero-num { font-family: var(--serif); font-size: 44px; font-weight: 700; line-height: 1.05; margin-top: 4px; }
.guide-hero-label { font-family: var(--serif); font-size: 16px; }
.guide-hero .round-btn { position: absolute; right: 14px; bottom: 14px; }

.level-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px 10px 14px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 14px;
}
.level-chip a { display: grid; place-items: center; color: var(--accent-deep); }
.level-chip .icon { width: 18px; height: 18px; }

.browse-controls { display: flex; gap: 10px; margin-bottom: 14px; }
.search-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  color: var(--ink-soft);
}
.search-wrap .icon { width: 18px; height: 18px; }
.search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 15px;
  padding: 11px 0;
  color: var(--ink);
  outline: none;
}
.filter-select {
  flex-shrink: 0;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  color: var(--ink);
}

.browse-list { display: flex; flex-direction: column; gap: 8px; }
.browse-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
}
.browse-row:hover { border-color: var(--accent); }
.browse-row[hidden] { display: none; }
.browse-row .chevron { width: 18px; height: 18px; color: var(--ink-soft); }
.browse-rank { font-size: 12px; color: var(--ink-soft); width: 22px; text-align: center; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.browse-thumb {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--paper-sunk);
  display: flex;
  align-items: center;
  justify-content: center;
}
.browse-thumb img { width: 100%; height: 100%; object-fit: cover; }
.browse-thumb .prompt-missing.small { padding: 0; border: none; font-size: 10px; margin: 0; background: none; }
.browse-info { min-width: 0; flex: 1; }
.browse-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browse-badges { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.badge {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 6px;
  padding: 2px 7px;
}
.badge.new { background: var(--paper-sunk); color: var(--ink-soft); }
.badge.learning { background: var(--amber-soft); color: var(--amber); }
.badge.mature { background: var(--good-soft); color: var(--good); }
.badge.unavailable { background: transparent; color: var(--ink-soft); border: 1px dashed var(--rule); }

/* --- bird detail ----------------------------------------------------------- */
.detail-hero { display: block; width: 100%; padding: 0; border: none; cursor: zoom-in; margin-bottom: 16px; }
.detail-header { margin-bottom: 8px; }
.detail-sci { font-size: 15px; font-family: var(--serif); font-style: italic; color: var(--ink-soft); margin: 4px 0 10px; }
.detail h3 { font-family: var(--serif); font-size: 20px; margin: 26px 0 10px; }
.detail-facts { margin: 0; padding: 14px 16px 14px 34px; background: var(--paper-raised); border: 1px solid var(--rule); border-radius: var(--radius); }
.detail-facts li { font-size: 15px; line-height: 1.5; margin-bottom: 6px; }
.detail-facts li:last-child { margin-bottom: 0; }
.detail-credit { font-size: 12px; color: var(--ink-soft); }
.detail-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.detail-image-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 8px;
  cursor: zoom-in;
}
.detail-image-card img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: contain;
  background: var(--paper-sunk);
  border-radius: 10px;
  margin-bottom: 6px;
}
.detail-audio-list { display: flex; flex-direction: column; gap: 8px; }
.detail-audio-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 10px 12px;
}
.detail-audio-info { min-width: 0; }
.detail-audio-info .feedback-audio-detail { margin: 0 0 4px; }

/* --- session ------------------------------------------------------------ */
.session { padding-top: 10px; }
.session-head { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; }
.session-progress { text-align: center; font-size: 15px; color: var(--ink); }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border: none; background: none; cursor: pointer; margin-left: -8px; }
.progress { height: 8px; background: var(--paper-sunk); border-radius: 5px; overflow: hidden; margin: 8px 0 18px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 5px; transition: width 0.3s; }
.mode-pill {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  margin: 0 auto 14px;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.mode-pill .icon { width: 17px; height: 17px; }

.photo-card {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: var(--paper-sunk);
  box-shadow: var(--shadow);
  margin-bottom: 6px;
}
.photo-bg {
  position: absolute;
  inset: -20px;
  width: calc(100% + 40px);
  height: calc(100% + 40px);
  object-fit: cover;
  filter: blur(22px) saturate(1.1);
  opacity: 0.75;
}
.prompt-img {
  position: relative;
  display: block;
  width: 100%;
  height: 320px;
  object-fit: contain;
}
.expand-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(20, 25, 20, 0.45);
  color: #fff;
  cursor: zoom-in;
}
.expand-btn .icon { width: 17px; height: 17px; }

.question { font-family: var(--serif); font-size: 27px; font-weight: 700; text-align: center; margin: 20px 0 16px; line-height: 1.2; }
.intro-sci { text-align: center; font-family: var(--serif); font-style: italic; color: var(--ink-soft); margin: -10px 0 16px; }
.prompt-missing {
  padding: 24px;
  text-align: center;
  color: var(--ink-soft);
  background: var(--paper-raised);
  border: 1px dashed var(--rule);
  border-radius: 14px;
  margin-bottom: 18px;
}
.prompt-missing.small { padding: 8px; font-size: 11px; }

.play-btn {
  display: block;
  width: 100%;
  padding: 44px 20px;
  font-size: 20px;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid var(--rule);
  background: radial-gradient(circle at 50% 40%, #fffdf8, #eef2ea);
  color: var(--accent);
  box-shadow: var(--shadow);
  cursor: pointer;
  margin-bottom: 6px;
}
.play-btn.small {
  flex-shrink: 0;
  width: auto;
  padding: 10px 14px;
  font-size: 14px;
  border-radius: 12px;
  background: var(--paper);
  box-shadow: none;
  margin-bottom: 0;
}

.options { display: grid; grid-template-columns: 1fr; gap: 10px; }
.options:has(.img-option) { grid-template-columns: 1fr 1fr; }
.option-btn {
  border: 1.5px solid var(--rule);
  background: var(--paper-raised);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 16px;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow);
}
.option-btn:hover:not(:disabled) { border-color: var(--accent); }
.text-option { padding: 18px 20px; }
.img-option { text-align: center; padding: 8px; }
.img-option img { display: block; width: 100%; height: 130px; object-fit: contain; background: var(--paper-sunk); border-radius: 10px; }
.option-btn:disabled { cursor: default; }
.option-btn.correct { border-color: var(--good); background: var(--good-soft); color: var(--accent-deep); font-weight: 600; }
.option-btn.incorrect { border-color: var(--bad); background: var(--bad-soft); }
.option-label { display: block; margin-top: 6px; font-size: 13px; color: var(--ink-soft); }

.hint {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 18px auto 0;
  padding: 10px 16px;
  border-radius: 20px;
  background: var(--paper-sunk);
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.35;
}
.hint[hidden] { display: none; }
.hint .icon { width: 20px; height: 20px; }

.group-line { margin: 14px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink-soft); }
.group-name { font-weight: 700; color: var(--accent); }
.group-name a { color: var(--accent); }
.detail-header .group-line { margin: 0 0 10px; }
.detail-blurb { font-family: var(--serif); font-size: 17px; line-height: 1.5; color: var(--ink); margin: 4px 0 12px; max-width: 65ch; }
.group-row .level-meta { line-height: 1.4; }
.group-count { font-weight: 600; }
.group-trait { margin: 6px 0 0; color: var(--ink-soft); font-size: 15px; line-height: 1.45; }
.group-about { font-size: 15px; line-height: 1.55; margin: 12px 0 0; }
.group-vs-row + .group-vs-row { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule); }
.group-vs-name { font-weight: 700; font-size: 15px; color: var(--accent); }
.tips-card { margin: 16px 0 0; padding: 14px 16px; border-radius: var(--radius); background: var(--paper-raised); border: 1px solid var(--rule); }
.intro-tips { margin: 8px 0 0; padding-left: 20px; }
.intro-tips li { font-size: 15px; line-height: 1.5; margin-bottom: 6px; }
.lookalike-card { display: flex; gap: 12px; align-items: flex-start; margin-top: 10px; }
.lookalike-card + .lookalike-card { padding-top: 10px; border-top: 1px solid var(--rule); }
.lookalike-thumb { width: 64px; height: 64px; flex: none; object-fit: cover; border-radius: 10px; background: var(--paper-sunk); }
.lookalike-card .play-btn { flex: none; }
.lookalike-text { min-width: 0; }
.lookalike-name { font-weight: 700; font-size: 15px; }
.lookalike-name a { color: var(--accent); }
.lookalike-tell { font-size: 14px; line-height: 1.45; color: var(--ink-soft); margin-top: 2px; }
.detail-lookalikes { padding: 4px 16px 14px; background: var(--paper-raised); border: 1px solid var(--rule); border-radius: var(--radius); }

.feedback { margin-top: 16px; padding: 18px; border-radius: 18px; box-shadow: var(--shadow); }
.feedback.good { background: var(--good-soft); }
.feedback.bad { background: var(--bad-soft); }
.feedback-headline { font-family: var(--serif); font-size: 21px; font-weight: 700; margin-bottom: 8px; }
.feedback-img {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: contain;
  background: var(--paper-raised);
  border-radius: 14px;
  margin-bottom: 10px;
}
.feedback-audio-detail {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 3px 8px;
  margin-bottom: 8px;
}
.feedback-fact { font-size: 15px; line-height: 1.5; margin-bottom: 8px; }
.fact-kind { font-weight: 700; }
.feedback-credit { font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }

/* --- summary / checkpoint ------------------------------------------------ */
.summary { text-align: center; padding-top: 24px; }
.summary-art { position: relative; height: 150px; border-radius: 20px; overflow: hidden; background: linear-gradient(#eef0e8, #e2e8df); margin-bottom: 22px; box-shadow: var(--shadow); }
.summary-art .landscape { height: 150px; }
.summary-score { font-family: var(--serif); font-size: 56px; font-weight: 700; color: var(--accent); margin: 4px 0 0; line-height: 1.1; }
.summary-sub { color: var(--ink-soft); margin: 6px 0 0; line-height: 1.5; }

/* --- lightbox -------------------------------------------------------------- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 15, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.lightbox-img { max-width: min(92vw, 760px); max-height: 78vh; object-fit: contain; border-radius: 10px; }
.lightbox-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  color: white;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: white;
  font-size: 36px;
  line-height: 1;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-nav[hidden] { display: none; }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-caption {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  padding: 0 60px;
}
.lightbox-caption[hidden] { display: none; }

/* On screens wider than the column, fade the header scene's side edges so
   it doesn't end in a hard vertical line against the page background. */
@media (min-width: 520px) {
  .hero { -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
}

/* --- Group pages and comparison pages --- */
.group-mosaic { display: grid; gap: 4px; border-radius: var(--radius); overflow: hidden; margin: 4px 0 16px; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 96px 96px; }
.group-mosaic .mosaic-tile:first-child { grid-row: span 2; }
.group-mosaic.n1 { grid-template-columns: 1fr; grid-template-rows: 200px; }
.group-mosaic.n1 .mosaic-tile:first-child { grid-row: auto; }
.group-mosaic.n2 { grid-template-columns: 1fr 1fr; grid-template-rows: 180px; }
.group-mosaic.n2 .mosaic-tile:first-child { grid-row: auto; }
.group-mosaic.n3 { grid-template-columns: 2fr 1fr; }
.group-mosaic.n4 { grid-template-columns: 2fr 1fr 1fr; }
.group-mosaic.n4 .mosaic-tile:last-child { grid-column: span 2; }
.mosaic-tile { position: relative; display: block; min-width: 0; background: var(--paper-sunk); }
.mosaic-tile .photo-tile-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mosaic-tile .photo-tile-name { position: absolute; left: 6px; bottom: 6px; right: 6px; font-size: 11px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mark-list { display: grid; gap: 8px; }
.mark-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 14px; background: var(--paper-raised); border: 1px solid var(--rule); color: inherit; text-decoration: none; }
.mark-row:hover { border-color: var(--accent); }
.mark-img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; flex: none; background: var(--paper-sunk); }
.mark-body { display: grid; gap: 3px; min-width: 0; }
.mark-text { font-size: 15px; line-height: 1.35; font-weight: 600; }
.mark-eg { font-size: 12.5px; color: var(--ink-soft); }

.cluster-list { display: grid; gap: 10px; }
.cluster-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--paper-raised); border: 1px solid var(--rule); color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.cluster-card:hover { border-color: var(--accent); }
.cluster-strip { display: flex; grid-column: 1 / -1; }
.cluster-img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--paper-raised); background: var(--paper-sunk); }
.cluster-img + .cluster-img { margin-left: -12px; }
.cluster-body { display: grid; gap: 2px; min-width: 0; flex: 1; }
.cluster-name { font-family: var(--serif); font-size: 17px; }
.cluster-groups { font-size: 12.5px; color: var(--ink-soft); line-height: 1.35; }
.cluster-card .chevron { width: 18px; height: 18px; color: var(--ink-soft); flex: none; }

.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.member-tile { display: grid; gap: 4px; color: inherit; text-decoration: none; min-width: 0; }
.member-img { width: 100%; aspect-ratio: 1; max-width: 100%; border-radius: 12px; object-fit: cover; display: block; background: var(--paper-sunk); }
.member-name { font-size: 13px; font-weight: 600; line-height: 1.25; }
.member-status { font-size: 11px; color: var(--ink-soft); }
.member-status.learning { color: var(--amber); }
.member-status.mastered { color: var(--good); }
details.elsewhere { margin-top: 22px; }
details.elsewhere summary { font-family: var(--serif); font-size: 20px; cursor: pointer; margin-bottom: 10px; }

.vs-pair { margin-top: 12px; padding: 12px; border-radius: var(--radius); background: var(--paper-raised); border: 1px solid var(--rule); }
.vs-photos { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.vs-side { display: grid; gap: 4px; justify-items: center; text-align: center; color: inherit; text-decoration: none; min-width: 0; }
.vs-img { width: 100%; max-width: 140px; aspect-ratio: 4 / 3; border-radius: 10px; object-fit: cover; display: block; background: var(--paper-sunk); }
.vs-name { font-size: 13px; font-weight: 700; color: var(--accent); line-height: 1.25; }
.vs-bird { font-size: 11.5px; color: var(--ink-soft); line-height: 1.2; }
.vs-mid { font-family: var(--serif); font-style: italic; color: var(--ink-soft); }
.vs-tell { margin: 10px 0 0; font-size: 14px; line-height: 1.5; }

.compare-cards { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 10px; margin: 8px -2px 0; }
.compare-card { flex: 0 0 82%; max-width: 300px; scroll-snap-align: start; padding: 10px; border-radius: var(--radius); background: var(--paper-raised); border: 1px solid var(--rule); box-shadow: var(--shadow); display: grid; gap: 10px; align-content: start; }
.compare-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.compare-photo { display: block; color: inherit; text-decoration: none; min-width: 0; }
.compare-photo .photo-tile-img { width: 100%; aspect-ratio: 1; max-width: 100%; border-radius: 8px; object-fit: cover; display: block; background: var(--paper-sunk); }
.compare-photo .photo-tile-name { display: block; font-size: 10.5px; color: var(--ink-soft); line-height: 1.2; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compare-name { font-family: var(--serif); font-size: 19px; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.compare-name .icon { width: 16px; height: 16px; }
.compare-rows { margin: 0; display: grid; gap: 8px; }
.compare-rows dt { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.compare-rows dd { margin: 2px 0 0; font-size: 14px; line-height: 1.4; }
.compare-trait { margin: 0; font-size: 14px; line-height: 1.4; }
.compare-hint { margin-top: 2px; }

.photo-caption { font-size: 12.5px; font-weight: 600; color: var(--ink); margin: 6px 0 2px; }

.plumage-chip { position: absolute; left: 10px; top: 10px; padding: 3px 9px; border-radius: 999px; background: rgba(20, 25, 20, 0.6); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; pointer-events: none; }
.img-option { position: relative; }
.img-option .plumage-chip { left: 6px; top: 6px; font-size: 10.5px; padding: 2px 7px; }
.lookalike-plumage { font-weight: 400; color: var(--ink-soft); }

/* --- Profile and account forms --- */
.profile .tips-card p { margin: 0 0 8px; line-height: 1.5; }
.profile .tips-card p:last-child { margin-bottom: 0; }
.account-email { font-size: 17px; font-weight: 600; margin: 4px 0 6px; overflow-wrap: anywhere; }
.auth-form { display: grid; gap: 14px; margin-top: 16px; }
.form-field { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.form-field input { font: inherit; font-weight: 400; font-size: 16px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--rule); background: var(--paper-raised); color: var(--ink); min-width: 0; }
.form-field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.field-error, .form-error { color: var(--bad); font-size: 13px; font-weight: 500; margin: 0; }
.form-note { color: var(--good); font-size: 14px; margin: 0; }
.auth-form .primary-btn { margin-top: 4px; }
.auth-form .primary-btn:disabled { opacity: 0.6; cursor: default; }
.form-foot { text-align: center; margin-top: 18px; }
.form-foot a, .profile a { color: var(--accent); }
.danger-zone { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--rule); }
.link-btn.danger { color: var(--bad); }
.danger-btn { background: var(--bad); }
.danger-btn:hover { background: var(--bad); filter: brightness(0.92); }
.sync-card .sync-status { font-weight: 600; margin: 4px 0 6px; }
.sync-card .link-btn { padding: 0; margin-top: 4px; }
.save-prompt { margin-top: 22px; text-align: left; }
.save-prompt p { margin: 0; line-height: 1.5; font-size: 14px; }

/* --- Demo limits: locked levels and birds --- */
.level-row.locked, .browse-row.locked { opacity: 0.62; }
.level-row.locked .level-num { background: var(--paper-sunk); color: var(--ink-soft); }
.level-row.locked .level-num .icon { width: 16px; height: 16px; }
.level-row.locked .level-avatar, .browse-row.locked .browse-thumb img { filter: grayscale(1); }
.locked-badge { display: inline-flex; align-items: center; gap: 4px; background: var(--paper-sunk); color: var(--ink-soft); }
.locked-badge .icon { width: 12px; height: 12px; }
