/* ============================================================================
   Replay — Refined variant — design_handoff_sc2tree_ui overlays
   The existing replay.css already covers the 80% token match. This file
   adds grade chips, pin drop animation, tactical rotation, and token
   fine-tuning where the legacy CSS drifts.
   ============================================================================ */

/* Top bar — 52px min, flat bg-elev per handoff */
.replay-topbar {
  min-height: 52px;
  background: var(--bg-elev) !important;
  border-bottom: 1px solid var(--border) !important;
}

/* "New Replay" — promoted from a muted breadcrumb into a proper CTA pill
   since this is the primary action a user takes after finishing analysis
   of the current replay. */
.replay-topbar-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  color: #56c2ff;
  background: rgba(86, 194, 255, 0.12);
  border: 1px solid rgba(86, 194, 255, 0.4);
  border-radius: 6px;
  padding: 5px 12px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.replay-topbar-home:hover {
  color: #fff;
  background: rgba(86, 194, 255, 0.25);
  border-color: rgba(86, 194, 255, 0.75);
}
.replay-topbar-home-icon {
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
  opacity: 0.85;
}

.replay-topbar-divider { color: var(--text-muted); opacity: 0.4; }

.replay-topbar-map {
  font-family: var(--display) !important;
  color: var(--text) !important;
  font-size: 15px !important;
  letter-spacing: 0.04em !important;
}

.replay-topbar-badge {
  font-family: var(--display);
  font-size: 10px !important;
  padding: 2px 8px !important;
  border-width: 1px !important;
}

.replay-topbar-matchup {
  color: var(--text-dim);
  font-style: normal;
  font-family: var(--ui);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* Grade chips — S/A/B/C/D — letter-only inline row (matches design_handoff) */
.grade-chip-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 12px;
}

.grade-chip-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  color: var(--bg);
}

.grade-chip-letter[data-grade="S"] { background: var(--grade-s); }
.grade-chip-letter[data-grade="A"] { background: var(--grade-a); }
.grade-chip-letter[data-grade="B"] { background: var(--grade-b); }
.grade-chip-letter[data-grade="C"] { background: var(--grade-c); }
.grade-chip-letter[data-grade="D"] { background: var(--grade-d); }
.grade-chip-letter[data-grade="-"] { background: var(--surface-hi); color: var(--text-muted); }

/* Title block: map name + badge stacked over player line */
.replay-topbar-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.replay-topbar-title-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.replay-topbar-players {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--ui);
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1;
}

.replay-topbar-players .p-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.replay-topbar-players .p-dot-1 { background-color: var(--p1); }
.replay-topbar-players .p-dot-2 { background-color: var(--p2); }

.replay-topbar-players .p-vs {
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 2px;
}

.replay-topbar-players .p-race {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 10px;
}

/* Variant pill ("A · Refined" / "B · Analyst") — clickable toggle on the
   right edge of the top bar. */
.replay-variant-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(86, 194, 255, 0.40);
  background-color: rgba(86, 194, 255, 0.10);
  margin-left: 6px;
  user-select: none;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

/* The class rule above sets display:inline-flex, which would override the
   browser's default `[hidden]{display:none}`. Reassert the default so the
   `hidden` attribute still works while the variant toggle is paused. */
.replay-variant-pill[hidden] { display: none; }

.replay-variant-pill:hover {
  background-color: rgba(86, 194, 255, 0.18);
  border-color: rgba(86, 194, 255, 0.65);
}

.replay-variant-pill[aria-pressed="true"] {
  color: #a78bfa;
  border-color: rgba(167, 139, 250, 0.50);
  background-color: rgba(167, 139, 250, 0.12);
}

.replay-variant-pill[aria-pressed="true"]:hover {
  background-color: rgba(167, 139, 250, 0.20);
  border-color: rgba(167, 139, 250, 0.70);
}

/* Ghost buttons on top bar (Highlights, Share, Compare, Sidebar, Fit) */
.replay-topbar-actions .btn-primary,
.replay-topbar-actions .btn-secondary,
.replay-topbar-actions .replay-share-btn {
  background: transparent !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text-dim) !important;
  font-family: var(--ui) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 6px 10px !important;
  border-radius: 6px !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
}

.replay-topbar-actions .btn-primary:hover,
.replay-topbar-actions .btn-secondary:hover,
.replay-topbar-actions .replay-share-btn:hover {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border-strong) !important;
}

/* View-mode toggle — segmented pill look */
.replay-viewmode-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px;
  gap: 2px;
}

.replay-viewmode-btn {
  background: transparent !important;
  border: none !important;
  color: var(--text-dim) !important;
  font-family: var(--ui) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 4px 10px !important;
  border-radius: 4px !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.replay-viewmode-btn:hover {
  color: var(--text) !important;
  background: var(--surface-alt) !important;
}

.replay-viewmode-btn.active {
  background: var(--accent-dim) !important;
  color: var(--accent) !important;
}

/* Tactical rotation — applied to canvas wrapper when tactical view active */
.replay-canvas-container.tactical .canvas-wrapper,
.canvas-wrapper.tactical {
  transition: transform 0.35s cubic-bezier(.4, .2, .2, 1);
}

/* Hint pin drop animation (match handoff) */
@keyframes pinDrop {
  0%   { transform: translate(-50%, -110%); opacity: 0; }
  60%  { transform: translate(-50%, -55%); opacity: 1; }
  100% { transform: translate(-50%, -50%); opacity: 1; }
}

.hint-pin {
  animation: pinDrop 0.4s cubic-bezier(.2, .8, .2, 1);
}

/* Canvas filter pill group — matches design_handoff "All/Macro/Micro/Scouting"
   pattern: rounded pill container, compact inline buttons, accent-tinted active. */
.insights-toolbar-canvas {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 20px !important;
  padding: 3px !important;
  gap: 2px !important;
  display: inline-flex !important;
  box-shadow: var(--shadow-lg);
}

.insights-toolbar-canvas .insights-btn {
  background: transparent !important;
  border: none !important;
  color: var(--text-dim) !important;
  font-family: var(--ui) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 14px !important;
  border-radius: 16px !important;
  letter-spacing: 0.02em;
  transition: all 0.15s;
}

.insights-toolbar-canvas .insights-btn:hover {
  background: var(--surface-alt) !important;
  color: var(--text) !important;
}

.insights-toolbar-canvas .insights-btn.active {
  background: var(--accent-dim) !important;
  color: var(--accent) !important;
}

/* Player dot pulsing ring */
@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(86, 194, 255, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(86, 194, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(86, 194, 255, 0); }
}

.player-dot {
  animation: pulseRing 2s ease-out infinite;
}

/* Sidebar — new tokens */
.replay-sidebar {
  background: var(--surface) !important;
  border-color: var(--border-strong) !important;
}

.replay-sidebar-tabs {
  background: var(--bg-elev) !important;
  border-bottom: 1px solid var(--border) !important;
}

.rs-tab {
  font-family: var(--ui);
  color: var(--text-dim);
}

.rs-tab.active {
  color: var(--accent) !important;
  border-bottom-color: var(--accent) !important;
}
