/* Gengdian — token-only overrides on top of kit */

.geng-search-wrap {
  position: relative;
  margin-bottom: 14px;
}

.geng-search-panel {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: min(420px, 55vh);
  overflow: auto;
  background: var(--raised);
  border: 1px solid var(--line-2);
  border-radius: var(--r-2);
  box-shadow: var(--shadow);
}

.geng-search-panel[hidden] {
  display: none !important;
}

.geng-search-panel .pp-item {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.geng-search-panel .pp-item:last-child {
  border-bottom: 0;
}

.geng-search-panel .pp-item:hover,
.geng-search-panel .pp-item:focus-visible {
  background: var(--hover);
}

.geng-search-panel .pp-empty {
  padding: 16px 14px;
  margin: 0;
}

.geng-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 10px;
}

.geng-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.geng-filter-count {
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* Dictionary headword (list + aside) */
.geng-hw {
  font-family: var(--pp-serif);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}

a.geng-hw:hover {
  color: var(--sig-ink);
}

.geng-headword {
  font-family: var(--pp-serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  font-size: clamp(40px, 5vw, 56px);
  line-height: 1.04;
  margin: 0 0 10px;
}

.geng-tags {
  font-family: var(--pp-mono);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-3);
}

.geng-tags__sep {
  color: var(--ink-4);
}

.geng-tags__link {
  color: var(--ink-3);
  text-decoration: none;
}

.geng-tags__link:hover {
  color: var(--sig-ink);
}

.geng-entry-lead {
  margin: 0 0 14px;
}

.geng-entry-rule {
  height: 0;
  border-bottom: 1px solid var(--line);
  margin: 0 0 14px;
}

.geng-entry-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 12px;
}

.geng-entry-kicker a {
  color: var(--ink-3);
  text-decoration: none;
}

.geng-entry-kicker a:hover {
  color: var(--sig-ink);
}

.pp-sticky.geng-entry-aside {
  top: calc(var(--bar-h) + 22px);
}

.geng-aside-list {
  display: flex;
  flex-direction: column;
}

.geng-aside-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--line);
}

.geng-aside-row:first-child {
  border-top: 0;
}

.geng-aside-row:hover,
.geng-aside-row:focus-visible {
  background: var(--hover);
}

.geng-aside-empty {
  padding: 12px 16px 14px;
  margin: 0;
}

.geng-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 0 0 1.25rem;
  padding: 0;
  font-size: 13px;
}

.geng-toc a {
  color: var(--ink-3);
  text-decoration: none;
}

.geng-toc a:hover {
  color: var(--sig-ink);
}

.geng-facts dl {
  margin: 0;
  display: grid;
  gap: 10px;
}

.geng-facts dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin: 0;
}

.geng-facts dd {
  margin: 2px 0 0;
  font-size: 14px;
}

.geng-read-in {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  font-size: 14px;
}

.geng-read-in a.is-muted {
  color: var(--ink-4);
  pointer-events: none;
  text-decoration: line-through;
}

.geng-table .pp-badge {
  min-width: 2.2em;
  justify-content: center;
}

.geng-pic {
  margin: 1rem 0 1.25rem;
}

.geng-pic img {
  width: 100%;
  max-width: 520px;
  height: auto;
  border-radius: var(--r-2);
  border: 1px solid var(--line);
}

.geng-pic figcaption {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
}

.ad-slot {
  margin: 14px 0;
}

.ad-slot:not([hidden]) {
  padding: 10px 12px;
  background: var(--sunk);
  border: 1px dashed var(--line);
  border-radius: var(--r-2);
  min-height: 90px;
}

.ad-slot:not([hidden])::before {
  content: "";
  display: block;
  height: 0;
}

@media (max-width: 640px) {
  .geng-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .geng-filter-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    gap: 6px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
  }

  .geng-filter-row::-webkit-scrollbar {
    display: none;
  }

  .geng-filter-row .pp-chip {
    flex: 0 0 auto;
    padding: 5px 9px;
    font-size: 12px;
  }

  .geng-filter-count {
    width: 100%;
    margin-left: 0;
    font-size: 12px;
  }

  .geng-table .pp-table thead {
    display: none;
  }

  .geng-table .pp-table tbody tr {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 6px 8px;
    align-items: start;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
  }

  .geng-table .pp-table tbody tr:last-child {
    border-bottom: 0;
  }

  .geng-table .pp-table td {
    display: block;
    padding: 0;
    border: 0;
    vertical-align: top;
  }

  .geng-table .pp-table .geng-col-rank {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
  }

  .geng-table .pp-table .geng-col-badge {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }

  .geng-table .pp-table .geng-col-head {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
  }

  .geng-table .pp-table .geng-col-gloss {
    grid-column: 3;
    grid-row: 2;
    font-size: 13px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .geng-table .pp-table .geng-col-tags {
    display: none;
  }

  .geng-table .pp-table-wrap {
    overflow-x: visible;
  }
}

@media (max-width: 680px) and (min-width: 641px) {
  .geng-filter-count {
    width: 100%;
    margin-left: 0;
  }
}
