/* «Classifiche e titoli» (web/rankings.js, docs/CLASSIFICHE.md), style «Creuza a colori»: ink outlines, offset shadows,
   Archivo condensed titles, podium in yellow / blue / red. Prefix rk-. Tokens: web/app.css. */
.rk-i { width: 20px; height: 20px; flex: none; }
.rk-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.rk-page > * { min-width: 0; }
.rk-standalone .rk-page { margin-top: 8px; }

/* ---------- Amici segment with four sections: fits 360 px ---------- */
.amici-page.has-rankings .amici-seg { gap: 2px; padding: 3px; }
.amici-page.has-rankings .amici-seg-link { font-size: 13px; letter-spacing: -0.01em; padding: 0 2px; }
@media (max-width: 374px) { .amici-page.has-rankings .amici-seg-link { font-size: 12px; } }

/* ---------- Participation prompt ---------- */
.rk-join { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--r-lg); background: var(--gold); color: #1d1f24; border: var(--card-border); box-shadow: var(--card-shadow); }
.rk-join-mark { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 50%; background: #fffdf7; border: 2px solid #1d1f24; }
.rk-join-copy { display: grid; gap: 6px; min-width: 0; }
.rk-join h2 { font: 900 22px/1 var(--display); font-stretch: 68%; text-transform: uppercase; margin: 0; }
.rk-join p { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.4; }
.rk-join small { font-size: 12.5px; font-weight: 650; opacity: .8; }
.rk-join-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.rk-join-actions .button { min-height: 40px; }
.rk-join-actions .button.secondary { background: #fffdf7; color: #1d1f24; }
.rk-join-actions .rk-i { width: 17px; height: 17px; }
@media (prefers-color-scheme: dark) { .rk-join { border-color: #000; box-shadow: 4px 4px 0 #000; } }

/* ---------- Theme chips (horizontal) ---------- */
.rk-chips { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 8px; scrollbar-width: none; }
.rk-chips::-webkit-scrollbar { display: none; }
.rk-chip { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 40px; padding: 0 14px 0 10px; border-radius: var(--r-pill); background: var(--surface); color: var(--ink); border: 2px solid var(--outline); box-shadow: 2px 2px 0 var(--outline); text-decoration: none; font-weight: 800; font-size: 14px; scroll-snap-align: start; }
.rk-chip .rk-i { width: 18px; height: 18px; }
.rk-chip.is-on { background: var(--ink); color: var(--bg); box-shadow: none; transform: translate(2px, 2px); }
@media (prefers-color-scheme: dark) { .rk-chip { border-color: rgba(245, 241, 230, .35); box-shadow: 2px 2px 0 #000; } .rk-chip.is-on { border-color: var(--ink); } }

/* ---------- Scope switch Amici | Città | Italia (web/gestures.js swipes it) ---------- */
.rk-scope { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface-2); border: 2px solid var(--outline); }
.rk-scope-link { display: flex; align-items: center; justify-content: center; min-height: 38px; border-radius: var(--r-pill); text-decoration: none; font-weight: 800; font-size: 14px; color: var(--muted); }
.rk-scope-link[aria-current="page"] { background: var(--sea); color: #fff; }
@media (prefers-color-scheme: dark) { .rk-scope { border-color: rgba(245, 241, 230, .22); } .rk-scope-link[aria-current="page"] { background: var(--navy); } }

/* ---------- Header and countdown ---------- */
.rk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 4px; }
.rk-head > div { min-width: 0; }
.rk-kicker { margin: 0 0 2px; font-size: 12px; font-weight: 850; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.rk-title { font: 900 clamp(30px, 9vw, 38px)/.95 var(--display); font-stretch: 66%; text-transform: uppercase; margin: 0; }
.rk-sub { margin: 4px 0 0; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.rk-clock { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 6px 10px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-deep); font-size: 12.5px; font-weight: 850; white-space: nowrap; }
.rk-clock .rk-i { width: 16px; height: 16px; }

/* ---------- My level ---------- */
.rk-level { padding: 14px; border-radius: var(--r-lg); background: var(--surface); border: var(--card-border); box-shadow: var(--card-shadow); display: grid; gap: 10px; }
.rk-level-head { display: flex; align-items: center; gap: 10px; }
.rk-level-head > div { display: grid; min-width: 0; flex: 1; }
.rk-level-head small { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.rk-level-head strong { font: 900 22px/1.05 var(--display); font-stretch: 70%; text-transform: uppercase; }
.rk-level-mark { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: #1d1f24; border: 2px solid var(--outline); }
.rk-level-week { flex: none; text-align: right; font-size: 12px; font-weight: 700; color: var(--muted); line-height: 1.1; max-width: 76px; }
.rk-level-week b { display: block; font: 900 24px/1 var(--display); font-stretch: 70%; color: var(--ink); }
.rk-bar { height: 12px; border-radius: 99px; background: var(--surface-2); border: 2px solid var(--outline); overflow: hidden; }
.rk-bar i { display: block; height: 100%; background: var(--accent); }
.rk-level-goal { margin: 0; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.rk-level.is-all { grid-template-columns: auto 1fr; align-items: center; gap: 14px; }
.rk-level.is-all p { margin: 0; font-size: 14px; font-weight: 600; }
.rk-level-num { display: grid; text-align: center; padding: 8px 12px; border-radius: var(--r-md); background: var(--gold); color: #1d1f24; border: 2px solid var(--outline); }
.rk-level-num b { font: 900 30px/1 var(--display); font-stretch: 68%; }
.rk-level-num span { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; max-width: 90px; line-height: 1.1; }
@media (prefers-color-scheme: dark) { .rk-level-mark, .rk-level-num { border-color: #000; } .rk-bar { border-color: rgba(245, 241, 230, .3); } }

/* ---------- Podium ---------- */
.rk-board { min-width: 0; }
.rk-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 8px; padding-top: 18px; }
.rk-podium-col { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; text-decoration: none; color: var(--ink); }
.rk-podium-col .social-avatar { width: 52px; height: 52px; font-size: 18px; border: 2px solid var(--outline); }
.rk-podium-col.is-1 .social-avatar { width: 66px; height: 66px; font-size: 22px; }
.rk-podium-name { max-width: 100%; font-weight: 850; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-podium-pts { font-size: 12.5px; font-weight: 750; color: var(--muted); }
.rk-block { width: 100%; display: grid; place-items: center; border: var(--card-border); border-bottom-width: 0; border-radius: var(--r-md) var(--r-md) 0 0; box-shadow: 4px 0 0 var(--outline); margin-top: 6px; }
.rk-block-rank { font: 900 40px/1 var(--display); font-stretch: 66%; }
.rk-podium-col.is-1 .rk-block { height: 116px; background: var(--gold); color: #1d1f24; }
.rk-podium-col.is-2 .rk-block { height: 86px; background: var(--navy); color: #fff; }
.rk-podium-col.is-3 .rk-block { height: 66px; background: #c8371f; color: #fff; }
.rk-podium-col.is-empty .rk-block { background: var(--surface-2); color: var(--muted); border-style: dashed; }
.rk-podium-col.is-mine .rk-podium-name { text-decoration: underline; text-decoration-thickness: 3px; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.rk-crown { position: absolute; top: -20px; color: #1d1f24; background: var(--gold); border: 2px solid var(--outline); border-radius: 50%; width: 30px; height: 30px; display: grid; place-items: center; z-index: 1; }
.rk-crown .rk-i { width: 18px; height: 18px; }
.rk-podium + .rk-list { margin-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; }
@media (prefers-color-scheme: dark) { .rk-block, .rk-podium-col .social-avatar, .rk-crown { border-color: #000; } .rk-block { box-shadow: 4px 0 0 #000; } }

/* ---------- List ---------- */
.rk-list { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; border-radius: var(--r-lg); background: var(--surface); border: var(--card-border); box-shadow: var(--card-shadow); }
.rk-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); text-decoration: none; color: var(--ink); min-width: 0; }
.rk-row:active { background: var(--surface-2); }
.rk-row.is-mine { background: var(--sea-soft); }
.rk-row-rank { width: 28px; flex: none; text-align: center; font: 900 20px/1 var(--display); font-stretch: 70%; color: var(--muted); }
.rk-row-name { display: grid; min-width: 0; flex: 1; }
.rk-row-name strong { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-row-name small { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-row-pts { flex: none; font: 900 20px/1 var(--display); font-stretch: 70%; }

/* ---------- My row, sticky above the tab bar ---------- */
.rk-mine { position: sticky; bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px); z-index: 5; display: flex; align-items: center; gap: 12px; padding: 7px 14px; border-radius: var(--r-lg); background: var(--ink); color: var(--bg); border: 2px solid var(--outline); box-shadow: var(--card-shadow); }
.rk-mine-rank { font: 900 28px/1 var(--display); font-stretch: 66%; color: var(--gold); flex: none; }
.rk-mine-copy { display: grid; min-width: 0; flex: 1; }
.rk-mine-copy strong { font-size: 14px; font-weight: 850; }
.rk-mine-copy small { font-size: 12.5px; font-weight: 600; opacity: .85; }
.rk-mine-lock { flex: none; opacity: .8; }
.rk-mine.is-empty { background: var(--surface); color: var(--ink); border-style: dashed; box-shadow: none; position: static; }
@media (min-width: 960px) { .rk-mine { bottom: 16px; } }
@media (prefers-color-scheme: dark) { .rk-mine { background: #f5f1e6; color: #121418; border-color: #000; } .rk-mine-rank { color: #c8371f; } .rk-mine.is-empty { background: var(--surface); color: var(--ink); border-color: rgba(245, 241, 230, .3); } }

.rk-who { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
.rk-who .rk-i { width: 16px; height: 16px; }
.rk-empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 22px 16px; border-radius: var(--r-lg); background: var(--surface); border: 2px dashed var(--line-strong); }
.rk-empty-mark { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--gold-soft); border: 2px solid var(--outline); }
.rk-empty h3 { font: 900 20px/1 var(--display); font-stretch: 70%; text-transform: uppercase; margin: 0; }
.rk-empty p { margin: 0; font-size: 14px; color: var(--ink-2); font-weight: 600; max-width: 32ch; }
.rk-prize { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--gold-soft); border: 2px solid var(--outline); font-size: 13.5px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .rk-prize { color: var(--ink); } }

/* ---------- How to score, last week's titles ---------- */
.rk-how { border-radius: var(--r-lg); background: var(--surface-2); padding: 0 14px; }
.rk-how summary { cursor: pointer; min-height: 46px; display: flex; align-items: center; font-weight: 850; font-size: 15px; }
.rk-how ul { list-style: none; margin: 0; padding: 0 0 8px; display: grid; gap: 10px; }
.rk-how li { display: flex; gap: 10px; font-size: 14px; }
.rk-how li small { display: block; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.rk-how-i { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 2px solid var(--outline); }
.rk-how-i .rk-i { width: 17px; height: 17px; }
.rk-fine { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 4px 0 14px; }
.rk-h2 { font: 900 19px/1 var(--display); font-stretch: 70%; text-transform: uppercase; margin: 6px 0 10px; }
.rk-past-list { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 6px; scrollbar-width: none; }
.rk-past-chip { display: flex; align-items: center; gap: 8px; flex: none; padding: 6px 12px 6px 6px; border-radius: var(--r-pill); background: var(--surface); border: 2px solid var(--outline); text-decoration: none; color: var(--ink); }
.rk-past-chip > span { display: grid; line-height: 1.15; }
.rk-past-chip strong { font-size: 13px; font-weight: 850; }
.rk-past-chip small { font-size: 12px; color: var(--muted); font-weight: 650; }

/* ---------- Profile: titles and levels ---------- */
.rk-prof-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rk-title-chip, .rk-level-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 4px 14px 4px 8px; border-radius: var(--r-pill); border: 2px solid var(--outline); text-decoration: none; color: var(--ink); max-width: 100%; }
.rk-title-chip > span, .rk-level-chip > span { display: grid; line-height: 1.12; min-width: 0; }
.rk-title-chip strong, .rk-level-chip strong { font-size: 13.5px; font-weight: 850; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-title-chip small, .rk-level-chip small { font-size: 11.5px; font-weight: 700; opacity: .8; }
.rk-title-chip { background: var(--gold); color: #1d1f24; box-shadow: 2px 2px 0 var(--outline); }
.rk-title-chip .rk-i { width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: #fffdf7; border: 1.5px solid #1d1f24; }
.rk-level-chip { background: var(--surface-2); }
.rk-level-chip .rk-i { width: 18px; height: 18px; }
.rk-level-chip.is-add { border-style: dashed; }
@media (prefers-color-scheme: dark) { .rk-title-chip { border-color: #000; box-shadow: 2px 2px 0 #000; } .rk-level-chip { border-color: rgba(245, 241, 230, .3); } }

/* ---------- Oggi: «Classifica della settimana» ---------- */
.rk-home { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface); border: var(--card-border); box-shadow: var(--card-shadow); text-decoration: none; color: var(--ink); }
.rk-home:active { box-shadow: var(--press-shadow); transform: translate(2px, 2px); }
.rk-home-rank { display: grid; place-items: center; flex: none; width: 64px; height: 64px; border-radius: var(--r-md); background: var(--gold); color: #1d1f24; border: 2px solid var(--outline); line-height: 1; }
.rk-home-rank b { font: 900 32px/1 var(--display); font-stretch: 66%; }
.rk-home-rank small { font-size: 10.5px; font-weight: 800; }
.rk-home-copy { display: grid; gap: 2px; min-width: 0; flex: 1; }
.rk-home-copy strong { font-size: 15.5px; font-weight: 850; }
.rk-home-copy small { font-size: 13px; color: var(--muted); font-weight: 650; }
.rk-home-go { color: var(--muted); }
@media (prefers-color-scheme: dark) { .rk-home-rank { border-color: #000; } }
