/* Сторінки поза грою: рейтинг, гравець, кабінет. Токени кольорів — зі style.css. */
html.page, html.page body { overflow: auto; height: auto; min-height: 100%; }
html.page body {
  background: radial-gradient(ellipse at 50% -10%, rgba(64, 44, 120, .55), transparent 60%), var(--bg);
  user-select: text; -webkit-user-select: text;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px 64px; }
.topnav { display: flex; align-items: center; gap: 14px; padding: 16px 0 26px; flex-wrap: wrap; }
.brand { font: 400 22px var(--display); color: var(--text); text-decoration: none; letter-spacing: .02em; }
.brand span { color: var(--gold); }
.topnav nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.topnav nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 15px; }
.topnav nav a:hover, .topnav nav a.on { color: var(--text); background: rgba(255,255,255,.07); }

.box { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; margin-bottom: 16px; }
h1.pg { font: 800 30px/1.15 var(--font); margin: 0 0 6px; word-break: break-word; }
.sub { color: var(--muted); margin: 0 0 18px; line-height: 1.45; }
.sec { font: 700 17px var(--font); margin: 0 0 12px; }
.row2 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; margin-bottom: 14px; }
.period { color: var(--muted); font-size: 14px; }
.tabs.inline { display: inline-flex; }
.tabs.inline .tab { flex: none; padding: 8px 16px; }

/* таблиці */
.tablewrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 15px; }
table.tb th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.tb td { padding: 10px; border-bottom: 1px solid rgba(255,255,255,.05); font-variant-numeric: tabular-nums; vertical-align: middle; }
table.tb .num { text-align: right; }
table.tb tr.me td { background: rgba(255,209,102,.07); }
table.tb td.rank { font-weight: 800; color: var(--muted); width: 44px; }
table.tb tr:nth-child(-n+3) td.rank { color: var(--gold); }
.pts { font-weight: 800; color: var(--gold); }
.muted { color: var(--muted); }
.up { color: var(--ok); font-weight: 700; }
.down { color: var(--bad); font-weight: 700; }
.empty { color: var(--muted); padding: 24px 6px; text-align: center; }

/* нікнейм-кнопка й спливне вікно з історією */
.nick { appearance: none; background: none; border: 0; padding: 0; color: var(--text); font: 600 15px var(--font); cursor: pointer;
  text-decoration: underline dotted rgba(255,255,255,.35); text-underline-offset: 4px; text-align: left; }
.nick:hover { color: var(--gold); }
.pop { position: absolute; z-index: 30; min-width: 250px; max-width: min(340px, calc(100vw - 32px)); background: #1a1e36; border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px; box-shadow: 0 20px 50px rgba(0,0,0,.5); font-size: 14px; }
.pop h4 { margin: 0 0 8px; font-size: 15px; }
.pop ol { margin: 0 0 10px; padding-left: 18px; line-height: 1.6; }
.pop .when { color: var(--muted); font-size: 12px; margin-left: 6px; }
.pop a { color: var(--gold); }

/* картки місць */
.ranks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.rcard { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.rcard .k { color: var(--muted); font-size: 13px; }
.rcard .big { font: 800 30px var(--font); margin: 4px 0; font-variant-numeric: tabular-nums; }
.rcard .big small { font-size: 15px; color: var(--muted); font-weight: 600; }
.rcard .d { font-size: 13px; color: var(--muted); }
.rcard .d b { color: var(--gold); }

/* графік */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.tip { position: absolute; pointer-events: none; background: #1a1e36; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px;
  font-size: 13px; line-height: 1.45; white-space: nowrap; box-shadow: 0 10px 30px rgba(0,0,0,.45); transform: translate(-50%, calc(-100% - 12px)); }
.tip b { color: var(--text); }

/* форми кабінету */
.form { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.ok { color: var(--ok); margin: 0; }
.hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.hist li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.hist .arrow { color: var(--muted); }

@media (max-width: 640px) {
  .ranks { grid-template-columns: 1fr; }
  h1.pg { font-size: 24px; }
  table.tb { font-size: 14px; }
  table.tb .hide-sm { display: none; }
}

a.btn { text-decoration: none; display: inline-block; }

/* персонаж: редактор у кабінеті й портрет на сторінці гравця */
.hero-ed { display: grid; grid-template-columns: minmax(230px, 300px) 1fr; gap: 20px; align-items: start; }
.hero-stage { position: sticky; top: 12px; }
.hero-cv, .hero-mini { display: block; border-radius: 16px; border: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 88%, rgba(255,209,102,.16), transparent 62%), linear-gradient(#1c2142, #11142a); }
.hero-cv { width: 100%; aspect-ratio: 5 / 6; cursor: pointer; }
.hero-actions { margin-top: 12px; gap: 8px; }
.hero-actions .btn { padding: 9px 12px; font-size: 14px; flex: 1; }
.hero-actions .btn.primary { flex-basis: 100%; }
.hero-status { margin: 10px 0 0; font-size: 14px; }
.hero-tabs { flex-wrap: wrap; }
.hero-tabs .tab { flex: none; padding: 8px 12px; font-size: 14px; }
.hero-pane { margin-top: 14px; }
.hero-sub { font: 700 14px var(--font); color: var(--muted); margin: 16px 0 8px; }
.hero-sub:first-child { margin-top: 0; }
.hero-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; font-size: 14px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); cursor: pointer; padding: 0; }
.sw.on { border-color: #fff; box-shadow: 0 0 0 2px var(--gold); }
.hero-custom { width: 32px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 8px; max-height: 430px; overflow-y: auto; padding: 2px; }
.tile { position: relative; appearance: none; padding: 0; border: 2px solid transparent; border-radius: 12px; background: rgba(255,255,255,.05);
  cursor: pointer; aspect-ratio: 1; overflow: hidden; }
.hero-grid.outfit { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.hero-grid.outfit .tile { aspect-ratio: 4 / 5; }
.tile canvas { display: block; width: 100%; height: 100%; }
.tile:hover { background: rgba(255,255,255,.1); }
.tile.on { border-color: var(--gold); background: rgba(255,209,102,.12); }
.tile .none { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 0 4px; text-align: center; font: 700 12px var(--font); color: var(--text);
  background: rgba(7,9,18,.72); }
.phead { display: flex; gap: 18px; align-items: center; }
.hero-mini { width: 120px; height: 144px; flex: none; cursor: pointer; }
@media (max-width: 720px) {
  .hero-ed { grid-template-columns: 1fr; }
  .hero-stage { position: static; max-width: 300px; width: 100%; margin: 0 auto; }
  .hero-grid { max-height: 340px; }
  .hero-mini { width: 96px; height: 116px; }
}
