/* /chinese/most-common-characters/ (generate_frequency_pages.py).
   Loaded after styles.css, hsk.css and reference.css, which supply the
   tokens, stat tiles, toolbar, table base and the script/reading switches.
   Colors come from the site variables, so both themes work. */

.freq-table .mw { font-size: 1.9rem; }
.freq-table .gl { min-width: 150px; }
.freq-table .fw { min-width: 200px; }
.freq-table .fw .nl { margin: 0; }
.freq-table .fw .nl li > span { font-size: 1.05rem; }
.freq-table .fh { white-space: nowrap; width: 1%; text-align: center; font-weight: 800; }
.freq-table .fh a { color: var(--primary-ink); }
.freq-table .fh .none { color: var(--muted); font-weight: 600; }
.freq-table tr:target { background: var(--primary-tint); }
.freq-table tr[id] { scroll-margin-top: 90px; }
.scr-b .freq-page .fw .t { display: none; }

/* coverage table with bars */
.freq-cov, .freq-hsk { max-width: 720px; }
.freq-cov th[scope="row"], .freq-hsk th[scope="row"] { font-weight: 800; white-space: nowrap; }
.freq-cov td:nth-child(2) { font-weight: 800; color: var(--primary-ink); white-space: nowrap; width: 1%; }
.freq-cov td:nth-child(3) { width: 45%; vertical-align: middle; }
.freq-cov .bar { display: block; height: 10px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); overflow: hidden; }
.freq-cov .bar i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.freq-cov .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* top-100 grid */
.freq-grid { padding: 0; counter-reset: fq; }
.freq-grid li { padding: 0; position: relative; counter-increment: fq; }
.freq-grid li a { display: block; padding: 8px 2px 6px; color: var(--ink); border-radius: 10px; }
.freq-grid li a:hover { background: var(--primary-tint); color: var(--primary-ink); }
.freq-grid li::before { content: counter(fq); position: absolute; top: 2px; left: 5px; font-size: .58rem; color: var(--muted); font-weight: 700; line-height: 1; }
.freq-grid .t { display: block; font-size: .72rem; color: var(--muted); line-height: 1.2; }
.scr-s .freq-grid .t { display: none; }
.scr-t .freq-grid .t { font-size: 1em; color: inherit; }

.freq-sheets { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.freq-sheets a { display: inline-block; background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 14px; font-weight: 700; font-size: .95rem; color: var(--primary-ink); }
.freq-sheets a:hover { border-color: var(--primary); background: var(--primary-tint); }

/* phones: [rank] [character] [reading + meaning] [covers] / words */
@media (max-width: 680px) {
  .freq-table tbody tr { grid-template-columns: 2.1em auto 1fr auto; column-gap: 10px; }
  .freq-table .rk { grid-column: 1; grid-row: 1; align-self: center; }
  .freq-table .mw { grid-column: 2; grid-row: 1 / span 2; font-size: 2rem; align-self: center; }
  .freq-table .rd { grid-column: 3; grid-row: 1; align-self: end; }
  .freq-table .gl { grid-column: 3; grid-row: 2; }
  .freq-table .num { grid-column: 4; grid-row: 1 / span 2; align-self: center; }
  .freq-table .fh { display: none; }
  .freq-table .fw { grid-column: 1 / -1; grid-row: 3; margin-top: 6px; min-width: 0 !important; }
  .freq-table .fw:empty { display: none; }
  .freq-table .mw .t { display: block; margin: 0; font-size: .6em; }
  .scr-s .freq-table .mw .t { display: none; }
  .freq-cov, .freq-cov tbody, .freq-hsk, .freq-hsk tbody { display: table; }
  .freq-cov, .freq-hsk { width: 100%; }
  .freq-cov tbody, .freq-hsk tbody { display: table-row-group; }
  .freq-cov td:nth-child(2) { width: auto; }
  .freq-cov thead, .freq-hsk thead { display: table-header-group; }
  .freq-cov tbody tr, .freq-hsk tbody tr { display: table-row; padding: 0; }
  .freq-cov th, .freq-cov td, .freq-hsk th, .freq-hsk td { padding: 7px 5px !important; border-bottom: 1px solid var(--border) !important; }
  .freq-cov thead th, .freq-hsk thead th { font-size: .68rem; }
  .freq-cov td:nth-child(3), .freq-cov th:nth-child(3) { display: none; }
}

@media print {
  .freq-grid, .freq-sheets, #coverage, #hsk, #write, #method { display: none !important; }
}
