body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #111;
  color: #eee;
}

.page {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px;
  box-sizing: border-box;
}

.app-header {
  width: 100%;
  border-bottom: 1px solid #2c2c3f;
  background: #161622;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
}

.app-header-inner {
  max-width: 1500px;
  margin: 0 auto;
  padding: 18px 20px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
}

.controls-top {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.controls-bottom {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.tick-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

#tickSlider {
  width: 160px;
}

.viewer-layout {
  display: flex;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 10px;
}

#mapLabel {
  margin-bottom: 14px;
  font-size: 18px;
  color: #d6d6d6;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.upload-panel {
  margin-bottom: 16px;
}

.drop-zone {
  border: 2px dashed #4a4f63;
  background: #151520;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop-zone.dragover {
  border-color: #7f8db8;
  background: #1b2030;
}

.drop-zone-text {
  color: #dfe5f7;
  font-size: 15px;
}

.drop-zone-subtext {
  margin-top: 6px;
  font-size: 13px;
  color: #9ea7c7;
}

#browseDemoBtn {
  margin-left: 6px;
}

.upload-status {
  margin-top: 10px;
  font-size: 14px;
  color: #cfd3df;
}

.map-name {
  color: #d6d6d6;
}

.map-score {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.5px;
}

.score-ct {
  color: #ffffff;;
}

.score-separator {
  color: #ffffff;;
  margin: 0 4px;
}

.score-t {
  color: #ffffff;;
}

.final-score-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #3a3a4f;
  border-radius: 10px;
  background: #1a1a26;
}

.final-score-label {
  color: #cfd3df;
  font-size: 14px;
  font-weight: 600;
}

.map-score {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
}

.score-ct,
.score-separator,
.score-t {
  color: #ffffff;
}

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.controls input[type="number"] {
  width: 90px;
}


/* make both side panels explicitly match */
.team-panel-left,
.team-panel-right {
  width: 320px;
  min-width: 320px;
  flex: 0 0 320px;
}

/* remove any side-specific weirdness */
.team-panel-right .team-header,
.team-panel-left .team-header {
  justify-content: space-between;
}

/* controls box */
.viewer-controls {
  margin-top: 18px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;

  background: #151520;
  border: 1px solid #35354a;
  border-radius: 12px;
  box-sizing: border-box;
}

/* make each row sit nicely inside the box */
.controls-top,
.controls-bottom {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* optional: tighten the round row a little */
.rounds-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.player-panel {
  width: 320px;
  min-width: 320px;
  background: #151520;
  border: 1px solid #35354a;
  border-radius: 12px;
  padding: 10px;
  max-height: 742px;
  overflow-y: auto;
  box-sizing: border-box;
}

.team-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.team-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.team-section.t .team-header {
  color: #ffb347;
}

.team-section.ct .team-header {
  color: #4da3ff;
}

.team-section.unknown .team-header {
  color: #cccccc;
}

.player-card {
  background: #1d1d2b;
  border: 1px solid #2c2c3f;
  border-left: 4px solid #777;
  border-radius: 10px;
  padding: 8px 10px;
  transition: opacity 0.15s ease;
}

.player-card.t {
  border-left-color: #ffb347;
}

.player-card.ct {
  border-left-color: #4da3ff;
}

.player-card.unknown {
  border-left-color: #777;
}

.player-card.dead {
  opacity: 0.55;
}

.player-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.player-card-top.compact {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.player-armor-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.player-utility-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
}

.player-defuse-icon {
  opacity: 0.95;
}

.player-name {
  font-weight: bold;
  font-size: 15px;
  word-break: break-word;
}

.player-hp {
  font-size: 13px;
  color: #d8dde8;
}

.player-money {
  color: #7CFC8A;
  font-weight: 600;
}

.player-status {
  margin-left: auto;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #2a2a3b;
  color: #ddd;
  white-space: nowrap;
}

.player-health-wrap {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.player-health-bar {
  width: 70px;
  height: 10px;
  background: #2a2a3b;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #3a3a4f;
}

.player-health-fill {
  height: 100%;
  border-radius: 999px;
}

.player-health-fill.alive {
  background: linear-gradient(90deg, #35c96b, #65e595);
}

.player-health-fill.dead {
  background: linear-gradient(90deg, #a94444, #d86b6b);
}

.player-health-text {
  font-size: 12px;
  color: #ddd;
  min-width: 42px;
  text-align: right;
}

.player-kda {
  font-size: 13px;
  font-weight: 600;
  color: #e3e7f2;
}

.player-armor-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
}

.player-armor-empty {
  color: #8e93a8;
  font-size: 11px;
  font-weight: 600;
}

.player-card.alive .player-status {
  background: rgba(60, 190, 110, 0.16);
  color: #65e595;
}

.player-card.dead .player-status {
  background: rgba(220, 85, 85, 0.16);
  color: #ff8f8f;
}

.player-card-meta {
  display: flex;
  grid-template-columns: 64px minmax(0, 1fr) 64px 40px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: #cfd3df;
  line-height: 1.3;
}

.player-card-meta-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.player-weapon-slot {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 34px;
  margin-left: auto;
  flex-shrink: 0;
}

.empty-team {
  color: #aaa;
  font-size: 14px;
}

.canvas-wrap {
  flex: 1;
  min-width: 0;
  position: relative;
}

canvas {
  border: 1px solid #444;
  background: #1b1b1b;
  display: block;
  max-width: 100%;
}

.killfeed-overlay {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  z-index: 6;
  align-items: flex-end;
}

.killfeed-item {
  min-width: 0;
  width: fit-content;
  max-width: 320px;
  background: rgba(0, 0, 0, 0.78);
  border-radius: 8px;
  padding: 6px 10px;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  /*box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);*/
  box-shadow:
    0 0 0 1px rgba(255, 0, 0, 0.35),
    0 3px 12px rgba(0, 0, 0, 0.28);
  border: 2px solid #ff2a2a;
}

.killfeed-attacker,
.killfeed-victim {
  font-weight: 700;
  white-space: nowrap;
}

.killfeed-attacker.t,
.killfeed-victim.t {
  color: #ffb347;
}

.killfeed-attacker.ct,
.killfeed-victim.ct {
  color: #4da3ff;
}

.killfeed-attacker.unknown,
.killfeed-victim.unknown {
  color: #f0f0f0;
}

.killfeed-icon-wrap {
  width: 34px;
  min-width: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.killfeed-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
}

.killfeed-weapon-text {
  font-size: 12px;
  color: #ddd;
  opacity: 0.9;
}

.player-weapon-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
}

.player-weapon-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  filter: brightness(0) invert(1);
}

.player-weapon-empty {
  color: #8e93a8;
  font-weight: 600;
}

.legend {
  margin-top: 12px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  color: #d9deea;
  font-size: 14px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.35);
  box-sizing: border-box;
}

.legend-smoke {
  background: rgba(170, 170, 170, 0.75);
}

.legend-flash {
  background: rgba(255, 255, 255, 0.9);
}

.legend-he {
  background: rgba(255, 70, 70, 0.9);
}

.legend-molly {
  background: rgba(255, 120, 60, 0.9);
}

.ct-dot,
.t-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.ct-dot {
  background: #4da3ff;
}

.t-dot {
  background: #ffb347;
}

.round-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.controls button,
.round-btn {
  border: 1px solid #4a4f63;
  background: linear-gradient(180deg, #202334 0%, #181b28 100%);
  color: #eef2ff;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.controls button:hover,
.round-btn:hover {
  background: linear-gradient(180deg, #2a2e43 0%, #1d2131 100%);
  border-color: #5a6280;
}

.controls button:disabled {
  opacity: 1;
  cursor: default;
  background: linear-gradient(180deg, #3a425f 0%, #29314a 100%);
  border-color: #7f8db8;
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 0 0 1px rgba(120, 145, 210, 0.12);
}

#playPauseBtn {
  background: #1f8f45;
  border-color: #39b865;
  color: #fff;
  font-weight: 700;
  padding: 8px 16px;
  font-size: 15px;
  min-width: 84px;
}

#playPauseBtn:hover {
  background: #25a14f;
}

.round-btn {
  border: 1px solid #555;
  background: #222;
  color: #eee;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.round-btn:hover {
  background: #333;
}

.round-btn.active {
  background: linear-gradient(180deg, #3b435f 0%, #2a3148 100%);
  border-color: #aab7e8;
  color: #ffffff;
  font-weight: bold;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 0 0 1px rgba(170, 183, 232, 0.14);
}

.round-btn.t-win {
  color: #ffb347;
  border-color: rgba(255, 179, 71, 0.55);
}

.round-btn.ct-win {
  color: #4da3ff;
  border-color: rgba(77, 163, 255, 0.55);
}

.round-btn.t-win.active {
  background: linear-gradient(180deg, rgba(255,179,71,0.32) 0%, rgba(120,82,28,0.35) 100%);
  border-color: #ffb347;
  color: #ffd18a;
}

.round-btn.ct-win.active {
  background: linear-gradient(180deg, rgba(77,163,255,0.30) 0%, rgba(28,74,120,0.35) 100%);
  border-color: #4da3ff;
  color: #b9dcff;
}

@media (max-width: 1100px) {
  .viewer-layout {
    flex-direction: column;
  }

  .player-panel {
    width: 100%;
    min-width: 0;
    max-height: none;
  }
}
