/* BioTaxa — Living atlas. Light theme, local assets, rem-based sizes (the SD level scales everything up). */

/* ========== 1. Tokens ========== */
:root {
  color-scheme: light;
  --green: #06715d;
  --green-dark: #056653;
  --ink: #153c38;
  --muted: #496963;
  --line: #cfe7df;
  --paper: #f8fffc;
  --soft: #eefaf5;
  --cream: #ddf6eb;
  --accent: #d4f76a;
  --mint: #c9f4e4;
  --lilac: #ece2ff;
  --apricot: #ffe3cd;
  --sky: #daf3ff;
  --blue: #e2ecff;
  --lime: #effacb;
  --grey: #edf6f3;
  --focus: #1f6fd1;
  --danger: #b3261e;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 16px 36px #243e2812;
  --shadow-sm: 0 4px 14px #123e340d;
  --page: 1280px;
  --gutter: clamp(16px, 4vw, 48px);
  --font:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}
html[data-level='sd'] {
  font-size: 112.5%;
  --radius: 22px;
  --radius-sm: 16px;
}
html[data-level='kuliah'] {
  font-size: 96%;
}

/* ========== 2. Base ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  line-height: 1.6;
}
a {
  color: var(--green);
  text-underline-offset: 3px;
}
a:hover {
  color: var(--green-dark);
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
a {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
main:focus {
  outline: none;
}
h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}
h1,
h2,
h3 {
  overflow-wrap: anywhere;
  line-height: 1.15;
}
h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.9rem);
  letter-spacing: -0.045em;
  font-weight: 780;
  margin-bottom: 0.4em;
}
h2 {
  font-size: clamp(1.45rem, 2.6vw, 2.2rem);
  letter-spacing: -0.035em;
  font-weight: 740;
  margin-bottom: 0.6em;
}
h3 {
  font-size: 1.15rem;
  letter-spacing: -0.015em;
  font-weight: 700;
  margin-bottom: 0.5em;
}
h4 {
  font-size: 1rem;
  margin-bottom: 0.4em;
}
p {
  line-height: 1.7;
}
img {
  max-width: 100%;
}
em {
  font-family: var(--serif);
}
ul,
ol {
  padding-left: 1.3em;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}
th,
td {
  padding: 0.7em 0.8em;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  font-weight: 700;
}
textarea,
input[type='text'],
input[type='search'],
input[type='date'],
input:not([type]),
select {
  width: 100%;
  border: 1px solid #c7d8d0;
  border-radius: var(--radius-sm);
  padding: 0.75em 0.9em;
  background: #fff;
  line-height: 1.5;
}
textarea {
  min-height: 8.5rem;
  resize: vertical;
}
input[type='range'] {
  width: 100%;
  accent-color: var(--green);
  min-height: 2rem;
}
details > summary {
  cursor: pointer;
  color: var(--green-dark);
  font-weight: 650;
}
[hidden] {
  display: none !important;
}
.icon {
  width: 1.3em;
  height: 1.3em;
  flex-shrink: 0;
  vertical-align: -0.25em;
}

/* ========== 3. Utilities ========== */
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.center {
  text-align: center;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.eyebrow,
.overline {
  display: block;
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0.14em;
  font-weight: 760;
  text-transform: uppercase;
  color: var(--green-dark);
  margin-bottom: 0.9rem;
}
.eyebrow.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  border: 1px solid #cce8db;
  border-radius: 99px;
  padding: 0.35em 0.9em;
  background: #fff;
}
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 0.3em;
  flex-shrink: 0;
}
.source-meta {
  display: block;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--muted);
  margin: 0.7rem 0;
}
.list-title {
  font-size: clamp(1.25rem, 2vw, 1.6rem);
  margin: 2rem 0 1rem;
}
.list-title small {
  font-size: 0.75em;
  color: var(--muted);
  font-weight: 500;
}
.notice {
  padding: 1rem 1.2rem;
  background: var(--cream);
  border: 1px solid #cbe6d8;
  border-radius: var(--radius-sm);
  color: #33534a;
  font-size: 0.92rem;
  line-height: 1.7;
  margin: 1.4rem 0;
}
.status {
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 1px dashed #b8d3c7;
  border-radius: var(--radius);
  background: var(--soft);
  margin: 1.5rem 0;
}
.status.inline {
  padding: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
}
.status h3 {
  font-size: 1.25rem;
}
.status p {
  color: var(--muted);
  margin-bottom: 0.8rem;
}
.loading-brand,
.empty-brand {
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  opacity: 0.85;
}
.loading-brand {
  animation: breathe 1.8s ease-in-out infinite;
}
.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid #cde4d8;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* Buttons & controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  min-height: 2.9rem;
  border: 1px solid var(--green);
  border-radius: var(--radius-sm);
  padding: 0.7em 1.2em;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  transition:
    transform 0.15s,
    box-shadow 0.15s,
    background 0.15s;
}
.btn:hover {
  color: #fff;
  background: var(--green-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px #047c6426;
}
.btn.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.btn.secondary:hover {
  background: var(--cream);
  color: var(--ink);
}
.btn.ghost {
  background: transparent;
  color: var(--green);
  border-color: transparent;
}
.btn.ghost:hover {
  background: var(--cream);
  box-shadow: none;
}
.btn.dark {
  background: var(--ink);
  border-color: var(--ink);
}
.btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
}
.btn.small {
  min-height: 2.3rem;
  padding: 0.45em 0.9em;
  font-size: 0.85rem;
}
.btn:disabled {
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}
.btn.speaking {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
}
.icon-button {
  border: 0;
  background: var(--grey);
  color: var(--ink);
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  font-size: 1.3rem;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
  margin: 1.3rem 0;
}
.actions.center {
  justify-content: center;
}
.text-link {
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
  padding: 0.3em 0;
}
.badge {
  display: inline-block;
  background: #e5f5ee;
  color: var(--green);
  padding: 0.3em 0.6em;
  border-radius: 7px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge.warn {
  background: #fff1e0;
  color: #9a4f00;
}
.badge.muted-badge {
  background: var(--grey);
  color: var(--muted);
}
.badge.indo {
  background: #fdecec;
  color: #a4161a;
  text-transform: none;
  letter-spacing: 0;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  background: #edf6f1;
  border: 1px solid #d3e6dc;
  border-radius: 8px;
  padding: 0.35em 0.7em;
  font-size: 0.82rem;
  text-decoration: none;
  color: #2f574d;
}
button.tag {
  cursor: pointer;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0.5em 0.9em;
  border-radius: 99px;
  font-size: 0.85rem;
  text-decoration: none;
  min-height: 2.4rem;
}
.chip:hover {
  border-color: var(--green);
  color: var(--ink);
}
.chip.big {
  border-radius: var(--radius-sm);
  padding: 0.6em 0.9em;
  flex-wrap: wrap;
  text-align: left;
}
.chip.big strong {
  font-weight: 700;
}
.chip.big em,
.chip.big small {
  color: var(--muted);
  font-size: 0.8rem;
}
.chip:disabled {
  opacity: 0.45;
}
.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.3rem;
  border-radius: 14px;
  background: var(--grey);
  margin: 0.5rem 0;
}
.segmented a {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.55em 0.95em;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 650;
}
.segmented a.selected {
  background: #fff;
  color: var(--green);
  box-shadow: var(--shadow-sm);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 650;
}
.inline-field {
  display: flex;
  gap: 0.5rem;
}
.inline-field input {
  flex: 1;
  min-width: 0;
}
.kv {
  display: grid;
  gap: 0.5rem;
  margin: 0.8rem 0;
}
.kv div {
  display: grid;
  grid-template-columns: minmax(7rem, 38%) 1fr;
  gap: 0.8rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--line);
}
.kv dt {
  color: var(--muted);
  font-size: 0.85rem;
}
.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.plain-list {
  list-style: none;
  padding: 0;
}
.plain-list li {
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--line);
}
.source-list {
  line-height: 1.9;
}
.tip-list li {
  margin: 0.4rem 0;
  line-height: 1.6;
}

/* ========== 4. Layout ========== */
.skip {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 60;
  padding: 0.8rem 1rem;
  background: var(--accent);
  color: var(--ink);
  border-radius: 10px;
  font-weight: 700;
}
.skip:focus {
  top: 12px;
}
/* Only the app navigation sticks; semantic page headers scroll normally. */
#header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fffffff2;
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1440px;
  margin: auto;
  padding: 0.7rem var(--gutter);
  display: flex;
  align-items: center;
  gap: 1.2rem;
  min-height: 4.6rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.55rem;
  font-weight: 820;
  letter-spacing: -0.05em;
  flex-shrink: 0;
  line-height: 1;
}
.brand:hover {
  color: var(--ink);
}
.brand-symbol {
  width: 46px;
  height: 46px;
  object-fit: contain;
}
.brand small {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  font-weight: 700;
  color: var(--muted);
  margin-top: 0.3em;
}
.nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: auto;
  min-width: 0;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 680;
  white-space: nowrap;
}
.nav a:hover {
  background: var(--grey);
  color: var(--ink);
}
.nav a.active {
  background: var(--cream);
  color: var(--green);
}
.nav .nav-short {
  display: none;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 99px;
  padding: 0.45rem 0.85rem;
  min-height: 2.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  max-width: 13rem;
}
.mode-chip:hover {
  border-color: var(--green);
}
.mode-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lang {
  display: flex;
  background: var(--grey);
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.lang button {
  border: 0;
  background: none;
  border-radius: 9px;
  min-height: 2.2rem;
  min-width: 2.4rem;
  padding: 0.3rem 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 760;
}
.lang button.active {
  background: var(--ink);
  color: #fff;
}
main {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter) 3rem;
  min-height: 70vh;
}
.net-status,
.update-status {
  position: sticky;
  top: 0;
  z-index: 25;
  margin: 0;
  padding: 0.6rem var(--gutter);
  font-size: 0.9rem;
  text-align: center;
  background: #fff4d6;
  color: #5d4400;
  border-bottom: 1px solid #f0dca0;
}
.update-status {
  background: var(--lime);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}
footer {
  max-width: var(--page);
  margin: 3rem auto 0;
  padding: 2.5rem var(--gutter) 2rem;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-main p {
  margin: 0.9rem 0 0.2rem;
  color: var(--ink);
  font-weight: 650;
}
.footer-note {
  font-size: 0.85rem;
}
.footer-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}
.footer-links a {
  color: var(--ink);
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--green);
  text-decoration: underline;
}
.footer-discover {
  text-align: right;
}
.footer-discover p {
  font-size: 1.5rem;
  font-weight: 760;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.footer-bottom {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  font-size: 0.8rem;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 0.85rem 1.3rem;
  border-radius: 14px;
  z-index: 70;
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  max-width: calc(100vw - 32px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast[data-tone='success'] {
  background: var(--green);
}

/* Page heads & breadcrumbs */
.page-head {
  position: relative;
  padding: 2.8rem 6rem 1.4rem 0;
  isolation: isolate;
}
.page-head h1 {
  max-width: 900px;
}
.page-head p {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.05rem;
}
.page-brand {
  position: absolute;
  right: 0;
  top: 2.6rem;
  width: 80px;
  height: 80px;
  opacity: 0.15;
  transform: rotate(10deg);
  z-index: -1;
}
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1.4rem;
  font-size: 0.88rem;
}
.breadcrumbs a {
  text-decoration: none;
}
.breadcrumbs span {
  color: var(--muted);
}

/* ========== 5. Cards ========== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.2rem;
}
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}
a.card {
  display: block;
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
a.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  color: inherit;
}
.discovery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.2rem;
}
.featured-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.discovery-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.discovery-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.discovery-link {
  display: block;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
.discovery-link:hover {
  color: inherit;
}
.media-frame {
  position: relative;
  overflow: hidden;
  background: #e9f2ee;
  aspect-ratio: 4 / 3;
}
.media-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.discovery-card:hover .media-frame img {
  transform: scale(1.04);
}
.photo-credit {
  position: absolute;
  z-index: 2;
  left: 6px;
  right: 6px;
  bottom: 6px;
  background: #062319b8;
  color: #fff;
  font-size: 0.7rem;
  line-height: 1.5;
  padding: 0.15em 0.5em;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-badge {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 2;
  background: #fffffff0;
  color: var(--ink);
  border-radius: 8px;
  padding: 0.3em 0.6em;
  font-size: 0.78rem;
  font-weight: 700;
}
.media-badge.endemic {
  background: #fff;
  color: #a4161a;
}
.image-license {
  position: absolute;
  right: 0.9rem;
  bottom: 0.6rem;
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
}
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 100%;
  padding: 1.2rem;
  text-align: center;
}
.photo-placeholder > span {
  font-size: 2.6rem;
}
.photo-placeholder small {
  color: var(--muted);
  font-size: 0.8rem;
}
.image-error-text {
  display: none;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.image-unavailable {
  display: grid;
  place-items: center;
}
.image-unavailable .image-error-text {
  display: block;
}
.image-unavailable .photo-credit {
  display: none;
}
.discovery-body {
  padding: 1rem 1.1rem 2rem;
}
.discovery-body h3 {
  font-size: 1.08rem;
  margin-bottom: 0.25rem;
}
.latin {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0;
  overflow-wrap: anywhere;
}
.discovery-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.8rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.card-fact {
  font-size: 0.88rem;
  color: #35524a;
  margin: 0.6rem 0 0;
  line-height: 1.55;
}
.taxon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.taxon-card {
  position: relative;
  display: flex !important;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 150px;
  overflow-wrap: anywhere;
}
.taxon-card h3 {
  font-size: 1.2rem;
  margin: 0.4rem 0 0.1rem;
}
.taxon-card h3.sci,
.taxon-card:not(.group-card) h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.35rem;
}
.taxon-card.has-photo {
  padding-top: 0;
  overflow: hidden;
}
.index-photo {
  margin: 0 -1.5rem 0.8rem;
  width: calc(100% + 3rem);
  aspect-ratio: 16 / 9;
}
.card-sub {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}
.card-sub.strong {
  color: var(--ink);
  font-weight: 650;
}
.card-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.8rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}
.group-card-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.group-icon {
  font-size: 1.6rem;
  line-height: 1;
}
.group-card.curated {
  border-color: #bfe3d1;
}
.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}
.action-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.2rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
.action-card strong {
  display: block;
  font-size: 1.05rem;
}
.action-card small {
  display: block;
  color: #3f5a55;
  font-size: 0.88rem;
  line-height: 1.5;
  margin-top: 0.2rem;
}
.action-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  background: #ffffffb0;
  color: var(--green);
  flex-shrink: 0;
}
.action-icon .icon {
  width: 1.6rem;
  height: 1.6rem;
}
.tone-mint {
  background: var(--mint);
}
.tone-lime {
  background: var(--lime);
}
.tone-lilac {
  background: var(--lilac);
}
.tone-sky {
  background: var(--sky);
}
.tone-apricot {
  background: var(--apricot);
}
.tone-blue {
  background: var(--blue);
}
.tone-grey {
  background: var(--grey);
}
.feature-card {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.5rem;
  border-radius: var(--radius);
  background: linear-gradient(120deg, var(--lime), var(--mint));
  text-decoration: none;
  color: var(--ink);
  flex-wrap: wrap;
}
.feature-card > span:nth-child(2) {
  flex: 1;
  min-width: 200px;
}
.feature-card strong {
  display: block;
  font-size: 1.3rem;
}
.feature-card small {
  color: #3f5a55;
}
.feature-emoji {
  font-size: 3rem;
}
.done {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--green-dark);
  font-weight: 700;
  margin-top: 0.3rem;
}

/* Domains */
.domains-section {
  border-radius: 28px;
  background: var(--soft);
  padding: 2.5rem clamp(1rem, 3vw, 2rem);
}
.domain-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.domain-card {
  position: relative;
  overflow: hidden;
  border: 0;
  background: var(--mint);
  min-height: 300px;
  display: flex !important;
  flex-direction: column;
}
.domain-card:nth-child(2) {
  background: var(--lilac);
}
.domain-card:nth-child(3) {
  background: var(--apricot);
}
.domain-card .eyebrow {
  color: var(--ink);
}
.domain-card h3 {
  font-size: 1.8rem;
  margin: 1rem 0 0.5rem;
}
.domain-card p {
  color: #3e5960;
  font-size: 0.95rem;
}
.domain-card .card-link {
  border-top: 1px solid #112d381c;
}
.domain-art {
  position: relative;
  height: 88px;
}
.domain-art > span::after {
  content: attr(data-n);
}
.domain-art > span {
  position: absolute;
  right: 0;
  top: 0;
  font-size: 4rem;
  font-weight: 800;
  color: #112d3812;
  line-height: 1;
}
.domain-art i {
  position: absolute;
  left: 6px;
  top: 4px;
  width: 78px;
  height: 78px;
  background: #047c6419;
  border: 2px solid var(--green);
  border-radius: 50% 45% 55% 48%;
}
.domain-art i:nth-child(2) {
  width: 42px;
  height: 42px;
  top: 22px;
  left: 24px;
  background: var(--green);
  border: 8px solid #a7e5bf;
}
.domain-art i:nth-child(3) {
  width: 13px;
  height: 13px;
  left: 82px;
  top: 62px;
  background: #8cc664;
  border: 0;
}
.domain-art-1 i {
  border-radius: 45px;
  width: 88px;
  height: 45px;
  top: 24px;
  border-color: #7258b4;
  background: #b8a1e144;
}
.domain-art-1 i:nth-child(2) {
  width: 10px;
  height: 10px;
  left: 30px;
  top: 40px;
  background: #7258b4;
  border: 0;
}
.domain-art-1 i:nth-child(3) {
  left: 60px;
  top: 46px;
  width: 10px;
  height: 10px;
  background: #7258b4;
}
.domain-art-2 i {
  border-radius: 35% 55% 40% 60%;
  border-color: #c96637;
  background: #fac5a4;
}
.domain-art-2 i:nth-child(2) {
  background: #c96637;
  border-color: var(--apricot);
}
.domain-art-2 i:nth-child(3) {
  background: #c96637;
}

/* ========== 6. Home ========== */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 3.5rem 0 3rem;
}
.hero::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0 calc(-1 * var(--gutter));
  background:
    radial-gradient(ellipse at 85% 20%, #c9f5dd 0, transparent 65%),
    linear-gradient(115deg, #f8fffc 25%, #e8fbf2);
}
.hero-copy h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 5.4vw, 4.6rem);
  letter-spacing: -0.055em;
  line-height: 1.02;
}
.hero-copy h1 em {
  font-style: normal;
  font-family: inherit;
  color: var(--green);
}
.hero-copy > p {
  color: var(--muted);
  font-size: 1.08rem;
  max-width: 34rem;
}
.hero-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 34rem;
  margin-top: 1.4rem;
  padding: 0.45rem 0.45rem 0.45rem 0.9rem;
  background: #fff;
  border: 1px solid #b9d6cb;
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.hero-search > span {
  color: var(--green);
}
.hero-search .suggest {
  flex: 1;
}
.hero-search input {
  border: 0;
  padding: 0.7rem 0.3rem;
  background: none;
}
.hero-search input:focus-visible {
  outline: none;
}
.hero-search:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.hero-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-top: 1.4rem;
}
.hero-footnote {
  margin-top: 1.2rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.hero-mosaic {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  grid-template-rows: 220px 220px;
  gap: 0.9rem;
  padding: 0.6rem;
  transform: none;
}
.atlas-grid {
  position: absolute;
  inset: -14px;
  z-index: -1;
  background-image: radial-gradient(#8fb9a7 1px, transparent 1px);
  background-size: 16px 16px;
  opacity: 0.35;
  border-radius: 28px;
}
.hero-photo {
  position: relative;
  display: block;
  overflow: hidden;
  border: 5px solid #fff;
  border-radius: 22px;
  background: #dcefe8;
  box-shadow: 0 10px 25px #14372b1a;
  color: #fff;
  text-decoration: none;
}
.hero-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.hero-photo:hover img {
  transform: scale(1.05);
}
.hero-photo::after {
  content: '';
  position: absolute;
  inset: 40% 0 0;
  background: linear-gradient(transparent, #062319cc);
  pointer-events: none;
}
.hero-primary {
  grid-column: 1;
  grid-row: 1 / 3;
  border-radius: 100px 24px 24px 24px;
}
.hero-secondary {
  transform: none;
}
.hero-tertiary {
  transform: none;
}
.hero-photo-caption {
  position: absolute;
  z-index: 1;
  left: 1rem;
  right: 0.8rem;
  bottom: 1.9rem;
}
.hero-photo-caption strong {
  display: block;
  font-size: 1.25rem;
}
.hero-primary .hero-photo-caption strong {
  font-size: 1.7rem;
}
.hero-photo-caption em {
  display: block;
  font-size: 0.85rem;
  opacity: 0.9;
}
.explorer-seal {
  position: absolute;
  right: 34%;
  top: 11rem;
  z-index: 3;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--accent);
  border: 5px solid #fff;
  border-radius: 50%;
  transform: rotate(10deg);
  box-shadow: var(--shadow-sm);
}
.explorer-seal img {
  width: 40px;
  height: 52px;
}
.explorer-seal span {
  font-size: 0.6rem;
  line-height: 1.4;
  font-weight: 850;
  color: var(--ink);
}
.mode-strip {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 1.5rem;
  align-items: center;
  margin: 1rem 0 2rem;
  padding: 1.6rem;
  border-radius: 24px;
  background: var(--cream);
  border: 1px solid var(--line);
}
.mode-strip h2 {
  margin-bottom: 0.3rem;
}
.mode-strip p {
  color: var(--muted);
  margin: 0;
}
.mode-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.7rem;
}
.mode-options.compact {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
}
.mode-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  background: #fff;
  text-align: left;
  color: var(--ink);
  min-height: 3.4rem;
}
.mode-option:hover {
  border-color: var(--green);
}
.mode-option.selected {
  border-color: var(--green);
  background: var(--cream);
}
.mode-option small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}
.mode-icon {
  font-size: 1.6rem;
  line-height: 1;
}
.today-card {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1.8rem;
  align-items: center;
  margin: 1.5rem 0;
  padding: 1.2rem;
  border-radius: 26px;
  background: var(--soft);
  border: 1px solid var(--line);
}
.today-card > .status {
  grid-column: 1 / -1;
  margin: 0;
  border: 0;
}
.today-photo {
  border-radius: 20px;
  aspect-ratio: 4 / 3;
}
.today-body h2 {
  margin-bottom: 0.1rem;
}
.today-text p {
  margin-bottom: 0.6rem;
}
.fun-fact {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--accent);
}
.teacher-banner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  align-items: center;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  border-radius: 28px;
  background: var(--blue);
  margin: 2.5rem 0;
}
.teacher-banner p {
  color: var(--muted);
}
.teacher-art {
  display: grid;
  place-items: center;
  color: #315d8e;
}
.teacher-art .icon {
  width: 7rem;
  height: 7rem;
  stroke-width: 1;
}
.section {
  padding: 2.4rem 0;
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.4rem;
  flex-wrap: wrap;
}
.section-head h2 {
  margin: 0;
  max-width: 640px;
}
.section-head p {
  color: var(--muted);
  max-width: 460px;
  margin: 0.6rem 0 0;
}
.discovery-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.discovery-strip > span {
  color: var(--muted);
  max-width: 14rem;
}
.discovery-strip strong {
  font-size: 1.1rem;
  color: #4f6a6e;
}

/* ========== 7. Explore & search ========== */
.explore-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.6rem 0 1.4rem;
}
.explore-heading p {
  color: var(--muted);
  max-width: 640px;
}
.explore-stamp {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  background: var(--accent);
  border-radius: 26px;
  transform: rotate(12deg);
}
.explore-stamp img {
  width: 66px;
  height: 66px;
}
.search-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem;
  background: #fff;
  border: 1px solid #b7d3c9;
  border-radius: 16px;
  box-shadow: 0 6px 0 #eaf3ed;
}
.search-form:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.search-symbol {
  padding-left: 0.6rem;
  color: var(--green);
}
.search-form .suggest {
  flex: 1;
  min-width: 0;
}
.search-form input {
  border: 0;
  padding: 0.75rem 0.4rem;
  background: transparent;
}
.search-form input:focus-visible {
  outline: none;
}
.search-form select {
  width: auto;
  max-width: 11rem;
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  color: var(--muted);
}
.suggest {
  position: relative;
}
.suggest-list {
  position: absolute;
  z-index: 30;
  left: -0.5rem;
  right: -0.5rem;
  top: calc(100% + 0.6rem);
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  max-height: 60vh;
  overflow-y: auto;
  min-width: 260px;
}
.suggest-list [role='option'] {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  cursor: pointer;
}
.suggest-list [role='option']:hover,
.suggest-list [aria-selected='true'] {
  background: var(--cream);
}
.suggest-list img,
.suggest-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--grey);
  color: var(--green);
}
.suggest-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.suggest-text strong,
.suggest-text em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggest-text em {
  font-size: 0.82rem;
  color: var(--muted);
}
.suggest-rank {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}
.suggest-rank.is-group {
  color: var(--green);
  font-weight: 700;
}
.suggest-empty {
  padding: 0.7rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.group-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.2rem 0;
}
.group-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  min-height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 620;
}
.group-pill:hover {
  border-color: var(--green);
  color: var(--ink);
}
.group-pill.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.catalog-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}
.live-label {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.filter-chip-row {
  margin: 1rem 0 0;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.5rem 0.4rem 0.9rem;
  border-radius: 99px;
  background: var(--cream);
  font-size: 0.9rem;
}
.filter-chip a {
  display: inline-grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: #fff;
  text-decoration: none;
  font-size: 1.1rem;
}
.matched-groups {
  margin-top: 1.4rem;
  padding: 1.2rem;
  border-radius: var(--radius);
  background: var(--lime);
}
.matched-groups h2 {
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
}
.result-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1.4rem 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.result-head strong {
  font-size: 1.2rem;
  color: var(--ink);
}
.catalog-footnote {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  max-width: 760px;
  margin: 1.5rem auto;
}
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 2rem 0;
  font-size: 0.9rem;
}

/* ========== 8. Tree ========== */
.rank-ladder {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 1rem;
}
.rank-ladder li {
  position: relative;
  padding: 0.35rem 0.7rem;
  border-radius: 99px;
  background: var(--grey);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}
.rank-ladder li.done {
  background: var(--mint);
  color: var(--green-dark);
}
.rank-ladder li.here {
  background: var(--ink);
  color: #fff;
}
.rank-ladder small {
  margin-left: 0.4em;
  color: var(--accent);
  font-weight: 700;
}
.more-groups {
  margin: 1.5rem 0;
  padding: 1rem 1.2rem;
  border: 1px dashed #b8d3c7;
  border-radius: var(--radius);
}
.more-groups[open] summary {
  margin-bottom: 0.6rem;
}
.shortcuts {
  margin: 0.5rem 0 1rem;
}

/* ========== 9. Species ========== */
.detail-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1.2rem 0;
  font-size: 0.88rem;
  color: var(--muted);
}
.detail-topbar a {
  text-decoration: none;
  font-weight: 650;
}
.species-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
  padding-bottom: 1.8rem;
}
.gallery-stage {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 6 / 5;
  padding: 0;
  border: 0;
  border-radius: 24px;
  overflow: hidden;
  background: #edf5f0;
}
.gallery-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.gallery-stage:hover img {
  transform: scale(1.02);
}
.gallery-stage:disabled {
  opacity: 1;
}
.gallery-stage .photo-credit {
  right: 3.2rem;
  bottom: 0.7rem;
  left: 0.7rem;
  text-align: left;
  white-space: normal;
}
.enlarge-icon {
  position: absolute;
  right: 0.7rem;
  bottom: 0.7rem;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 10px;
  background: var(--accent);
  color: var(--ink);
  font-size: 1.4rem;
}
.photo-strip {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.7rem;
}
.photo-strip button {
  flex: 1;
  min-width: 0;
  height: 4.4rem;
  padding: 0;
  border: 0;
  border-radius: 11px;
  overflow: hidden;
  background: var(--cream);
}
.photo-strip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-strip .more-photos {
  max-width: 5rem;
  background: var(--accent);
  font-size: 1.1rem;
  font-weight: 750;
}
.more-photos small {
  display: block;
  font-size: 0.75rem;
}
.species-intro h1 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  font-size: clamp(2.1rem, 4.2vw, 3.5rem);
}
.species-intro h1.common-first {
  font-family: var(--font);
  font-style: normal;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.sci-title {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--muted);
}
.common-title {
  font-size: 1.3rem;
  color: var(--muted);
  font-weight: 550;
}
.endemic-badge {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border-radius: 99px;
  background: #fdecec;
  color: #a4161a;
  font-weight: 700;
  font-size: 0.9rem;
}
.names {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin: 1.2rem 0;
}
.names div {
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}
.names dt {
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.names dd {
  margin: 0;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
.specimen-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1rem 0;
}
.status-tag.tone-red,
.status-explain.tone-red {
  background: #fdecea;
  border-color: #f6c8c3;
  color: #9b1c14;
}
.status-tag.tone-orange,
.status-explain.tone-orange {
  background: #fff1e0;
  border-color: #f5d4ad;
  color: #8a4200;
}
.status-tag.tone-yellow,
.status-explain.tone-yellow {
  background: #fff8d6;
  border-color: #efe09a;
  color: #6b5400;
}
.status-tag.tone-lime,
.status-explain.tone-lime,
.status-tag.tone-green,
.status-explain.tone-green {
  background: #e8f5e9;
  border-color: #c3e2c6;
  color: #1f6a28;
}
.status-tag.tone-grey,
.status-explain.tone-grey,
.status-tag.tone-black,
.status-explain.tone-black {
  background: #eceff1;
  border-color: #cfd8dc;
  color: #263238;
}
.status-explain {
  border: 1px solid;
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.9rem;
  font-size: 0.92rem;
}
.dossier-tabs {
  position: sticky;
  top: 4.7rem;
  z-index: 10;
  display: flex;
  gap: 0.4rem;
  padding: 0.35rem;
  background: #eaf0e6f2;
  backdrop-filter: blur(8px);
  border-radius: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.dossier-tabs button {
  border: 0;
  border-radius: 11px;
  background: transparent;
  padding: 0.75rem 1.1rem;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 680;
  white-space: nowrap;
  min-height: 2.8rem;
}
.dossier-tabs button[aria-selected='true'] {
  background: #fff;
  color: var(--green);
  box-shadow: var(--shadow-sm);
}
.inline-status {
  font-size: 0.88rem;
  color: var(--muted);
  padding: 0.8rem 0;
}
.dossier-panel {
  padding: 1.6rem 0;
}
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2.5rem;
}
.curated-block {
  padding: 1.5rem;
  margin-bottom: 1.6rem;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--lime), #fff 70%);
  border: 1px solid #e3efbd;
}
.curated-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.curated-head .eyebrow {
  margin: 0;
  font-size: 0.9rem;
}
.lead {
  font-size: 1.15rem;
  line-height: 1.7;
}
.fact-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}
.fact {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
}
.fact dt {
  font-size: 0.8rem;
  font-weight: 750;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.fact dd {
  margin: 0.2rem 0 0;
}
.fact dd p,
.fun-fact-box p {
  margin: 0;
}
.fun-fact-box {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  background: #fff;
  border-left: 5px solid var(--accent);
}
.fun-fact-box strong {
  display: block;
  margin-bottom: 0.2rem;
}
.prose {
  white-space: pre-line;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.prose-list li {
  margin: 0.35rem 0;
  line-height: 1.7;
}
.wiki-text {
  font-size: 1.05rem;
}
.overview-card h2 {
  font-size: 1.6rem;
}
.source-text {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}
.source-text:last-child {
  border-bottom: 0;
}
.taxonomy-aside {
  align-self: start;
  background: var(--cream);
  border: 1px solid #d2e7da;
  border-radius: 20px;
  padding: 1.3rem;
  position: sticky;
  top: 9rem;
}
.taxonomy-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.taxonomy-list li {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.55rem 0;
  border-bottom: 1px solid #cfe3d6;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}
.taxonomy-list li > span {
  color: var(--muted);
  font-size: 0.8rem;
}
.taxonomy-list a {
  text-decoration: none;
  font-weight: 650;
}
.taxonomy-list small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}
.overview-invites {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin: 1.6rem 0;
}
.invitation {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  text-align: left;
  color: var(--ink);
}
.invitation:hover {
  border-color: var(--green);
}
.invitation .icon {
  color: var(--green);
  width: 1.8rem;
  height: 1.8rem;
}
.invitation h3 {
  font-size: 1rem;
  margin: 0 0 0.15rem;
}
.invitation p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}
.source-disclosure {
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  margin: 1.2rem 0;
  font-size: 0.92rem;
}
.trait-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
.missing-data {
  padding: 1.3rem;
  background: var(--grey);
  border-radius: var(--radius);
  margin: 1.2rem 0;
}
.missing-data p {
  color: var(--muted);
}
.conservation-card {
  margin-bottom: 1.2rem;
}
.occurrence-map {
  border: 1px solid #cddfd6;
  border-radius: 20px;
  overflow: hidden;
  isolation: isolate;
  min-height: 460px;
  background: #fff;
}
.map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}
.map-caption {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--green);
  font-weight: 750;
}
.map-toolbar > div {
  display: flex;
  gap: 0.4rem;
}
.map-toolbar button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 0.85rem;
  padding: 0.45rem 0.7rem;
  min-height: 2.3rem;
}
.geo-map {
  height: 430px;
  background: #edf5f7 !important;
  z-index: 1;
}
.map-status {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
  padding: 0.9rem 1rem 0;
}
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0.6rem 1rem 1rem;
}
.map-legend span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  border: 1px solid #fff;
}
.land-key {
  display: inline-block;
  width: 14px;
  height: 10px;
  border: 1px solid #aabaad;
  background: #e5eade;
}
.continent-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: #6b8a83;
  text-shadow: 0 1px 2px #fff;
  white-space: nowrap;
  pointer-events: none;
}
.leaflet-control-layers-toggle {
  background-image: none !important;
  display: grid !important;
  place-items: center;
}
.leaflet-control-layers-toggle::after {
  content: '▱';
  font-size: 1.5rem;
  color: var(--green);
}
.leaflet-control-layers,
.leaflet-popup-content {
  font-size: 0.85rem !important;
  line-height: 1.6;
}
.leaflet-control-attribution {
  font-size: 0.7rem !important;
}
.leaflet-container a {
  color: var(--green);
}
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.2rem;
}
.photo-gallery figure {
  margin: 0;
}
.photo-gallery .gallery-stage {
  aspect-ratio: 1;
  border-radius: 16px;
}
.photo-gallery figcaption {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.6rem 0.2rem;
}
.photo-dialog,
.sheet-dialog {
  border: 0;
  border-radius: 22px;
  padding: 1.2rem;
  background: #fff;
  box-shadow: var(--shadow);
}
.photo-dialog {
  width: min(1050px, 94vw);
  max-height: 94vh;
}
.photo-dialog::backdrop,
.sheet-dialog::backdrop {
  background: #172a25b8;
  backdrop-filter: blur(4px);
}
.photo-dialog img {
  display: block;
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 12px;
}
.photo-dialog p {
  font-size: 0.85rem;
  margin: 0.8rem 3rem 0 0;
}
.dialog-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: #fff;
  font-size: 1.6rem;
}
.sheet-dialog {
  width: min(720px, 94vw);
  max-height: calc(100dvh - 2rem);
  padding: clamp(1.2rem, 4vw, 2rem);
  overscroll-behavior: contain;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.sheet-head h2 {
  margin: 0;
}
.teacher-level {
  margin-top: 1rem;
  max-width: 24rem;
}
.worksheet {
  position: relative;
  background: #f7faec;
  border: 1px solid #e3e9c9;
  border-radius: 22px;
  padding: clamp(1.2rem, 3vw, 2rem);
  margin: 1.8rem 0;
}
.worksheet li {
  padding: 0.25rem 0;
  line-height: 1.7;
}
.worksheet label {
  display: block;
  font-weight: 700;
  margin: 1rem 0 0.5rem;
}
.worksheet small {
  display: block;
  margin-top: 0.4rem;
  color: var(--muted);
}
.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
.citations li {
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 0.5rem 0;
  overflow-wrap: anywhere;
}

/* Glossary term popover */
.term {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline dotted var(--green) 2px;
  text-underline-offset: 3px;
  cursor: help;
}
.term:hover {
  color: var(--green);
}
.term-pop {
  position: absolute;
  z-index: 50;
  padding: 1rem 1.1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  font-size: 0.95rem;
}
.term-pop-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
}
.term-pop p {
  margin-bottom: 0.6rem;
  line-height: 1.6;
}
.term-adv {
  font-size: 0.88rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 0.5rem;
}

/* ========== 10. Learn ========== */
.mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--grey);
}
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.topic-card {
  display: flex;
  gap: 1rem;
  padding: 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.topic-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  border-color: #bfe3d1;
}
.topic-icon {
  font-size: 2rem;
  line-height: 1;
}
.topic-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.topic-text strong {
  display: block;
  font-size: 1.05rem;
}
.topic-text small {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-top: 0.2rem;
}
.topic-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
  align-items: center;
}
.level-dot {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15em 0.55em;
  border-radius: 99px;
  background: var(--grey);
  color: var(--muted);
}
.level-dot.current {
  background: var(--ink);
  color: #fff;
}
.topic-head {
  padding-right: 0;
}
.topic-hero-icon {
  display: block;
  font-size: 3rem;
  margin-bottom: 0.4rem;
}
.version-switch {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.version-switch a {
  padding: 0.35rem 0.8rem;
  border-radius: 99px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
  font-weight: 650;
}
.version-switch a.selected {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.topic-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 2rem;
  align-items: start;
}
.topic-body {
  font-size: 1.06rem;
}
.topic-body .prose {
  white-space: normal;
}
.topic-tools {
  display: flex;
  justify-content: flex-end;
}
.topic-side {
  display: grid;
  gap: 1rem;
}
.activity-card {
  background: var(--sky);
  border-color: #cfe4f4;
}
.activity-card h2 {
  font-size: 1.15rem;
}
.teacher-notes {
  margin: 2rem 0;
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius);
  background: var(--blue);
  border: 1px solid #d3def3;
}
.teacher-notes summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
}
.teacher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem 2rem;
  margin-top: 1rem;
}
.teacher-grid .wide {
  grid-column: 1 / -1;
}
.teacher-grid h3 {
  font-size: 1rem;
  margin-bottom: 0.3rem;
}
.answer-key li {
  margin: 0.3rem 0;
}
.topic-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem 0;
}

/* ========== 11. Quiz ========== */
.quiz {
  display: grid;
  gap: 1rem;
}
.quiz-q {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  margin: 0;
  background: #fff;
}
.quiz-q legend {
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0 0.3rem;
  line-height: 1.5;
}
.quiz-num {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.quiz-options {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.8rem;
}
.quiz-options.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.quiz-option {
  text-align: left;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  background: #fff;
  font-size: 1rem;
  min-height: 3rem;
  line-height: 1.4;
}
.quiz-option:hover:not(:disabled) {
  border-color: var(--green);
  background: var(--cream);
}
.quiz-option.right {
  border-color: #2e7d32;
  background: #e8f5e9;
  color: #1b5e20;
}
.quiz-option.wrong {
  border-color: var(--danger);
  background: #fdecea;
  color: #8c1d18;
}
.quiz-option:disabled {
  cursor: default;
}
.quiz-feedback {
  font-weight: 700;
  margin: 0.7rem 0 0;
}
.quiz-why {
  color: var(--muted);
  margin: 0.3rem 0 0;
}
.quiz-result {
  padding: 1.2rem;
  border-radius: var(--radius);
  background: var(--lime);
  text-align: center;
}
.quiz-result strong {
  font-size: 1.4rem;
}
.quiz-result.big strong {
  font-size: 1.8rem;
}
.photo-game {
  max-width: 760px;
  margin: 0 auto;
}
.game-photo {
  border-radius: 18px;
  aspect-ratio: 4 / 3;
  margin: 0.5rem 0 1rem;
}
.game-feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--soft);
}
.missed {
  text-align: left;
  display: inline-block;
}
.quick-quiz {
  margin-bottom: 1.4rem;
}
.quick-quiz .quiz-q {
  border: 0;
  padding: 0.6rem 0;
}

/* ========== 12. Laboratory ========== */
.lab-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.4rem;
}
.lab-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 680;
  min-height: 2.9rem;
}
.lab-tabs button.recommended {
  border-color: #bfe3d1;
}
.lab-tabs button.active {
  background: var(--ink);
  color: var(--accent);
  border-color: var(--ink);
}
.lab-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.3rem;
}
.lab-card {
  background: var(--soft);
  border-color: var(--line);
}
.control {
  margin: 1.1rem 0;
}
.control label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
}
.control output {
  font-weight: 750;
  color: var(--green);
}
.lab-result {
  display: grid;
  place-content: center;
  gap: 0.4rem;
  min-height: 170px;
  padding: 1.5rem;
  text-align: center;
  border-radius: 18px;
  background: #e6f7ec;
  border: 1px solid #cde9dc;
}
.lab-result strong {
  font-size: 2.8rem;
  letter-spacing: -0.04em;
  color: var(--green);
  line-height: 1.1;
}
.lab-headline {
  font-size: 1.05rem;
  font-weight: 700;
}
.lab-note {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.8rem;
}
.lab-note.ok {
  color: #1f6a28;
  font-weight: 700;
}
.lab-note.bad {
  color: #8a4200;
  font-weight: 700;
}
.bar-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr 5rem;
  gap: 0.6rem;
  align-items: center;
  margin: 0.9rem 0;
  font-size: 0.9rem;
}
.bar-track {
  height: 1.4rem;
  background: #dce9e2;
  border-radius: 7px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  min-width: 2px;
  background: var(--green);
}
.bar-fill.alt {
  background: #9aa9ad;
}
.cell {
  display: grid;
  place-content: center;
  width: 110px;
  height: 110px;
  margin: 0 auto 0.8rem;
  border: 5px double var(--green);
  border-radius: 45%;
  background: #c6f2d9;
  font-size: 1.4rem;
  transition: transform 0.35s;
}
.photo-result {
  grid-template-columns: auto 1fr;
  align-items: center;
  place-content: stretch;
  text-align: left;
  gap: 1.2rem;
}
.photo-result span {
  display: block;
  color: var(--muted);
}
.beaker {
  position: relative;
  width: 110px;
  height: 140px;
  border: 3px solid #9bc3dd;
  border-top: 0;
  border-radius: 0 0 22px 22px;
  background: linear-gradient(#e7f6ff 20%, #cfeaff);
  overflow: hidden;
}
.beaker .plant {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.6rem;
}
.beaker i {
  position: absolute;
  bottom: 40px;
  left: var(--x);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid #6aa7cf;
  background: #ffffffb0;
  animation: rise 2.2s ease-in infinite;
  animation-delay: calc(var(--i) * 0.18s);
}
.food-game {
  margin: 1.5rem 0;
  padding: 1.3rem;
  border-radius: var(--radius);
  background: var(--lime);
}
.chain-slots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 1rem 0;
}
.chain-slot {
  min-width: 6.5rem;
  min-height: 2.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.7rem;
  border-radius: 12px;
  border: 2px dashed #b9cf86;
  background: #ffffffa0;
  font-weight: 700;
}
.chain-slot.filled {
  border-style: solid;
  border-color: var(--green);
  background: #fff;
}
.chain-arrow {
  color: var(--green);
  font-weight: 800;
}
.chain-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.parents {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}
.parents .field {
  flex: 1;
  min-width: 8rem;
}
.cross {
  font-size: 1.6rem;
  font-weight: 800;
  padding-bottom: 0.5rem;
}
.punnett {
  width: auto;
  margin: 1rem auto;
  font-size: 1.05rem;
}
.punnett th,
.punnett td {
  text-align: center;
  border: 1px solid var(--line);
  padding: 0.7rem 1rem;
}
.punnett thead th,
.punnett tbody th {
  background: var(--grey);
}
.punnett td {
  background: #fff;
  font-weight: 700;
}
.env-choice {
  border: 0;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.5rem;
}
.env-choice legend {
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.radio-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
}
.radio-card.selected {
  border-color: var(--green);
}
.bark {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 8px;
  flex-shrink: 0;
}
.bark-clean {
  background: repeating-linear-gradient(35deg, #d8dccb 0 6px, #c5cdb3 6px 12px);
}
.bark-polluted {
  background: repeating-linear-gradient(35deg, #3a3d3f 0 6px, #2b2d2e 6px 12px);
}
.moth-field {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  padding: 0.8rem;
  border-radius: 14px;
}
.moth-field i {
  aspect-ratio: 1.6;
  border-radius: 50% 50% 40% 40%;
}
.moth-field i.dark {
  background: #1b1d1e;
  box-shadow: 0 0 0 1px #ffffff40;
}
.moth-field i.light {
  background: #eceee5;
  box-shadow: 0 0 0 1px #00000026;
}
.selection-chart {
  width: 100%;
  max-width: 420px;
  display: block;
  margin: 0.6rem auto;
}
.selection-chart .axis {
  stroke: #9aa9ad;
  stroke-width: 1;
}
.selection-chart .tick {
  font-size: 9px;
  fill: var(--muted);
}
.selection-chart .line {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.5;
}
.selection-chart .dot {
  fill: var(--green);
}
.scale-now {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.8rem;
}
.scale-now strong {
  font-size: 2.2rem;
  color: var(--green);
}
.tool-eye {
  color: #1f6a28;
}
.tool-light {
  color: #1f5f99;
}
.tool-electron {
  color: #7b3fa1;
}
.scale-ruler {
  position: relative;
  height: 4.2rem;
  margin: 1rem 0;
}
.scale-bands {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0.7rem;
  display: flex;
  border-radius: 99px;
  overflow: hidden;
}
.band.electron {
  background: #d7c3e6;
}
.band.light {
  background: #bcd9f2;
}
.band.eye {
  flex: 1;
  background: #c4e6c7;
}
.scale-mark {
  position: absolute;
  bottom: 1rem;
  transform: translateX(-50%);
  font-size: 1.05rem;
}
.scale-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--ink);
  border-radius: 2px;
  transform: translateX(-50%);
}
.scale-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.scale-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: #fff;
}
.scale-list small {
  margin-left: auto;
  color: var(--muted);
}

/* ========== 13. Compare, nearby, prehistoric, glossary ========== */
.compare-pickers {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: end;
  padding: 1.2rem;
  border-radius: var(--radius);
  background: var(--soft);
  border: 1px solid var(--line);
}
.compare-slot label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.versus {
  font-weight: 850;
  font-size: 1.2rem;
  color: var(--green);
  padding-bottom: 0.7rem;
}
.compare-summary {
  margin: 1.4rem 0;
}
.shared-line {
  font-size: 1.15rem;
}
.compare-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.compare-table th:first-child,
.ladder-table th:first-child {
  width: 11rem;
  color: var(--muted);
  font-weight: 650;
}
.compare-table thead th {
  vertical-align: bottom;
}
.compare-photo {
  border-radius: 14px;
  margin-bottom: 0.5rem;
  max-width: 260px;
}
.ladder-table tr.shared td {
  background: var(--cream);
  font-weight: 700;
}
.ladder-table .match {
  text-align: center;
  color: var(--muted);
  white-space: nowrap;
}
.ladder-table tr.shared .match {
  color: var(--green);
}
.nearby-tools {
  display: grid;
  gap: 1rem;
  justify-items: start;
}
.place-form {
  width: 100%;
  max-width: 34rem;
}
.place-form label {
  display: block;
  font-weight: 650;
  margin-bottom: 0.4rem;
}
.small-title {
  font-size: 1rem;
}
.geo-timeline {
  margin: 1.5rem 0 2rem;
}
.timeline-scroll {
  overflow-x: auto;
  padding-bottom: 0.4rem;
}
.timeline {
  min-width: 720px;
  position: relative;
}
.timeline-markers {
  position: relative;
  height: 2.6rem;
}
.timeline-marker {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  font-size: 1.35rem;
  text-decoration: none;
  line-height: 1;
  transition: transform 0.15s;
}
.timeline-marker:hover,
.timeline-marker:focus-visible {
  transform: translateX(-50%) scale(1.35);
}
.timeline-bar {
  display: flex;
  height: 2.2rem;
  border-radius: 10px;
  overflow: hidden;
}
.period {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #06121a;
  font-size: 0.7rem;
}
.period b {
  font-weight: 700;
  white-space: nowrap;
  padding: 0 2px;
}
.timeline-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.3rem;
}
.period-section {
  margin: 2rem 0;
}
.period-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.period-title small {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}
.period-swatch {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 5px;
}
.fossil-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr));
  gap: 1rem;
}
.fossil-top {
  display: flex;
  flex-wrap: wrap; /* the "found in Indonesia" badge drops below the name on narrow screens */
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 0.6rem;
}
.fossil-top > div {
  flex: 1;
  min-width: 0;
}
.fossil-top h3 {
  margin-bottom: 0.15rem;
}
.fossil-icon {
  font-size: 2.2rem;
  line-height: 1;
}
.fossil-card .kv div {
  grid-template-columns: 9rem 1fr;
}
.flash {
  animation: flash 1.6s ease;
}
.glossary-tools {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.glossary-tools input {
  max-width: 32rem;
}
.alphabet {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 1rem 0;
}
.alphabet a {
  display: inline-grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 9px;
  background: var(--grey);
  text-decoration: none;
  font-weight: 700;
}
.letter-group h2 {
  font-size: 1.5rem;
  color: var(--green);
  border-bottom: 2px solid var(--line);
  padding-bottom: 0.3rem;
  margin-top: 1.8rem;
}
.term-entry {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}
.term-entry h3 {
  margin-bottom: 0.2rem;
}
.term-entry h3 small {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
}
.term-entry p {
  margin-bottom: 0.4rem;
}

/* ========== 14. Collection & teacher ========== */
.tabs-nav {
  margin-bottom: 1.4rem;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.8rem;
}
.stat {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: var(--soft);
  border: 1px solid var(--line);
}
.stat strong {
  display: block;
  font-size: 2rem;
  color: var(--green);
  line-height: 1.1;
}
.stat span {
  font-size: 0.88rem;
  color: var(--muted);
}
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.8rem;
}
.badge-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px dashed #c8d7d2;
  background: #fafcfb;
  color: var(--muted);
}
.badge-card.earned {
  border-style: solid;
  border-color: #cfe7a3;
  background: var(--lime);
  color: var(--ink);
}
.badge-icon {
  font-size: 2rem;
}
.certificate {
  position: relative;
  margin: 2rem 0;
  text-align: center;
  background: linear-gradient(135deg, #fff, var(--cream));
  border: 3px double #bfe3d1;
}
.certificate .field {
  max-width: 22rem;
  margin: 0 auto;
  text-align: left;
}
.cert-brand {
  width: 64px;
  height: 64px;
}
.cert-text {
  font-size: 1.1rem;
  margin-top: 1rem;
}
.cert-badges {
  font-size: 1.6rem;
}
.note-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.8rem;
}
.note-item > div:first-child {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.note-item p {
  white-space: pre-line;
  margin: 0.6rem 0 0;
}
.file-button {
  cursor: pointer;
}
.danger-zone {
  margin-top: 1rem;
  border-color: #f2c9c5;
  background: #fff8f7;
}
.builder {
  margin: 2rem 0;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.form-grid .wide {
  grid-column: 1 / -1;
}
.picked-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.6rem 0;
}
.picked-list .icon-button {
  width: 1.7rem;
  height: 1.7rem;
  font-size: 1rem;
}
.assignment-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.student-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}
.assignment-species li,
.assignment-questions li {
  margin: 0.6rem 0;
}
.assignment-questions p {
  font-weight: 650;
  margin-bottom: 0.4rem;
}

/* ========== 15. Level adjustments ========== */
html[data-level='sd'] body {
  line-height: 1.7;
}
html[data-level='sd'] h1 {
  letter-spacing: -0.03em;
}
html[data-level='sd'] .btn,
html[data-level='sd'] .quiz-option {
  min-height: 3.2rem;
}
html[data-level='sd'] .species-intro h1.common-first {
  font-size: clamp(2.3rem, 5vw, 3.6rem);
}
html[data-level='sd'] .card,
html[data-level='sd'] .discovery-card,
html[data-level='sd'] .topic-card {
  border-width: 2px;
}
html[data-level='sd'] .curated-block {
  font-size: 1.05rem;
}

/* ========== 16. Responsive ========== */
/* Shared learning surfaces */
.topic-body {
  background: #fff;
  padding: clamp(1.1rem, 3vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.topic-icon {
  display: grid;
  place-items: center;
  width: 3.3rem;
  height: 3.3rem;
  flex-shrink: 0;
  background: var(--soft);
  border-radius: 14px;
  font-size: 1.7rem;
}
.mode-banner {
  background: var(--cream);
  border: 1px solid var(--line);
  padding: 1rem 1.2rem;
}
.lab-tabs button,
.segmented a,
.version-switch a {
  transition: background 0.15s;
}
.lab-tabs button:hover,
.version-switch a:hover {
  box-shadow: inset 0 0 0 1px var(--green);
}

.page-head h1,
.explore-heading h1,
.section-head h2,
.learning-welcome h2 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.035em;
}
.page-head {
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}
.card,
.discovery-card,
.topic-card {
  box-shadow: var(--shadow-sm);
}
.nav a.active {
  box-shadow: inset 0 -2px var(--green);
}
.search-examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.search-examples a {
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  text-decoration: none;
}
.search-examples a:hover {
  background: var(--cream);
  border-color: var(--green);
}
.learning-welcome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  margin-top: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--cream);
}
.learning-welcome h2 {
  margin: 0.3rem 0;
}
.learning-welcome p {
  margin: 0;
  color: var(--muted);
}
.mode-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
  padding-top: 1rem;
}
.mode-dialog-footer p {
  flex: 1 1 14rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.sheet-dialog .mode-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.sheet-dialog .mode-option:last-child {
  grid-column: 1 / -1;
}
.sheet-dialog .mode-option.selected::after {
  content: '✓';
  position: absolute;
  right: 0.75rem;
  top: 0.6rem;
  color: var(--green);
  font-weight: bold;
}
.sheet-dialog .mode-option {
  position: relative;
  padding-right: 2rem;
}
.sheet-dialog .teacher-level {
  max-width: none;
  padding: 1rem;
  background: var(--soft);
  border-radius: var(--radius-sm);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--green);
}
@media (max-width: 480px) {
  .sheet-dialog .mode-options {
    grid-template-columns: 1fr;
  }
  .learning-welcome .actions {
    width: 100%;
  }
  .learning-welcome .btn {
    flex: 1;
  }
}

@media (max-width: 1180px) {
  .nav .nav-long {
    display: none;
  }
  .nav .nav-short {
    display: inline;
  }
}
/* Larger SD text needs the short labels sooner. */
@media (max-width: 1440px) {
  html[data-level='sd'] .nav .nav-long {
    display: none;
  }
  html[data-level='sd'] .nav .nav-short {
    display: inline;
  }
}

/* Phones and tablets: navigation moves to a bottom bar within thumb reach. */
@media (max-width: 1024px) {
  /* A backdrop-filter would become the containing block of the fixed bottom navigation. */
  #header {
    backdrop-filter: none;
    background: #fff;
  }
  .header-tools {
    margin-left: auto;
  }
  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    margin: 0;
    padding: 0.35rem max(0.4rem, calc((100vw - 760px) / 2)) calc(0.35rem + env(safe-area-inset-bottom));
    background: #fffffff7;
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px #123e340d;
  }
  .nav .desktop-only {
    display: none;
  }
  .nav a {
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.4rem 0.2rem;
    min-height: 3.4rem;
    font-size: 0.75rem;
    border-radius: 12px;
  }
  .nav .nav-long {
    display: none;
  }
  .nav .nav-short {
    display: inline;
  }
  .nav .icon {
    display: block;
    width: 1.45rem;
    height: 1.45rem;
  }
  body {
    padding-bottom: calc(4.4rem + env(safe-area-inset-bottom));
  }
  .toast {
    bottom: calc(5.2rem + env(safe-area-inset-bottom));
  }
  .dossier-tabs {
    top: 4.1rem;
  }
}
@media (max-width: 1000px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .hero-mosaic {
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
  }
  .detail-grid,
  .topic-layout {
    grid-template-columns: 1fr;
  }
  .taxonomy-aside {
    position: static;
  }
  .species-hero {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .mode-strip,
  .today-card,
  .teacher-banner {
    grid-template-columns: 1fr;
  }
  .teacher-art {
    display: none;
  }
  footer {
    grid-template-columns: 1fr 1fr;
  }
  .footer-discover {
    text-align: left;
  }
  .domain-grid {
    grid-template-columns: 1fr;
  }
  .domain-card {
    min-height: 0;
  }
}
@media (max-width: 860px) {
  .lab-grid,
  .compare-lists {
    grid-template-columns: 1fr;
  }
  .featured-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 700px) {
  .header-inner {
    min-height: 4rem;
    gap: 0.6rem;
  }
  .hero-photo-caption {
    bottom: 1.7rem;
    left: 0.7rem;
  }
  .hero-photo-caption strong {
    font-size: 0.95rem;
    line-height: 1.2;
  }
  .hero-primary .hero-photo-caption strong {
    font-size: 1.3rem;
  }
  .hero-secondary .hero-photo-caption em,
  .hero-tertiary .hero-photo-caption em {
    display: none;
  }
  .brand {
    font-size: 1.3rem;
  }
  .brand-symbol {
    width: 38px;
    height: 38px;
  }
  .brand small {
    display: none;
  }
  .mode-chip {
    max-width: 8.5rem;
    padding: 0.35rem 0.7rem;
  }
  .page-head {
    padding: 1.8rem 0 1rem;
  }
  .page-brand,
  .explore-stamp {
    display: none;
  }
  .hero {
    padding-top: 1.6rem;
  }
  .hero-mosaic {
    grid-template-rows: 165px 165px;
    gap: 0.6rem;
    transform: none;
  }
  .explorer-seal {
    width: 76px;
    height: 76px;
    top: 10rem;
    right: 0.2rem;
  }
  .explorer-seal img {
    width: 30px;
    height: 40px;
  }
  .hero-search {
    flex-wrap: wrap;
  }
  .hero-search .suggest {
    flex: 1 1 60%;
  }
  .discovery-grid,
  .featured-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
  }
  .discovery-body {
    padding: 0.7rem 0.75rem 1.6rem;
  }
  .discovery-body h3 {
    font-size: 0.98rem;
  }
  .latin {
    font-size: 0.85rem;
  }
  .discovery-meta {
    flex-wrap: wrap;
  }
  .photo-credit {
    font-size: 0.65rem;
  }
  .taxon-grid {
    grid-template-columns: 1fr;
  }
  .names,
  .overview-invites,
  .quiz-options.grid-2 {
    grid-template-columns: 1fr;
  }
  .search-form {
    flex-wrap: wrap;
  }
  .search-form .suggest {
    flex: 1 1 70%;
  }
  .search-form select {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-width: none;
    flex: 1 1 100%;
  }
  .compare-pickers {
    grid-template-columns: 1fr;
  }
  .versus {
    padding: 0;
    text-align: center;
  }
  .bar-row {
    grid-template-columns: 6rem 1fr 4rem;
    font-size: 0.82rem;
  }
  .kv div,
  .fossil-card .kv div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
  footer {
    grid-template-columns: 1fr;
  }
  .occurrence-map {
    min-height: 380px;
  }
  .geo-map {
    height: 330px;
  }
  .trait-grid,
  .data-grid {
    grid-template-columns: 1fr;
  }
  .photo-result {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
}
@media (max-width: 380px) {
  .discovery-grid,
  .featured-grid {
    grid-template-columns: 1fr;
  }
  .mode-chip-text {
    display: none;
  }
}

/* ========== 17. Motion & print ========== */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes breathe {
  50% {
    opacity: 0.45;
    transform: scale(0.94);
  }
}
@keyframes rise {
  from {
    transform: translateY(0);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  to {
    transform: translateY(-95px);
    opacity: 0;
  }
}
@keyframes flash {
  0%,
  100% {
    box-shadow: none;
  }
  30% {
    box-shadow: 0 0 0 4px var(--accent);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .hero-mosaic,
  .hero-secondary,
  .hero-tertiary,
  .explorer-seal {
    transform: none;
  }
}
.print-only {
  display: none;
}
@media print {
  @page {
    margin: 14mm;
  }
  body > header,
  body > footer,
  .skip,
  .toast,
  .net-status,
  .update-status,
  .actions,
  .btn,
  .hero-search,
  .dossier-tabs,
  .inline-status,
  .photo-strip,
  .overview-invites,
  .photo-dialog,
  .map-toolbar,
  .group-pills,
  .catalog-tools,
  .lab-tabs,
  .version-switch,
  .listen,
  .term-pop,
  .topic-nav,
  .mode-banner,
  .tabs-nav,
  .suggest-list,
  textarea,
  input[type='text'],
  input[type='range'] {
    display: none !important;
  }
  body {
    padding: 0 !important;
    font-size: 11pt;
    color: #000;
  }
  main {
    max-width: none;
    padding: 0;
    min-height: 0;
  }
  .print-only {
    display: block;
    white-space: pre-line;
    min-height: 3.5em;
    border: 1px solid #999;
    border-radius: 6px;
    padding: 0.5em;
  }
  .dossier-panel[hidden] {
    display: none !important;
  }
  .teacher-notes {
    display: block;
  }
  .teacher-notes:not([open]) > :not(summary) {
    display: block;
  }
  .card,
  .worksheet,
  .quiz-q,
  .fossil-card {
    break-inside: avoid;
    box-shadow: none;
  }
  a {
    color: #000;
    text-decoration: none;
  }
  .discovery-card:hover,
  a.card:hover {
    transform: none;
  }
}

/* Tags that open a glossary definition keep the tag look. */
.tag.term {
  display: inline-flex;
  padding: 0.35em 0.7em;
  background: #edf6f1;
  border: 1px solid #d3e6dc;
  border-radius: 8px;
  font-size: 0.82rem;
  color: #2f574d;
}

/* Large SD text in the desktop header between tablet and wide layouts. */
@media (min-width: 1025px) and (max-width: 1240px) {
  html[data-level='sd'] .nav .icon {
    display: none;
  }
  html[data-level='sd'] .nav a {
    padding: 0.6rem 0.6rem;
  }
}

/* ========== Biology map, lesson layers & knowledge search ========== */
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}
.field-group + .field-group {
  margin-top: 2rem;
}
.field-head {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  margin-bottom: 0.9rem;
}
.field-head h3 {
  margin: 0;
  font-size: 1.2rem;
}
.field-head p {
  margin: 0.15rem 0 0;
}
.field-icon {
  font-size: 1.8rem;
  line-height: 1;
}
.version-switch a small {
  display: inline-block;
  margin-left: 0.1em;
  font-weight: 500;
  opacity: 0.8;
}
.key-points {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--lime);
  border: 1px solid #dcebb0;
}
.key-points h2 {
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
}
.key-points .prose-list,
.key-points .prose {
  margin: 0.2rem 0;
}
.related-card h2 {
  font-size: 1.05rem;
}
.related-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.related-list a {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  text-decoration: none;
  font-weight: 600;
}
.misconception-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.7rem;
}
.misconception-list li {
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid #d3def3;
}
.misconception-list p {
  margin: 0.15rem 0;
}
.wrong-idea strong {
  color: var(--danger);
}
.right-idea strong {
  color: var(--green);
}
.layer-table {
  background: #fff;
  min-width: 560px;
}
.layer-table th[scope='row'] {
  white-space: nowrap;
}
.compact-list,
.layer-table .compact-list {
  margin: 0;
  padding-left: 1.1rem;
}
.layer-table .compact {
  margin: 0;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.topic-chip {
  min-height: 2.2rem;
  padding: 0.35em 0.8em;
}
.org-ladder {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  gap: 0.6rem;
  counter-reset: none;
}
.org-step {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 0.8rem;
  align-items: start;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--line);
}
.org-step:nth-child(-n + 3) {
  background: var(--sky);
}
.org-step:nth-child(n + 8) {
  background: var(--soft);
}
.org-index {
  font-weight: 800;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.2rem;
}
.org-icon {
  font-size: 1.7rem;
  line-height: 1.2;
}
.org-text h3 {
  margin: 0;
  font-size: 1.1rem;
}
.org-text p {
  margin: 0.2rem 0;
}
.field-map,
.branch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.field-card h3,
.branch-card h3 {
  margin-top: 0;
  font-size: 1.1rem;
}
.field-topics {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
  display: grid;
  gap: 0.5rem;
}
.field-topics li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.3rem;
}
.field-topics a {
  font-weight: 600;
  text-decoration: none;
}
.field-topics .topic-meta {
  margin-top: 0;
}
.branch-card p {
  margin: 0.3rem 0;
}
.coverage-table {
  background: #fff;
}
.coverage-table tr.current th,
.coverage-table tr.current td {
  background: var(--cream);
  font-weight: 700;
}
.stat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1rem 0;
}
.stat-list div {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--soft);
  border: 1px solid var(--line);
}
.stat-list dt {
  font-size: 0.82rem;
  color: var(--muted);
}
.stat-list dd {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
}
.group-counts {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.group-counts li {
  padding: 0.3rem 0.7rem;
  border-radius: 99px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.88rem;
}
.knowledge-results {
  margin: 0 0 1.5rem;
}
.knowledge-results h2 {
  font-size: 1.15rem;
  margin-bottom: 0.1rem;
}
.knowledge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.7rem;
  margin-top: 0.6rem;
}
.knowledge-card {
  display: flex;
  gap: 0.7rem;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.knowledge-card:hover {
  border-color: var(--green);
  color: var(--ink);
}
.knowledge-card > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}
.knowledge-card small {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--green);
}
.knowledge-card .muted {
  font-size: 0.84rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.knowledge-icon {
  font-size: 1.5rem;
  line-height: 1.2;
}
.mention-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.9rem;
}
.suggest-local .suggest-icon {
  font-size: 1.3rem;
  background: var(--lime);
}
@media (max-width: 700px) {
  .org-step {
    grid-template-columns: auto minmax(0, 1fr);
    padding: 0.8rem;
  }
  .org-index {
    display: none;
  }
  .version-switch a small {
    display: none;
  }
}
@media print {
  .key-points,
  .misconception-list li {
    break-inside: avoid;
  }
  .related-card {
    display: none;
  }
}

/* ========== Genetic code & enzyme labs ========== */
.sequence-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  word-break: break-all;
}
.inline-options {
  border: 0;
  padding: 0;
  margin: 0.6rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
}
.inline-options legend {
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.inline-options label {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}
.codon-scroll {
  overflow-x: auto;
  padding-bottom: 0.4rem;
  max-width: 100%;
}
.codon-row {
  display: grid;
  grid-template-columns: 9.5rem max-content;
  gap: 0.6rem;
  align-items: center;
  margin: 0.3rem 0;
}
.codon-label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}
.codon-cells {
  display: flex;
  gap: 3px;
}
.codon {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  min-width: 2.9em;
  text-align: center;
  padding: 0.15rem 0.2rem;
  border-radius: 5px;
  background: var(--soft);
  border: 1px solid var(--line);
}
.codon.lead {
  min-width: 0;
  background: transparent;
  border-style: dashed;
  color: var(--muted);
}
.codon-row.mrna .codon {
  background: var(--sky);
}
.codon-row.template .codon {
  background: #fff;
}
.codon.aa {
  background: var(--lime);
  font-weight: 700;
}
.codon.stop {
  background: #ffd9cf;
  color: var(--danger);
}
.codon.changed {
  outline: 2px solid var(--danger);
  outline-offset: -1px;
}
.genetic-output h4 {
  margin: 0.8rem 0 0.2rem;
}
.chart-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 0.4rem 0;
}
.mini-chart {
  margin: 0;
  flex: 1 1 200px;
  max-width: 280px;
}
.mini-chart svg {
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.mini-chart .axis {
  stroke: var(--muted);
  stroke-width: 1;
}
.mini-chart .curve {
  fill: none;
  stroke: var(--green);
  stroke-width: 2.5;
}
.mini-chart .dot {
  fill: var(--danger);
}
.mini-chart text {
  font-size: 10px;
  fill: var(--muted);
}
.mini-chart figcaption {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}
@media (max-width: 480px) {
  .codon-row {
    grid-template-columns: 6.5rem max-content;
  }
}

/* Phones: the differentiation table becomes one card per level instead of a sideways scroll. */
@media (max-width: 540px) {
  .layer-table,
  .layer-table tbody,
  .layer-table tr,
  .layer-table th,
  .layer-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .layer-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .layer-table tr {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--line);
  }
  .layer-table th[scope='row'],
  .layer-table td {
    padding: 0.2rem 0;
    border: 0;
  }
  .layer-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
  }
}
