:root {
  --bg: #0a1218;
  --panel: #0f1b24;
  --panel-alt: #132330;
  --line: #345066;
  --text: #ecf3f8;
  --muted: #8ea6b9;
  --enemy: #ff5f5f;
  --friendly: #6ac5ff;
  --local: #ffffff;
  --accent: #99ffae;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  color: var(--text);
  background: radial-gradient(circle at 10% 0%, #1d2a33, var(--bg) 45%);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
}

.page {
  min-height: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(130deg, #172532, #0f1d28);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.4px;
}

#status {
  margin: 4px 0 0;
  color: var(--muted);
}

.mode-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

button {
  border: 1px solid var(--line);
  background: #162635;
  color: var(--text);
  padding: 8px 11px;
  border-radius: 10px;
  cursor: pointer;
}

button:hover {
  border-color: #7ca8c4;
}

button.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

#focusInfo {
  color: var(--muted);
  min-width: 180px;
  text-align: right;
}

#zoomInfo {
  color: var(--muted);
  min-width: 110px;
  text-align: right;
}

#bombInfo {
  color: #f4d58d;
  min-width: 180px;
  text-align: right;
}

#bombInfo .bomb-icon {
  margin-right: 6px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) 280px;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.map-card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  min-height: 420px;
}

#mapCanvas {
  width: 100%;
  height: 100%;
  min-height: 360px;
  border-radius: 10px;
  background: linear-gradient(145deg, #122330, #0b1822);
  border: 1px solid #2a4357;
}

.legend {
  margin-top: 8px;
  color: var(--muted);
  display: flex;
  gap: 16px;
  font-size: 13px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.dot.local {
  background: var(--local);
}

.dot.enemy {
  background: var(--enemy);
}

.dot.friendly {
  background: var(--friendly);
}

.sidebar {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar h2 {
  margin: 0;
  font-size: 17px;
}

.hint {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.player-list {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.player-item {
  border: 1px solid #294258;
  border-radius: 8px;
  background: #112332;
  padding: 7px 9px;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.player-item:hover {
  border-color: #75abc8;
}

.player-item.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.player-name {
  font-size: 14px;
  margin-bottom: 4px;
}

.player-meta {
  color: var(--muted);
  font-size: 12px;
}

.player-hint {
  color: #9ec5dd;
  font-size: 11px;
  margin-top: 4px;
}

.player-bomb {
  color: #f4d58d;
  font-size: 11px;
  margin-top: 4px;
  letter-spacing: 0.2px;
}

.bomb-icon {
  position: relative;
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border-radius: 50%;
  vertical-align: -1px;
  background: #f2c464;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.bomb-icon::before {
  content: "";
  position: absolute;
  width: 6px;
  height: 2px;
  top: -2px;
  right: -3px;
  border-radius: 2px;
  background: #f2c464;
  transform: rotate(35deg);
}

.bomb-icon::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  top: -4px;
  right: -6px;
  border-radius: 50%;
  background: #ffdc9b;
}

.player-team-local {
  color: var(--local);
}

.player-team-enemy {
  color: var(--enemy);
}

.player-team-friendly {
  color: var(--friendly);
}

.play-hud {
  display: none;
}

body.play-mode {
  background: #030608;
}

body.play-mode .page {
  padding: 0;
  gap: 0;
  min-height: 100vh;
}

body.play-mode .topbar,
body.play-mode .sidebar,
body.play-mode .legend {
  display: none;
}

body.play-mode .layout {
  display: block;
  min-height: 100vh;
  height: 100vh;
}

body.play-mode .map-card {
  border: 0;
  border-radius: 0;
  min-height: 100vh;
  height: 100vh;
  padding: 0;
  background: #030608;
}

body.play-mode #mapCanvas {
  min-height: 100vh;
  height: 100vh;
  width: 100vw;
  border: 0;
  border-radius: 0;
  background: #06101a;
}

body.play-mode .play-hud {
  display: none;
  position: fixed;
  top: 10px;
  left: 12px;
  z-index: 20;
  font-size: 13px;
  background: rgba(12, 22, 32, 0.8);
  color: #d9edf9;
  border: 1px solid #2c495f;
  border-radius: 8px;
  padding: 6px 10px;
}

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

  #focusInfo {
    min-width: 0;
    text-align: left;
  }

  #zoomInfo,
  #bombInfo {
    min-width: 0;
    text-align: left;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .mode-controls {
    width: 100%;
    justify-content: space-between;
  }
}
