body { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
.page { margin: 0 auto; display: flex; flex-direction: column; gap: 1.5rem;
		padding: 1rem; }

@media (min-width: 600px) { body { padding-bottom: 0; } }
@media (min-width: 900px) { .page { padding: 2rem 1.5rem; } }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border);
		border-radius: var(--radius); overflow: hidden; }

/* Ranking table */
.ranking-table { width: 100%; border-collapse: collapse; }
.ranking-table thead th {
  background: var(--surface2); color: var(--muted); font-size: .72rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: .55rem .75rem; text-align: left; white-space: nowrap;
}
.ranking-table thead th.cat-head { text-align: center; }
.ranking-table tbody tr { border-bottom: 1px solid var(--border); }
.ranking-table tbody tr:last-child { border-bottom: none; }
.ranking-table tbody tr:hover { background: var(--surface2); }
.ranking-table td { padding: .55rem .75rem; font-size: .88rem; vertical-align: middle; }
.col-rank  { color: var(--muted); font-size: .8rem; width: 2rem; text-align: center; }
.col-name  { font-weight: 600; min-width: 180px; }
.col-rating { width: 70px; }
.col-count  { color: var(--muted); font-size: .82rem; width: 60px; text-align: center; }
.cat-cell   { text-align: center; width: 60px; }
.cat-empty  { color: var(--muted); font-size: .8rem; }

.club-link { color: var(--text); text-decoration: none; }
.club-link:hover { color: var(--accent); text-decoration: underline; }

.rating-badge { display: inline-block; font-size: .8rem; font-weight: 700;
				padding: .15rem .45rem; border-radius: 999px; }
.pct-badge    { display: inline-block; font-size: .72rem; font-weight: 600;
				padding: .1rem .35rem; border-radius: 999px; }
.rating-good, .pct-badge.rating-good { background: rgba(22,163,74,.12);  color: var(--darkgreen); }
.rating-mid,  .pct-badge.rating-mid  { background: rgba(234,88,12,.10);   color: var(--orange); }
.rating-low,  .pct-badge.rating-low  { background: rgba(220,38,38,.10);   color: var(--red); }

.cat-n { display: block; color: var(--muted); font-size: .68rem; margin-top: .1rem; }

/* Legend */
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: .3rem; }
.dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }
.dot-good { background: var(--emerald); } .dot-mid { background: var(--orange); } .dot-low { background: var(--red); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Club row toggle */
.club-row { cursor: pointer; }
.club-row:hover { background: var(--surface2); }
.chevron { color: var(--muted); font-size: .8rem; margin-left: .3rem;
		   display: inline-block; transition: transform .2s; }
.club-row[aria-expanded='true'] .chevron { transform: rotate(90deg); }

/* Detail row */
.detail-row { display: none; background: var(--surface2); }
.detail-row.open { display: table-row; }
.detail-row > td { padding: 0; border-bottom: 2px solid var(--border); }
.detail-table { width: 100%; border-collapse: collapse; }
.detail-table thead th { background: var(--surface3); color: var(--muted); font-size: .7rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: .35rem .75rem; text-align: left; }
.detail-table tbody tr { border-bottom: 1px solid var(--border); }
.detail-table tbody tr:last-child { border-bottom: none; }
.detail-table td { padding: .4rem .75rem; font-size: .84rem; }
.dr-rank { color: var(--muted); font-size: .78rem; width: 2rem; text-align: center; }
.dr-name { font-weight: 500; min-width: 160px; }
.dr-cat  { color: var(--muted); font-size: .78rem; }
.dr-score { width: 70px; }
.dr-pos  { color: var(--muted); font-size: .78rem; width: 60px; }
.dr-top td { background: rgba(22,163,74,.07); }
.dr-top .dr-rank { color: var(--darkgreen); font-weight: 700; }

@media (max-width: 700px) {
  .col-name { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ranking-table td, .ranking-table th { white-space: nowrap; }
}