/* ============================================================
   乒乓世界 · 数据说明（Wave 5）
   ------------------------------------------------------------
   面向普通球迷：像一张比赛记录卡，而不是开发者面板。
   页面只讲三件事：这个数字是什么、怎么来的、能信多少。
   ============================================================ */

/* ---------- 可点击的数字 ---------- */
a.trace-link {
  color: inherit;
  text-decoration: none;
}
[data-trace] {
  cursor: pointer;
  border-bottom: 1px dashed rgba(0, 224, 198, 0.4);
  transition: border-color 0.15s ease, color 0.15s ease;
}
[data-trace]:hover,
[data-trace]:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
  outline: none;
}
[data-trace="none"] {
  cursor: default;
  border-bottom: 0;
}

/* ---------- 抽屉 ---------- */
.trace-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(4, 8, 16, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.trace-backdrop.is-on {
  opacity: 1;
  pointer-events: auto;
}

.trace-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 910;
  width: min(600px, 94vw);
  background: #0c1320;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -30px 0 70px rgba(0, 0, 0, 0.5);
  transform: translateX(102%);
  transition: transform 0.24s cubic-bezier(0.22, 0.61, 0.36, 1);
  display: flex;
  flex-direction: column;
}
.trace-drawer.is-on {
  transform: translateX(0);
}
.trace-drawer__scroll {
  overflow-y: auto;
  padding: 22px 22px 60px;
  overscroll-behavior: contain;
}
.trace-drawer__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(25, 20, 12, 0.14);
  background: rgba(25, 20, 12, 0.07);
  color: #4a4438;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(3px);
}
.trace-drawer__close:hover {
  background: rgba(25, 20, 12, 0.12);
}

/* ---------- 独立页 ---------- */
.trace-page-new {
  max-width: 1280px;
  margin: 0 auto;
  padding: 112px 40px 96px;
}

/* 独立页：桌面端左右分栏，把屏幕铺满 */
.tp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 0 52px;
  align-items: start;
}
.tp-col {
  min-width: 0;
}
.tp-col--side {
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  padding-left: 52px;
}
.trace-page-new .trace-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.trace-back {
  font-size: 13px;
  color: var(--text-1);
  text-decoration: none;
}
.trace-back:hover {
  color: var(--text-0);
}

/* ---------- 顶部记分卡 ---------- */
.tp-card {
  position: relative;
  padding: 20px 50px 20px 22px;
  border-radius: 18px;
  background:
    radial-gradient(120% 150% at 100% 0%, rgba(214, 74, 22, 0.1), transparent 55%),
    repeating-linear-gradient(
      90deg,
      rgba(70, 52, 22, 0.055) 0 1px,
      transparent 1px 30px
    ),
    #f2ead9;
  color: #1c1914;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.tp-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 22px;
}
.tp-card__kicker {
  font-size: 12px;
  color: #7a6d58;
  letter-spacing: 0.02em;
}
.tp-card__open {
  font-size: 12px;
  color: #7a6d58;
  text-decoration: none;
  border-bottom: 1px solid rgba(28, 25, 20, 0.2);
  white-space: nowrap;
}
.tp-card__open:hover {
  color: #1c1914;
}
.tp-card__label {
  margin-top: 14px;
  font-size: 15px;
  font-weight: 600;
  color: #51483a;
}
.tp-card__value {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #1c1914;
  font-variant-numeric: tabular-nums;
}
.tp-card__subject {
  margin-top: 10px;
  font-size: 13.5px;
  color: #3d372d;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tp-card__meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: #7a6d58;
}
.tp-muted {
  color: #8a7f6c;
}

/* ---------- 一句话总结 ---------- */
.tp-summary {
  margin: 18px 2px 4px;
  padding-left: 14px;
  border-left: 2px solid var(--brand);
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--text-0);
}

/* ---------- 正文分节 ---------- */
.tp-sec {
  padding: 18px 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.tp-sec:last-of-type {
  border-bottom: 0;
}
.tp-sec__title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-0);
  display: flex;
  align-items: center;
  gap: 8px;
}
.tp-sec__title::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand);
  flex: none;
}
.tp-sec__body {
  font-size: 14.5px;
  line-height: 1.85;
  color: #c3ccdd;
}
.tp-sec__body > p {
  margin: 0 0 10px;
}
.tp-sec__body > p:last-child {
  margin-bottom: 0;
}
.tp-note {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-2);
}

/* ---------- 算式 ---------- */
.tp-formula {
  margin: 4px 0 14px;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.tp-formula p {
  margin: 0;
  font-size: 14px;
  line-height: 1.95;
  color: var(--text-0);
  font-variant-numeric: tabular-nums;
}
.tp-formula p + p {
  color: var(--text-1);
}
.tp-formula p:first-child {
  font-weight: 600;
}

/* ---------- 计算步骤 ---------- */
.tp-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.tp-steps li {
  position: relative;
  padding: 0 0 12px 30px;
  font-size: 14px;
  line-height: 1.8;
  color: #c3ccdd;
  counter-increment: step;
}
.tp-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: #ffd7c6;
  background: rgba(255, 92, 26, 0.16);
  border: 1px solid rgba(255, 92, 26, 0.3);
}
.tp-steps li:last-child {
  padding-bottom: 0;
}

/* ---------- 参与计算的数字 ---------- */
.tp-figures {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 1px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
}
.tp-figure {
  background: #0e1624;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tp-figure span {
  font-size: 12px;
  color: var(--text-2);
}
.tp-figure b {
  font-size: 19px;
  color: var(--text-0);
  font-variant-numeric: tabular-nums;
}

/* ---------- 覆盖说明折叠 ---------- */
.tp-more {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-2);
}
.tp-more summary {
  cursor: pointer;
  color: var(--text-1);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.2);
  padding-bottom: 1px;
}
.tp-more summary::-webkit-details-marker {
  display: none;
}
.tp-more summary::before {
  content: "+";
  color: var(--brand);
  font-size: 13px;
}
.tp-more[open] summary::before {
  content: "−";
}
.tp-more ul {
  margin: 10px 0 0;
  padding-left: 18px;
  line-height: 1.75;
}
.tp-more li {
  margin-bottom: 6px;
}
.tp-more li b {
  color: var(--text-1);
  font-weight: 500;
}

/* ---------- 问答 ---------- */
.tp-qa {
  display: grid;
  gap: 14px;
}
.tp-qa__q {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-0);
}
.tp-qa__a {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.8;
  color: #c3ccdd;
}

/* ---------- 明细表 ---------- */
.tp-evd {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}
.tp-evd table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  white-space: nowrap;
}
.tp-evd th,
.tp-evd td {
  padding: 9px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-align: left;
}
.tp-evd__date {
  display: block;
  color: var(--text-0);
  font-size: 12.5px;
}
.tp-evd__event {
  display: block;
  margin-top: 2px;
  max-width: 260px;
  white-space: normal;
  line-height: 1.6;
  color: var(--text-2);
  font-size: 11px;
}
.tp-evd th {
  position: sticky;
  top: 0;
  background: #141d2d;
  color: var(--text-2);
  font-weight: 500;
  font-size: 11.5px;
}
.tp-evd td {
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
.tp-evd tr:last-child td {
  border-bottom: 0;
}
.tp-evd .is-win {
  color: var(--accent);
}
.tp-evd .is-lose {
  color: #ff9b87;
}
/* 逐局比分完整换行展示，不截断 */
.tp-evd td.tp-evd__games {
  white-space: normal;
  min-width: 240px;
  max-width: 420px;
  line-height: 1.75;
  color: var(--text-0);
}
.tp-evd td.tp-evd__opponent {
  white-space: normal;
  min-width: 120px;
}

.tp-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--text-2);
}
.tp-pager button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: var(--text-1);
  border-radius: 8px;
  padding: 5px 11px;
  cursor: pointer;
}
.tp-pager button:hover:not(:disabled) {
  color: var(--text-0);
  border-color: rgba(255, 255, 255, 0.28);
}
.tp-pager button:disabled {
  opacity: 0.35;
  cursor: default;
}

.tp-footnote {
  margin-top: 22px;
  font-size: 12px;
  color: var(--text-2);
  text-align: right;
}

.tp-loading,
.tp-error {
  padding: 28px 4px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.8;
}
.tp-error {
  color: #ff9b87;
}

.tp-chip {
  display: inline-block;
  font-size: 11.5px;
  color: var(--text-1);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ---------- 独立页：桌面端放大字号 ---------- */
.trace-page-new .tp-card {
  padding: 32px 60px 30px 34px;
  border-radius: 22px;
}
.trace-page-new .tp-card__label {
  font-size: 17px;
}
.trace-page-new .tp-card__value {
  font-size: clamp(64px, 8.4vw, 108px);
}
.trace-page-new .tp-card__subject {
  font-size: 16px;
}
.trace-page-new .tp-card__meta {
  font-size: 13px;
}
.trace-page-new .tp-summary {
  margin: 24px 4px 6px;
  font-size: 19px;
  line-height: 1.8;
  max-width: 72ch;
}
.trace-page-new .tp-sec {
  padding: 24px 0 22px;
}
.trace-page-new .tp-sec__title {
  font-size: 16px;
  margin-bottom: 14px;
}
.trace-page-new .tp-sec__body {
  font-size: 16px;
  line-height: 1.95;
}
.trace-page-new .tp-formula {
  padding: 20px 22px;
}
.trace-page-new .tp-formula p {
  font-size: 16px;
}
.trace-page-new .tp-steps li {
  font-size: 15.5px;
  line-height: 1.9;
  padding-bottom: 16px;
}
.trace-page-new .tp-figure {
  padding: 16px 18px;
}
.trace-page-new .tp-figure span {
  font-size: 12.5px;
}
.trace-page-new .tp-figure b {
  font-size: 24px;
}
.trace-page-new .tp-qa__q {
  font-size: 15.5px;
}
.trace-page-new .tp-qa__a {
  font-size: 15.5px;
}
.trace-page-new .tp-evd table {
  font-size: 14px;
}
.trace-page-new .tp-evd th,
.trace-page-new .tp-evd td {
  padding: 12px 14px;
}
.trace-page-new .tp-evd__date {
  font-size: 14px;
}
.trace-page-new .tp-evd__event {
  font-size: 12px;
}

/* ---------- 移动端：底部抽屉 ---------- */
@media (max-width: 720px) {
  .trace-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 90vh;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px 20px 0 0;
    transform: translateY(102%);
  }
  .trace-drawer.is-on {
    transform: translateY(0);
  }
  .trace-drawer__scroll {
    padding: 18px 16px 46px;
  }
  .trace-page-new {
    padding: 92px 16px 60px;
  }
  .tp-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .tp-col--side {
    border-left: 0;
    padding-left: 0;
  }
  .tp-card {
    padding: 18px 46px 18px 18px;
  }
  .trace-page-new .tp-card {
    padding: 20px 46px 20px 20px;
    border-radius: 18px;
  }
  .trace-page-new .tp-card__value {
    font-size: clamp(44px, 13vw, 64px);
  }
  .trace-page-new .tp-summary {
    font-size: 16px;
  }
  .trace-page-new .tp-sec__body {
    font-size: 15px;
  }
  .tp-evd td.tp-evd__games {
    min-width: 190px;
    max-width: 260px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .trace-drawer,
  .trace-backdrop {
    transition: none;
  }
}
