/* rating addon —— 排名分与段位展示
 *
 * 色板：时间复杂度 10 档，500 分一档。
 * 基础规则取「浅色主题可读」的深色值，.theme--dark 覆盖为浅色值。
 * 只作用于非链接元素（徽章用 span 不用 a），因此不受主题的 a{color} 规则影响。
 */

/* ---------- 段位色（前景色 + 胶囊实心底 --rt-bg） ----------
 * 每档给两个值：color 用于文字/折线/排行榜数字，--rt-bg 用于徽章实心底。
 * 浅色主题：字取 700 档、底取 100 档（对比度 ≥ 6:1，胶囊里的小字号公式才看得清）；
 * 深色主题：字取 300/400 档、底取 800 档（在 #0d1117 上能立住，不会糊成一片）。 */
.rt-c-o1 { color: #475569; --rt-bg: #e2e8f0; }
.rt-c-ologn { color: #15803d; --rt-bg: #dcfce7; }
.rt-c-osqrt { color: #0e7490; --rt-bg: #cffafe; }
.rt-c-on { color: #1d4ed8; --rt-bg: #dbeafe; }
.rt-c-onlogn { color: #4338ca; --rt-bg: #e0e7ff; }
.rt-c-on2 { color: #7e22ce; --rt-bg: #f3e8ff; }
.rt-c-on3 { color: #a21caf; --rt-bg: #fae8ff; }
.rt-c-o2n { color: #c2410c; --rt-bg: #ffedd5; }
.rt-c-onf { color: #b91c1c; --rt-bg: #fee2e2; }
.rt-c-onn { color: #a16207; --rt-bg: #fef9c3; }

.theme--dark .rt-c-o1 { color: #cbd5e1; --rt-bg: #1e293b; }
.theme--dark .rt-c-ologn { color: #4ade80; --rt-bg: #166534; }
.theme--dark .rt-c-osqrt { color: #22d3ee; --rt-bg: #155e75; }
.theme--dark .rt-c-on { color: #60a5fa; --rt-bg: #1e40af; }
.theme--dark .rt-c-onlogn { color: #818cf8; --rt-bg: #3730a3; }
.theme--dark .rt-c-on2 { color: #c084fc; --rt-bg: #5b21b6; }
.theme--dark .rt-c-on3 { color: #e879f9; --rt-bg: #86198f; }
.theme--dark .rt-c-o2n { color: #fb923c; --rt-bg: #9a3412; }
.theme--dark .rt-c-onf { color: #f87171; --rt-bg: #991b1b; }
.theme--dark .rt-c-onn { color: #facc15; --rt-bg: #854d0e; }

/* ---------- 用户名后的段位徽章（实心胶囊 + 服务端渲染的 KaTeX） ---------- */
.rt-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.45rem;
  padding: 0 .55rem;
  margin-left: .25rem;
  border: 1px solid transparent;
  /* 描边取「实心底 + 段位色」的中间值，让淡色底也有清晰轮廓；
     浏览器不支持 color-mix 时该声明被忽略，退化为无描边，不影响可读性 */
  border-color: color-mix(in srgb, currentColor 22%, transparent);
  border-radius: 1rem;
  background: var(--rt-bg, #e5e7eb);
  font-size: .8rem;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
  cursor: default;
}

/* KaTeX 默认 1.21em，缩回 1em 以免把徽章撑高；字体族仍用 KaTeX_Main */
.rt-badge .katex {
  font-size: 1em;
  line-height: 1.1;
}

/* ---------- 排行榜排名分列 ---------- */
.col--rating { width: 76px; }

/* ---------- 个人主页 · 排名分标签页 ---------- */
.rt-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
  margin: .25rem 0 1.1rem;
}

.rt-stat { min-width: 5rem; }

.rt-stat__num {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
}

.rt-stat__num--tier .katex { font-size: 1em; }

.rt-stat__label {
  font-size: .75rem;
  opacity: .6;
  margin-top: .15rem;
}

/* ---------- 曲线 ---------- */
.rt-chart {
  position: relative;
  margin: .9rem 0 .4rem;
}

.rt-chart svg { display: block; width: 100%; height: auto; }

.rt-chart__note {
  font-size: .75rem;
  opacity: .55;
  margin-top: .4rem;
}

.rt-dot { transition: r .12s ease; }

.rt-hit { cursor: pointer; }

.rt-guide { transition: opacity .12s ease; }

/* ---------- 悬浮提示 ---------- */
.rt-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  min-width: 9.5rem;
  padding: .45rem .6rem;
  border-radius: .4rem;
  background: #1f2328;
  color: #fff;
  font-size: .75rem;
  line-height: 1.5;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
}

.theme--dark .rt-tip {
  background: #e6edf3;
  color: #0d1117;
}

.rt-tip__title {
  font-weight: 500;
  margin-bottom: .25rem;
  white-space: normal;
  max-width: 15rem;
}

.rt-tip__row {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.rt-tip__k { opacity: .65; }

.rt-tip__v {
  font-variant-numeric: tabular-nums;
}

/* ---------- 参赛流水表 ---------- */
.rt-hist { margin-top: .9rem; }

.rt-hist__date {
  display: block;
  font-size: .6875rem;
  opacity: .5;
}

.rt-col--i { width: 74px; }
.rt-col--r { width: 76px; }
.rt-col--s { width: 66px; }
.rt-col--a { width: 84px; }
.rt-col--d { width: 66px; }

.rt-up { color: #dc2626; }
.rt-down { color: #16a34a; }
.rt-hold { opacity: .6; }

.theme--dark .rt-up { color: #f87171; }
.theme--dark .rt-down { color: #4ade80; }
