/* Рейтинг (public/leaderboard.html + rating.js), 23.10 — у стилі лобі й профілю: фон-арт залу трофеїв (.pf-bg з
   profile.css), темні панелі, золоті заголовки, вкладки кнопками, п'єдестал топ-3 з персонажами, таблиця.
   Статичний каркас: шапка, вкладки, рядок «моє місце» і п'єдестал мають висоту наперед — дані лише заповнюють місця,
   перемикання вкладки нічого не зсуває (таблиця під ними росте за кількістю гравців — і лише вона). */
.rt-wrap { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 28px 20px 56px; color: #eadfc8; }

/* ---------- шапка: назва, як рахуються очки; праворуч — вкладки, період, моє місце ---------- */
.rt-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 28px; align-items: end; margin-bottom: 22px; }
.rt-h { margin: 0 0 10px; font: 400 44px/1 var(--display); letter-spacing: .02em; color: #fff3da; text-shadow: 0 2px 0 #000, 0 0 30px rgba(255, 209, 102, .35); }
.rt-sub { margin: 0; max-width: 560px; color: #d4c7aa; font-size: 15px; line-height: 1.5; text-shadow: 0 1px 2px #000; }
.rt-ctl { display: flex; flex-direction: column; align-items: stretch; gap: 8px; text-align: right; }
.rt-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(23, 16, 9, .9); border: 1px solid rgba(255, 209, 102, .22); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.rt-tab { appearance: none; border: 0; background: transparent; color: #d4c7aa; font: 700 15px/1 var(--font); width: 112px; height: 40px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.rt-tab:hover:not(.on) { color: #fff3da; background: rgba(255, 255, 255, .06); }
.rt-tab.on { background: linear-gradient(180deg, #ffe39a, #ffb43f); color: #2b1800; }
.rt-tab:focus-visible { outline: 2px solid #ffd166; outline-offset: 2px; }
.rt-period, .rt-mine { margin: 0; height: 20px; line-height: 20px; font-size: 14px; color: #c9bc9f; text-shadow: 0 1px 2px #000; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rt-mine { color: #ffe7a8; font-weight: 700; }

/* ---------- п'єдестал: 2 · 1 · 3, висоти наперед ---------- */
.rt-podium { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr) minmax(0, 1fr); gap: 16px; align-items: end; max-width: 760px; height: 372px; margin: 0 auto 22px; }
.rt-step { --c: #ffd166; --c2: #b77a12; position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; color: inherit; text-decoration: none; }
.rt-step.p2 { --c: #dfe5ee; --c2: #7f8a99; }
.rt-step.p3 { --c: #e6a46a; --c2: #8a4d1e; }
.rt-hero { position: relative; display: block; width: 132px; height: 150px; border-radius: 18px; overflow: hidden; flex: none;
  background: radial-gradient(ellipse at 50% 92%, color-mix(in srgb, var(--c) 34%, transparent), transparent 64%), linear-gradient(#2a1d10, #120c06);
  border: 2px solid color-mix(in srgb, var(--c) 70%, transparent); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); transition: transform .15s, border-color .15s; }
.rt-step.p1 .rt-hero { width: 158px; height: 180px; box-shadow: 0 12px 34px rgba(0, 0, 0, .55), 0 0 36px rgba(255, 209, 102, .28); }
.rt-hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 1; }
.rt-hero i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 400 54px/1 var(--display); font-style: normal; color: var(--c); opacity: .75; }
.rt-hero.drawn i { visibility: hidden; }
.rt-nick { display: block; max-width: 100%; margin-top: 10px; font: 800 18px/1.2 var(--font); color: #fff3da; text-shadow: 0 1px 2px #000; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; height: 22px; }
.rt-step.p1 .rt-nick { font-size: 20px; height: 24px; }
.rt-pts { display: block; height: 20px; margin-top: 2px; font: 700 15px/20px var(--font); color: var(--c); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt-base { display: flex; align-items: flex-start; justify-content: center; width: 100%; margin-top: 10px; border-radius: 14px 14px 6px 6px; padding-top: 10px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 34%, #2a1d10), rgba(23, 16, 9, .95) 85%); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-bottom: 0; }
.rt-base span { font: 400 40px/1 var(--display); color: var(--c); text-shadow: 0 2px 0 #000; }
.rt-step.p1 .rt-base { height: 104px; }
.rt-step.p1 .rt-base span { font-size: 52px; }
.rt-step.p2 .rt-base { height: 76px; }
.rt-step.p3 .rt-base { height: 58px; }
.rt-step[href]:hover .rt-hero, .rt-step[href]:focus-visible .rt-hero { transform: translateY(-4px); border-color: var(--c); }
.rt-step:focus-visible { outline: none; }
.rt-step:focus-visible .rt-nick { text-decoration: underline; text-underline-offset: 3px; }
.rt-step.me .rt-nick::after { content: ' ★'; color: #ffd166; }
.rt-step.rt-free .rt-hero { opacity: .55; border-style: dashed; }
.rt-step.rt-free .rt-nick { color: #8f846e; font-weight: 600; font-size: 15px; }
.rt-step.rt-free .rt-pts { color: #6f6553; }

/* ---------- таймери (24.10 вечір): до кінця тижня й сезону, за Києвом; висота наперед ---------- */
.rt-timers { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 22px; height: 34px; margin: -6px auto 14px; color: #c9bc9f; font-size: 14px; text-shadow: 0 1px 2px #000; }
.rt-tm { white-space: nowrap; padding: 4px 12px; border-radius: 999px; background: rgba(23, 16, 9, .78); border: 1px solid rgba(255, 209, 102, .18); }
.rt-tm .v { color: #ffe7a8; font: 800 15px/1 var(--font); font-variant-numeric: tabular-nums; }
.rt-tm.on { border-color: rgba(255, 209, 102, .6); }
.rt-tz { color: #8f846e; }

/* ---------- нагороди під п'єдесталом (24.10 вечір): та сама сітка 2·1·3 ---------- */
.rt-rewards { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr) minmax(0, 1fr); gap: 16px; max-width: 760px; height: 64px; margin: -12px auto 6px; }
.rt-rw-cell { position: relative; display: flex; justify-content: center; align-items: flex-start; min-width: 0; }
.rt-rw { appearance: none; display: inline-flex; align-items: center; gap: 8px; max-width: 100%; height: 56px; padding: 4px 12px 4px 6px; border-radius: 14px; cursor: pointer;
  background: rgba(23, 16, 9, .9); border: 1px solid rgba(255, 209, 102, .3); color: #eadfc8; font: 700 14px/1.15 var(--font); text-align: left; }
.rt-rw:hover, .rt-rw:focus-visible, .rt-rw[aria-expanded="true"] { border-color: #ffd166; outline: none; background: rgba(43, 30, 14, .95); }
.rt-rw .gift-art { flex: none; width: 46px; height: 46px; background-size: contain; background-position: center; background-repeat: no-repeat; }
.rt-rw-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rt-rw-c { color: #ffe7a8; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rt-rw-c .coin { font-size: 15px; margin-right: 4px; }
.rt-rw-n { color: #a89c84; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-rw-year { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; color: #a89c84; font-size: 14px; }
.rt-rw-year[hidden] { display: none; }
.rt-rw-note { max-width: 760px; min-height: 38px; margin: 0 auto 18px; text-align: center; color: #a89c84; font-size: 13px; line-height: 1.45; text-shadow: 0 1px 2px #000; }
/* подробиці нагороди — поверх сторінки, нічого не зсуває */
.rt-rw-pop { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 20; width: 260px; max-width: 86vw; padding: 12px 14px; border-radius: 14px; text-align: left;
  background: #1d140b; border: 1px solid rgba(255, 209, 102, .5); box-shadow: 0 18px 40px rgba(0, 0, 0, .6); color: #eadfc8; font-size: 13.5px; line-height: 1.45; }
.rt-rw-pop b { display: block; color: #fff3da; font-size: 15px; margin-bottom: 4px; }
.rt-rw-pop ul { margin: 6px 0 0; padding-left: 16px; }
.rt-rw-pop a { color: #8fd3ff; font-weight: 700; margin-left: 6px; }

/* ---------- таблиця (базові стилі — .pf-tb у profile.css) ---------- */
.rt-board { padding: 8px 18px 12px; min-height: 280px; transition: opacity .15s; }
.rt-wrap[aria-busy] .rt-board, .rt-wrap[aria-busy] .rt-podium { opacity: .6; }
.rt-tb th.rk, .rt-tb td.rk { width: 64px; }
.rt-row { cursor: pointer; }
.rt-row:hover td { background: rgba(255, 209, 102, .06); }
.rt-row.me td { background: rgba(255, 209, 102, .1); }
.rt-rank { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 999px; font: 800 14px/1 var(--font);
  color: #c9bc9f; background: rgba(255, 255, 255, .05); font-variant-numeric: tabular-nums; }
.rt-row.rt-t1 .rt-rank { background: linear-gradient(180deg, #ffe39a, #ffb43f); color: #2b1800; }
.rt-row.rt-t2 .rt-rank { background: linear-gradient(180deg, #f2f5f9, #aab4c2); color: #1d2430; }
.rt-row.rt-t3 .rt-rank { background: linear-gradient(180deg, #f0b47c, #b0662a); color: #2a1404; }
.rt-tb td.who { max-width: 360px; }
/* нік з аватаром (24.10): голова персонажа 30 px, рамка — навколо (виходить на 26 %) */
.rt-who { display: flex; align-items: center; gap: 12px; min-width: 0; white-space: nowrap; }
.rt-ava { position: relative; flex: none; width: 30px; height: 30px; margin: 0 4px; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(255, 209, 102, .25), transparent 70%), linear-gradient(#2a1d10, #120c06); border: 1px solid rgba(255, 209, 102, .35); }
.rt-ava canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: 50%; }
.rt-ava i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 800 13px/1 var(--font); font-style: normal; color: #ffd166; }
.rt-ava.drawn i { visibility: hidden; }
.rt-ava.fr { border-color: transparent; }
.rt-name { color: #fff3da; font-weight: 700; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rt-name:hover, .rt-name:focus-visible { color: #ffe7a8; text-decoration: underline; text-underline-offset: 3px; outline: none; }
.rt-you { color: #a89c84; font-size: 13px; }
.rt-tb .muted { color: #a89c84; }
.rt-empty { padding: 36px 10px !important; text-align: center; color: #c9bc9f; white-space: normal; }
.rt-empty.err { color: #ffb3b3; }

/* ---------- вузько й телефон ---------- */
@media (max-width: 860px) {
  .rt-top { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .rt-ctl { text-align: left; }
  .rt-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rt-tab { width: auto; }
}
@media (max-width: 600px) {
  .rt-wrap { padding: 16px 12px 36px; }
  .rt-h { font-size: 32px; margin-bottom: 8px; }
  .rt-sub { font-size: 14px; }
  .rt-period, .rt-mine { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rt-podium { gap: 8px; height: 288px; margin-bottom: 16px; }
  .rt-hero { width: 96px; height: 112px; border-radius: 14px; }
  .rt-step.p1 .rt-hero { width: 112px; height: 132px; }
  .rt-hero i { font-size: 40px; }
  .rt-nick, .rt-step.p1 .rt-nick { font-size: 14px; height: 18px; margin-top: 8px; }
  .rt-pts { font-size: 13px; height: 18px; line-height: 18px; }
  .rt-base span { font-size: 30px; }
  .rt-step.p1 .rt-base { height: 78px; }
  .rt-step.p1 .rt-base span { font-size: 38px; }
  .rt-step.p2 .rt-base { height: 58px; }
  .rt-step.p3 .rt-base { height: 44px; }
  .rt-step.rt-free .rt-nick { font-size: 13px; }
  .rt-board { padding: 4px 8px 8px; min-height: 220px; }
  .rt-timers { height: 62px; flex-direction: column; gap: 4px; margin: -4px auto 10px; font-size: 13px; }
  .rt-tz { display: none; }
  .rt-rewards { gap: 8px; height: 56px; margin-top: -10px; }
  .rt-rw { height: 50px; padding: 3px 8px 3px 3px; gap: 4px; font-size: 13px; }
  .rt-rw .gift-art { width: 36px; height: 36px; }
  .rt-rw-n { display: none; }
  .rt-rw-note { min-height: 56px; font-size: 12.5px; }
  .rt-tb th.rk, .rt-tb td.rk { width: 44px; }
  .rt-tb td.who { max-width: 150px; }
}
