/* Replay page follows the same layout system as /player and /gifs */

.replay-page-main{
  max-width: 1200px;
  margin: 22px auto 32px;
  padding: 0 14px;
}

.replay-page{
  min-width: 0;
}

.replay-page-head{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.replay-head-left{
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.replay-back{
  width: fit-content;
}

.replay-title-row{
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.replay-title{
  margin: 0;
  font-size: var(--fz-sec);
  letter-spacing: -0.2px;
}

.replay-meta{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.replay-meta-item{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.replay-meta-item i{
  color: var(--muted2);
}

.replay-speed{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.replay-speed-label{
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}

.replay-speed-select{
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.replay-status{
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.replay-status:empty{
  display: none;
}

.replay-layout{
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}

.replay-player,
.replay-side{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
}

.replay-player{
  position: relative;
}

.replay-player-foot{
  --replay-toolbar-bg: var(--panel);
  --replay-toolbar-surface: var(--panel2);
  --replay-toolbar-border: var(--line);
  --replay-toolbar-text: var(--ink);
  --replay-toolbar-muted: var(--muted);
  --replay-toolbar-muted-2: var(--muted2);
  --replay-toolbar-shadow: none;
}

.replay-player-actions{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}

.replay-primary-actions,
.replay-secondary-actions{
  display: flex;
  align-items: center;
  gap: 8px;
}

.replay-primary-actions{
  flex: 0 0 auto;
}

.replay-secondary-actions{
  flex: 0 0 auto;
}

.replay-player-foot{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 10px 14px;
  border-top: 1px solid var(--replay-toolbar-border);
  background: var(--replay-toolbar-bg);
  flex-wrap: wrap;
  overflow: visible;
}

.replay-timeline{
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 320px;
  min-width: 260px;
  padding: 0 4px;
  position: relative;
}

/* Compact controls: keep the strip clean and modern */
.replay-player-foot #btn-play span{
  display: none;
}

.replay-player-foot .chip{
  height: 38px;
  min-width: 38px;
  padding: 0 12px;
  border-radius: 11px;
  border-color: var(--replay-toolbar-border);
  background: var(--replay-toolbar-surface);
  box-shadow: var(--replay-toolbar-shadow);
  color: var(--replay-toolbar-muted);
}

.replay-player-foot .chip:hover{
  transform: none;
  box-shadow: none;
  border-color: var(--replay-toolbar-border);
  background: var(--replay-toolbar-bg);
  color: var(--replay-toolbar-text);
}

.replay-player-foot .chip i{
  font-size: 13px;
}

.replay-player-foot #btn-play{
  min-width: 40px;
  padding: 0;
  justify-content: center;
  border: none;
  background: linear-gradient(180deg, #ffcb4d, #ffb300);
  color: #2b2b2b;
}

.replay-player-foot #btn-play:hover{
  background: linear-gradient(180deg, #ffd15f, #ffb300);
  color: #1e1e1e;
}

.replay-player-foot #btn-fullscreen,
.replay-player-foot #btn-replay-tools{
  opacity: .88;
}

.replay-speed-menu{
  position: relative;
}

.replay-speed-trigger{
  height: 38px;
  padding: 0 8px;
  border-radius: 11px;
  border-color: var(--replay-toolbar-border);
  background: var(--replay-toolbar-surface);
}

.replay-speed-trigger-label{
  min-width: 32px;
  text-align: center;
  color: var(--replay-toolbar-text);
  font-size: 14px;
  font-weight: 800;
}

.replay-speed-trigger i{
  font-size: 12px;
  color: var(--replay-toolbar-muted);
}

.replay-speed-trigger[aria-expanded="true"]{
  background: var(--replay-toolbar-bg);
  color: var(--replay-toolbar-text);
}

.replay-speed-trigger[aria-expanded="true"] i{
  color: var(--replay-toolbar-text);
}

.replay-speed-popover{
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: 96px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 12;
}

.replay-speed-popover[hidden]{
  display: none;
}

.replay-speed-item{
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.replay-speed-item:hover{
  background: var(--panel2);
}

.replay-speed-item.is-active{
  background: rgba(74,168,255,.16);
  color: var(--ink);
}

.replay-player-foot .replay-status{
  flex: 0 0 auto;
  white-space: nowrap;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--replay-toolbar-border);
  background: var(--replay-toolbar-surface);
  color: var(--replay-toolbar-muted-2);
  font-size: 11px;
  letter-spacing: .02em;
}

.replay-time{
  font-size: 13px;
  font-weight: 900;
  color: var(--replay-toolbar-muted);
  min-width: 42px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.replay-seek{
  flex: 1 1 auto;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--replay-toolbar-border);
  cursor: pointer;
}

.replay-seek::-webkit-slider-runnable-track{
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.replay-seek::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: none;
  background: var(--gold);
  box-shadow: 0 0 0 2px rgba(255,255,255,.7);
  margin-top: -5px;
}

.replay-seek::-moz-range-track{
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.replay-seek::-moz-range-thumb{
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: none;
  background: var(--gold);
  box-shadow: 0 0 0 2px rgba(255,255,255,.7);
}

.replay-seek-preview{
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  min-width: 44px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  pointer-events: none;
  z-index: 4;
}

.replay-tools-menu{
  position: relative;
}

.replay-tools-popover{
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  width: 220px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  z-index: 12;
}

.replay-tools-popover[hidden]{
  display: none;
}

.replay-tools-item{
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.replay-tools-item i{
  width: 16px;
  text-align: center;
  color: var(--muted);
}

.replay-tools-item:hover{
  background: var(--panel2);
}

.replay-tools-item:hover i{
  color: var(--ink);
}

.replay-tools-trigger[aria-expanded="true"]{
  border-color: var(--replay-toolbar-border);
  background: var(--replay-toolbar-bg);
}

.replay-player-frame{
  aspect-ratio: 16 / 9;
  width: 100%;
  position: relative;
  min-height: 0;
}

.replay-players-corner{
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 9;
  min-width: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  border-color: rgba(204, 212, 230, 0.92);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  backdrop-filter: blur(10px);
}

.replay-players-corner:hover{
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

body:not(.theme-light) .replay-players-corner{
  border-color: rgba(255,255,255,.2);
  background: rgba(17, 19, 24, 0.7);
  color: #f8f9ff;
}

body:not(.theme-light) .replay-players-corner:hover{
  background: rgba(17, 19, 24, 0.84);
  color: #ffffff;
}

/* Fullscreen: expand only the replay player panel */
.replay-player:fullscreen{
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  position: relative;
}

.replay-player:fullscreen .replay-player-frame{
  flex: 1 1 auto;
  aspect-ratio: auto;
  min-height: 0;
}

.replay-player:fullscreen .replay-player-foot{
  --replay-toolbar-bg: rgba(255, 255, 255, 0.92);
  --replay-toolbar-surface: rgba(248, 250, 255, 0.92);
  --replay-toolbar-border: rgba(227, 231, 242, 0.95);
  --replay-toolbar-text: var(--ink);
  --replay-toolbar-muted: var(--muted);
  --replay-toolbar-muted-2: var(--muted2);
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 8;
  border: 1px solid var(--replay-toolbar-border);
  border-radius: 16px;
  background: var(--replay-toolbar-bg);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  align-items: center;
}

.replay-player:fullscreen .replay-speed-popover{
  border-color: var(--line);
  background: var(--panel);
}

.replay-player:fullscreen .replay-speed-item{
  color: var(--ink);
}

.replay-player:fullscreen .replay-speed-item:hover{
  background: var(--panel2);
}

.replay-player:fullscreen .replay-speed-item.is-active{
  background: rgba(74,168,255,.16);
  color: var(--ink);
}

.replay-player:fullscreen .replay-player-actions{
  flex: 0 1 auto;
  flex-wrap: wrap;
}

.replay-player:fullscreen .replay-timeline{
  flex: 1 1 320px;
  min-width: 240px;
}

/* Safari/WebKit */
.replay-player:-webkit-full-screen{
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  position: relative;
}

.replay-player:-webkit-full-screen .replay-player-frame{
  flex: 1 1 auto;
  aspect-ratio: auto;
  min-height: 0;
}

.replay-player:-webkit-full-screen .replay-player-foot{
  --replay-toolbar-bg: rgba(255, 255, 255, 0.92);
  --replay-toolbar-surface: rgba(248, 250, 255, 0.92);
  --replay-toolbar-border: rgba(227, 231, 242, 0.95);
  --replay-toolbar-text: var(--ink);
  --replay-toolbar-muted: var(--muted);
  --replay-toolbar-muted-2: var(--muted2);
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 8;
  border: 1px solid var(--replay-toolbar-border);
  border-radius: 16px;
  background: var(--replay-toolbar-bg);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  align-items: center;
}

.replay-player:-webkit-full-screen .replay-speed-popover{
  border-color: var(--line);
  background: var(--panel);
}

.replay-player:-webkit-full-screen .replay-speed-item{
  color: var(--ink);
}

.replay-player:-webkit-full-screen .replay-speed-item:hover{
  background: var(--panel2);
}

.replay-player:-webkit-full-screen .replay-speed-item.is-active{
  background: rgba(74,168,255,.16);
  color: var(--ink);
}

body:not(.theme-light) .replay-speed-popover{
  border-color: rgba(255,255,255,.12);
  background: #111318;
}

body:not(.theme-light) .replay-speed-item{
  color: #f8f9ff;
}

body:not(.theme-light) .replay-speed-item:hover{
  background: rgba(255,255,255,.08);
}

body:not(.theme-light) .replay-speed-item.is-active{
  background: rgba(74,168,255,.32);
  color: #f8f9ff;
}

body:not(.theme-light) .replay-player:fullscreen .replay-player-foot{
  --replay-toolbar-bg: rgba(17, 19, 24, 0.92);
  --replay-toolbar-surface: rgba(255,255,255,.08);
  --replay-toolbar-border: rgba(255,255,255,.12);
  --replay-toolbar-text: #f8f9ff;
  --replay-toolbar-muted: #c4cbe0;
  --replay-toolbar-muted-2: #aab3cc;
}

body:not(.theme-light) .replay-player:fullscreen .replay-speed-popover{
  border-color: rgba(255,255,255,.12);
  background: #111318;
}

body:not(.theme-light) .replay-player:fullscreen .replay-speed-item{
  color: #f8f9ff;
}

body:not(.theme-light) .replay-player:fullscreen .replay-speed-item:hover{
  background: rgba(255,255,255,.08);
}

body:not(.theme-light) .replay-player:fullscreen .replay-speed-item.is-active{
  background: rgba(74,168,255,.32);
  color: #f8f9ff;
}

body:not(.theme-light) .replay-player:-webkit-full-screen .replay-player-foot{
  --replay-toolbar-bg: rgba(17, 19, 24, 0.92);
  --replay-toolbar-surface: rgba(255,255,255,.08);
  --replay-toolbar-border: rgba(255,255,255,.12);
  --replay-toolbar-text: #f8f9ff;
  --replay-toolbar-muted: #c4cbe0;
  --replay-toolbar-muted-2: #aab3cc;
}

body:not(.theme-light) .replay-player:-webkit-full-screen .replay-speed-popover{
  border-color: rgba(255,255,255,.12);
  background: #111318;
}

body:not(.theme-light) .replay-player:-webkit-full-screen .replay-speed-item{
  color: #f8f9ff;
}

body:not(.theme-light) .replay-player:-webkit-full-screen .replay-speed-item:hover{
  background: rgba(255,255,255,.08);
}

body:not(.theme-light) .replay-player:-webkit-full-screen .replay-speed-item.is-active{
  background: rgba(74,168,255,.32);
  color: #f8f9ff;
}

.replay-player:-webkit-full-screen .replay-player-actions{
  flex: 0 1 auto;
  flex-wrap: wrap;
}

.replay-player:-webkit-full-screen .replay-timeline{
  flex: 1 1 320px;
  min-width: 240px;
}

@media (max-width: 900px){
  .replay-player-actions{
    flex: 1 1 100%;
  }

  .replay-player-foot{
    gap: 10px;
  }

  .replay-timeline{
    order: 2;
    flex-basis: 100%;
    min-width: 0;
    padding: 0;
  }

  .replay-status{
    order: 3;
    margin-left: auto;
  }
}

@media (max-width: 640px){
  .replay-player-actions{
    flex-direction: column;
    align-items: stretch;
  }

  .replay-primary-actions,
  .replay-secondary-actions{
    justify-content: space-between;
  }

  .replay-primary-actions{
    width: 100%;
  }

  .replay-primary-actions .replay-speed-menu{
    flex: 1 1 auto;
  }

  .replay-secondary-actions{
    width: 100%;
  }

  .replay-tools-menu{
    margin-left: auto;
  }

  .replay-tools-popover{
    right: 0;
    left: auto;
    width: min(220px, calc(100vw - 36px));
  }

  .replay-status{
    margin-left: 0;
  }
}

/* ===== In-player HUD (score + match clock) ==================== */
.replay-hud{
  position:absolute;
  left:10px;
  right:10px;
  top:10px;
  z-index: 5;
  pointer-events:none;
  display:flex;
  align-items:center;
  justify-content:center;
}

.replay-hud-score{
  display:inline-flex;
  align-items:center;
  gap:10px;
  padding: 8px 12px;
  border-radius: 12px;
  border:1px solid rgba(204, 212, 230, 0.92);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(10px);
}

.replay-hud-dot{
  width:10px;
  height:10px;
  border-radius: 3px;
  background: var(--muted2);
}

.replay-hud-dot--red{ background: var(--hot); }
.replay-hud-dot--blue{ background: var(--cool); }

.replay-hud-num{
  min-width: 14px;
  text-align:center;
}

.replay-hud-sep{ color: var(--muted); font-weight: 900; }

.replay-hud-clock{
  position:absolute;
  right: 0;
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  border:1px solid rgba(204, 212, 230, 0.92);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-weight: 900;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(10px);
}

body:not(.theme-light) .replay-hud-score,
body:not(.theme-light) .replay-hud-clock{
  border-color: rgba(255,255,255,.2);
  background: rgba(17, 19, 24, 0.72);
}

.replay-hud-clock-icon{
  font-size: 11px;
  color: var(--muted);
}

.replay-hud-clock-value{
  line-height: 1;
}

#replay-canvas{
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: optimizeSpeed;
  image-rendering: crisp-edges;
  image-rendering: -moz-crisp-edges;
  image-rendering: -o-crisp-edges;
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor;
}

.replay-side{
  display: flex;
  flex-direction: column;
}

.replay-side-head{
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.replay-side-head h2{
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.replay-events-filters{
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.replay-filter-types{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  width: 100%;
}

.replay-filter-chip{
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
  width: 100%;
}

.replay-filter-check{
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.replay-filter-chip > span{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  transition: filter 120ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease;
  width: 100%;
  justify-content: flex-start;
}

/* Small indicator on the left (acts like a premium check) */
.replay-filter-chip > span::before{
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.replay-filter-check:checked + span{
  color: var(--ink);
  border-color: var(--gold);
  background: var(--panel);
}

.replay-filter-check:checked + span::before{
  border-color: var(--gold);
  background: var(--gold);
}

.replay-filter-chip:hover > span{
  filter: brightness(1.03);
}

.replay-filter-check:focus-visible + span{
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.replay-filter-chip:hover{
  filter: brightness(1.02);
}

.replay-filter-select{
  height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
  max-width: none;
}

.replay-events{
  padding: 12px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 12px;
  color: var(--ink);
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

/* Keep event cards nicely spaced */
#replay-events-log{
  display:flex;
  flex-direction:column;
  gap:0px;
}

.replay-event{
  padding: 3px 0;
  white-space: pre-wrap;
  color: var(--muted);
  font-weight: 700;
}

.replay-event--plain{
  padding: 3px 0;
}

.replay-event--rich{
  display:flex;
  align-items:center;
  gap:6px;
  padding:4px 0;
  border:none;
  border-bottom:1px solid var(--line);
  background:transparent;
  border-radius:0;
  white-space: normal;
  cursor:default;
  user-select:none;
}

.replay-event--rich:last-child{
  border-bottom:none;
}



.replay-event-time{
  font-weight:900;
  font-size:10px;
  color:var(--muted);
  font-variant-numeric: tabular-nums;
  padding:2px 6px;
  border-radius:999px;
  border:1px solid var(--line);
  background:var(--panel);
  flex:0 0 auto;
}

.replay-event-main{
  min-width:0;
  flex:1 1 auto;
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:6px;
  flex-wrap:nowrap;
}

.replay-event-top{
  display:flex;
  align-items:center;
  gap:6px;
  min-width:0;
  flex:1 1 auto;
  overflow:hidden;
}

.replay-event-chip{
  font-weight:900;
  font-size:9px;
  letter-spacing:.2px;
  padding:3px 7px;
  border-radius:999px;
  border:1px solid var(--line);
  background:var(--panel);
  color:var(--ink);
  flex:0 0 auto;
}

.replay-event-title{
  font-weight:900;
  font-size:11px;
  color:var(--ink);
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.replay-event-sub{
  display:inline-flex;
  align-items:center;
  flex-wrap:nowrap;
  gap:4px;
  color:var(--muted);
  font-size:10px;
  min-width:0;
  max-width:45%;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.replay-event-context{
  /* Context sentences tend to break layout; keep them out of the inline view. */
  display:none;
}

.replay-event-pill{
  font-weight:900;
  font-size:9px;
  color:var(--muted);
  border:1px solid var(--line);
  background:var(--panel);
  border-radius:999px;
  padding:2px 7px;
  font-variant-numeric: tabular-nums;
  flex:0 0 auto;
}

/* Keep the inline layout calm: de-emphasize details unless hovered/focused */
.replay-event--rich .replay-event-sub{
  opacity:0.92;
}
.replay-event--rich:hover .replay-event-sub,
.replay-event--rich:focus-visible .replay-event-sub{
  opacity:1;
}

/* Type accents (use existing theme tokens only) */
.replay-event[data-kind="goal"] .replay-event-chip{ border-color: var(--ok); }
.replay-event[data-kind="owngoal"] .replay-event-chip{ border-color: var(--gold); }
.replay-event[data-kind="error"] .replay-event-chip{ border-color: var(--hot); }
.replay-event[data-kind="shot"] .replay-event-chip{ border-color: var(--cool); }
.replay-event[data-kind="save"] .replay-event-chip{ border-color: var(--cool); }
.replay-event[data-kind="interception"] .replay-event-chip{ border-color: var(--gold); }
.replay-event[data-kind="pass-good"] .replay-event-chip{ border-color: var(--ok); }
.replay-event[data-kind="pass-bad"] .replay-event-chip{ border-color: var(--gold); }
.replay-event[data-kind="control-good"] .replay-event-chip{ border-color: var(--ok); }
.replay-event[data-kind="control-bad"] .replay-event-chip{ border-color: var(--hot); }

.replay-side-hint{
  padding: 10px 14px 14px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
}

/* ===== Players overlay (ESC) ================================== */

.replay-players-overlay{
  position:absolute;
  inset:0;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:24px 16px 16px;
  background:rgba(255,255,255,.55);
  backdrop-filter:saturate(140%) blur(8px);
  z-index:5;
}

.replay-players-panel{
  width:min(760px, 100%);
  max-height:calc(100% - 8px);
  overflow:hidden;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  display:flex;
  flex-direction:column;
}

.replay-players-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border-bottom:1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}

.replay-players-title{
  font-weight:900;
  font-size:14px;
  letter-spacing:.2px;
}

.replay-player-frame--players-open .replay-hud,
.replay-player-frame--players-open .replay-players-corner{
  opacity: 0;
  visibility: hidden;
}

.replay-players-hint{
  font-weight:900;
  font-size:11px;
  color:var(--muted);
  border:1px solid var(--line);
  background:var(--panel2);
  border-radius:10px;
  padding:6px 10px;
}

.replay-players-hint:hover{
  color: var(--ink);
}

.replay-players-body{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:8px;
  padding:10px 12px 12px;
  min-height:0;
  overflow:hidden;
}

@media (max-width: 720px){
  .replay-players-body{
    grid-template-columns: 1fr;
  }
}

.replay-players-team{
  border:1px solid var(--line);
  border-radius:14px;
  overflow:hidden;
  background:var(--panel2);
  display:flex;
  flex-direction:column;
  min-height:0;
}

.replay-players-team-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  font-weight:900;
  font-size:12px;
  border-bottom:1px solid var(--line);
  background:var(--panel);
}

.replay-players-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
}

.replay-players-dot{
  width:10px;
  height:10px;
  border-radius:999px;
  background:var(--muted2);
}

.replay-players-team--red .replay-players-dot{ background:var(--hot); }
.replay-players-team--blue .replay-players-dot{ background:var(--cool); }

.replay-players-list{
  display:flex;
  flex-direction:column;
  overflow-y:auto;
  min-height:0;
  max-height:320px;
}

.replay-players-row{
  display:grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-bottom:1px solid var(--line);
}

.replay-players-row:last-child{
  border-bottom:none;
}

.replay-players-left{
  display:flex;
  align-items:center;
  gap:8px;
}

.replay-players-avatar{
  width:22px;
  height:22px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--line);
  background:var(--panel);
  font-weight:900;
  font-size:11px;
  color:var(--ink);
  flex:0 0 auto;
}

.replay-players-flag{
  width:16px;
  height:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  line-height:1;
  flex:0 0 auto;
  font-weight:900;
  color:var(--muted2);
  letter-spacing:.2px;
  text-transform:uppercase;
}

.replay-players-main{
  display:flex;
  align-items:center;
  gap:8px;
  min-width:0;
}

.replay-players-admin{
  width:18px;
  height:18px;
  border-radius:999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  font-weight:900;
  color:var(--gold);
  border:1px solid var(--line);
  background:var(--panel);
  flex:0 0 auto;
}

.replay-players-right{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
}

.replay-players-ping{
  display:flex;
  align-items:flex-end;
  gap:2px;
  height:14px;
}

.replay-players-pbar{
  width:3px;
  border-radius:3px;
  background:var(--line);
}

.replay-players-pbar.on{ background:var(--ok); }
.replay-players-pbar.warn{ background:var(--gold); }
.replay-players-pbar.bad{ background:var(--hot); }

.replay-players-pms{
  font-weight:900;
  font-size:10px;
  color:var(--muted);
  font-variant-numeric: tabular-nums;
  min-width:28px;
  text-align:right;
}

.replay-players-name{
  font-weight:800;
  font-size:12px;
  color:var(--ink);
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.replay-code{
  font-weight: 900;
  color: var(--ink);
}

@media (max-width: 1024px){
  .replay-layout{
    grid-template-columns: 1fr;
  }

  /* In single-column layout the side panel is below the player, so cap the log height. */
  .replay-events{
    max-height: 60vh;
  }
}

@media (max-width: 520px){
  .replay-player-actions{
    width: 100%;
    flex-wrap: wrap;
  }

  .replay-timeline{
    width: 100%;
    min-width: 0;
  }

  .replay-player-foot{
    padding: 10px 10px 12px;
    flex-wrap: wrap;
  }

  .replay-speed{
    width: 100%;
    justify-content: space-between;
  }

  .replay-zoom{
    margin-left: auto;
  }

  .replay-status{
    width: 100%;
    justify-content: center;
  }
}
