:root {
  --bg: rgba(13, 20, 28, 0.88);
  --bg-row: rgba(255, 255, 255, 0.04);
  --line: rgba(236, 232, 225, 0.12);
  --text: #ece8e1;
  --muted: rgba(236, 232, 225, 0.55);
  --accent: #ff4655;
  --win: #3ad3a0;
  --loss: #ff5d6c;
  --width: 400px;
  --cut: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { background: transparent; overflow: hidden; }

body {
  font-family: "Barlow Semi Condensed", "Segoe UI", system-ui, sans-serif;
  font-weight: 500;
  color: var(--text);
  padding: 12px;
  -webkit-font-smoothing: antialiased;
}

.num { font-variant-numeric: tabular-nums; }

/* ---------- card shell ---------- */
.card {
  width: var(--width);
  background: var(--bg);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  border-left: 3px solid var(--accent);
  transform-origin: top left;
}

.head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 8px 14px;
  border-bottom: 1px solid var(--line);
  font-family: "Chakra Petch", sans-serif;
}
.tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--bg);
  background: var(--accent);
  padding: 2px 6px 1px;
}
.title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.dots { margin-left: auto; display: flex; gap: 5px; }
.dots i {
  width: 14px; height: 3px;
  background: var(--line);
  transition: background 0.3s;
}
.dots i.on { background: var(--accent); }

.stage {
  position: relative;
  padding: 10px 14px 12px;
  min-height: 60px;
  overflow: hidden;
  transition: height 0.3s ease;
}

.panel { animation: enter 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes enter {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: none; }
}

.timer { height: 2px; background: transparent; }
.timer-fill { height: 100%; width: 0; background: var(--accent); opacity: 0.7; }

.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* ---------- tier badge ---------- */
.badge {
  --c: #888;
  position: relative;
  width: 26px; height: 26px;
  flex: none;
  display: grid; place-items: center;
}
.badge::before {
  content: "";
  position: absolute; inset: 4px;
  transform: rotate(45deg);
  /* --c2 / --glow are set from JS: OBS's embedded Chromium can be too old for color-mix(). */
  background: linear-gradient(135deg, var(--c), var(--c2, #222));
  box-shadow: 0 0 10px var(--glow, transparent);
}
/* Official rank icon: no drawn diamond behind it. */
.badge.img { width: 30px; height: 30px; }
.badge.img::before { display: none; }
.badge.img img {
  width: 100%; height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}
.badge b {
  position: relative;
  font-family: "Chakra Petch", sans-serif;
  font-size: 11px; font-weight: 700;
  color: #0d141c;
}

/* ---------- ranks ---------- */
.ranks { display: flex; flex-direction: column; gap: 5px; }
.rank-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
  background: var(--bg-row);
}
.rank-main { min-width: 0; }
.rank-top { display: flex; align-items: baseline; gap: 8px; }
.pname {
  font-family: "Chakra Petch", sans-serif;
  font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tname { font-size: 13px; color: var(--muted); white-space: nowrap; }
.bar { height: 3px; margin-top: 4px; background: var(--line); }
.bar > div { height: 100%; background: var(--c, var(--accent)); }
.rank-side { text-align: right; line-height: 1.1; }
.rr { font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: 16px; }
.rr small { font-size: 10px; color: var(--muted); margin-left: 2px; }
.delta { font-size: 12px; }
.up { color: var(--win); }
.down { color: var(--loss); }
.flat { color: var(--muted); }

/* ---------- history chart ---------- */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .grid text { fill: var(--muted); font-size: 10px; font-family: "Barlow Semi Condensed", sans-serif; }
.chart path.line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 3px; display: inline-block; }

/* ---------- match feed ---------- */
.feed { display: flex; flex-direction: column; gap: 6px; }
.match {
  background: var(--bg-row);
  border-left: 3px solid var(--muted);
  padding: 5px 8px 6px;
}
.match.win { border-left-color: var(--win); }
.match.loss { border-left-color: var(--loss); }
.match-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--muted); }
.match-head .res {
  font-family: "Chakra Petch", sans-serif; font-weight: 700; font-size: 13px; letter-spacing: 0.06em;
}
.match.win .res { color: var(--win); }
.match.loss .res { color: var(--loss); }
.match-head .ago { margin-left: auto; }
.mp {
  display: grid;
  grid-template-columns: 22px 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 14px;
}
.agent {
  width: 22px; height: 22px;
  background: rgba(255, 255, 255, 0.08);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 600; color: var(--muted);
  overflow: hidden;
}
.agent img { width: 100%; height: 100%; object-fit: cover; }
.mp .kda { color: var(--text); }
.mp .acs { color: var(--muted); font-size: 12px; min-width: 48px; text-align: right; }
.mp .rrc { min-width: 34px; text-align: right; font-family: "Chakra Petch", sans-serif; font-weight: 600; }

/* ---------- today ---------- */
.today { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 14px; }
.today th {
  font-weight: 600; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); text-align: right; padding: 0 6px;
}
.today th:first-child { text-align: left; }
.today td { background: var(--bg-row); padding: 5px 6px; text-align: right; }
.today td:first-child { text-align: left; }
.today .wl b { font-weight: 600; }
.today-note { font-size: 11px; color: var(--muted); margin-top: 2px; }

.stale { opacity: 0.55; }
