:root {
  --bg: #0d1117;
  --bg-card: #151b23;
  --bg-inset: #0a0e14;
  --border: #21262d;
  --text: #e6edf3;
  --text-sec: #8b949e;
  --text-dim: #484f58;
  --green: #3fb950;
  --green-bright: #56d364;
  --green-fill: rgba(63,185,80,0.28);
  --green-border: rgba(63,185,80,0.30);
  --green-soft: rgba(63,185,80,0.10);
  --red: #f85149;
  --red-bright: #ff7b72;
  --red-fill: rgba(248,81,73,0.28);
  --red-border: rgba(248,81,73,0.30);
  --red-soft: rgba(248,81,73,0.10);
  --blue: #58a6ff;
  --yellow: #d29922;
  --purple: #bc8cff;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

.page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

/* Player Header */
.player-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.player-avatar {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 2px solid var(--border);
  object-fit: cover;
}
.player-info h1 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.player-info h1 .tag { color: var(--text-dim); font-weight: 400; }
.player-meta {
  font-size: 13px;
  color: var(--text-sec);
  display: flex;
  gap: 16px;
  margin-top: 2px;
}
.player-stats-compact {
  margin-left: auto;
  text-align: right;
  font-size: 13px;
  color: var(--text-sec);
}
.player-stats-compact .wr {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.player-stats-compact .record {
  margin-top: 2px;
}
.player-stats-compact .record .w { color: var(--green); font-weight: 600; }
.player-stats-compact .record .l { color: var(--red); font-weight: 600; }

/* API Error Banner */
.api-error-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(210, 153, 34, 0.08);
  border: 1px solid rgba(210, 153, 34, 0.25);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--yellow);
}
.api-error-icon { font-size: 16px; flex-shrink: 0; }
.api-error-detail {
  color: var(--text-dim);
  font-size: 11px;
  display: block;
  margin-top: 2px;
}

/* Sync Placeholder (new user empty state) */
.sync-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  margin-bottom: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.sync-placeholder-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.sync-placeholder h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.sync-placeholder p {
  font-size: 14px;
  color: var(--text-sec);
  max-width: 400px;
  margin-bottom: 24px;
}

/* Sync Buttons */
.btn-sync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
}
.btn-sync:hover { background: #4393e6; }
.btn-sync:disabled, .btn-sync[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-sync.btn-small {
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 6px;
}

/* Sync Inline (existing user update button) */
.sync-inline {
  margin-bottom: 20px;
}

/* Sync Progress */
.sync-running {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-inset);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green-bright));
  border-radius: 4px;
  transition: width 0.4s ease;
}
.progress-text {
  font-size: 13px;
  color: var(--text-sec);
}

/* Sync Complete */
.sync-complete {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  border-radius: 10px;
  padding: 12px 20px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--green);
}
.sync-done { font-weight: 600; }

/* Sync Failed / Error */
.sync-failed {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  border-radius: 10px;
  padding: 12px 20px;
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--red);
  flex-wrap: wrap;
}
.sync-error-icon {
  font-size: 16px;
  flex-shrink: 0;
}
.sync-error {
  flex: 1;
  min-width: 200px;
}
.sync-failed .btn-sync {
  background: var(--red);
}
.sync-failed .btn-sync:hover {
  background: var(--red-bright);
}

/* Section Labels */
.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.section-header h2 {
  font-size: 16px;
  font-weight: 600;
}
.section-header .hint {
  font-size: 12px;
  color: var(--text-dim);
}
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* Phase Cards */
.phase-grid {
  display: flex;
  gap: 16px;
  margin-bottom: 0;
  align-items: flex-start;
}

.card {
  flex: 1;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 22px 18px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: rgba(255,255,255,0.12); }
.card.filter-active {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.card-head {
  text-align: center;
  margin-bottom: 18px;
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .meta { font-size: 12px; color: var(--text-dim); }

.game-dist {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0;
  min-height: 120px;
  position: relative;
  margin-bottom: 6px;
}
.game-dist::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1px;
  height: 100%;
  background: var(--border);
  z-index: 0;
}
.game-dist-side {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  z-index: 1;
}
.game-dist-side.left { justify-content: flex-end; padding-right: 4px; }
.game-dist-side.right { justify-content: flex-start; padding-left: 4px; }

.game-dist-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: flex-end;
}
.game-dist-num {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.5px;
}
.game-dist-label {
  font-size: 10px;
  color: var(--text-dim);
}
.state-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.state-name.behind { color: var(--red); }
.state-name.ahead { color: var(--green); }

.vbar {
  width: 48px;
  border-radius: 5px 5px 0 0;
  flex-shrink: 0;
  position: relative;
}
.vbar.behind {
  background: var(--red-fill);
  border: 1px solid var(--red-border);
  border-bottom: none;
}
.vbar.ahead {
  background: var(--green-fill);
  border: 1px solid var(--green-border);
  border-bottom: none;
}

.gap-tag {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 3;
}
.gap-tag.neg { color: var(--red); background: rgba(248,81,73,0.15); }
.gap-tag.pos { color: var(--green); background: rgba(63,185,80,0.15); }

.gap-hatch {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
}
.gap-hatch.neg {
  background: repeating-linear-gradient(-45deg, rgba(248,81,73,0.10), rgba(248,81,73,0.10) 2px, transparent 2px, transparent 5px);
  border: 1px dashed rgba(248,81,73,0.25);
  border-bottom: none;
}
.gap-hatch.pos {
  background: repeating-linear-gradient(-45deg, rgba(63,185,80,0.10), rgba(63,185,80,0.10) 2px, transparent 2px, transparent 5px);
  border: 1px dashed rgba(63,185,80,0.25);
  border-bottom: none;
}

.baseline { height: 1px; background: var(--border); margin-bottom: 6px; }

.pc-section-label {
  text-align: center;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 12px;
}

/* Win Rate — Mirrored bars */
.wr-mirror { display: flex; gap: 2px; margin-bottom: 10px; }
.wr-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.wr-side.left { padding-right: 6px; border-right: 1px solid var(--border); align-items: flex-start; }
.wr-side.right { padding-left: 6px; align-items: flex-end; }

.wr-hero { font-size: 24px; font-weight: 700; line-height: 1; letter-spacing: -0.5px; }
.wr-hero.behind { color: var(--red); }
.wr-hero.ahead  { color: var(--green); }

.wr-context {
  font-size: 9px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.wr-bar-group { width: 100%; display: flex; flex-direction: column; gap: 3px; }
.wr-bar-row { display: flex; align-items: center; gap: 4px; }
.wr-track {
  flex: 1;
  height: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.wr-fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 3px; }
.wr-side.right .wr-track .wr-fill { right: 0; left: auto; }

.wr-fill.actual { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.10); }
.wr-fill.actual.pos {
  background: linear-gradient(to right, rgba(63,185,80,0.30), rgba(63,185,80,0.45));
  border: 1px solid rgba(63,185,80,0.25);
}
.wr-side.right .wr-fill.actual.pos {
  background: linear-gradient(to left, rgba(63,185,80,0.30), rgba(63,185,80,0.45));
}
.wr-fill.expected { background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.06); }

.wr-inline-pct { font-size: 10px; font-weight: 600; color: var(--text-sec); min-width: 32px; flex-shrink: 0; }
.wr-side.left .wr-inline-pct { text-align: left; }
.wr-side.right .wr-inline-pct { text-align: right; }
.wr-inline-pct.dim { color: var(--text-dim); font-weight: 400; }

.wr-delta { font-size: 10px; color: var(--text-sec); margin-top: 2px; }
.delta-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  display: inline-block;
}
.delta-badge.neg { color: var(--red); background: rgba(248,81,73,0.12); }
.delta-badge.pos { color: var(--green); background: rgba(63,185,80,0.12); }
.delta-badge.dim { color: var(--text-dim); background: rgba(255,255,255,0.05); font-weight: 400; }

.even-row {
  text-align: center;
  font-size: 10px;
  color: var(--text-dim);
  padding: 6px 0;
  margin: 8px 0 8px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.even-wr { font-weight: 600; color: var(--text-sec); }

.insight {
  font-size: 11px;
  padding: 7px 10px;
  border-radius: 8px;
  text-align: center;
  line-height: 1.4;
}
.insight.neg, .obj-insight.neg { color: var(--red); background: var(--red-soft); }
.insight.pos, .obj-insight.pos { color: var(--green); background: var(--green-soft); }
.insight.neutral, .obj-insight.neutral { color: var(--text-sec); background: rgba(255,255,255,0.04); }

/* Objective Control Card */
.obj-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 6px;
}
.obj-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.obj-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}
.obj-card-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.obj-insight {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.5;
}

.obj-phase-group { margin-bottom: 16px; }
.obj-phase-group:last-child { margin-bottom: 0; }
.obj-phase-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.obj-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.obj-col-headers {
  display: grid;
  grid-template-columns: 86px 50px 70px 70px 80px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
}
.obj-col-headers span:nth-child(n+2) { text-align: right; }
.obj-row {
  display: grid;
  grid-template-columns: 86px 50px 70px 70px 80px;
  align-items: center;
  gap: 8px;
  transition: opacity 0.15s;
}
.obj-row.hl-dim { opacity: 0.3; }
.obj-row.hl-active { opacity: 1; }
.obj-name {
  font-size: 12px;
  color: var(--text-sec);
  font-weight: 500;
  white-space: nowrap;
}
.obj-rate {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text-sec);
}
.obj-rate.weak { color: var(--red-bright); }
.obj-rate.strong { color: var(--green); }
.obj-wr-split {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.obj-wr-split.win { color: var(--green); }
.obj-wr-split.lose { color: var(--red-bright); opacity: 0.7; }
.obj-wr-split.dim { color: var(--text-dim); text-align: right; }
.obj-impact {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.obj-impact.neg { color: var(--red-bright); }
.obj-impact.pos { color: var(--green); }
.obj-impact.flat { color: var(--text-dim); }

/* Objective Chains */
.obj-chains {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.obj-chains-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-dim);
}
.obj-chain {
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.obj-chain-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 12px;
}
.obj-chain-flow {
  display: flex;
  align-items: center;
}

/* Step nodes */
.chain-node {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 72px;
  position: relative;
  z-index: 2;
  transition: border-color 0.2s;
}
.chain-node.weak {
  border-color: var(--red-border);
  background: rgba(248,81,73,0.04);
}
.chain-node.strong {
  border-color: var(--green-border);
  background: rgba(63,185,80,0.04);
}
.chain-node-pct {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.2;
}
.chain-node.weak .chain-node-pct { color: var(--red-bright); }
.chain-node.strong .chain-node-pct { color: var(--green); }
.chain-node-label {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
  white-space: nowrap;
  margin-top: 2px;
}

/* Link between nodes */
.chain-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  position: relative;
  min-width: 56px;
  padding: 0 6px;
  z-index: 1;
}
.chain-link-arrow {
  height: 1px;
  background: var(--border);
  position: relative;
  margin: 5px 0;
  width: 100%;
}
.chain-link-arrow::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  border: 3px solid transparent;
  border-left: 4px solid var(--border);
}

.chain-link-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}
.chain-link-label.empty {
  min-height: 16px;
}
.chain-link-label span {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
}
.chain-link-label strong {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-sec);
}
.chain-link-label.strong strong { color: var(--green); }
.chain-link-label.weak strong { color: var(--red-bright); }

/* Win Probability Chart */
.wp-chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px 16px;
}
.wp-chart-container h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.wp-chart-container h3 .hint {
  font-weight: 400;
  color: var(--text-dim);
  font-size: 11px;
  margin-left: 8px;
}
.wp-legend {
  display: flex;
  gap: 14px;
  margin-bottom: 10px;
}
.wp-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-sec);
}
.wp-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
}
.wp-legend-swatch.win  { background: var(--green); }
.wp-legend-swatch.loss { background: var(--red); opacity: 0.7; }
.wp-chart {
  position: relative;
  height: 120px;
  width: 100%;
}
.wp-chart svg {
  width: 100%;
  height: 100%;
}
.wp-chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
  padding: 0 2px;
}
.wp-divergence-insight {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-sec);
  line-height: 1.5;
}
.wp-divergence-insight strong {
  color: var(--text);
  font-weight: 600;
}

/* Filter Chips */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-right: 4px;
}
.filter-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-sec);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.filter-chip:hover { border-color: rgba(255,255,255,0.15); color: var(--text); }
.filter-chip.active {
  border-color: var(--blue);
  background: rgba(88,166,255,0.10);
  color: var(--blue);
}
.filter-chip .count {
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 4px;
}

/* Match History Rows */
.match-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.match-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s, opacity 0.25s;
}
.match-row.filtered-out {
  opacity: 0.2;
  pointer-events: none;
}

.load-more-btn {
  display: block;
  width: 100%;
  padding: 10px 0;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.load-more-btn:hover { border-color: var(--blue); color: var(--blue); }
.load-more-btn:disabled { opacity: .5; cursor: wait; }

.match-summary {
  display: grid;
  grid-template-columns: 4px 52px 1fr 160px 120px 100px 28px;
  align-items: center;
  gap: 0;
  padding: 10px 16px 10px 0;
  cursor: pointer;
  transition: background 0.15s;
}
.match-summary:hover { background: rgba(255,255,255,0.02); }

.match-accent {
  width: 4px;
  align-self: stretch;
  border-radius: 10px 0 0 10px;
}
.match-accent.win { background: var(--green); }
.match-accent.loss { background: var(--red); }

.match-champ {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
}
.match-champ-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-inset);
}

.match-info {
  padding-left: 16px;
}
.match-kda {
  font-size: 14px;
  font-weight: 600;
}
.match-kda .slash { color: var(--text-dim); font-weight: 400; }
.match-kda .deaths { color: var(--red-bright); }
.match-sub {
  font-size: 11px;
  color: var(--text-dim);
  display: flex;
  gap: 12px;
}

.match-result { text-align: right; }
.match-result-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 2px;
}
.match-result-tag.win { color: var(--green); background: var(--green-soft); }
.match-result-tag.loss { color: var(--red); background: var(--red-soft); }
.match-time {
  font-size: 11px;
  color: var(--text-dim);
}

.phase-trajectory {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.phase-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.phase-dot.behind { border-color: var(--red); background: var(--red-fill); }
.phase-dot.even   { border-color: var(--text-dim); background: rgba(139,148,158,0.15); }
.phase-dot.ahead  { border-color: var(--green); background: var(--green-fill); }
.phase-dot.na     { border-color: var(--border); background: transparent; }
.phase-connector {
  width: 12px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
}
.phase-traj-labels {
  display: flex;
  justify-content: space-between;
  font-size: 8px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  width: 66px;
  margin: 0 auto;
  margin-top: 2px;
}

.match-ago {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  padding-right: 4px;
}

.match-chevron {
  font-size: 14px;
  color: var(--text-dim);
  transition: transform 0.2s;
  text-align: center;
}
.match-row.expanded .match-chevron { transform: rotate(180deg); }

/* Expanded Match Detail */
.match-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
  background: var(--bg-inset);
  border-top: 0px solid var(--border);
}
.match-row.expanded .match-detail {
  max-height: 2000px;
  border-top-width: 1px;
}

.match-detail-inner {
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-chart,
.detail-events {
  grid-column: 1 / -1;
}
.detail-chart h4,
.detail-events h4 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.detail-chart-area {
  height: 80px;
  position: relative;
}
.detail-chart-area svg {
  width: 100%;
  height: 100%;
}
.detail-chart-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
}
.event-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.event-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  transition: background 0.1s;
}
.event-item:hover { background: rgba(255,255,255,0.03); }
.event-time {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  min-width: 42px;
  font-variant-numeric: tabular-nums;
}
.event-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.event-icon.kill-blue { background: rgba(63,185,80,0.15); color: var(--green); }
.event-icon.kill-red  { background: rgba(248,81,73,0.15); color: var(--red); }
.event-icon.obj-blue  { background: rgba(88,166,255,0.15); color: var(--blue); }
.event-icon.obj-red   { background: rgba(248,81,73,0.10); color: var(--red-bright); }
.event-icon.dragon    { background: rgba(210,153,34,0.15); color: var(--yellow); }
.event-desc {
  flex: 1;
  color: var(--text-sec);
}
.event-desc strong { color: var(--text); font-weight: 600; }
.event-prob {
  font-size: 11px;
  font-weight: 600;
  min-width: 36px;
  text-align: right;
}
.event-delta {
  font-size: 10px;
  font-weight: 600;
  min-width: 48px;
  text-align: right;
}
.event-delta.up { color: var(--green); }
.event-delta.down { color: var(--red); }

.detail-scoreboard {
  grid-column: 1 / -1;
  display: flex;
  gap: 24px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.team-summary {
  flex: 1;
}
.team-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.team-label.blue { color: var(--blue); }
.team-label.red { color: var(--red-bright); }
.team-stats-row {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-sec);
}
.team-stats-row .val { color: var(--text); font-weight: 600; }

/* Latest Match */
.latest-match-section {
  margin-bottom: 32px;
}
.latest-match-section .section-header {
  margin-bottom: 10px;
}
.latest-match-section .section-header .hint {
  font-size: 11px;
}
.latest-match-section .match-row {
  border-color: rgba(255,255,255,0.08);
}

/* Phase Narrative */
.phase-narrative {
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--bg-card);
  border-radius: 10px;
  border-left: 3px solid var(--text-dim);
}
.phase-narrative .narrative-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.phase-narrative.neg .narrative-title { color: var(--red-bright, var(--red)); }
.phase-narrative.pos .narrative-title { color: var(--green); }
.phase-narrative .narrative-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-sec);
}
.narrative-enrichments {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.enrichment {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-sec);
}
.enrichment-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  margin-top: 5px;
}
.enrichment.pos .enrichment-dot  { background: var(--green); }
.enrichment.neg .enrichment-dot  { background: var(--red); }
.enrichment.neutral .enrichment-dot { background: var(--text-dim); }
.enrichment[data-targets] { cursor: default; }
.enrichment-body { flex: 1; min-width: 0; }

.enrichment-addendum {
  margin-top: 4px;
  padding-left: 14px;
  font-size: .82em;
  line-height: 1.45;
  color: var(--text-dim);
  position: relative;
}
.enrichment-addendum::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--text-dim);
}
.enrichment-addendum.neg { color: var(--red-dim, var(--text-dim)); }
.enrichment-addendum.pos { color: var(--green-dim, var(--text-dim)); }

/* Hover-highlight system: dim non-targeted elements, glow targeted ones */
[data-hl] { transition: opacity .15s; }
[data-hl].hl-dim { opacity: .25; }
[data-hl].hl-active { opacity: 1; }

/* When .wr-side is dimmed but contains an active .wr-delta, dim children selectively */
.wr-side[data-hl].hl-dim:has(.wr-delta.hl-active) {
  opacity: 1;
}
.wr-side[data-hl].hl-dim:has(.wr-delta.hl-active) > .wr-hero,
.wr-side[data-hl].hl-dim:has(.wr-delta.hl-active) > .wr-context,
.wr-side[data-hl].hl-dim:has(.wr-delta.hl-active) > .wr-bar-group {
  opacity: .25;
  transition: opacity .15s;
}

.game-dist[data-hl].hl-active .gap-tag {
  box-shadow: 0 0 8px 2px currentColor;
  transition: box-shadow .15s;
}
.game-dist[data-hl].hl-active .gap-hatch.neg {
  background: repeating-linear-gradient(-45deg, rgba(248,81,73,.25), rgba(248,81,73,.25) 2px, transparent 2px, transparent 5px);
  border-color: rgba(248,81,73,.5);
  transition: background .15s, border-color .15s;
}
.game-dist[data-hl].hl-active .gap-hatch.pos {
  background: repeating-linear-gradient(-45deg, rgba(63,185,80,.25), rgba(63,185,80,.25) 2px, transparent 2px, transparent 5px);
  border-color: rgba(63,185,80,.5);
  transition: background .15s, border-color .15s;
}
.wr-side[data-hl].hl-active .wr-hero {
  text-shadow: 0 0 10px currentColor;
  transition: text-shadow .15s;
}
.wr-side[data-hl].hl-active .wr-bar-row:first-child .wr-fill {
  box-shadow: 0 0 6px 1px currentColor;
  transition: box-shadow .15s;
}
.wr-side[data-hl].hl-active .wr-bar-row:nth-child(2) {
  opacity: .25;
  transition: opacity .15s;
}
.wr-delta[data-hl].hl-active .delta-badge {
  box-shadow: 0 0 8px 1px currentColor;
  transition: box-shadow .15s;
}

/* No-data state */
.no-data { text-align: center; padding: 40px 20px; color: var(--text-dim); }

/* ── Pillar Cards ── */
.pillar-card {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
  border-radius: 10px;
  overflow: hidden;
}
.pillar-card.pos, .phase-narrative.pos { border-left-color: var(--green); }
.pillar-card.neg, .phase-narrative.neg { border-left-color: var(--red); }
.pillar-card.neutral, .phase-narrative.neutral { border-left-color: var(--text-dim); }

.pillar-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 16px 0;
}
.pillar-head h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}
.pillar-sub {
  font-size: 10px;
  color: var(--text-dim);
}

.pillar-body {
  padding: 10px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pillar-gold-matchup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.pillar-gold-side {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pillar-gold-side.right { flex-direction: row-reverse; }
.pillar-gold-side.right .pillar-gold-info { text-align: right; }

.pillar-champ-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
}
.pillar-gold-info {
  display: flex;
  flex-direction: column;
}
.pillar-gold-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.pillar-gold-name {
  font-size: 10px;
  color: var(--text-dim);
}

.pillar-gold-diff {
  font-size: 14px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.pillar-gold-diff.pos, .pillar-feedback.pos { color: var(--green); background: var(--green-soft); }
.pillar-gold-diff.neg, .pillar-feedback.neg { color: var(--red); background: var(--red-soft); }
.pillar-gold-diff.neutral { color: var(--text-sec); background: rgba(255,255,255,0.05); }

.pillar-objectives {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pillar-obj-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pillar-obj-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  min-width: 28px;
}
.pillar-obj-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.pillar-obj-tag.dragon { color: var(--yellow); background: rgba(210,153,34,0.12); }
.pillar-obj-tag.herald { color: var(--purple); background: rgba(188,140,255,0.12); }
.pillar-obj-tag.grubs { color: var(--blue); background: rgba(88,166,255,0.10); }
.pillar-obj-none {
  font-size: 10px;
  color: var(--text-dim);
  font-style: italic;
}
.pillar-obj-personal {
  font-size: 9px;
  color: var(--text-dim);
  font-style: italic;
  margin-left: 4px;
}

.pillar-feedback {
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
  color: var(--text-sec);
}
/* ── Key-moment: important-death annotations ── */
.km-has-note { border-bottom: none; }
.km-imp-note {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px 6px 54px;
  font-size: 11px;
  color: var(--red);
}
.km-imp-arrow {
  font-size: 13px;
  line-height: 1;
  color: var(--text-dim);
}
.km-imp-text { flex: 1; }
.km-imp-text strong { color: var(--text); }
.km-imp-time {
  font-size: 10px;
  color: var(--text-dim);
}
.km-assist-tag {
  font-size: 10px;
  color: var(--text-dim);
  font-style: italic;
}
.km-imp-note.km-imp-pos { color: var(--green); }
.km-imp-note.km-imp-pos strong { color: var(--text); }
.km-liability-badge {
  font-size: 11px;
  line-height: 1.4;
  padding: 8px 12px;
  margin-top: 6px;
  border-radius: 6px;
  background: var(--red-soft, rgba(248,81,73,0.08));
  color: var(--red);
}
.km-liability-badge.km-pick-badge {
  background: var(--green-soft, rgba(63,185,80,0.08));
  color: var(--green);
}

/* ── Scoreboard ── */
.sb-wrap {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.sb-obj-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 10px 16px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
}
.sb-obj-side {
  display: flex;
  gap: 14px;
  flex: 1;
}
.sb-obj-side.left { justify-content: flex-end; }
.sb-obj-side.right { justify-content: flex-start; }
.sb-obj {
  display: flex;
  align-items: baseline;
  gap: 3px;
}
.sb-obj-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.sb-obj-lbl {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.sb-obj-vs {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  padding: 2px 14px;
  margin: 0 12px;
  letter-spacing: 1px;
}

.sb-players {
  display: flex;
  flex-direction: column;
}
.sb-row {
  display: grid;
  grid-template-columns: 1fr auto 42px auto 1fr;
  align-items: center;
  gap: 0;
  padding: 5px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.1s;
}
.sb-row:last-child { border-bottom: none; }
.sb-row:hover { background: rgba(255,255,255,0.02); }
.sb-row.sb-user-left { background: rgba(63,185,80,0.04); }
.sb-row.sb-user-right { background: rgba(63,185,80,0.04); }

.sb-player {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.sb-player-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sb-player.right .sb-player-top { justify-content: flex-end; }

.sb-champ-group {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.sb-champ-wrap {
  position: relative;
  flex-shrink: 0;
}
.sb-champ-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  object-fit: cover;
  display: block;
}
.sb-user-left .sb-player.left .sb-champ-icon,
.sb-user-right .sb-player.right .sb-champ-icon {
  border-color: var(--green-border);
  box-shadow: 0 0 0 1px var(--green-border);
}
.sb-champ-lvl {
  position: absolute;
  bottom: -2px;
  right: -4px;
  font-size: 9px;
  font-weight: 700;
  background: var(--bg);
  color: var(--text-sec);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 3px;
  line-height: 1.3;
}

.sb-spells {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sb-spell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: block;
}

.sb-identity {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.sb-player.right .sb-identity { text-align: right; }
.sb-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.sb-champ-name {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sb-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 10px;
  min-width: 70px;
}
.sb-kda {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sb-cs {
  font-size: 10px;
  color: var(--text-dim);
}

.sb-items {
  display: flex;
  gap: 1px;
}
.sb-player.left .sb-items { justify-content: flex-start; }
.sb-player.right .sb-items { justify-content: flex-end; }
.sb-item {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: block;
  border: 1px solid rgba(255,255,255,0.06);
}
.sb-item-empty {
  background: rgba(255,255,255,0.03);
}

.sb-role {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
}
.sb-role-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Damage / Gold comparison bars */
.sb-bars-section {
  border-top: 1px solid var(--border);
}
.sb-bar-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.sb-bar-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 14px 6px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.sb-bar-tab:hover { color: var(--text-sec); }
.sb-bar-tab.active {
  color: var(--text);
  border-bottom-color: var(--blue);
}
.sb-bars-pane { display: none; }
.sb-bars-pane.active { display: block; }
.sb-bars {
  padding: 8px 12px 10px;
}
.sb-bar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}
.sb-bar-val {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-sec);
  min-width: 32px;
  font-variant-numeric: tabular-nums;
}
.sb-bar-val.left { text-align: right; }
.sb-bar-val.right { text-align: left; }
.sb-bar-half {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-inset);
  overflow: hidden;
  display: flex;
}
.sb-bar-half.left { justify-content: flex-end; border-radius: 3px 0 0 3px; }
.sb-bar-half.right { justify-content: flex-start; border-radius: 0 3px 3px 0; }
.sb-bar-fill {
  height: 100%;
  transition: width 0.3s;
}
.sb-bar-half.left .sb-bar-fill {
  background: linear-gradient(to left, var(--blue), rgba(88,166,255,0.35));
  border-radius: 3px 0 0 3px;
}
.sb-bar-half.right .sb-bar-fill {
  background: linear-gradient(to right, var(--red), rgba(248,81,73,0.35));
  border-radius: 0 3px 3px 0;
}

/* Responsive */
@media (max-width: 1100px) {
  .phase-grid { flex-direction: column; }
  .obj-row, .obj-col-headers { grid-template-columns: 76px 44px 60px 60px 72px; gap: 6px; }
  .chain-node { min-width: 60px; padding: 6px 10px; }
  .chain-link { min-width: 40px; }
  .match-summary { grid-template-columns: 4px 44px 1fr 120px 100px 28px; }
  .match-ago { display: none; }
  .sb-name { max-width: 80px; }
  .sb-obj-side { gap: 8px; }
}
