/* =========================================================
   North American Hunter's Field Encyclopedia - prototype CSS
   Mobile-first. Design cues: field guide, conservation, forest.
   ========================================================= */

:root {
  --bg: #f6f2e9;
  --bg-elev: #fbf8f1;
  --paper: #fffdf7;
  --ink: #1f2a24;
  --ink-soft: #3f4a44;
  --muted: #7a7568;
  --line: #e5ddca;
  --line-strong: #cfc3a4;

  --forest: #2d5a3d;
  --forest-deep: #1e3d29;
  --forest-soft: #3e6b4f;
  --moss: #6b8e5a;
  --wheat: #c9a961;
  --wheat-soft: #d8be82;
  --rust: #a04a1f;
  --sky: #4d6b7a;

  --danger: #92401b;
  --success: #365f3a;

  --font-serif: 'Fraunces', 'Iowan Old Style', 'Palatino', 'Georgia', serif;
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --radius: 14px;
  --radius-lg: 20px;
  --radius-sm: 10px;

  --shadow-sm: 0 1px 2px rgba(31,42,36,.06), 0 2px 8px rgba(31,42,36,.05);
  --shadow-md: 0 6px 24px rgba(31,42,36,.10), 0 2px 6px rgba(31,42,36,.06);
  --shadow-lg: 0 18px 48px rgba(31,42,36,.16);

  --bottomnav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
  padding-bottom: calc(var(--bottomnav-h) + var(--safe-b));
}
img { max-width: 100%; display: block; }
a { color: var(--forest); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

h1,h2,h3,h4 { font-family: var(--font-serif); font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 .5rem; }
h2 { font-size: 1.5rem; line-height: 1.2; margin: 0 0 .6rem; }
h3 { font-size: 1.15rem; margin: 0 0 .4rem; }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.14em; font-size: .75rem;
  color: var(--forest); font-weight: 600; font-family: var(--font-sans);
}
.muted { color: var(--muted); }
.serif { font-family: var(--font-serif); }
.italic { font-style: italic; }

/* ============ Layout ============ */

.app { max-width: 1180px; margin: 0 auto; padding: 0 18px 32px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(246,242,233,.92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--forest); display: grid; place-items: center;
  box-shadow: var(--shadow-sm); flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-title {
  font-family: var(--font-serif); font-weight: 600; font-size: 1rem; letter-spacing: 0.02em;
}
.brand-sub {
  font-family: var(--font-serif); font-style: italic;
  font-size: .8rem; color: var(--muted);
}
.topnav { display: none; gap: 22px; }
.topnav a {
  color: var(--ink-soft); font-weight: 500; padding: 6px 2px; border-bottom: 2px solid transparent;
}
.topnav a:hover { color: var(--forest); border-bottom-color: var(--wheat); text-decoration: none; }
.topnav a.active { color: var(--forest); border-bottom-color: var(--forest); }

@media (min-width: 780px) {
  .topnav { display: flex; }
  .brand-title { font-size: 1.1rem; }
  .brand-sub { font-size: .85rem; }
}

/* ============ Bottom nav ============ */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  display: grid; grid-template-columns: repeat(5,1fr);
  background: var(--paper); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  box-shadow: 0 -4px 20px rgba(31,42,36,.06);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 10px 4px; color: var(--muted); font-size: .72rem; font-weight: 500;
  text-decoration: none; min-height: var(--bottomnav-h);
}
.bottomnav a.active { color: var(--forest); }
.bottomnav a:active { background: rgba(45,90,61,.06); }
@media (min-width: 900px) {
  .bottomnav { display: none; }
  body { padding-bottom: 0; }
}

/* ============ Buttons / chips ============ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 999px; padding: 12px 20px; font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; text-decoration: none; transition: transform .05s, background .15s, border-color .15s;
  min-height: 48px;
}
.btn:active { transform: translateY(1px); }
.btn.primary   { background: var(--forest); color: #fff; }
.btn.primary:hover { background: var(--forest-deep); text-decoration: none; }
.btn.secondary { background: var(--wheat); color: var(--ink); }
.btn.secondary:hover { background: var(--wheat-soft); text-decoration: none; }
.btn.ghost     { background: transparent; color: var(--forest); border-color: var(--forest); }
.btn.ghost:hover { background: rgba(45,90,61,.08); text-decoration: none; }
.btn.outline   { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.btn.outline:hover { border-color: var(--forest); color: var(--forest); text-decoration: none; }
.btn.block { width: 100%; }
.btn-link {
  background: transparent; border: 0; color: var(--forest);
  text-decoration: underline; padding: 6px 4px; font-weight: 500;
}
.btn-link:hover { color: var(--forest-deep); }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line-strong);
  color: var(--ink); font-size: .9rem; cursor: pointer; user-select: none;
  min-height: 44px;
}
.chip:hover { border-color: var(--forest); color: var(--forest); }
.chip input { accent-color: var(--forest); }
.chip.selected, .chip[aria-selected="true"] { background: var(--forest); color: #fff; border-color: var(--forest); }
.chip-row { display: flex; gap: 8px; margin-top: 6px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.chip-row.wrap { flex-wrap: wrap; overflow: visible; }

/* ============ Search ============ */

.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 6px 6px 6px 16px;
  box-shadow: var(--shadow-sm);
}
.search input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font: inherit; padding: 12px 4px; min-height: 44px;
}
.search .search-icon { color: var(--muted); flex-shrink: 0; }
.search .btn { padding: 10px 18px; min-height: 40px; }

/* ============ Hero ============ */

.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 44px 22px 34px;
  color: #f4efe1;
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(201,169,97,.35), transparent 60%),
    radial-gradient(600px 500px at -10% 110%, rgba(107,142,90,.4), transparent 60%),
    linear-gradient(160deg, #1e3d29 0%, #2d5a3d 55%, #3e6b4f 100%);
  box-shadow: var(--shadow-md);
  margin-top: 18px;
}
.hero .eyebrow { color: var(--wheat-soft); }
.hero h1 {
  color: #fbf8f1; font-size: 2.15rem; line-height: 1.05;
  letter-spacing: -0.02em; margin: 10px 0 8px; font-weight: 600;
}
.hero .tagline {
  font-family: var(--font-serif); font-style: italic; font-size: 1.15rem;
  color: var(--wheat-soft); margin: 0 0 12px;
}
.hero p.lead { color: #eee8d6; max-width: 640px; margin: 0 0 22px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.hero .search { max-width: 620px; }
.hero-emblem {
  position: absolute; right: -50px; top: -40px; opacity: .18; pointer-events: none;
  color: var(--wheat);
}
@media (min-width: 780px) {
  .hero { padding: 64px 44px 52px; }
  .hero h1 { font-size: 3rem; }
  .hero .tagline { font-size: 1.35rem; }
}

/* ============ Cards / grids ============ */

.section { margin: 34px 0 12px; }
.section-head {
  display: flex; align-items: end; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 { margin: 0; }
.section-head a.view-all { font-weight: 600; color: var(--forest); }

.card-grid {
  display: grid; gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 560px) { .card-grid { grid-template-columns: repeat(2,1fr); } }
@media (min-width: 900px) { .card-grid { grid-template-columns: repeat(3,1fr); } }
@media (min-width: 1100px){ .card-grid.four { grid-template-columns: repeat(4,1fr); } }

.big-cards {
  display: grid; gap: 14px; grid-template-columns: 1fr;
  margin-top: 20px;
}
@media (min-width: 560px) { .big-cards { grid-template-columns: repeat(2,1fr); } }
@media (min-width: 780px) { .big-cards { grid-template-columns: repeat(3,1fr); } }
@media (min-width: 780px) { .big-cards.four { grid-template-columns: repeat(4,1fr); } }

.big-card {
  display: block; padding: 22px; border-radius: var(--radius);
  background: var(--paper); border: 1px solid var(--line);
  color: var(--ink); box-shadow: var(--shadow-sm);
  transition: transform .1s, box-shadow .15s, border-color .15s;
}
.big-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--wheat); text-decoration: none; }
.big-card .icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(140deg,var(--forest),var(--forest-soft));
  color: #fff; display: grid; place-items: center; margin-bottom: 12px;
  font-size: 1.4rem;
}
.big-card h3 { margin: 0 0 4px; }
.big-card p { margin: 0; color: var(--muted); }

/* Species card */
.species-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform .1s, box-shadow .15s, border-color .15s;
  color: var(--ink);
}
.species-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--wheat); text-decoration: none; }
.species-card .photo {
  position: relative; aspect-ratio: 4/3;
  display: grid; place-items: center;
  color: rgba(255,255,255,.85);
  isolation: isolate;
}
.species-card .photo::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.15), transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(0,0,0,.18), transparent 55%);
  pointer-events: none;
}
.species-card .photo svg { width: 78%; height: 78%; z-index: 1; opacity: .82; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); }
.species-card .badge {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 600;
  color: #fff; background: rgba(0,0,0,.4); padding: 4px 10px; border-radius: 999px;
}
.species-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.species-card .name { font-family: var(--font-serif); font-size: 1.15rem; font-weight: 600; }
.species-card .sci { font-family: var(--font-serif); font-style: italic; color: var(--muted); font-size: .9rem; }
.species-card .short { color: var(--ink-soft); font-size: .92rem; margin-top: 2px; }
.species-card .view {
  margin-top: auto; display: inline-flex; align-items: center; gap: 6px;
  color: var(--forest); font-weight: 600; font-size: .9rem; padding-top: 10px;
}

/* ============ Panels / callouts ============ */

.panel {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm);
}
.callout {
  background: #fff7e0; border: 1px solid #ecd98a; color: #5b4200;
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; gap: 12px; align-items: flex-start;
}
.callout.warn { background: #fbeadb; border-color: #e8b78a; color: #6f2c0a; }
.callout .ico { font-size: 1.15rem; line-height: 1; }
.callout p { margin: 0; }

.quick-id {
  background: linear-gradient(160deg, #f4efdc 0%, #eee5c4 100%);
  border: 1px solid #d9c98e; border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.quick-id h3 { color: #5b4200; margin-bottom: 8px; }
.quick-id ul { margin: 0; padding-left: 20px; }
.quick-id li { margin: 4px 0; color: #3a2d0e; }

/* ============ Species detail ============ */

.crumb { color: var(--muted); font-size: .9rem; margin: 14px 0 8px; }
.crumb a { color: var(--forest); font-weight: 500; }

.detail-hero {
  border-radius: var(--radius-lg); overflow: hidden;
  position: relative; aspect-ratio: 16/9;
  display: grid; place-items: center; color: rgba(255,255,255,.9);
  box-shadow: var(--shadow-md); margin: 6px 0 20px;
}
.detail-hero svg { width: 60%; height: 60%; opacity: .8; filter: drop-shadow(0 8px 16px rgba(0,0,0,.3)); }
.detail-hero .caption {
  position: absolute; left: 20px; bottom: 18px;
  background: rgba(15,20,17,.55); backdrop-filter: blur(6px);
  color: #fff; padding: 10px 14px; border-radius: 10px; max-width: 82%;
}
.detail-hero .caption .name { font-family: var(--font-serif); font-size: 1.3rem; }
.detail-hero .caption .sci { font-style: italic; opacity: .85; }
@media (min-width: 780px) { .detail-hero { aspect-ratio: 21/9; } }

.stage-grid {
  display: grid; gap: 14px; grid-template-columns: 1fr;
}
@media (min-width: 780px) { .stage-grid { grid-template-columns: repeat(3,1fr); } }
.stage {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--paper); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.stage .thumb { aspect-ratio: 4/3; display: grid; place-items: center; color: rgba(255,255,255,.85); position: relative; }
.stage .thumb svg { width: 70%; height: 70%; opacity: .82; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); }
.stage .thumb .lbl {
  position: absolute; top: 10px; left: 10px;
  background: rgba(0,0,0,.4); color: #fff; padding: 4px 10px;
  border-radius: 999px; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600;
}
.stage .txt { padding: 14px 16px; }
.stage .txt h4 { margin: 0 0 6px; font-family: var(--font-serif); font-size: 1.05rem; }
.stage .txt p { margin: 0; color: var(--ink-soft); font-size: .95rem; }

.subhead { margin: 26px 0 10px; display: flex; align-items: center; gap: 10px; }
.subhead h2 { margin: 0; font-size: 1.35rem; }
.subhead .line { flex: 1; height: 1px; background: var(--line-strong); }

.list-clean { margin: 8px 0 0; padding-left: 22px; }
.list-clean li { margin: 6px 0; color: var(--ink-soft); }

.compare {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
@media (min-width: 620px) { .compare { grid-template-columns: 1fr 1fr; } }
.compare .side {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); overflow: hidden; box-shadow: var(--shadow-sm);
}
.compare .side .thumb { aspect-ratio: 3/2; display: grid; place-items: center; color: rgba(255,255,255,.85); }
.compare .side .thumb svg { width: 66%; height: 66%; opacity: .82; }
.compare .side .txt { padding: 12px 14px; }
.compare .side .name { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 600; }
.compare .side .sci { font-style: italic; color: var(--muted); font-size: .88rem; margin-bottom: 4px; }
.compare .why { padding: 12px 14px; background: #f7f2df; color: #4a3c14; border-top: 1px solid var(--line); font-size: .92rem; }

.range-map {
  border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  background: linear-gradient(160deg, #f4eeda 0%, #e8ddb6 100%);
  padding: 18px 18px 60px; position: relative;
}
.range-map svg { width: 100%; height: auto; display: block; max-width: 780px; margin: 0 auto; }
.range-map .legend {
  position: absolute; right: 14px; bottom: 14px; background: rgba(255,253,247,.94);
  padding: 6px 10px; border-radius: 8px; font-size: .8rem; color: var(--ink-soft);
  border: 1px solid var(--line);
}
.range-map .legend .swatch {
  display: inline-block; width: 10px; height: 10px; background: var(--forest);
  border-radius: 2px; margin-right: 6px; vertical-align: middle;
}
.range-map .range-count {
  position: absolute; left: 14px; bottom: 14px; background: rgba(255,253,247,.94);
  padding: 6px 10px; border-radius: 8px; font-size: .8rem; color: var(--ink-soft);
  border: 1px solid var(--line); font-weight: 600;
}
@media (max-width: 600px) {
  .range-map .range-count { font-size:.72rem; padding: 5px 8px; }
  .range-map .legend { font-size: .72rem; padding: 5px 8px; }
}

/* ============ Real US map - state paths ============ */
.us-range-svg { display: block; }
.us-state {
  fill: #efe5c4;
  stroke: #b8a26a;
  stroke-width: 0.6;
  transition: fill 0.12s, stroke-width 0.1s;
  outline: none;
}
.us-state.present {
  fill: #2d5a3d;
  stroke: #1e3d29;
}
.us-state.present:hover {
  fill: #3e6b4f;
  stroke-width: 1.2;
}
.us-state.present:focus-visible {
  stroke: #c9a961;
  stroke-width: 2;
}
.us-state.selected {
  fill: #c9a961 !important;
  stroke: #7a5b18 !important;
  stroke-width: 1.8 !important;
}

/* ============ Region panel (opens under the map) ============ */
.region-panel {
  margin-top: 14px; background: var(--paper); border: 1px solid var(--line);
  border-left: 4px solid var(--forest);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.region-panel[hidden] { display: none; }
.region-panel .region-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.region-panel .region-close {
  background: transparent; border: 0; color: var(--muted); font-size: 1.5rem;
  line-height: 1; padding: 4px 10px; cursor: pointer; border-radius: 8px;
}
.region-panel .region-close:hover { background: var(--bg-elev); color: var(--ink); }

.region-panel .region-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.region-panel .region-row {
  padding: 12px 14px; background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: 10px;
}
.region-panel .region-name {
  font-family: var(--font-serif); font-size: 1.05rem; font-weight: 600; color: var(--forest);
  margin-bottom: 4px;
}
.region-panel .region-areas {
  font-size: .9rem; color: var(--ink-soft); margin-bottom: 4px;
}
.region-panel .region-areas .lbl {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 700; margin-right: 4px;
}
.region-panel .region-notes { font-size: .92rem; color: var(--ink); }

.region-panel .region-foot {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.region-panel .region-foot .source {
  font-size: .82rem; color: var(--muted); margin: 0 0 10px 0; font-style: italic;
}
.region-panel .region-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.state-cards {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
@media (min-width: 700px) { .state-cards { grid-template-columns: repeat(2,1fr); } }
@media (min-width: 1050px){ .state-cards { grid-template-columns: repeat(3,1fr); } }
.state-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px;
}
.state-card .st-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.state-card .st-head h3 { margin: 0; font-family: var(--font-serif); }
.state-card .agency { font-size: .82rem; color: var(--muted); }
.state-card .st-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

/* ============ Identify tool ============ */

.identify-shell {
  background: linear-gradient(160deg, #fdfaf1 0%, #f4eeda 100%);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.progress {
  display: flex; align-items: center; gap: 6px; margin-bottom: 14px;
  font-size: .8rem; color: var(--muted);
}
.progress .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line-strong);
}
.progress .dot.done { background: var(--forest); }
.progress .dot.current { background: var(--wheat); }

.q-grid {
  display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr);
  margin-top: 10px;
}
@media (min-width: 620px) { .q-grid { grid-template-columns: repeat(3, 1fr); } }
.q-btn {
  background: var(--paper); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 18px 14px; text-align: center;
  color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm);
  min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; transition: transform .1s, border-color .15s;
}
.q-btn:hover { border-color: var(--forest); transform: translateY(-2px); }
.q-btn.selected { background: var(--forest); color: #fff; border-color: var(--forest); }
.q-btn .emoji { font-size: 1.6rem; }

.match-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 10px;
}
.match-row .thumb-sm {
  width: 68px; height: 52px; border-radius: 10px; display: grid; place-items: center; color: rgba(255,255,255,.85); flex-shrink: 0;
}
.match-row .thumb-sm svg { width: 80%; height: 80%; opacity: .85; }
.match-row .meta { flex: 1; min-width: 0; }
.match-row .meta .name { font-family: var(--font-serif); font-weight: 600; }
.match-row .meta .sci { font-style: italic; color: var(--muted); font-size: .85rem; }
.match-row .pct {
  font-family: var(--font-serif); font-weight: 700; font-size: 1.15rem;
  color: var(--forest);
}
.match-row .bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 4px; }
.match-row .bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--forest), var(--moss)); }
.match-row .go { flex-shrink: 0; }

/* ============ Filters bar ============ */

.filter-bar {
  display: grid; gap: 10px; grid-template-columns: 1fr;
  margin: 14px 0 18px;
}
@media (min-width: 780px) {
  .filter-bar { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
}
.filter-bar label {
  display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); font-weight: 500;
}
.filter-bar select, .filter-bar input[type="search"] {
  font: inherit; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: 12px; background: var(--paper); min-height: 44px;
}

/* ============ State page ============ */

.state-hero {
  border-radius: var(--radius-lg); overflow: hidden; position: relative;
  padding: 30px 22px; color: #fbf8f1; margin-top: 6px;
  background:
    radial-gradient(600px 220px at 90% -20%, rgba(201,169,97,.25), transparent 60%),
    linear-gradient(160deg,#243a2a 0%, #345d40 60%, #4c7a5a 100%);
  box-shadow: var(--shadow-md);
}
.state-hero h1 { color: #fff; }
.state-hero p { color: #eee8d6; max-width: 640px; }

.cat-section { margin-top: 26px; }
.cat-section h3 { margin: 0 0 10px; font-size: 1.25rem; }

/* ============ Modals ============ */
.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal[aria-hidden="false"] { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,20,17,.55); backdrop-filter: blur(4px); }
.modal-panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 48px); overflow: auto;
  background: var(--paper); border-radius: var(--radius-lg); padding: 22px;
  box-shadow: var(--shadow-lg);
}
.modal-panel h2 { margin-top: 4px; }
.modal-close {
  position: absolute; top: 10px; right: 12px; background: transparent; border: 0;
  font-size: 1.6rem; color: var(--muted); line-height: 1; padding: 6px 10px; cursor: pointer;
}
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-size: .88rem; color: var(--ink-soft); font-weight: 500; }
.stack input, .stack textarea, .stack select {
  font: inherit; padding: 12px 14px; border: 1px solid var(--line-strong);
  border-radius: 12px; background: var(--bg-elev); color: var(--ink); min-height: 44px;
}
.stack textarea { min-height: 80px; resize: vertical; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.thanks { padding: 16px; background: #e8efdd; border: 1px solid #c8d8ae; border-radius: 12px; color: #2f4a1e; margin-top: 12px; }

/* ============ Footer ============ */

.site-footer {
  background: #1e2a24; color: #d8d3c4; margin-top: 40px;
  padding: 26px 18px calc(26px + var(--bottomnav-h) + var(--safe-b));
}
@media (min-width: 900px) { .site-footer { padding-bottom: 34px; } }
.footer-inner { max-width: 1180px; margin: 0 auto; display: grid; gap: 16px; }
.footer-note { color: #c9c3ac; font-size: .88rem; margin: 0; max-width: 720px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: #c9a961; font-weight: 500; }
.footer-links a:hover { color: #e2c988; }
.footer-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.footer-actions .btn-link { color: #c9a961; }
.footer-copy { color: #8f8874; font-size: .82rem; margin: 4px 0 0; }

/* ============ Utility ============ */
.grid-2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 780px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-3 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 780px) { .grid-3 { grid-template-columns: repeat(3,1fr); } }
.gap-sm { gap: 8px; }
.mt-sm { margin-top: 10px; } .mt-md { margin-top: 20px; } .mt-lg { margin-top: 34px; }
.center { text-align: center; }
.hide-mobile { display: none; }
@media (min-width: 780px) { .hide-mobile { display: initial; } .hide-desktop { display: none; } }
.link-plain { color: var(--forest); text-decoration: underline; }

/* Empty state */
.empty {
  padding: 40px 20px; text-align: center; border: 1px dashed var(--line-strong);
  border-radius: var(--radius); color: var(--muted); background: var(--bg-elev);
}

/* Small helper for external link tag */
.ext-tag {
  display: inline-block; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .1em; padding: 2px 8px; margin-left: 6px;
  color: #5b4200; background: #f4e6b8; border-radius: 999px; border: 1px solid #e0cd80;
  vertical-align: middle;
}

/* ============ Bookmark button ============ */
.bookmark-btn {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,253,247,.94); border: 1px solid var(--line-strong);
  color: var(--ink-soft); display: grid; place-items: center;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: color .15s, background .15s, transform .1s, border-color .15s;
  padding: 0;
}
.bookmark-btn:hover { color: var(--forest); border-color: var(--forest); }
.bookmark-btn.saved { background: var(--forest); color: #fff; border-color: var(--forest); }
.bookmark-btn.saved:hover { background: var(--forest-deep); }
.bookmark-btn:active { transform: scale(0.94); }
.bookmark-btn svg { width: 18px; height: 18px; }

.save-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px; min-height: 48px;
  font: inherit; font-weight: 600; font-size: .95rem;
  background: var(--paper); color: var(--forest);
  border: 1px solid var(--forest); cursor: pointer;
  transition: background .15s, color .15s, transform .05s;
}
.save-btn:hover { background: rgba(45,90,61,.08); }
.save-btn:active { transform: translateY(1px); }
.save-btn.saved { background: var(--forest); color: #fff; }
.save-btn.saved:hover { background: var(--forest-deep); }
.save-btn svg { width: 18px; height: 18px; }

.nav-count {
  display: inline-block; min-width: 20px; padding: 1px 7px;
  background: var(--forest); color: #fff; border-radius: 999px;
  font-size: .72rem; margin-left: 6px; font-weight: 600;
  text-align: center; vertical-align: baseline;
}
.nav-count:empty { display: none; }

/* Small saved chip on the homepage */
.saved-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line-strong);
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: .9rem;
  box-shadow: var(--shadow-sm); margin-top: 14px;
}
.saved-chip:hover { border-color: var(--forest); color: var(--forest); text-decoration: none; }
.saved-chip .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--forest);
}

/* ============ Compare - pair cards & detail ============ */
.pair-card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column;
  color: var(--ink); transition: transform .1s, box-shadow .15s, border-color .15s;
}
.pair-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--wheat); text-decoration: none; }
.pair-thumbs {
  display: grid; grid-template-columns: 1fr 1fr; aspect-ratio: 3/1.4;
  position: relative;
}
.pair-thumbs > div { display: grid; place-items: center; color: rgba(255,255,255,.85); position: relative; isolation: isolate; }
.pair-thumbs > div + div { border-left: 2px solid var(--paper); }
.pair-thumbs svg { width: 72%; height: 72%; opacity: .82; filter: drop-shadow(0 3px 6px rgba(0,0,0,.2)); }
.pair-vs {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--line-strong);
  display: grid; place-items: center; z-index: 2;
  font-family: var(--font-serif); font-weight: 700; font-style: italic; color: var(--forest);
  box-shadow: var(--shadow-sm);
}
.pair-body { padding: 14px 16px 16px; }
.pair-body h3 { margin: 0 0 4px; font-family: var(--font-serif); font-size: 1.1rem; }
.pair-body p { margin: 0; color: var(--ink-soft); font-size: .92rem; }
.pair-body .quick-tell { color: var(--muted); font-size: .88rem; margin-top: 6px; font-style: italic; }

.compare-hero {
  border-radius: var(--radius-lg); overflow: hidden;
  padding: 20px 22px; color: #fbf8f1;
  background:
    radial-gradient(600px 220px at 90% -20%, rgba(201,169,97,.25), transparent 60%),
    linear-gradient(160deg, #2d5a3d 0%, #3e6b4f 60%, #5a7f5a 100%);
  box-shadow: var(--shadow-md); margin: 6px 0 18px;
}
.compare-hero h1 { color: #fff; margin: 4px 0 2px; }
.compare-hero .sci-pair { font-family: var(--font-serif); font-style: italic; color: #e2c988; }
.compare-hero .context { color: #eee8d6; margin: 10px 0 0; max-width: 720px; }

.compare-pair {
  display: grid; gap: 12px; grid-template-columns: 1fr;
  margin-top: 4px;
}
@media (min-width: 720px) { .compare-pair { grid-template-columns: 1fr 1fr; } }
.compare-pair .side {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.compare-pair .side .thumb { aspect-ratio: 4/3; display: grid; place-items: center; color: rgba(255,255,255,.85); position: relative; }
.compare-pair .side .thumb svg { width: 66%; height: 66%; opacity: .85; filter: drop-shadow(0 4px 8px rgba(0,0,0,.2)); }
.compare-pair .side .thumb .lbl {
  position: absolute; top: 10px; left: 10px;
  background: rgba(0,0,0,.4); color: #fff; padding: 4px 10px;
  border-radius: 999px; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600;
}
.compare-pair .side .txt { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.compare-pair .side .name { font-family: var(--font-serif); font-weight: 600; font-size: 1.15rem; }
.compare-pair .side .sci { font-style: italic; color: var(--muted); font-size: .9rem; }
.compare-pair .side .short { color: var(--ink-soft); font-size: .92rem; }
.compare-pair .side .go { margin-top: auto; padding-top: 10px; }

.feature-table {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); margin-top: 10px;
}
.feature-row {
  display: grid; grid-template-columns: 1fr;
  border-top: 1px solid var(--line);
}
.feature-row:first-child { border-top: 0; }
.feature-row .feature-label {
  padding: 12px 16px; font-weight: 600; color: var(--forest); font-size: .78rem;
  text-transform: uppercase; letter-spacing: .1em;
  background: var(--bg-elev);
}
.feature-row .cell { padding: 12px 16px; }
.feature-row .cell.a { border-top: 1px solid var(--line); }
.feature-row .cell .cell-label {
  display: block; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 4px;
}
@media (min-width: 720px) {
  .feature-row { grid-template-columns: 200px 1fr 1fr; align-items: stretch; }
  .feature-row .feature-label { border-right: 1px solid var(--line); display: flex; align-items: center; }
  .feature-row .cell.a { border-top: 0; border-right: 1px solid var(--line); }
  .feature-row .cell .cell-label { display: none; }
}

/* ============ My Hunts (empty state) ============ */
.hunts-empty {
  text-align: center; padding: 44px 24px;
  background: linear-gradient(160deg, #fdfaf1 0%, #f0e9d2 100%);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg); color: var(--ink-soft);
}
.hunts-empty .emoji { font-size: 2.6rem; margin-bottom: 8px; }
.hunts-empty h2 { margin: 0 0 6px; }
.hunts-empty p { color: var(--muted); max-width: 460px; margin: 0 auto 16px; }
