:root {
  --bg: #F2EFE5; --card: #FBF8F0; --ink: #17251D; --muted: #5F6B63;
  --accent: #245C3A; --highlight: #E8A83A; --accent-2: #A94E2C;
  --line: rgba(23,37,29,.14); --line-strong: rgba(23,37,29,.28);
  --radius: 4px;
  --shadow: 0 1px 2px rgba(23,37,29,.06), 0 12px 32px rgba(23,37,29,.08);
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "DM Sans", system-ui, -apple-system, sans-serif;
  font-family: var(--sans);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.55; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; background: rgba(23,37,29,.07); padding: .1em .35em; border-radius: var(--radius); }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; padding: .9rem 1.4rem; border-bottom: 1px solid var(--line); background: rgba(242,239,229,.92); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; }
.brand img { height: 40px; width: auto; display: block; }
nav { display: flex; gap: .25rem; flex-wrap: wrap; }
nav a { padding: .35rem .8rem; border-radius: 999px; color: var(--ink); font-weight: 500; }
nav a.active { background: var(--accent); color: var(--bg); }
nav a:hover { text-decoration: none; background: rgba(36,92,58,.12); }
nav a.active:hover { background: var(--accent); }
.device-switch select { font: inherit; }

.wrap { width: min(1100px, calc(100% - 2.5rem)); margin: 1.2rem auto 2rem; flex: 1; }
.foot { padding: 1rem 1.4rem; border-top: 1px solid var(--line); text-align: center; }
.center { text-align: center; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
h1 { font-family: var(--serif); font-weight: 500; font-size: 2rem; margin: 0 0 .2rem; line-height: 1.1; }
h2 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; margin: 0 0 .75rem; line-height: 1.15; }
.lede, .muted { color: var(--muted); margin: 0; }
.small { font-size: .85rem; }
.sci { font-family: var(--serif); font-style: italic; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1rem; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; }
.grid-2 > * { min-width: 0; }
.cards-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; }
.stat .n { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; }
.stat .l { color: var(--muted); font-size: .8rem; margin-top: .15rem; }
img.panel { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: start; padding: .5rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(36,92,58,.06); }
td img.thumb { width: 44px; height: 44px; object-fit: contain; display: block; }
.species-cell { line-height: 1.3; }
.species-cell .sci { font-size: .88em; }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .02em; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); white-space: nowrap; }
/* Featured tiers (pi-companion/featured.py): beyond the garden first, then the garden's own. */
.badge.tier-regional_rare { background: var(--ink); border-color: var(--ink); color: var(--highlight); }
.badge.tier-threatened { background: var(--accent-2); border-color: var(--accent-2); color: var(--bg); }
.badge.tier-first_ever { background: var(--highlight); border-color: var(--highlight); }
.badge.tier-first_in_window, .badge.tier-uncommon { background: var(--accent); border-color: var(--accent); color: var(--bg); }

.featured { display: flex; gap: 1rem; align-items: flex-start; margin-top: .75rem; }
.featured img { width: 120px; height: 120px; object-fit: contain; flex: none; }
.featured .name { font-family: var(--serif); font-size: 1.6rem; font-weight: 500; line-height: 1.1; }
.alert { padding: .65rem .9rem; border-radius: var(--radius); background: rgba(232,168,58,.18); border: 1px solid rgba(232,168,58,.6); margin: .75rem 0 0; }
.alert.error { background: rgba(169,78,44,.12); border-color: rgba(169,78,44,.5); color: var(--accent-2); }

.actions { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
label { display: grid; gap: .25rem; font-size: .85rem; color: var(--muted); }
input, select { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: .5rem .6rem; background: var(--card); color: var(--ink); font: inherit; font-size: 1rem; }
input.code { font-family: ui-monospace, Menlo, monospace; font-size: 1.6rem; letter-spacing: .25em; text-transform: uppercase; text-align: center; }
.btn { appearance: none; border: none; background: var(--accent); color: var(--bg); font: inherit; font-weight: 600; padding: .55rem 1.05rem; border-radius: var(--radius); cursor: pointer; }
.btn:hover { filter: brightness(.95); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.big { display: block; text-align: center; font-size: 1.1rem; padding: .85rem 1.2rem; text-decoration: none; }
.get-app { display: grid; gap: .8rem; }
.get-app .btn.secondary { text-align: center; text-decoration: none; }
.store-links { display: inline-flex; flex-wrap: wrap; gap: .5rem; }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }
.btn.danger { background: var(--accent-2); }
.form { max-width: 420px; margin: 3rem auto; }
.form label { margin-bottom: .75rem; }
.form .link { display: block; margin-top: .9rem; text-align: center; }

.cloud { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: .75rem 1rem; padding: 1rem 0; }
.cloud .bird { text-align: center; cursor: pointer; }
.cloud .bird img { display: block; margin: 0 auto; object-fit: contain; }
.cloud .bird .lbl { font-size: .85rem; margin-top: .2rem; }
.cloud .bird .cnt { font-size: .75rem; color: var(--muted); }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; margin-bottom: .4rem; }
.chart .col { flex: 1; display: flex; align-items: flex-end; gap: 1px; height: 100%; min-width: 0; }
.chart .bar { flex: 2; background: var(--accent); border-radius: 2px 2px 0 0; }
.chart .bar.sp { flex: 1; background: var(--highlight); }
.legend { display: flex; justify-content: space-between; }
.tabs { display: flex; gap: .5rem; margin: 1rem 0; flex-wrap: wrap; }
.tabs button { font: inherit; font-size: .85rem; font-weight: 600; padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); cursor: pointer; }
.tabs button.active { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.pref { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-top: 1px solid var(--line); align-items: center; }
.species-hero { display: grid; grid-template-columns: 260px 1fr; gap: 1.5rem; align-items: center; }
.species-hero img { width: 100%; height: auto; }
.pairing-code { font-family: ui-monospace, Menlo, monospace; font-size: 2rem; letter-spacing: .18em; font-weight: 600; color: var(--accent); }

@media (max-width: 860px) {
  .grid-2, .species-hero { grid-template-columns: 1fr; }
  .brand img { height: 32px; }
  .wrap { width: calc(100% - 1.5rem); }
}

.plate { display: flex; flex-direction: column; align-items: center; }
img.plate-img { max-width: 100%; max-height: 82vh; height: auto; display: block; border: 1px solid var(--line); border-radius: 3px; background: #fff; }
.species-cell .badge { margin-top: .2rem; }
.btn.google { width: 100%; display: flex; justify-content: center; gap: .5rem; align-items: center; }
.btn.google .g { font-family: var(--serif); font-weight: 700; color: #4285F4; font-size: 1.1rem; }
.steps { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .6rem; }
.step { display: flex; gap: .9rem; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.step-n { width: 2rem; height: 2rem; border-radius: 999px; display: grid; place-items: center; font-weight: 600; border: 1px solid var(--line-strong); flex: none; }
.step.done .step-n { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.step.now .step-n { background: var(--highlight); border-color: var(--highlight); }
.step.todo { opacity: .7; }
.step-title { font-weight: 600; }

table.kv th { width: 40%; text-transform: none; letter-spacing: 0; font-size: .85rem; }
table.kv td { font-size: .9rem; }

/* Shared stations */
.section-title { margin: 1.5rem 0 .75rem; }
.row-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem 1rem; flex-wrap: wrap; }
.row-head .tabs { margin: 0; }
.tabs a { font-size: .85rem; font-weight: 600; padding: .3rem .8rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink); }
.tabs a:hover { text-decoration: none; background: rgba(36,92,58,.12); }
.tabs a.active { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.badge.shared-badge { vertical-align: middle; font-family: var(--sans); background: var(--highlight); border-color: var(--highlight); }
.link-row { margin-top: .75rem; }
.link-field { flex: 1; min-width: 0; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
label.toggle { display: flex; gap: .6rem; align-items: center; font-size: .95rem; color: var(--ink); margin-top: .75rem; cursor: pointer; }
label.toggle input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.card.empty h2 { margin-bottom: .3rem; }

/* Hebrew (I18N.md): Frank Ruhl Libre and Heebo carry the Hebrew letters; Latin text (scientific
   names, an English name the table lacks, "Bird Board") keeps Fraunces and DM Sans. Hebrew has no
   italic and no capitals: no slanted or letter-spaced Hebrew. */
:root:lang(he) {
  --serif: "Fraunces", "Frank Ruhl Libre", "Iowan Old Style", Georgia, serif;
  --sans: "DM Sans", "Heebo", system-ui, -apple-system, sans-serif;
  font-synthesis-style: none;
}
:lang(he) th, :lang(he) .badge { letter-spacing: 0; }

/* Settings → Language (I18N.md "Choosing a language"): a row with the current language, opening a list. */
.setting-row { display: flex; align-items: center; gap: .75rem; width: 100%; font: inherit; color: var(--ink); background: transparent; border: 0; padding: .2rem 0; margin: 0 0 .5rem; cursor: pointer; text-align: start; border-radius: var(--radius); }
.setting-row:focus-visible, .choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.setting-label { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; line-height: 1.15; flex: 1; }
.setting-value { color: var(--muted); font-weight: 500; }
.setting-chevron { color: var(--muted); font-size: 1.3rem; line-height: 1; transition: transform .15s; }
[dir="rtl"] .setting-chevron { transform: scaleX(-1); }
.setting-row[aria-expanded="true"] .setting-chevron { transform: rotate(90deg); }
.choice-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 .75rem; overflow: hidden; }
.choice { display: flex; align-items: center; justify-content: space-between; gap: 1rem; font: inherit; font-size: 1rem; color: var(--ink); background: transparent; border: 0; border-block-end: 1px solid var(--line); padding: .65rem .9rem; cursor: pointer; text-align: start; }
.choice:last-child { border-block-end: 0; }
.choice:hover { background: rgba(36,92,58,.08); }
.choice[aria-current="true"] { font-weight: 600; }
.choice-check { color: var(--accent); font-weight: 600; min-width: 1em; text-align: end; }
.choice:disabled, .setting-row:disabled { cursor: progress; opacity: .6; }
