/* ============================================================================
   NATION PAGE: the qualification block (_nation_qual.html). Loaded after results.css, whose
   .res-chip / .rk-qm badges it reuses. Navy canvas, white cards with navy ink; orange only as a
   FILL (navy ink on it) or a rule, never as text on white (--accent-ink there).
   Phone first: below 48rem the table becomes one card per gymnast (no sideways scroll).
   ============================================================================ */
.nq{--rs-card:#fff;--rs-ink:var(--rt-ink,#000735);--rs-mute:#4a4d78;--rs-line:#e9dfd8;margin:0 0 2rem}
.nq > .rail-h{color:#fff}
.nq-g{background:var(--rs-card);color:var(--rs-ink);border-radius:12px;padding:1rem 1.1rem 1.1rem;margin:0 0 1rem;min-width:0}
.nq-head{display:flex;flex-wrap:wrap;align-items:center;gap:.35rem .7rem;padding-block-end:.6rem;margin-block-end:.8rem;
  border-block-end:3px solid var(--rt-orange)}
.nq-head h3{margin:0;font-family:var(--display);font-weight:800;text-transform:uppercase;letter-spacing:.04em;font-size:1.05rem}
.nq-head .res-chip{margin:0;font-size:.68rem}
.nq-prog{font-size:.82rem;font-weight:700;color:var(--rs-mute);font-variant-numeric:tabular-nums}
.nq-all{margin-inline-start:auto;font-weight:800;font-size:.85rem;color:var(--accent-ink);text-decoration:none;white-space:nowrap}
.nq-all:hover{text-decoration:underline}
.nq-k{display:block;margin:0 0 .3rem;font-size:.68rem;font-weight:800;text-transform:uppercase;letter-spacing:.1em;color:var(--rs-mute)}
.nq-pending{margin:0;font-weight:700}

/* headline facts: the team tile, then who is through */
.nq-facts{display:grid;gap:.8rem;grid-template-columns:1fr;margin-block-end:1rem}
@media (min-width:40rem){.nq-facts{grid-template-columns:minmax(10rem,13rem) minmax(0,1fr);align-items:start}}
.nq-team{display:flex;flex-direction:column;gap:.15rem;padding:.75rem .9rem;border-radius:10px;background:#f3eff9;color:var(--rs-ink);
  text-decoration:none;border:2px solid transparent}
.nq-team:hover{border-color:var(--rt-orange)}
.nq-team.is-q{background:var(--rt-navy);color:#fff}
.nq-team.is-q .nq-k{color:var(--rt-mute)}
.nq-place{font-family:var(--display);font-weight:800;font-size:2.2rem;line-height:1;font-variant-numeric:tabular-nums}
.nq-score{font-weight:800;font-variant-numeric:tabular-nums;display:flex;align-items:center;gap:.4rem}
.nq-lines{min-width:0;grid-column:-2/-1}
.nq-lines:only-child{grid-column:1/-1}
.nq-lines .nq-k + .nq-list{margin-block-end:.7rem}
.nq-list{list-style:none;margin:0;padding:0;display:grid;gap:.3rem}
.nq-list li{display:flex;flex-wrap:wrap;align-items:baseline;gap:.15rem .55rem;min-width:0}
.nq-who{font-weight:800;color:var(--rs-ink);overflow-wrap:anywhere}
.nq-ev{font-size:.9rem;font-weight:700;color:var(--rs-mute)}
.nq-ev a,.nq-best a{color:var(--accent-ink);font-weight:800}
.nq-who:hover,.nq-ev a:hover,.nq-best a:hover{text-decoration:underline}
.nq-best{margin:0;font-weight:700}

/* per-gymnast table (wide screens) */
.nq-wrap{min-width:0}
.nq-table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums;font-size:.9rem}
.nq-table thead th{font-size:.68rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em;color:var(--rs-mute);
  text-align:start;padding:.4rem .5rem;border-block-end:1px solid var(--rs-line);white-space:nowrap}
.nq-table thead th abbr{text-decoration:none;display:none}
.nq-table tbody th,.nq-table tfoot th{text-align:start;padding:.5rem;font-weight:800;min-width:9rem;text-transform:none;letter-spacing:0}
.nq-table tbody th a,.nq-table tfoot th a{color:var(--rs-ink)}
.nq-table tbody th a:hover,.nq-table tfoot th a:hover{color:var(--accent-ink)}
.nq-table td{padding:.35rem .5rem;white-space:nowrap}
.nq-table tbody tr + tr{border-block-start:1px solid var(--rs-line)}
.nq-table td a{display:inline-flex;align-items:baseline;gap:.3rem;color:var(--rs-ink);text-decoration:none;border-radius:6px;padding:.15rem .3rem;margin-inline:-.3rem}
.nq-table td a:hover{background:#fff1e8}
.nq-table td b{font-weight:800}
.nq-table td small{font-size:.72rem;font-weight:800;color:var(--rs-mute)}
.nq-table td .rk-qm{min-width:1.4rem;font-size:.66rem;padding:.05rem .25rem;align-self:center}
.nq-table td.is-q small{color:var(--accent-ink)}
.nq-none{color:var(--rs-mute)}
.nq-teamrow{border-block-start:2px solid var(--rs-ink)}
.nq-teamrow th,.nq-teamrow td{padding-block-start:.55rem}
.nq-legend{display:flex;flex-wrap:wrap;gap:.3rem 1rem;margin:.2rem 0 0;color:var(--rt-mute);font-size:.8rem;font-weight:700}
.nq-legend .rk-qm{min-width:1.4rem;font-size:.66rem}
.nq-legend .rk-qm.is-x{color:#fff;border-color:rgba(255,255,255,.45)}
/* A medium screen: the full apparatus names would not fit; the codes carry a title. */
@media (min-width:48rem) and (max-width:72rem){
  .nq-table thead th abbr{display:inline}
  .nq-full{display:none}
}

/* phone: one card per gymnast, the all-around across the top, the apparatus in a grid */
@media (max-width:47.99rem){
  .nq-table,.nq-table tbody,.nq-table tfoot,.nq-table tr{display:block}
  .nq-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
  .nq-table tr{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:.3rem .5rem;padding:.7rem 0}
  .nq-w .nq-table tr{grid-template-columns:repeat(2,minmax(0,1fr))}
  .nq-table tbody th,.nq-table tfoot th{grid-column:1/-1;padding:0;min-width:0;font-size:1rem;overflow-wrap:anywhere}
  .nq-table td{display:block;padding:0;white-space:normal;min-width:0}
  .nq-table td::before{content:attr(data-label);display:block;font-size:.6rem;font-weight:800;text-transform:uppercase;
    letter-spacing:.06em;color:var(--rs-mute);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .nq-table td:first-of-type{grid-column:1/-1}
  .nq-table td a{margin-inline:0;padding:.05rem 0;gap:.2rem}
  .nq-table td.is-empty{display:none}
  .nq-table td small{font-size:.66rem}
  .nq-table td:first-of-type b{font-size:1.15rem}
  .nq-teamrow{border-block-start:2px solid var(--rs-ink)}
}
