﻿:root {
  --bg: #121a24;
  --panel: #1a2532;
  --panel-2: #202e3f;
  --line: #33475f;
  --text: #e8f0f9;
  --muted: #8ea4bb;
  --accent: #23c28a;
  --danger: #e8535b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 700px at 0% 0%, #1e3a46 0%, transparent 50%),
    radial-gradient(900px 500px at 100% 100%, #2d3147 0%, transparent 50%),
    var(--bg);
  display: grid;
  grid-template-rows: 74px 44px 1fr;
}

.topbar {
  height: 74px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 20, 29, 0.86);
  backdrop-filter: blur(6px);
}

.brand h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.sync-indicator {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #d8e4ef;
}

.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
}

.sync-dot.synced {
  background: #2fe387;
  box-shadow: 0 0 12px rgba(47, 227, 135, 0.7);
}

.sync-dot.waiting {
  background: #ffd86a;
  box-shadow: 0 0 12px rgba(255, 216, 106, 0.65);
}

.sync-dot.disconnected {
  background: #ff6f7a;
  box-shadow: 0 0 12px rgba(255, 111, 122, 0.7);
}

.conn {
  display: flex;
  gap: 10px;
  align-items: center;
}

input,
select,
button {
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #182330;
  color: var(--text);
  padding: 0 10px;
}

label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

button {
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.active {
  border-color: var(--accent);
}

.tab-nav {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 16, 24, 0.75);
}

.tab-btn {
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: #15202b;
  color: #cde0f1;
  font-size: 12px;
}

.tab-root {
  min-height: 0;
  overflow: hidden;
  padding: 12px;
}

.tab-pane {
  display: none;
  height: 100%;
  min-height: 0;
}

.tab-pane.active {
  display: block;
}

.console-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(20, 30, 40, 0.9);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(51, 71, 95, 0.55);
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
}

#logMeta {
  font-size: 12px;
  color: var(--muted);
}

.log-panel {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-height: 0;
}

.log-view {
  margin: 10px 12px;
  border: 1px solid #2c4058;
  border-radius: 8px;
  background: #081019;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 13px;
  line-height: 1.45;
  overflow: auto;
  padding: 10px;
  min-height: 0;
}

.log-line {
  color: #e8f0f9;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-line.warn {
  color: #ffd55d;
}

.log-line.error {
  color: #ff5e66;
}

.log-line.ok {
  color: #e8f0f9;
}

.log-line.pending {
  color: #8ea4bb;
}

.history-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 0 12px 8px;
  color: var(--muted);
  font-size: 12px;
}

.history-list {
  display: flex;
  gap: 8px;
  overflow: auto;
  white-space: nowrap;
  padding-bottom: 2px;
}

.history-item {
  height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 100px;
  border: 1px solid #3d4d62;
  background: #182230;
  color: #d8e6f3;
  padding: 0 10px;
  cursor: pointer;
  font-size: 12px;
}

.cmd-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 0 12px 12px;
}

#cmdInput {
  font-family: "Cascadia Mono", "Consolas", monospace;
}

.right-stack {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
}

.player-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 12px;
}

.actions-grid.two-col {
  grid-template-columns: repeat(2, 1fr);
}

.actions-grid.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.danger {
  border-color: var(--danger);
}

.table-wrap {
  min-height: 0;
  overflow: auto;
  margin: 0 12px;
  border: 1px solid #2c4058;
  border-radius: 8px;
}

.table-wrap-large {
  height: calc(100vh - 280px);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead tr {
  background: var(--panel-2);
}

th,
td {
  text-align: left;
  padding: 7px;
  border-bottom: 1px solid rgba(51, 71, 95, 0.45);
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: rgba(35, 194, 138, 0.08);
}

tbody tr.selected {
  background: rgba(35, 194, 138, 0.2);
}

.hint {
  margin: 8px 12px 10px;
  color: var(--muted);
  font-size: 11px;
}

.hint.ok {
  color: #30d18c;
}

.hint.warn {
  color: #ffd55d;
}

.hint.error {
  color: #ff6d73;
}

.hint.pending {
  color: #a7b9ca;
}

.broadcast-panel {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
}

.broadcast-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
}

.broadcast-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 10px;
}

.broadcast-options label,
.control-grid label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.broadcast-format {
  display: flex;
  gap: 12px;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 12px;
}

.role-options {
  padding-top: 2px;
}

#playerActionFeedback {
  margin-top: 2px;
}

.broadcast-format label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.broadcast-format input[type="checkbox"] {
  width: 14px;
  height: 14px;
  padding: 0;
}

.quick-grid {
  padding: 0 12px 12px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.quick {
  background: #1d2a39;
}

.manage-layout {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 58% 42%;
  gap: 14px;
}

.manage-layout.single {
  grid-template-columns: 1fr;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.player-center-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.player-subtabs {
  display: flex;
  gap: 8px;
  padding: 10px 12px 0;
  border-bottom: 1px solid rgba(51, 71, 95, 0.55);
}

.player-subtab-btn {
  height: 30px;
  border-radius: 999px;
  font-size: 12px;
  padding: 0 12px;
  background: #15202b;
}

.player-subtab-btn.active {
  border-color: var(--accent);
  color: #dff7eb;
  background: #193043;
}

.player-subpane {
  display: none;
  min-height: 0;
  overflow: auto;
  padding-bottom: 10px;
}

.player-subpane.active {
  display: block;
}

.request-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.request-box {
  margin: 0 12px;
  min-height: 240px;
  max-height: calc(100vh - 380px);
  overflow: auto;
  border: 1px solid #2c4058;
  border-radius: 8px;
  background: #081019;
  color: #d2e4f5;
  padding: 10px;
  font-family: "Cascadia Mono", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.round-grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.round-group {
  border: 1px solid #2c4058;
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: rgba(8, 16, 25, 0.45);
}

.round-group h3 {
  margin: 0;
  font-size: 14px;
}

.map-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
}

.map-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(51, 71, 95, 0.4);
  color: #bfd2e4;
  font-size: 12px;
  flex-wrap: wrap;
}

.map-zone-tabs {
  display: inline-flex;
  gap: 6px;
  margin-left: 8px;
  flex-wrap: wrap;
}

.map-zone-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid #35506c;
  background: #132131;
  color: #c9d9e8;
}

.map-zone-btn.active {
  border-color: #66c2ff;
  color: #e8f6ff;
  background: #17304a;
}

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

.map-legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.dot.scp {
  background: #ff5568;
}

.dot.mtf {
  background: #3fa1ff;
}

.dot.chaos {
  background: #57d87a;
}

.dot.civ {
  background: #ffd769;
}

.dot.other {
  background: #d0d7df;
}

.map-board {
  min-height: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid #2d425a;
  border-radius: 10px;
  background: rgba(8, 15, 24, 0.5);
}

.map-plane {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background:
    radial-gradient(1000px 600px at 40% 30%, rgba(25, 74, 122, 0.18) 0%, transparent 65%),
    linear-gradient(180deg, rgba(8, 25, 46, 0.72), rgba(5, 15, 29, 0.82));
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.35);
}

.map-zone-panel {
  position: absolute;
  border: 1px solid rgba(83, 130, 179, 0.46);
  border-radius: 10px;
  background: rgba(6, 15, 24, 0.34);
}

.map-zone-title {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 11px;
  color: #d7e8fa;
  background: rgba(5, 14, 24, 0.76);
  border: 1px solid rgba(68, 107, 146, 0.7);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.map-empty {
  color: #97acc0;
  font-size: 12px;
  padding: 16px;
}

.map-room {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-radius: 4px;
  background: #2a5a8a;
  padding: 2px 3px;
  overflow: hidden;
  transition: left 0.2s ease, top 0.2s ease, width 0.2s ease, min-height 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.map-room.topology {
  z-index: 2;
  border-width: 0;
  border-radius: 3px;
  padding: 0;
  opacity: 0.82;
  box-shadow: 0 0 2px rgba(141, 190, 238, 0.25);
}

.map-room.topology.occupied {
  opacity: 0.98;
  border-width: 1px;
  box-shadow: 0 0 10px rgba(125, 194, 255, 0.3);
}

.map-room.topology .map-room-title,
.map-room.topology .map-room-sub,
.map-room.topology .map-room-players {
  display: none;
}

.map-room-overlay-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  z-index: 10;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 2px;
}

.map-links {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.map-link {
  position: absolute;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(121, 178, 232, 0.35), rgba(121, 178, 232, 0.9), rgba(121, 178, 232, 0.35));
  box-shadow: 0 0 8px rgba(82, 142, 199, 0.55);
}

.map-room.topology.shape-cross {
  border-radius: 2px;
}

.map-room.topology.shape-t,
.map-room.topology.shape-line-h,
.map-room.topology.shape-line-v {
  border-radius: 2px;
}

.map-room.topology.shape-corner,
.map-room.topology.shape-end,
.map-room.topology.shape-isolated {
  border-radius: 4px;
}

.map-room.topology.shape-surface {
  border-radius: 10px;
}

.map-player-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 6;
  pointer-events: none;
  transition: left 0.3s linear, top 0.3s linear;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.map-player-arrow {
  display: block;
  width: 16px;
  height: 22px;
  background: currentColor;
  clip-path: polygon(50% 0, 100% 100%, 50% 76%, 0 100%);
  color: #d7e8fb;
  transform-origin: 50% 56%;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.7));
}

.map-player-text {
  display: grid;
  gap: 0;
  line-height: 1.05;
  white-space: nowrap;
}

.map-player-role {
  font-size: 10px;
  font-weight: 700;
  color: #d8ebff;
}

.map-player-nickname {
  font-size: 10px;
  color: #ffffff;
}

.map-player-marker.team-scp .map-player-arrow,
.map-player-marker.team-scp .map-player-role {
  color: #ff6d7f;
}

.map-player-marker.team-mtf .map-player-arrow,
.map-player-marker.team-mtf .map-player-role {
  color: #67bcff;
}

.map-player-marker.team-chaos .map-player-arrow,
.map-player-marker.team-chaos .map-player-role {
  color: #68de86;
}

.map-player-marker.team-civilian .map-player-arrow,
.map-player-marker.team-civilian .map-player-role {
  color: #ffd76f;
}

.map-player-marker.team-other .map-player-arrow,
.map-player-marker.team-other .map-player-role {
  color: #e1e8f0;
}

.map-room.zone-lightcontainment,
.map-zone-label.zone-lightcontainment {
  border-color: rgba(220, 226, 232, 0.45);
  background: rgba(90, 90, 90, 0.78);
}

.map-room.zone-heavycontainment,
.map-zone-label.zone-heavycontainment {
  border-color: rgba(130, 174, 216, 0.5);
  background: rgba(26, 58, 90, 0.82);
}

.map-room.zone-entrance,
.map-zone-label.zone-entrance {
  border-color: rgba(233, 179, 121, 0.5);
  background: rgba(138, 90, 42, 0.76);
}

.map-room.zone-surface,
.map-zone-label.zone-surface {
  border-color: rgba(153, 222, 178, 0.5);
  background: rgba(62, 126, 84, 0.8);
}

.map-room.zone-pocket,
.map-zone-label.zone-pocket {
  border-color: rgba(183, 148, 243, 0.5);
  background: rgba(77, 55, 116, 0.82);
}

.map-room.zone-unknown,
.map-zone-label.zone-unknown {
  border-color: rgba(164, 190, 212, 0.45);
  background: rgba(61, 90, 117, 0.8);
}

.map-room-title {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-room-sub {
  font-size: 10px;
  color: rgba(230, 242, 252, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.map-room-players {
  margin-top: 2px;
  display: grid;
  gap: 2px;
  width: 100%;
}

.map-player-chip {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-left: 3px solid #9aa9b7;
  border-radius: 6px;
  background: rgba(3, 10, 19, 0.72);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  min-height: 18px;
  padding: 1px 4px;
  font-size: 10px;
}

.map-player-chip.team-scp {
  border-left-color: #ff5568;
}

.map-player-chip.team-mtf {
  border-left-color: #49a9ff;
}

.map-player-chip.team-chaos {
  border-left-color: #57d87a;
}

.map-player-chip.team-civilian {
  border-left-color: #ffd769;
}

.map-player-chip.team-other {
  border-left-color: #d0d7df;
}

.map-role-icon {
  width: 12px;
  text-align: center;
  font-size: 11px;
  color: #d7e9ff;
}

.map-player-name {
  color: #ecf5ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-view-arrow {
  color: #93d3ff;
  font-size: 9px;
  transform-origin: center;
}

.map-more {
  font-size: 10px;
  color: #a7bfd6;
  text-align: right;
}

.map-zone-label {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 3px 8px;
  border: 1px solid #3f668f;
  border-radius: 100px;
  background: rgba(6, 15, 24, 0.82);
  color: #d7e8fa;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}

@media (max-width: 1280px) {

  .console-layout,
  .manage-layout {
    grid-template-columns: 1fr;
  }

  .right-stack {
    grid-template-rows: minmax(280px, 1fr) minmax(240px, 1fr);
  }

  .broadcast-options,
  .control-grid,
  .round-grid,
  .actions-grid.three-col,
  .request-actions {
    grid-template-columns: 1fr;
  }

  .player-subtabs {
    flex-wrap: wrap;
  }

  .map-board {
    padding: 8px;
  }
}