/* LinkedLines Community Replays — 与 iOS 端视觉对齐
   背景 #F6F7F9 / 主色 #4F6BED / 主文字 #1C2130 / 次文字 #8C919F / 浅灰 #EEF0F4 */

:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --accent: #4f6bed;
  --accent-soft: rgba(79, 107, 237, 0.12);
  --text: #1c2130;
  --text-sub: #8c919f;
  --line: #e6e8ee;
  --gray: #eef0f4;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(28, 33, 48, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-top, 0px));
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: -0.2px; }

.brand-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #8fa3ff, var(--accent) 62%, #3349c4);
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.18);
}

.brand-text { font-size: 17px; }

.tabs { margin-left: auto; display: flex; gap: 6px; background: var(--gray); padding: 3px; border-radius: 999px; }

.tab {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--text-sub); cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.tab.is-active { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(28, 33, 48, 0.12); }

/* ---------- 容器 ---------- */
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 40px; }

/* ---------- 搜索 ---------- */
.searchbox {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow);
}
.search-icon { color: var(--text-sub); flex: none; }
.searchbox input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 15px; color: var(--text);
}
.searchbox input::placeholder { color: var(--text-sub); }

.meta-row { display: flex; align-items: center; justify-content: space-between; margin: 14px 4px 8px; }
.meta { font-size: 13px; color: var(--text-sub); }
.state { font-size: 12px; color: var(--accent); opacity: 0; transition: opacity 0.2s; }
.state.is-on { opacity: 1; }

/* ---------- 列表 ---------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  cursor: pointer; transition: transform 0.12s, box-shadow 0.12s;
}
.item:active { transform: scale(0.99); box-shadow: 0 1px 4px rgba(28, 33, 48, 0.08); }

.rank {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--gray); color: var(--text-sub);
}
.rank.is-top { background: var(--accent-soft); color: var(--accent); }

.item-main { min-width: 0; flex: 1; }
.item-name { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; }
.item-name .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  flex: none; font-size: 10px; font-weight: 600; line-height: 1;
  padding: 3px 6px; border-radius: 6px; background: var(--gray); color: var(--text-sub);
}

.item-sub { margin-top: 4px; font-size: 12px; color: var(--text-sub); }

.item-score { flex: none; text-align: right; }
.score-val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; }
.score-cap { font-size: 10px; letter-spacing: 0.6px; color: var(--text-sub); text-transform: uppercase; }

.skel { height: 72px; border-radius: var(--radius); background: linear-gradient(90deg, #f0f1f5 25%, #f7f8fa 37%, #f0f1f5 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite linear; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------- 底部 ---------- */
.list-footer { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 18px; }
.btn-more {
  border: 0; background: var(--accent-soft); color: var(--accent);
  font-weight: 600; font-size: 14px; padding: 11px 22px; border-radius: 999px; cursor: pointer;
}
.btn-more:disabled { opacity: 0.5; }
.empty { color: var(--text-sub); font-size: 14px; margin: 24px 0; }

.foot { text-align: center; font-size: 12px; color: var(--text-sub); padding: 0 16px calc(24px + env(safe-area-inset-bottom, 0px)); }

/* ================= 播放页 ================= */
.player-wrap { max-width: 520px; margin: 0 auto; padding: 14px 16px calc(28px + env(safe-area-inset-bottom, 0px)); }

.phead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pback {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: var(--gray); color: var(--text); display: grid; place-items: center;
  cursor: pointer; font-size: 16px; line-height: 1;
}
.pnick { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmeta { margin-top: 2px; font-size: 12px; color: var(--text-sub); }

.board-card {
  background: var(--card); border-radius: 20px; padding: 14px;
  box-shadow: var(--shadow);
}
canvas#board { width: 100%; height: auto; display: block; border-radius: 12px; touch-action: manipulation; }

.preview-row { display: flex; justify-content: center; align-items: center; margin-top: 10px; }
canvas#preview { width: 120px; height: 40px; display: block; }

.hud { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 4px 6px; }
.hud-score { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; font-variant-numeric: tabular-nums; }
.hud-step { font-size: 12px; color: var(--text-sub); font-variant-numeric: tabular-nums; }

.slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px;
  background: var(--line); outline: none; margin: 10px 0 4px;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(28, 33, 48, 0.2); cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  border: 2px solid var(--accent); cursor: pointer;
}

.controls { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.cbtn {
  border: 0; border-radius: 999px; cursor: pointer;
  display: grid; place-items: center; background: var(--gray); color: var(--text);
  width: 44px; height: 44px;
}
.cbtn:disabled { opacity: 0.4; }
.cbtn.play {
  width: 58px; height: 58px; background: var(--accent); color: #fff;
  box-shadow: 0 6px 16px rgba(79, 107, 237, 0.34);
}
.cbtn.speed { width: auto; padding: 0 14px; height: 36px; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); }

.hint { margin-top: 16px; text-align: center; font-size: 12px; color: var(--text-sub); }
.err { margin: 40px auto; text-align: center; color: var(--text-sub); font-size: 14px; line-height: 1.7; }

/* ================= 玩家专题页 ================= */
a.plink { color: var(--text); }
a.plink:active { color: var(--accent); }
.pnick.is-link { cursor: pointer; }
.pnick.is-link:active { color: var(--accent); }

.profile-wrap { max-width: 720px; }

.pcard {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 12px; margin-bottom: 14px;
}
.pstats { display: flex; align-items: stretch; }
.pstat { flex: 1; min-width: 0; text-align: center; padding: 2px 4px; }
.pstat + .pstat { border-left: 1px solid var(--line); }
.pstat b {
  display: block; font-size: 17px; font-weight: 700; letter-spacing: -0.3px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pstat span { display: block; margin-top: 5px; font-size: 11px; color: var(--text-sub); }
.pstat.is-link { cursor: pointer; }
.pstat.is-link b { color: var(--accent); }

.tabs-inline { margin: 0 0 2px; width: max-content; margin-left: 0; }
