.roots-page {
  --roots-paper: #fffdf8;
  --roots-label: #5b6256;
}
.roots-page [hidden] { display: none !important; }
.roots-page .hero { margin-bottom: 1.45rem; }
.roots-page .hero h1 { max-width: 20ch; }
.roots-page .lede { max-width: 52rem; margin-bottom: 0; }
.roots-skip {
  position: absolute;
  inset-inline-start: 1.15rem;
  top: .75rem;
  z-index: 2;
  transform: translateY(-150%);
  background: var(--roots-paper, #fffdf8);
  padding: .4rem .7rem;
}
.roots-skip:focus { transform: none; }
.roots-finder {
  margin: 0 0 1.25rem;
  padding: clamp(.95rem, 2.4vw, 1.4rem);
  border: 1px solid #c3cbbd;
  border-radius: 12px;
  background: var(--soft);
}
.roots-finder label { display: grid; gap: .35rem; font-weight: 650; }
.roots-finder input, .roots-finder select, .roots-finder button {
  min-height: 44px;
  min-width: 0;
  padding: .45rem .72rem;
  border: 1px solid #849282;
  border-radius: 6px;
  color: var(--ink);
  background: var(--roots-paper);
  font: inherit;
  font-weight: 500;
}
.roots-finder input, .roots-finder select { width: 100%; }
.roots-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
  gap: .85rem;
}
.roots-surname-fields { grid-template-columns: minmax(0, 1fr) auto; }
#surname-name-form { margin-top: 1rem; }
#surname-name-status:empty { margin: 0; }
#surname-name-matches button { margin-top: .45rem; }
.roots-options, .roots-jumps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
}
.roots-options { margin-top: .6rem; }
.roots-options span { padding-right: .2rem; }
.roots-finder button { color: var(--green); }
.roots-finder button:hover, .roots-jumps a:hover { background: #dce6d8; }
.roots-jumps a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .35rem .7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--roots-paper);
}
.roots-status { display: block; margin-top: .6rem; color: var(--roots-label); }
.roots-section { margin-top: clamp(2.5rem, 5vw, 3.6rem); scroll-margin: 1rem; }
.roots-section h2 { margin-bottom: .65rem; }
.roots-explanation { max-width: 47rem; }
.roots-cards, .roots-ranking {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: .9rem 0 0;
  padding: 0;
  gap: .65rem;
  list-style: none;
}
.roots-card, .roots-rank-link {
  min-width: 0;
  padding: .75rem .95rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--roots-paper);
}
.roots-card { scroll-margin: 1rem; }
.roots-card:target { outline: 2px solid var(--green); outline-offset: 2px; }
.roots-term, .roots-rank-heading { color: var(--ink); font-weight: 650; }
.roots-term { margin-bottom: .12rem; display: flex; align-items: baseline; flex-wrap: wrap; gap: .15rem .55rem; }
.roots-zh { font: 1.6rem/1.24 var(--han); }
.roots-variant { font: 1.14rem/1.35 var(--han); color: var(--roots-label); }
.roots-pinyin { color: var(--green); }
.roots-card p { margin-bottom: .2rem; }
.roots-card p:last-child { margin-bottom: 0; }
.roots-example {
  margin: .8rem 0 0;
  padding: .68rem .95rem;
  border-inline-start: 3px solid var(--green);
  background: #eff2e9;
}
.roots-example p { margin-bottom: .15rem; }
.roots-example p:last-child { margin-bottom: 0; }
.roots-example .roots-zh { font-size: 1.2rem; }
.roots-ranking { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.roots-rank-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.roots-rank-table :is(th, td) {
  padding: .46rem .58rem;
  text-align: start;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.roots-rank-table thead { background: var(--soft); }
.roots-rank-table thead th:first-child { width: 10%; }
.roots-rank-table thead th:last-child { width: 36%; }
.roots-rank-table tbody tr:nth-child(even) { background: var(--roots-paper); }
.roots-rank-table tbody [lang="zh-Hans"], .roots-rank-table tbody [lang="zh-Hant"] { font-family: var(--han); font-size: 1.12rem; }
.roots-page-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; margin-block: .75rem; }
.roots-page-controls button { min-height: 44px; padding: .35rem .7rem; font: inherit; }
.roots-rank-link {
  display: grid;
  min-height: 5rem;
  align-content: center;
  text-decoration: none;
  padding-inline: .65rem;
}
.roots-rank-link:hover { background: var(--soft); }
.roots-rank-heading, .roots-aliases { font-size: .92rem; }
.roots-rank-link .roots-zh { font-size: 1.35rem; }
.roots-aliases { color: var(--roots-label); }
.roots-aliases span { display: block; overflow-wrap: anywhere; }
.roots-questions { margin: 0; max-width: 47rem; }
.roots-questions dt { margin-top: .8rem; font-weight: 700; }
.roots-questions dd { margin: .15rem 0 .7rem; }
.roots-resources {
  background: var(--roots-paper);
  padding: 1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.roots-resources ul { padding-inline-start: 1.25rem; margin-bottom: 0; }
@media (max-width: 49rem) {
  .roots-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roots-ranking { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 33rem) {
  .roots-fields:not(.roots-surname-fields) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roots-fields:not(.roots-surname-fields) button { grid-column: 1 / -1; justify-self: start; }
  .roots-rank-table :is(td, th) { padding-inline: .28rem; }
  .roots-rank-table thead th:first-child { width: 14%; }
  .roots-rank-table thead th:last-child { width: 30%; }
}
@media (max-width: 23rem) {
  .roots-fields:not(.roots-surname-fields) { grid-template-columns: minmax(0, 1fr); }
  .roots-cards { grid-template-columns: minmax(0, 1fr); }
  .roots-ranking { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
