/* ===========================================================================
   无畏契约（VALORANT）风格前端样式 —— 查询端 + 商家后台共用
   调色板：红 #FF4655 / 深蓝 #0F1923 / 米白 #ECE8E1 / 青 #0AC8B9
   视觉特征：切角面板、大写间距标题、细线分隔、HUD 式数据块
   =========================================================================== */

:root {
  --bg: #0f1923;
  --bg-2: #111d29;
  --panel: #16222e;
  --panel-2: #101b26;
  --panel-hi: #1b2a38;
  --line: #33414e;
  --line-soft: #22303c;
  --text: #ece8e1;
  --muted: #8b9aa3;
  --brand: #ff4655;
  --brand-hi: #ff5f6c;
  --win: #0ac8b9;
  --warn: #e8c15a;
  --err: #ff4655;
  --info: #4fa8ff;
  --radius: 2px;
  --cut: 14px;
  --shadow: 0 10px 28px rgba(0, 0, 0, .45);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  background-color: var(--bg);
  /* 深蓝底 + 斜细纹 + 右上角红色微光 */
  background-image:
    repeating-linear-gradient(135deg, rgba(236, 232, 225, .022) 0 2px, transparent 2px 26px),
    radial-gradient(1000px 560px at 88% -12%, rgba(255, 70, 85, .12), transparent 62%);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: none; color: var(--brand-hi); }

code { color: #ffd7db; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0c141c; }
::-webkit-scrollbar-thumb { background: #33414e; border: 2px solid #0c141c; }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

/* ------------------------------ 标题行 ------------------------------ */
.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 2px 18px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 18px;
}

.page-head .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: default;
}

.page-head .dot {
  width: 10px; height: 26px;
  background: var(--brand);
  transform: skewX(-14deg);
}

.page-head .brand-en {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--muted);
  transform: translateY(3px);
}

.page-head .spacer { flex: 1; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 18px 90px; }
.wrap.wide { max-width: 1400px; }

/* ------------------------------ 面板 ------------------------------- */
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(236, 232, 225, .035), rgba(236, 232, 225, .012)), var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  /* 右上角切口 */
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
}

.panel h2, .panel h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 标题前的红色斜杠 */
.panel h2::before, .panel h3::before {
  content: "";
  width: 4px; height: 16px;
  background: var(--brand);
  transform: skewX(-14deg);
  flex: none;
}

.panel h3 { font-size: 13px; color: var(--muted); letter-spacing: 1.5px; margin-top: 16px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row.tight { gap: 8px; }
.grow { flex: 1; min-width: 220px; }

/* ------------------------------ 表单 ------------------------------- */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
label.field > span { font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }

input, select, textarea {
  background: #0c151e;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  min-width: 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(255, 70, 85, .16);
}
input::placeholder, textarea::placeholder { color: #55636d; }
select { cursor: pointer; }

button {
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  transition: background .15s ease, transform .06s ease;
  font-family: inherit;
}
button:hover { background: var(--brand-hi); }
button:active { transform: translateY(1px); }
button[disabled] { opacity: .45; cursor: not-allowed; }

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  clip-path: none;
}
button.ghost:hover { border-color: var(--brand); color: #fff; background: rgba(255, 70, 85, .08); }

button.small { padding: 6px 12px; font-size: 12px; letter-spacing: 1px; }
button.danger { background: #c8384a; }
button.danger:hover { background: #e04759; }

/* ------------------------------ 徽章 ------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #101b26;
  white-space: nowrap;
}
.badge.ok { color: #062a24; background: var(--win); border-color: transparent; }
.badge.warn { color: #2c2205; background: var(--warn); border-color: transparent; }
.badge.err { color: #fff; background: var(--err); border-color: transparent; }
.badge.info { color: #04202f; background: var(--info); border-color: transparent; }
.badge.gold { color: #2c2205; background: linear-gradient(135deg, #ffd479, #f0a93c); border-color: transparent; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mb0 { margin-bottom: 0; }

/* ------------------------------ 档案头 ------------------------------ */
.profile {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.profile .card-img {
  width: 76px; height: 76px; border-radius: var(--radius); object-fit: cover;
  border: 1px solid var(--line); background: #0c151e;
}
.profile .who { display: flex; flex-direction: column; gap: 6px; }
.profile .who .name { font-size: 24px; font-weight: 800; letter-spacing: .5px; line-height: 1.2; }
.profile .rankimg { width: 40px; height: 40px; }
.profile .stats { display: flex; gap: 0; margin-left: auto; flex-wrap: wrap; }

/* HUD 式数据块：数字大、标签小写间距、竖细线分隔 */
.profile .stats .kv {
  display: flex; flex-direction: column; align-items: center;
  padding: 2px 22px; border-left: 1px solid var(--line-soft);
}
.profile .stats .kv:first-child { border-left: none; }
.profile .stats .kv b { font-size: 24px; font-weight: 800; letter-spacing: 1px; line-height: 1.2; }
.profile .stats .kv span { font-size: 11px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }

/* ------------------------------ 数据网格 ---------------------------- */
.grid { display: grid; gap: 10px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.stat {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand);
  transform: skewY(-12deg);
  opacity: .85;
}
.stat b { display: block; font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.stat span { font-size: 11px; color: var(--muted); letter-spacing: 1px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 4px 10px; font-size: 12px;
}
.chip img { width: 20px; height: 20px; border-radius: 50%; background: #0c151e; }

/* ------------------------------ 比赛列表 ---------------------------- */
.match {
  display: grid;
  grid-template-columns: 3px 56px minmax(120px, 1fr) 90px 110px 90px 120px 130px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  background: var(--panel-2);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .06s ease;
}
.match:hover { border-color: var(--line); border-left-color: var(--brand); background: var(--panel-hi); }
.match:active { transform: scale(.995); }
.match .bar { width: 3px; height: 36px; border-radius: 0; background: var(--win); }
.match.loss .bar { background: var(--err); }
.match .agent { display: flex; align-items: center; gap: 8px; }
.match .agent img { width: 28px; height: 28px; border-radius: 50%; background: #0c151e; border: 1px solid var(--line-soft); }
.match .mode { font-weight: 700; letter-spacing: .5px; }
.match .kda { font-weight: 800; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.match .map { color: var(--muted); font-size: 12px; }
.match .tag { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.match .lock { font-size: 11px; letter-spacing: 1px; }
.match .rankimg { width: 22px; height: 22px; vertical-align: middle; }

/* 手机端：压缩为「首行概览 + 次行数据」的三行网格 */
@media (max-width: 900px) {
  .hide-sm { display: none !important; }
}

@media (max-width: 720px) {
  .match {
    grid-template-columns: 3px 44px 1fr auto;
    grid-template-rows: auto auto auto;
    row-gap: 6px;
    padding: 12px;
  }
  .match > :nth-child(1) { grid-column: 1; grid-row: 1 / span 3; height: 100%; }
  .match > :nth-child(2) { grid-column: 2; grid-row: 1; }
  .match > :nth-child(3) { grid-column: 3; grid-row: 1; }
  .match > :nth-child(4) { grid-column: 4; grid-row: 1; text-align: right; }
  .match > :nth-child(5) { grid-column: 3; grid-row: 2; }
  .match > :nth-child(6) { grid-column: 4; grid-row: 2; text-align: right; }
  .match > :nth-child(8) {
    grid-column: 2 / 5; grid-row: 3;
    display: flex; justify-content: space-between; align-items: center;
  }
}

/* ------------------------------ 表格 -------------------------------- */

/* ------------------------------ 表格 -------------------------------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th, table.data td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
table.data th {
  position: sticky; top: 0;
  background: #131f2b;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 11px;
  z-index: 1;
}
table.data tr:hover td { background: var(--panel-hi); }
table.data td.wrap-cell { white-space: normal; max-width: 260px; }

.table-scroll { overflow: auto; max-height: 62vh; border: 1px solid var(--line-soft); border-radius: var(--radius); }

/* ------------------------------ 分页 -------------------------------- */
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.pager input { width: 76px; }

/* ------------------------------ 代码块 ------------------------------ */
.codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding: 10px;
  background: #0c151e;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.codes .code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  letter-spacing: .5px;
  padding: 7px 9px;
  background: #101c27;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  cursor: pointer;
}
.codes .code:hover { border-color: var(--brand); }

/* ------------------------------ 弹层 -------------------------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(6, 12, 18, .82);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 16px;
  backdrop-filter: blur(3px);
}
.modal {
  width: min(1080px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.modal .modal-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
  position: sticky; top: -18px; background: var(--panel); padding: 10px 0; z-index: 2;
  border-bottom: 1px solid var(--line-soft);
}
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tabs button {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  padding: 8px 16px; clip-path: none;
}
.tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ------------------------------ 队伍 / 玩家 -------------------------- */
.team {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.team > header {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--panel-hi); font-weight: 700; letter-spacing: 1px;
  border-left: 3px solid var(--brand);
}
.team > header .pill { font-size: 12px; color: var(--muted); font-weight: 500; }
/* 玩家数据：手机端单列（10 人 10 行）、电脑端双列（5 行 × 2 列） */
.team .players { display: grid; gap: 8px; padding: 10px; grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .team .players { grid-template-columns: 1fr 1fr; }
}

.pcard {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.pcard.target {
  border-color: var(--brand);
  border-left: 3px solid var(--brand);
  background:
    linear-gradient(90deg, rgba(255, 70, 85, .16), rgba(255, 70, 85, .05) 55%, transparent),
    var(--panel-2);
  box-shadow: 0 0 0 1px rgba(255, 70, 85, .28) inset;
}
.pcard .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pcard .head img.agent { width: 28px; height: 28px; border-radius: 50%; background: #0c151e; }
.pcard .head img.rank { width: 22px; height: 22px; }
.pcard .head .nm { font-weight: 700; }
.pcard .kda { margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.pcard .metrics { display: none; flex-wrap: wrap; gap: 10px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-soft); font-size: 12px; }
.pcard.open .metrics { display: flex; }
.pcard .metrics .m b { color: var(--text); font-variant-numeric: tabular-nums; }
.pcard .metrics .m span { color: var(--muted); }

/* 玩家卡片展开/收起箭头 */
.pcard-arrow {
  padding: 0 8px;
  min-height: 22px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  clip-path: none;
  font-size: 12px;
  letter-spacing: 0;
  transition: transform .15s ease, color .15s ease, border-color .15s ease;
}
.pcard-arrow:hover { color: var(--brand); border-color: var(--brand); background: transparent; }
.pcard.open .pcard-arrow { transform: rotate(180deg); color: var(--brand); border-color: var(--brand); }

/* 组队徽章（颜色由内联样式按组队分配） */
.badge.party { letter-spacing: 1px; }

/* 回合经济表中被查询玩家的行高亮 */
table.data tr.target-row td {
  background: rgba(255, 70, 85, .10);
  border-top: 1px solid rgba(255, 70, 85, .35);
  border-bottom: 1px solid rgba(255, 70, 85, .35);
}
table.data tr.target-row td:first-child { border-left: 3px solid var(--brand); }
table.data tr.target-row:hover td { background: rgba(255, 70, 85, .16); }

/* ------------------------------ 时间线 ------------------------------ */
.timeline { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; }
.timeline .ev {
  display: grid; grid-template-columns: 60px 1fr 24px 1fr 130px 70px;
  gap: 8px; align-items: center; font-size: 13px;
  padding: 6px 8px; background: var(--panel-2); border-radius: var(--radius);
}
.timeline .ev .t { color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.timeline .ev .k { text-align: right; }
.timeline .ev .d { color: var(--muted); font-size: 12px; }

/* 对位战绩表：净胜列正负着色 */
table.data.duel td, table.data.duel th { text-align: center; }
table.data.duel td:first-child { text-align: left; }
table.data.duel .net-win { color: var(--win); font-weight: 800; }
table.data.duel .net-loss { color: var(--err); font-weight: 800; }

/* ------------------------------ 提示 ------------------------------- */
.notice {
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  background: #101b26;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 10px;
}
.notice.warn { border-left-color: var(--warn); color: #f0dca8; }
.notice.err { border-left-color: var(--err); color: #ffb9c1; }

.toast-host {
  position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column;
  gap: 8px; z-index: 100; max-width: min(380px, calc(100vw - 32px));
}
.toast {
  padding: 10px 14px; border-radius: var(--radius); font-size: 13px;
  background: #17232f; border: 1px solid var(--line); border-left: 3px solid var(--info);
  box-shadow: var(--shadow);
  animation: toast-in .18s ease;
}
.toast-ok { border-left-color: var(--win); }
.toast-err { border-left-color: var(--err); }
.toast-warn { border-left-color: var(--warn); }
.toast-out { opacity: 0; transform: translateY(6px); transition: all .25s ease; }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.hidden-copy { position: fixed; opacity: 0; pointer-events: none; left: -9999px; }

.empty {
  text-align: center; color: var(--muted); padding: 28px 10px; font-size: 13px;
  border: 1px dashed var(--line); border-radius: var(--radius);
}

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(236, 232, 225, .3);
  border-top-color: var(--brand);
  display: inline-block; vertical-align: -2px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 已绑定玩家的醒目展示（再次进入页面时只显示它，不再给输入框） */
.bound-player {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: clamp(18px, 4vw, 24px);
  font-weight: 700;
  letter-spacing: .5px;
  padding: 10px 18px;
  background: #0c151e;
  border: 1px solid var(--brand);
  border-left-width: 4px;
  color: #fff;
  word-break: break-all;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}

/* 无感分页底部哨兵 */
.load-sentinel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 10px;
  color: var(--muted);
}
.load-more { display: flex; justify-content: center; }

/* 排位趋势折线图 */
.trend-chart { width: 100%; max-width: 760px; }
.trend-chart svg { width: 100%; height: 180px; display: block; }
.trend-chart .line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.trend-chart .axis { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 4; }
.trend-chart .pt { stroke: none; }
.trend-chart .pt.win { fill: var(--win); }
.trend-chart .pt.loss { fill: var(--err); }

/* 卡密历史下拉（点击输入框弹出） */
.code-field { position: relative; }
.code-history {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 30;
  margin-top: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
  overflow: hidden;
}
.code-history .code-item {
  padding: 9px 12px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  border-bottom: 1px solid var(--line-soft);
}
.code-history .code-item:last-child { border-bottom: none; }
.code-history .code-item:hover { background: var(--panel-hi); color: var(--brand); }

/* ------------------------------ 移动端适配 -------------------------- */
@media (max-width: 720px) {
  .wrap, .wrap.wide { padding: 16px 12px 70px; }
  .panel { padding: 14px; }
  .panel h2 { font-size: 14px; letter-spacing: 1.5px; }

  .page-head { padding-bottom: 14px; }
  .page-head .brand { font-size: 17px; }
  .page-head .brand-en { letter-spacing: 2px; }

  .profile { gap: 12px; }
  .profile .stats { margin-left: 0; width: 100%; justify-content: space-between; }
  .profile .stats .kv { padding: 2px 10px; }
  .profile .stats .kv b { font-size: 19px; }

  button { min-height: 40px; }
  .row > button { flex: 1 1 auto; }
  .row .field { flex: 1 1 100%; }

  .grid.c4 { grid-template-columns: repeat(2, 1fr); }

  .modal { padding: 12px; max-height: 94vh; }
  .team .players { grid-template-columns: 1fr; }
  .timeline .ev { grid-template-columns: 52px 1fr 18px 1fr 92px; }
  .timeline .ev .d.right { display: none; }

  .pager { justify-content: center; }
}

@media (min-width: 721px) {
  .row .field.grow { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
