:root {
  --bg: #0c1016;
  --panel: #151b24;
  --panel-soft: rgba(21, 27, 36, 0.88);
  --line: #2c3543;
  --text: #ecf2f8;
  --muted: #92a0b3;
  --red: #e5484d;
  --blue: #3da5ff;
  --gold: #d6a23a;
  --green: #2fd37f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 30% 18%, rgba(229, 72, 77, 0.12), transparent 28%),
    radial-gradient(circle at 72% 58%, rgba(61, 165, 255, 0.1), transparent 30%),
    var(--bg);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 16px 34px 0;
}

.toolbar {
  min-height: 38px;
  max-width: min(980px, calc(100vw - 68px));
  display: none;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 9px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-soft);
  backdrop-filter: blur(10px);
}

body.room-active .toolbar {
  display: flex;
}

.toolbar label,
.range-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.toolbar input[type="checkbox"] {
  accent-color: var(--gold);
}

.toolbar input[type="range"] {
  width: 62px;
  accent-color: var(--red);
}

.tool-button,
.btn-primary {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.tool-button {
  min-width: 68px;
  height: 28px;
  color: white;
  background: var(--red);
  font-size: 12px;
  padding: 0 10px;
}

.btn-primary {
  height: 44px;
  min-width: 86px;
  padding: 0 18px;
  color: #111;
  background: var(--gold);
}

.radar-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.minimap-container {
  position: relative;
  width: min(calc(100vh - 84px), calc(100vw - 72px), 680px);
  height: min(calc(100vh - 84px), calc(100vw - 72px), 680px);
  min-width: 280px;
  min-height: 280px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: #090d12;
  box-shadow: 0 0 28px rgba(61, 165, 255, 0.24), inset 0 0 24px rgba(0, 0, 0, 0.32);
}

.minimap-container::before,
.minimap-container::after {
  content: "";
  position: absolute;
  top: 8px;
  z-index: 20;
  width: 20px;
  height: 20px;
  border-top: 2px solid var(--gold);
  pointer-events: none;
}

.minimap-container::before {
  left: 8px;
  border-left: 2px solid var(--gold);
}

.minimap-container::after {
  right: 8px;
  border-right: 2px solid var(--gold);
}

.minimap-background,
#minimapCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.minimap-background {
  z-index: 1;
  background: url("/map.png") center / 100% 100% no-repeat;
  opacity: 0.94;
}

#minimapCanvas {
  z-index: 10;
}

.radar-scan {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--gold);
  animation: radarPulse 2s ease-out infinite;
}

@keyframes radarPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(214, 162, 58, 0.64);
  }
  100% {
    box-shadow: 0 0 0 220px rgba(214, 162, 58, 0);
  }
}

.connection-strip {
  display: none;
  gap: 14px;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(12px);
}

.modal-content {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.modal-header h1 {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 25px;
  line-height: 1.15;
}

.modal-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.room-input-wrapper {
  display: flex;
  gap: 10px;
}

.room-input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--text);
  background: #1c2430;
  font-weight: 800;
}

.room-input:focus {
  border-color: var(--gold);
}

.status-line {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.room-item {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  color: var(--text);
  background: #1a222e;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 700px) {
  .shell {
    justify-content: flex-start;
    padding: 12px 12px 0;
  }

  .minimap-container {
    width: min(calc(100vw - 24px), calc(100vh - 84px));
    height: min(calc(100vw - 24px), calc(100vh - 84px));
  }

  .room-input-wrapper {
    flex-wrap: wrap;
  }

  .btn-primary {
    flex: 1;
  }
}
