/* One document scroll surface shared by the directory and species pages. */
#species-load-sentinel { height: 1px; }
.side-account { display: flex; align-items: center; gap: 10px; margin: 28px 0 24px; padding: 4px 0; }
.account-avatar { display: grid; place-items: center; width: 66px; height: 66px; flex: 0 0 66px; border-radius: 50%; background: #d8eee1; color: #579889; overflow: hidden; }
.account-avatar svg { width: 54px; height: 54px; }
.account-identity { position: relative; flex: 0 0 66px; }
button.account-avatar { padding: 0; border: 0; }
button.account-avatar:disabled { cursor: default; opacity: 1; filter: none; }
button.account-avatar:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.account-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 20; padding: 5px; min-width: 112px; border: 1px solid #dcebe3; border-radius: 10px; background: #fff; box-shadow: 0 6px 20px #17474220; }
.account-menu button { width: 100%; padding: 9px 12px; color: #286e64; font-size: 12px; white-space: nowrap; border-radius: 6px; }
.account-menu button:hover { background: #eff8f4; }
.account-info { min-width: 0; flex: 1; }
.account-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #fff; font-size: 14px; font-weight: 600; line-height: 1.5; }
.account-info button { padding: 6px 14px; border-radius: 8px; background: #e8f5dc; color: #286e64; font-size: 12px; font-weight: 600; line-height: 1.5; }
.account-info button:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }
.account-membership { display: flex; align-items: center; gap: 5px; margin-top: 7px; white-space: nowrap; }
.account-vip { padding: 3px 7px; border-radius: 6px; background: #ffd164; color: #65460d; font-size: 11px; font-weight: 700; line-height: 1.4; }
.account-membership time { color: #d4eee9; font-size: 10px; font-variant-numeric: tabular-nums; }
.side-account [hidden] { display: none !important; }
#login-dialog { color: #193e40; }
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }
#login-dialog { text-align: center; max-width: 380px; }
#login-code { display: block; width: 220px; height: 220px; margin: 20px auto 12px; }
#login-status { line-height: 1.8; }
#login-retry { margin-top: 14px; }
@media (max-width:820px) {
 .side-account { margin: 12px 0 20px; }
}
body.directory, body.species {
  --sidebar-width: 250px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: linear-gradient(to right, #2b999e 0 var(--sidebar-width), #eff8f4 var(--sidebar-width));
}
.directory > .sidebar, .species > .sidebar {
  position: sticky;
  inset: 0 auto auto 0;
  width: auto;
  height: auto;
  min-height: 100dvh;
  align-self: start;
  overflow: visible;
}
.directory-main { margin-left: 0; min-width: 0; }
.species-main { min-width: 0; padding: 0 32px; container-type: inline-size; }
.species-main .page, .species-main .header-inner { width: 100%; margin: 0 auto; }
.species-main .site-header { background: transparent; }
.species-main .header-inner { justify-content: flex-end; }
.species-main .header-inner > .brand, .species-main .main-nav { display: none; }
.species-main .hero-content { min-width: 0; }
@media (max-width:1200px) {
  body.directory, body.species { --sidebar-width: 220px; }
  .species-main { padding: 0 28px; }
  .directory > .sidebar, .species > .sidebar { padding-left: 16px; padding-right: 16px; }
}
/* Compact navigation still fits ordinary laptop windows without an inner scrollbar. */
@media (max-height:850px) and (min-width:821px) {
  .directory > .sidebar, .species > .sidebar { padding: 20px 16px; }
  .side-heading { margin: 20px 0 12px 12px; }
  .all-category { padding: 10px 12px; }
  .side-cats { gap: 4px; margin-top: 8px; }
  .side-cats > a { padding: 7px 10px; }
  .side-cats img { width: 30px; height: 32px; }
  .side-more { margin-top: 16px; padding-top: 12px; }
  .side-more a { padding: 9px 12px; }
  .side-bottom { padding-top: 16px; }
  .side-bottom > span, .side-bottom > strong { display: none; }
  .side-bottom button { margin-top: 0; }
}
/* Very short windows scroll the whole sidebar with the page so its links stay reachable. */
@media (max-height:600px) and (min-width:821px) {
  .directory > .sidebar, .species > .sidebar { position: static; }
}
@container (max-width:950px) {
  .species-hero { grid-template-columns: 240px minmax(0,1fr); gap: 24px; padding: 22px; }
  .hero-content h1 { font-size: 32px; }
  .section-nav { gap: 20px; padding: 0 10px; }
  .section-nav .updated { display: none; }
}
@container (max-width:700px) {
  .species-hero { grid-template-columns: 1fr; }
  .hero-art { min-height: 240px; }
  .sub-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@container (max-width:480px) {
  .sub-grid { grid-template-columns: 1fr; }
}
@media (max-width:820px) {
  body.directory, body.species { display: block; background: #eff8f4; }
  .directory > .sidebar, .species > .sidebar { position: relative; min-height: 0; }
  .species-main { padding: 0 18px; }
  .side-cats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); overflow: visible; }
  .side-cats > a { min-width: 0; padding: 7px 5px; }
  .tabs { flex-wrap: wrap; overflow: visible; }
}
@media (max-width:420px) {
  .side-cats { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* Long-form species articles share the existing light palette and document scroll. */
.page-rich .summary { font-size: 15px; line-height: 1.95; white-space: pre-line; }
.page-rich .sub-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); overflow: visible; }
.page-rich .sub-card { min-width: 0; max-width: none; }
.larval-stage-facts { margin: 12px 0 0; display: grid; gap: 8px; font-size: 13px; color: #496759; }
.larval-stage-facts>div { display: flex; gap: 16px; align-items: baseline; }
.larval-stage-facts dt { min-width: 3em; }
.larval-stage-facts dd { margin: 0; font-weight: 600; }
.horn-illustration { margin: 14px 0 12px; padding: 2px 5px 10px; border: 1px solid #e6ede8; border-radius: 12px; background: #fff; }
.horn-illustration img { display: block; width: 100%; height: auto; }
.horn-illustration figcaption { text-align: center; font-size: 10px; line-height: 1.5; color: #788a7d; }
.page-rich .sub-card:has(.horn-illustration) .difference { min-height: 0; margin-bottom: 12px; }
.page-rich .difference { font-size: 14px; line-height: 1.9; }
.page-rich .record-explanation { margin: 20px 0; font-size: 12px; line-height: 1.8; color: #657c70; }
.page-rich .difficulty-grade>p,.page-rich .difficulty-reasons p { font-size: 13px; line-height: 1.85; }
.page-rich .care-v2 p,.page-rich .adult-brief small { font-size: 13px; line-height: 1.85; }
.page-rich .unified-temp { flex-wrap: wrap; gap: 8px; }
.page-rich .unified-temp>strong { white-space: normal; font-size: 20px; letter-spacing: 0; }
.page-rich .enclosure-facts { flex-wrap: wrap; }
.page-rich .breeding-grid { grid-template-columns: repeat(2,minmax(0,1fr))!important; }
.care-guide { margin-top: 18px; padding: 28px; background: #fff; color: #496759; }
.care-guide .guide-section + .guide-section { border-top: 1px solid #e3ede6; margin-top: 26px; padding-top: 26px; }
.care-guide > .guide-section:not(:first-child) { border-top: 1px solid #e3ede6; margin-top: 26px; padding-top: 26px; }
.care-guide h3 { font-size: 20px; margin-bottom: 15px; }
.care-guide p { font-size: 14px; line-height: 1.95; overflow-wrap: anywhere; }
.care-guide .guide-note { color: #687e73; font-size: 12px; margin-top: 14px; }
.guide-facts { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 0; }
.guide-facts>div { background: #f4f8f5; border-radius: 12px; padding: 17px 20px; }
.guide-facts dt { color: #647f70; font-size: 13px; }
.guide-facts dd { margin: 8px 0 0; }
.guide-facts strong { display: block; color: #327f75; font-size: 19px; line-height: 1.65; font-weight: 600; }
.guide-facts dd p { font-size: 12px; margin-top: 6px; }
.guide-section .guide-section { margin-top: 20px; }
.guide-section .guide-section h3 { font-size: 16px; }
.teaching-grid { display: grid; gap: 20px; }
.teaching-grid article { display: flex; align-items: flex-start; gap: 14px; }
.teaching-number { flex: 0 0 32px; padding: 6px 0; text-align: center; border-radius: 9px; background: #e8f3ee; color: #418773; font-size: 12px; }
.teaching-grid h4 { font-size: 16px; line-height: 1.7; margin: 0 0 7px; }
.print-reference { padding-bottom: 20px; color: #496759; }
.print-reference p { font-size: 12px; line-height: 1.8; margin-top: 6px; }
@container (max-width:600px) {
 .page-rich .sub-grid,.guide-facts { grid-template-columns: 1fr; }
 .page-rich .difficulty-panel { grid-template-columns: 1fr; }
 .page-rich .larval-focus { grid-template-columns: 1fr; }
 .page-rich .breeding-grid { grid-template-columns: 1fr!important; }
 .page-rich .larval-heading { flex-wrap: wrap; }
 .care-guide { padding: 20px; }
 .care-guide h3 { font-size: 18px; }
 .teaching-grid article { gap: 10px; }
 .page-rich .summary,.page-rich .difference { font-size: 14px; }
}

/* Shared mini-program gender artwork keeps its original geometry and colors. */
.sex { display: inline-flex; width: 19px; height: 19px; flex: 0 0 19px; vertical-align: middle; }
.sex > svg { display: block; width: 100%; height: 100%; }

/* Food and duration are peer facts: identical labels, values and top spacing. */
.species .larval-focus > article { min-width: 0; }
.species .larval-focus .care-label { display: block; font-size: 12px; font-weight: 500; line-height: 1.5; }
.species .larval-focus .larval-food > h4,
.species .larval-focus .single-duration,
.species .larval-focus .duration-pair strong {
  font-size: clamp(17px,1.45vw,23px) !important;
  font-weight: 600;
  line-height: 1.65 !important;
  letter-spacing: 0;
  color: #466735;
  margin: 10px 0 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.species .larval-focus .duration-pair { margin-top: 10px; }
.species .larval-focus .duration-pair > div { align-content: start; }
.species .larval-focus .duration-pair strong { order: -1; margin-top: 0; }
