:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: #070b14;
  color: #eef6ff;
  --screen-edge-inset: 2px;
  --app-viewport-width: 100vw;
  --app-viewport-height: 100dvh;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

.is-hidden {
  display: none !important;
}

.login-view {
  --login-design-width: 1440px;
  --login-design-height: 810px;
  --login-scale: 1;
  --login-rotation: 0deg;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  display: grid;
  align-items: start;
  justify-items: end;
  padding: 32px;
  background:
    linear-gradient(90deg, rgba(4, 8, 16, 0.68), rgba(4, 8, 16, 0.18) 46%, rgba(4, 8, 16, 0.08)),
    linear-gradient(180deg, rgba(4, 8, 16, 0.2), rgba(4, 8, 16, 0.5)),
    url("/assets/cover.jpg");
  background-size: cover;
  background-position: center;
}

.login-panel {
  width: min(390px, calc(100vw - 64px));
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid rgba(130, 211, 255, 0.35);
  border-radius: 8px;
  background: rgba(9, 16, 30, 0.92);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
}

.mobile-access-denied {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(7, 12, 24, 0.9), rgba(7, 12, 24, 0.74)),
    url("/assets/cover.jpg");
  background-size: cover;
  background-position: center;
}

.mobile-access-denied-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px 24px;
  border: 1px solid rgba(130, 211, 255, 0.36);
  border-radius: 8px;
  background: rgba(9, 16, 30, 0.94);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.mobile-access-denied-panel h1,
.mobile-access-denied-panel p {
  margin: 0;
}

.mobile-access-denied-panel h1 {
  font-size: 25px;
  line-height: 1.25;
}

.mobile-access-denied-panel p {
  color: #c9d6ea;
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 6px;
  color: #78e5ff;
  font-size: 12px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

.login-title {
  display: grid;
  justify-items: center;
  gap: 4px;
  font-size: 28px;
  line-height: 1.2;
  text-align: center;
}

label {
  display: grid;
  gap: 8px;
  color: #c9d6ea;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(132, 173, 223, 0.26);
  border-radius: 6px;
  background: rgba(19, 30, 51, 0.96);
  color: #f5fbff;
  outline: none;
  padding: 12px 14px;
}

.password-field {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.password-field input {
  padding-right: 52px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 36px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border-color: rgba(132, 173, 223, 0.3);
  border-radius: 5px;
  background: rgba(14, 25, 45, 0.92);
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible,
.password-toggle.is-visible {
  border-color: rgba(123, 234, 255, 0.78);
  background: rgba(44, 70, 112, 0.96);
  outline: none;
}

.password-toggle-eye {
  position: relative;
  width: 18px;
  height: 11px;
  border: 2px solid #dceaff;
  border-radius: 50%;
}

.password-toggle-eye::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #dceaff;
  transform: translate(-50%, -50%);
}

button {
  border: 1px solid rgba(122, 177, 242, 0.35);
  border-radius: 6px;
  background: rgba(37, 57, 96, 0.88);
  color: #f4fbff;
  padding: 11px 16px;
  cursor: pointer;
}

button:hover,
button.active {
  border-color: rgba(123, 234, 255, 0.8);
  background: rgba(52, 89, 145, 0.95);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: #ff8f8f;
  font-size: 13px;
  line-height: 1.4;
}

.form-note {
  min-height: 20px;
  margin: 0;
  color: #9fe7ff;
}

.shell {
  --sidebar-width: 340px;
  --mobile-rotation: 0deg;
  width: calc(100% - var(--screen-edge-inset));
  max-width: calc(100vw - var(--screen-edge-inset));
  height: 100vh;
  height: calc(100dvh - var(--screen-edge-inset));
  max-height: calc(100dvh - var(--screen-edge-inset));
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: 72px minmax(0, 1fr);
  position: relative;
  background: #09101e;
  overflow: hidden;
  transition: grid-template-columns 0.22s ease;
}

.shell.is-sidebar-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.shell.is-sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

.shell.is-sidebar-collapsed .sidebar-toggle {
  left: 6px;
}

.sidebar-toggle {
  position: absolute;
  top: 50%;
  left: calc(var(--sidebar-width) - 16px);
  z-index: 20;
  width: 32px;
  height: 64px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(224, 205, 101, 0.62);
  border-radius: 0 6px 6px 0;
  background: #121d31;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  transform: translateY(-50%);
  transition:
    left 0.22s ease,
    background 0.18s ease,
    border-color 0.18s ease;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  border-color: rgba(255, 220, 115, 0.9);
  background: #223654;
  outline: none;
}

.sidebar-toggle-icon {
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-right: 10px solid #f4fbff;
  border-bottom: 8px solid transparent;
  transition: transform 0.22s ease;
}

.shell.is-sidebar-collapsed .sidebar-toggle-icon {
  transform: rotate(180deg);
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
  border-bottom: 1px solid rgba(118, 164, 219, 0.28);
  background: #0b1324;
  overflow: hidden;
}

.brand {
  width: 430px;
  flex: 0 0 430px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  font-size: 26px;
  font-weight: 800;
  color: #b8f7ff;
  text-shadow: 0 0 16px rgba(102, 225, 255, 0.45);
}

.brand-title {
  flex: 0 0 auto;
  white-space: nowrap;
}

.brand-mark {
  width: 12px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: #ffdc73;
}

.brand-logo {
  display: block;
  width: auto;
  height: 42px;
  max-width: 96px;
  flex: 0 0 auto;
  object-fit: contain;
}

.nav-tabs {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-right: 18px;
}

.nav-tabs button {
  flex: 0 0 auto;
  min-width: 96px;
  height: 44px;
  font-weight: 700;
}

.map-config-button {
  flex: 0 0 auto;
  height: 44px;
  min-width: 96px;
}

.logout-button {
  flex: 0 0 auto;
  height: 44px;
  min-width: 72px;
  margin-right: 18px;
  background: rgba(56, 35, 42, 0.9);
  border-color: rgba(255, 151, 151, 0.5);
}

.logout-button:hover {
  border-color: rgba(255, 180, 180, 0.9);
  background: rgba(92, 44, 52, 0.96);
}

.sidebar {
  width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 18px 14px;
  border-right: 2px solid rgba(224, 205, 101, 0.65);
  background: #08101e;
  z-index: 4;
  overflow-x: hidden;
  overflow-y: auto;
  transition:
    transform 0.22s ease,
    opacity 0.18s ease;
}

.team-heading {
  min-width: 0;
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.team-flag {
  position: relative;
  width: 22px;
  height: 28px;
  flex: 0 0 auto;
}

.team-flag::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 3px;
  height: 24px;
  background: #f2d7a2;
  border-radius: 999px;
}

.team-flag::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 4px;
  width: 16px;
  height: 12px;
  clip-path: polygon(0 0, 100% 0, 78% 50%, 100% 100%, 0 100%);
  background: #e33b32;
  box-shadow: 0 0 12px rgba(227, 59, 50, 0.45);
}

.team-logo-wrap {
  width: 82px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
}

.team-logo {
  display: block;
  width: 100%;
  height: 28px;
  object-fit: contain;
}

.team-name {
  min-width: 0;
  color: #ff4f4a;
  font-size: 24px;
  font-weight: 800;
  line-height: 28px;
  white-space: nowrap;
}

.search {
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 15px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid rgba(100, 134, 189, 0.25);
}

.filters button {
  min-width: 0;
  border-radius: 0;
  border-width: 0 1px 0 0;
  padding: 8px 3px;
  font-size: 15px;
  line-height: 1;
}

.device-list {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.device-card {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-bottom-color: rgba(120, 151, 198, 0.22);
  border-radius: 4px;
}

.device-card.is-disabled {
  opacity: 0.62;
}

.device-card.is-selected {
  border: 1px solid rgba(125, 243, 255, 0.72);
  background: linear-gradient(135deg, rgba(125, 243, 255, 0.1), rgba(52, 96, 255, 0.08));
  box-shadow:
    inset 0 0 0 1px rgba(180, 250, 255, 0.18),
    0 0 22px rgba(73, 214, 255, 0.26);
}

.device-card.is-selected::before {
  content: "";
  position: absolute;
  inset: 7px auto 7px 0;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, #b9faff, #38d7ff 48%, #4584ff);
  box-shadow: 0 0 16px rgba(73, 214, 255, 0.62);
}

.device-card header {
  display: block;
  min-width: 0;
}

.device-identity {
  min-width: 0;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.device-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(120, 202, 255, 0.38);
  border-radius: 50%;
  background: rgba(18, 31, 55, 0.9);
  color: #9fe7ff;
  cursor: pointer;
}

.device-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.device-avatar-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.device-avatar-readonly {
  cursor: default;
}

.device-avatar-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.avatar-name-stack {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: repeat(2, minmax(0, auto));
  place-items: center;
  align-content: center;
  justify-content: center;
  gap: 1px;
  font-size: 9px;
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0;
}

.avatar-name-stack--fallback {
  grid-template-rows: 1fr;
}

.avatar-name-line {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.device-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.device-card strong {
  font-size: 15px;
  line-height: 1;
}

.device-code {
  flex: 0 0 auto;
  white-space: nowrap;
}

.device-profile-name {
  width: min(78px, 44%);
  max-width: 78px;
  min-width: 54px;
  height: 24px;
  padding: 0 6px;
  border-color: rgba(100, 134, 189, 0.32);
  border-radius: 4px;
  background: rgba(13, 24, 43, 0.74);
  font-size: 12px;
}

.device-details {
  margin-left: 40px;
  min-width: 0;
  color: #c2cce0;
}

.device-details-toggle {
  width: fit-content;
  cursor: pointer;
  color: #91a9c9;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  user-select: none;
}

.device-details-toggle:hover,
.device-details-toggle:focus-visible {
  color: #dceaff;
  outline: none;
}

.device-detail-grid {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.device-detail-grid p {
  overflow-wrap: anywhere;
}

.device-card p {
  margin: 0;
  color: #c2cce0;
  font-size: 12px;
  line-height: 1.35;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #7d889b;
  flex: 0 0 auto;
}

.device-state {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 78px;
}

.device-actions {
  display: grid;
  grid-template-columns: repeat(2, 32px);
  gap: 3px;
}

.device-control-stack {
  display: grid;
  gap: 3px;
}

.device-active-button {
  min-width: 32px;
  height: 20px;
  padding: 0 4px;
  border-radius: 4px;
  border-color: rgba(100, 134, 189, 0.34);
  background: rgba(16, 29, 52, 0.78);
  font-size: 11px;
  line-height: 1;
}

.device-active-button.is-selected {
  border-color: rgba(139, 202, 255, 0.72);
  background: rgba(75, 101, 156, 0.88);
  color: #ffffff;
}

.device-gender-actions {
  display: grid;
  grid-template-columns: repeat(2, 32px);
  gap: 3px;
}

.device-gender-button {
  min-width: 32px;
  height: 20px;
  padding: 0 4px;
  border-radius: 4px;
  border-color: rgba(100, 134, 189, 0.34);
  background: rgba(16, 29, 52, 0.72);
  color: #c8d4ea;
  font-size: 11px;
  line-height: 1;
}

.device-gender-button.is-selected {
  color: #ffffff;
}

.device-gender-button[data-gender="male"].is-selected {
  border-color: rgba(113, 189, 255, 0.82);
  background: rgba(49, 104, 172, 0.9);
}

.device-gender-button[data-gender="female"].is-selected {
  border-color: rgba(255, 139, 176, 0.82);
  background: rgba(159, 59, 99, 0.9);
}

.status-dot.idle {
  background: #f3d66b;
  box-shadow: 0 0 12px rgba(243, 214, 107, 0.62);
}

.status-dot.online {
  background: #8dff9a;
  box-shadow: 0 0 14px rgba(141, 255, 154, 0.9);
}

.status-dot.alarm {
  background: #ff756e;
  box-shadow: 0 0 14px rgba(255, 117, 110, 0.9);
  animation: status-alert-pulse 0.9s ease-in-out infinite;
}

.status-dot.disabled {
  background: #535b6a;
  box-shadow: none;
}

@keyframes status-alert-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 14px rgba(255, 117, 110, 0.9);
  }

  50% {
    opacity: 0.38;
    transform: scale(0.82);
    box-shadow: 0 0 4px rgba(255, 117, 110, 0.45);
  }
}

.map-stage {
  --map-control-width: 202px;
  --map-left-control-zone: calc(28px + var(--map-control-width) + 64px);
  min-width: 0;
  min-height: 0;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(224, 205, 101, 0.65);
}

.map-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(18, 35, 42, 0.15), rgba(8, 16, 30, 0.15)),
    url("https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/7/53/105");
  background-size: cover;
  background-position: center;
}

.amap-container {
  position: absolute;
  inset: 0;
  z-index: 0;
  touch-action: none;
}

.map-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(rgba(190, 229, 255, 0.09) 1px, transparent 1px),
    linear-gradient(90deg, rgba(190, 229, 255, 0.09) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
}

.map-canvas.is-simple-map::after {
  display: none;
}

.map-badge {
  position: absolute;
  top: 24px;
  left: 28px;
  z-index: 5;
  box-sizing: border-box;
  width: var(--map-control-width);
  padding: 8px 12px;
  border: 1px solid rgba(116, 180, 242, 0.55);
  border-radius: 4px;
  background: #314567;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
}

.map-layer-mode {
  position: absolute;
  top: 58px;
  left: 28px;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  box-sizing: border-box;
  width: var(--map-control-width);
  padding: 3px;
  border: 1px solid rgba(116, 180, 242, 0.45);
  border-radius: 5px;
  background: #233550;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

.map-layer-mode button {
  height: 28px;
  min-width: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #dceaff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.map-layer-mode button[aria-pressed="true"] {
  background: #5274d1;
  color: #ffffff;
}

.map-search {
  position: absolute;
  top: 94px;
  left: 28px;
  z-index: 6;
  width: 44px;
  min-width: 0;
  display: grid;
  grid-template-columns: 44px;
  gap: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.map-search-toggle {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(120, 202, 255, 0.56);
  border-radius: 4px;
  background: #233550;
  color: #f4fbff;
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
}

.map-search-toggle:hover {
  border-color: rgba(123, 234, 255, 0.8);
  background: #314567;
}

.map-search.is-open {
  width: min(430px, calc(100% - 56px));
  grid-template-columns: 44px minmax(0, 1fr) 74px;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(120, 202, 255, 0.4);
  border-radius: 6px;
  background: #233550;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
}

.map-search input {
  display: none;
  width: 100%;
  height: 36px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid rgba(116, 180, 242, 0.45);
  border-radius: 4px;
  background: #0d182b;
}

.map-search-submit {
  display: none;
  height: 36px;
  padding: 0;
  border-radius: 4px;
  background: #5274d1;
  font-weight: 800;
}

.map-search.is-open input,
.map-search.is-open .map-search-submit,
.map-search.is-open .map-search-status {
  display: block;
}

.map-search-status {
  display: none;
  grid-column: 1 / -1;
  min-height: 16px;
  margin: -2px 4px 0;
  color: #9fe7ff;
  font-size: 12px;
  line-height: 1.3;
}

.map-search-status.is-error {
  color: #ff9d99;
}

.route-milestone-button {
  position: absolute;
  top: 24px;
  left: calc(28px + var(--map-control-width) + 10px);
  z-index: 6;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(120, 202, 255, 0.5);
  border-radius: 4px;
  background: rgba(8, 15, 29, 0.78);
  color: #f4fbff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.route-milestone-button[aria-pressed="true"] {
  border-color: rgba(255, 220, 115, 0.85);
  background: rgba(169, 124, 24, 0.82);
}

.top-map-panels {
  position: absolute;
  top: 10px;
  right: 28px;
  left: var(--map-left-control-zone);
  z-index: 8;
  max-width: calc(100% - var(--map-left-control-zone) - 28px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(18px, 3vw, 40px);
  transform: none;
  pointer-events: none;
}

.top-map-panels > section {
  position: relative;
  min-width: 0;
  display: grid;
  justify-items: center;
  width: auto;
  pointer-events: none;
}

.miniprogram-link-panel {
  z-index: 3;
}

.miniprogram-link-panel.is-collapsed {
  width: auto;
}

.miniprogram-link-toggle {
  min-width: 116px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(120, 202, 255, 0.42);
  border-radius: 0 0 6px 6px;
  background: rgba(8, 15, 29, 0.82);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  color: #eef6ff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.miniprogram-link-toggle:hover,
.miniprogram-link-toggle:focus-visible {
  border-color: rgba(255, 220, 115, 0.82);
  outline: none;
}

.miniprogram-link-panel:not(.is-collapsed) .competition-toggle-arrow {
  transform: rotate(180deg);
}

.miniprogram-link-card {
  position: absolute;
  top: 40px;
  left: 50%;
  width: min(420px, calc(100vw - 56px));
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(120, 202, 255, 0.42);
  border-radius: 6px;
  background: rgba(8, 15, 29, 0.88);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(6px);
  transform: translateX(-50%);
  pointer-events: auto;
}

.miniprogram-link-panel.is-collapsed .miniprogram-link-card {
  display: none;
}

.miniprogram-link-field {
  gap: 6px;
  color: #bcd4f2;
  font-size: 12px;
}

.miniprogram-link-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 8px;
}

.miniprogram-link-copy-row input {
  height: 34px;
  padding: 0 9px;
  border-radius: 4px;
  background: rgba(18, 30, 50, 0.88);
  font-size: 12px;
}

.miniprogram-link-copy-row button {
  height: 34px;
  padding: 0;
  border-radius: 4px;
  background: #2f6fd6;
  font-size: 13px;
  font-weight: 800;
}

.competition-panel {
  position: relative;
  z-index: 7;
}

.competition-panel.is-collapsed {
  width: auto;
}

.competition-toggle {
  min-width: 116px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(120, 202, 255, 0.42);
  border-radius: 0 0 6px 6px;
  background: rgba(8, 15, 29, 0.82);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  color: #eef6ff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.competition-toggle:hover,
.competition-toggle:focus-visible {
  border-color: rgba(255, 220, 115, 0.82);
  outline: none;
}

.competition-toggle-arrow {
  width: 0;
  height: 0;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  border-top: 7px solid #eef6ff;
  transform-origin: 50% 42%;
  transition: transform 0.18s ease;
}

.competition-panel:not(.is-collapsed) .competition-toggle-arrow {
  transform: rotate(180deg);
}

.competition-panel-body {
  position: absolute;
  top: 40px;
  left: 50%;
  width: min(1180px, calc(100vw - 56px));
  max-width: calc(100vw - 56px);
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(120, 202, 255, 0.42);
  border-radius: 6px;
  background: rgba(8, 15, 29, 0.82);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(6px);
  transform: translateX(-50%);
  pointer-events: auto;
}

.competition-panel.is-collapsed .competition-panel-body {
  display: none;
}

.competition-ranking-panel {
  z-index: 7;
}

.command-status-panel {
  z-index: 7;
}

.competition-ranking-panel.is-collapsed {
  width: auto;
}

.command-status-panel.is-collapsed {
  width: auto;
}

.competition-ranking-toggle,
.command-status-toggle {
  min-width: 116px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(120, 202, 255, 0.42);
  border-radius: 0 0 6px 6px;
  background: rgba(8, 15, 29, 0.82);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  color: #eef6ff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  backdrop-filter: blur(6px);
  pointer-events: auto;
}

.competition-ranking-toggle:hover,
.competition-ranking-toggle:focus-visible,
.command-status-toggle:hover,
.command-status-toggle:focus-visible {
  border-color: rgba(255, 220, 115, 0.82);
  outline: none;
}

.competition-ranking-panel:not(.is-collapsed) .competition-toggle-arrow,
.command-status-panel:not(.is-collapsed) .competition-toggle-arrow {
  transform: rotate(180deg);
}

.command-status-toggle {
  min-width: 260px;
  white-space: nowrap;
}

.command-status-toggle > span:first-child {
  white-space: nowrap;
}

.command-status-summary {
  color: #9fe7ff;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.competition-ranking-body,
.command-status-body {
  position: absolute;
  top: 40px;
  left: 50%;
  width: min(360px, calc(100vw - 56px));
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(120, 202, 255, 0.42);
  border-radius: 6px;
  background: rgba(8, 15, 29, 0.86);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(6px);
  transform: translateX(-50%);
  pointer-events: auto;
}

.competition-ranking-panel.is-collapsed .competition-ranking-body,
.command-status-panel.is-collapsed .command-status-body {
  display: none;
}

.competition-ranking-head {
  display: grid;
  gap: 3px;
}

.competition-ranking-head strong {
  color: #ffffff;
  font-size: 14px;
}

.competition-ranking-head span {
  color: #91a9c9;
  font-size: 11px;
  line-height: 1.25;
}

.competition-ranking-list {
  max-height: 300px;
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.competition-ranking-list li {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(38px, auto) 24px minmax(70px, 1fr) minmax(58px, auto);
  gap: 6px;
  align-items: center;
  padding: 6px 7px;
  border: 1px solid rgba(103, 150, 217, 0.22);
  border-radius: 5px;
  background: rgba(4, 10, 20, 0.46);
  color: #dcecff;
  font-size: 12px;
  line-height: 1;
}

.competition-rank-index {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255, 220, 115, 0.18);
  color: #ffdc73;
  font-weight: 900;
}

.competition-ranking-list strong {
  color: #ffffff;
  font-size: 13px;
}

.competition-rank-gender {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(120, 202, 255, 0.16);
  color: #9fe7ff;
  font-weight: 900;
}

.competition-rank-gender.is-female {
  background: rgba(255, 128, 184, 0.18);
  color: #ff9fc8;
}

.competition-ranking-empty {
  grid-template-columns: 1fr !important;
  color: #91a9c9;
  text-align: center;
}

.command-status-list {
  max-height: 300px;
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.command-status-list li {
  min-width: 0;
  display: grid;
  grid-template-columns: 54px minmax(68px, auto) minmax(92px, 1fr) minmax(40px, auto);
  gap: 7px;
  align-items: center;
  padding: 6px 7px;
  border: 1px solid rgba(103, 150, 217, 0.22);
  border-radius: 5px;
  background: rgba(4, 10, 20, 0.46);
  color: #dcecff;
  font-size: 12px;
  line-height: 1.1;
}

.command-status-list li.is-offline {
  border-color: rgba(140, 150, 164, 0.22);
  background: rgba(31, 35, 43, 0.66);
  color: #aeb6c1;
}

.command-status-list strong,
.command-status-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-status-list time {
  color: #91a9c9;
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.command-status-badge {
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.command-connection-badge {
  display: inline-grid;
  place-items: center;
  min-width: 46px;
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.command-connection-badge.online {
  background: rgba(109, 235, 126, 0.16);
  color: #9dffa8;
}

.command-connection-badge.offline,
.command-status-badge.missing {
  background: rgba(142, 150, 163, 0.18);
  color: #b4bdc9;
}

.command-status-badge.queued {
  background: rgba(255, 220, 115, 0.18);
  color: #ffdc73;
}

.command-status-badge.sent {
  background: rgba(120, 202, 255, 0.16);
  color: #9fe7ff;
}

.command-status-badge.acked {
  background: rgba(109, 235, 126, 0.16);
  color: #9dffa8;
}

.command-status-empty {
  grid-template-columns: 1fr !important;
  color: #91a9c9;
  text-align: center;
}

.competition-settings-row {
  display: grid;
  grid-template-columns: minmax(128px, 0.8fr) minmax(220px, 1.35fr) repeat(3, minmax(108px, 0.7fr));
  gap: 8px;
}

.competition-time-settings-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(210px, 280px)) minmax(260px, 1fr);
  gap: 8px;
  align-items: end;
}

.competition-time-settings-row label {
  gap: 4px;
  color: #bcd4f2;
  font-size: 12px;
  line-height: 1.1;
}

.competition-time-settings-row input {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border-color: rgba(255, 220, 115, 0.62);
  border-radius: 4px;
  background: rgba(18, 30, 50, 0.92);
  color: #fff7d1;
  font-size: 13px;
  font-weight: 800;
}

.competition-time-settings-row input:disabled {
  cursor: not-allowed;
  opacity: 0.74;
}

.competition-time-settings-row p {
  min-height: 32px;
  display: flex;
  align-items: center;
  margin: 0;
  color: #91a9c9;
  font-size: 11px;
  line-height: 1.35;
}

.competition-settings-row label {
  gap: 4px;
  color: #bcd4f2;
  font-size: 12px;
  line-height: 1.1;
}

.competition-settings-row input,
.competition-settings-row select {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border-radius: 4px;
  background: rgba(18, 30, 50, 0.86);
  color: #eef6ff;
  font-size: 13px;
}

.competition-settings-row select:disabled,
.competition-settings-row input:disabled {
  cursor: not-allowed;
  opacity: 0.74;
}

.competition-config-status {
  flex: 1;
  min-height: 16px;
  margin: 0;
  color: #8ee7b4;
  font-size: 11px;
  line-height: 1.35;
}

.competition-save-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.competition-save-button {
  min-width: 132px;
  height: 34px;
  flex: 0 0 auto;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 900;
}

.competition-save-button.is-dirty:not(:disabled) {
  border-color: rgba(255, 220, 115, 0.86);
  background: linear-gradient(135deg, #c58a20, #8d6118);
  box-shadow: 0 0 0 2px rgba(255, 220, 115, 0.15);
}

.competition-input-wrap {
  position: relative;
  display: block;
  min-width: 0;
}

.competition-input-wrap input {
  padding-right: 50px;
}

.competition-input-unit {
  position: absolute;
  top: 50%;
  right: 9px;
  color: #91a9c9;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  transform: translateY(-50%);
  pointer-events: none;
}

.competition-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.competition-metrics-row article {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 7px 9px;
  border: 1px solid rgba(103, 150, 217, 0.22);
  border-radius: 5px;
  background: rgba(4, 10, 20, 0.42);
}

.competition-metrics-row span {
  overflow: hidden;
  color: #91a9c9;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.competition-metrics-row strong {
  color: #ffffff;
  font-size: 16px;
  line-height: 1.2;
}

#sixth-countdown,
#mobile-sixth-countdown {
  display: block;
  font-size: 15px;
  line-height: 1.3;
}

.track-panel {
  position: absolute;
  top: 26px;
  right: 32px;
  z-index: 6;
  width: min(300px, calc(100% - 64px));
  display: grid;
  gap: 8px;
  padding: 16px 12px 12px;
  border: 1px solid rgba(120, 202, 255, 0.4);
  border-radius: 8px;
  background: rgba(8, 15, 29, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

.track-panel.is-loading {
  border-color: rgba(120, 202, 255, 0.5);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
}

.route-panel,
.geofence-panel {
  position: absolute;
  top: 26px;
  right: 32px;
  z-index: 7;
  width: min(360px, calc(100% - 64px));
  display: grid;
  gap: 12px;
  padding: 18px 14px 14px;
  border: 1px solid rgba(120, 202, 255, 0.4);
  border-radius: 8px;
  background: rgba(8, 15, 29, 0.94);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

.track-close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border-color: rgba(154, 189, 242, 0.42);
  background: rgba(19, 30, 51, 0.72);
  font-size: 22px;
  line-height: 1;
}

.route-close-button,
.geofence-close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border-color: rgba(154, 189, 242, 0.42);
  background: rgba(19, 30, 51, 0.72);
  font-size: 22px;
  line-height: 1;
}

.track-close-button:hover,
.route-close-button:hover,
.geofence-close-button:hover {
  border-color: rgba(123, 234, 255, 0.8);
  background: rgba(52, 89, 145, 0.92);
}

.track-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.track-confirm-button,
.track-cancel-button {
  height: 38px;
  border-color: rgba(154, 189, 242, 0.42);
  color: #f4fbff;
  font-size: 15px;
  font-weight: 800;
}

.track-confirm-button {
  border-color: rgba(123, 234, 255, 0.62);
  background: #2f6fd6;
}

.track-cancel-button {
  background: rgba(35, 53, 80, 0.88);
}

.track-confirm-button:disabled,
.track-cancel-button:disabled {
  cursor: default;
  opacity: 0.56;
}

.track-confirm-button:hover,
.track-confirm-button:focus-visible,
.track-cancel-button:hover,
.track-cancel-button:focus-visible {
  border-color: rgba(123, 234, 255, 0.8);
  background: rgba(52, 89, 145, 0.92);
  outline: none;
}

.track-panel label,
.route-panel label,
.geofence-panel label {
  gap: 6px;
}

.geofence-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.route-upload-section {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(103, 150, 217, 0.24);
}

.route-upload-section input[type="file"] {
  padding: 9px 10px;
}

.route-list {
  max-height: 190px;
  display: grid;
  gap: 8px;
  overflow-y: auto;
}

.route-empty {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(103, 150, 217, 0.24);
  color: #b7c6da;
  font-size: 13px;
}

.route-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  border: 1px solid rgba(103, 150, 217, 0.28);
  background: rgba(10, 19, 36, 0.78);
}

.route-row.is-active {
  border-color: rgba(255, 220, 115, 0.78);
  background: rgba(47, 61, 45, 0.84);
}

.route-open-button {
  min-width: 0;
  display: grid;
  gap: 4px;
  justify-items: start;
  padding: 9px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.route-open-button strong,
.route-open-button span {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.route-open-button span {
  color: #9fe7ff;
  font-size: 12px;
}

.route-delete-button {
  align-self: center;
  margin-right: 8px;
  padding: 6px 9px;
  border-color: rgba(255, 117, 110, 0.42);
  background: rgba(87, 31, 38, 0.76);
  color: #ffd8d6;
  font-size: 12px;
}

.track-panel .form-note,
.route-panel .form-note,
.geofence-panel .form-note {
  font-size: 13px;
}

.track-panel #track-status {
  min-height: 26px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.track-panel.is-loading #track-status {
  padding: 7px 9px;
  border: 1px solid rgba(123, 234, 255, 0.28);
  border-radius: 6px;
  background: rgba(46, 93, 142, 0.24);
  color: #dff7ff;
}

.track-panel.is-loading #track-status::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #7beaff;
  box-shadow: 0 0 0 0 rgba(123, 234, 255, 0.42);
  animation: track-loading-pulse 1.1s ease-out infinite;
}

@keyframes track-loading-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(123, 234, 255, 0.46);
  }
  100% {
    box-shadow: 0 0 0 9px rgba(123, 234, 255, 0);
  }
}

.route-layer,
.geofence-layer,
.track-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.geofence-band {
  fill: none;
  stroke: rgba(255, 220, 115, 0.72);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 14;
  opacity: 0.54;
  vector-effect: non-scaling-stroke;
}

.route-line {
  fill: none;
  stroke: #5b21b6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  opacity: 0.96;
  vector-effect: non-scaling-stroke;
}

.route-point {
  fill: #5b21b6;
  stroke: #08101e;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.route-mile-label {
  fill: #08101e;
  stroke: #ffdc73;
  stroke-width: 5;
  paint-order: stroke;
  font-size: 4px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.route-rest-point {
  fill: #ff4d57;
  stroke: #fff7e8;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.route-rest-label {
  fill: #fff7e8;
  stroke: rgba(20, 24, 35, 0.92);
  stroke-width: 4;
  paint-order: stroke;
  font-size: 4px;
  font-weight: 900;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.track-line {
  fill: none;
  stroke: #ff2d7a;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  opacity: 0.88;
  vector-effect: non-scaling-stroke;
}

.marker-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.marker {
  position: absolute;
  transform: translate(-50%, -100%);
  display: grid;
  gap: 6px;
}

.marker-pin {
  width: 22px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #6deb7e;
}

.marker-label {
  min-width: 150px;
  padding: 8px 10px;
  border: 1px solid rgba(109, 235, 126, 0.35);
  background: rgba(5, 10, 19, 0.82);
  line-height: 1.35;
}

.runner-map-marker {
  position: relative;
  display: grid;
  justify-items: center;
  transform-origin: center bottom;
  overflow: visible;
  pointer-events: none;
}

.runner-spider-line {
  position: absolute;
  left: 50%;
  top: 33px;
  width: 2px;
  height: var(--spider-line-length, 42px);
  border-radius: 999px;
  background: rgba(220, 236, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(5, 10, 19, 0.45);
  transform: translateX(-50%) rotate(var(--spider-line-angle, 0deg));
  transform-origin: top center;
  pointer-events: none;
  z-index: -1;
}

.runner-stem {
  order: 2;
  width: 3px;
  height: 34px;
  border-radius: 999px;
  background: #37f29b;
  box-shadow: 0 0 0 2px rgba(5, 10, 19, 0.76), 0 0 14px rgba(55, 242, 155, 0.55);
}

.runner-avatar-button {
  order: 1;
  min-width: 32px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 3px;
  border: 1px solid rgba(140, 226, 255, 0.72);
  border-radius: 50%;
  background: rgba(4, 10, 20, 0.88);
  color: #ffffff;
  pointer-events: auto;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}

.runner-avatar-mini {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, #4c80ff, #23d1a6);
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
}

.runner-avatar-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.runner-loss-badge {
  order: 3;
  position: absolute;
  top: 100%;
  left: 50%;
  margin-top: 0;
  padding: 2px 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  transform: translate(-50%, 3px);
}

.runner-location-badge {
  order: 3;
  position: absolute;
  left: 50%;
  margin-top: 0;
  padding: 2px 5px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.runner-loss-badge {
  border: 1px solid rgba(255, 144, 118, 0.72);
  background: rgba(78, 16, 10, 0.84);
  color: #ffd1c7;
}

.runner-location-badge {
  top: auto;
  bottom: 100%;
  border: 1px solid rgba(255, 205, 96, 0.76);
  background: rgba(71, 48, 8, 0.9);
  color: #ffe6a6;
  transform: translate(-50%, -3px);
}

.runner-map-marker.is-location-stale .runner-avatar-button {
  border-style: dashed;
  border-color: rgba(255, 205, 96, 0.84);
  opacity: 0.86;
}

.runner-map-marker.is-location-stale .runner-stem {
  background: #d7a93f;
  box-shadow: 0 0 0 2px rgba(5, 10, 19, 0.76), 0 0 12px rgba(215, 169, 63, 0.42);
}

.runner-map-marker.is-packet-loss .runner-stem {
  background: #ff725c;
  box-shadow: 0 0 0 2px rgba(5, 10, 19, 0.76), 0 0 14px rgba(255, 114, 92, 0.5);
}

.runner-map-marker.is-spider-expanded .runner-avatar-button {
  border-color: rgba(255, 78, 104, 0.92);
  background: rgba(8, 12, 26, 0.94);
  box-shadow:
    0 0 0 2px rgba(255, 78, 104, 0.36),
    0 12px 26px rgba(0, 0, 0, 0.42);
  transform: translate(var(--spider-x, 0px), var(--spider-y, 0px));
}

.runner-map-marker.is-spider-expanded .runner-spider-line {
  display: none;
}

.runner-map-marker.is-spider-expanded .runner-loss-badge {
  transform: translate(
    calc(-50% + var(--spider-x, 0px)),
    calc(3px + var(--spider-y, 0px))
  );
}

.runner-map-marker.is-spider-expanded .runner-location-badge {
  transform: translate(
    calc(-50% + var(--spider-x, 0px)),
    calc(-3px + var(--spider-y, 0px))
  );
}

.amap-marker-label {
  padding: 6px 8px;
  border: 1px solid rgba(109, 235, 126, 0.42);
  border-radius: 4px;
  background: rgba(5, 10, 19, 0.86);
  color: #eef6ff;
  line-height: 1.35;
  white-space: nowrap;
}

.amap-runner-info {
  display: grid;
  gap: 4px;
  min-width: 190px;
  padding: 8px 10px;
  border: 1px solid rgba(109, 235, 126, 0.42);
  border-radius: 4px;
  background: rgba(5, 10, 19, 0.92);
  color: #eef6ff;
  font: 13px/1.4 "Microsoft YaHei", system-ui, sans-serif;
}

.amap-runner-info strong,
.amap-runner-info span {
  display: block;
}

.amap-runner-info strong {
  font-size: 15px;
}

.nearby-runner-panel {
  width: min(310px, 76vw);
  max-height: 340px;
}

.nearby-runner-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  width: 100%;
  overflow-y: auto;
}

.nearby-runner-item {
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid rgba(142, 190, 255, 0.24);
  border-radius: 8px;
  background: rgba(21, 35, 56, 0.82);
  color: #f6fbff;
  text-align: left;
}

.nearby-runner-item:hover,
.nearby-runner-item:focus-visible {
  border-color: rgba(109, 235, 126, 0.75);
  background: rgba(30, 58, 73, 0.92);
}

.nearby-runner-item.is-offline {
  border-color: rgba(146, 153, 164, 0.25);
  background: rgba(51, 55, 63, 0.9);
  color: #aeb4bc;
}

.nearby-runner-item.is-offline:hover,
.nearby-runner-item.is-offline:focus-visible {
  border-color: rgba(184, 190, 200, 0.48);
  background: rgba(61, 65, 74, 0.94);
}

.nearby-runner-item.is-offline .nearby-runner-avatar {
  background: linear-gradient(135deg, #6d737c, #454a52);
  filter: grayscale(1);
  opacity: 0.72;
}

.nearby-runner-item.is-offline .nearby-runner-copy small,
.nearby-runner-item.is-offline .mobile-runner-overview-metrics,
.nearby-runner-item.is-offline .nearby-runner-chevron {
  color: #939aa4;
}

.nearby-runner-avatar {
  width: 34px;
  height: 34px;
  display: grid !important;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, #4c80ff, #23d1a6);
  font-size: 11px;
  font-weight: 900;
}

.nearby-runner-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nearby-runner-copy {
  min-width: 0;
}

.nearby-runner-copy strong,
.nearby-runner-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nearby-runner-copy strong {
  font-size: 14px;
}

.nearby-runner-copy small {
  display: block;
  margin-top: 2px;
  color: rgba(226, 238, 252, 0.7);
  font-size: 11px;
}

.nearby-runner-copy .mobile-runner-overview-metrics {
  color: #d9fff1;
  font-size: 11px;
}

.mobile-runner-list-empty {
  grid-column: 1 / -1;
  margin: 18px 0;
  color: rgba(255, 255, 255, 0.74);
  text-align: center;
}

.nearby-runner-chevron {
  color: #72eab0;
  font-size: 24px;
  text-align: center;
}

.route-amap-mile-label {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 2px solid #08101e;
  border-radius: 50%;
  background: #ffdc73;
  color: #08101e;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.route-amap-rest-label {
  padding: 7px 9px;
  border: 2px solid #fff7e8;
  border-radius: 4px;
  background: #ff4d57;
  box-shadow: 0 8px 20px rgba(8, 12, 20, 0.24);
  color: #fff7e8;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.route-amap-turnaround-label {
  padding: 7px 9px;
  border: 2px solid #fff7e8;
  border-radius: 4px;
  background: #ff4d57;
  box-shadow: 0 8px 20px rgba(8, 12, 20, 0.24);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.route-amap-endpoint {
  min-width: 42px;
  padding: 6px 8px;
  border: 2px solid #eef6ff;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(8, 12, 20, 0.24);
  color: #08101e;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.route-amap-endpoint.is-start {
  background: #72eab0;
}

.route-amap-endpoint.is-finish {
  background: #ff8b91;
}

.route-amap-endpoint.is-shared-terminal {
  border-color: #fff7e8;
  border-radius: 6px;
  background: #e5525b;
  color: #fff;
}

.empty-map {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
  color: rgba(236, 247, 255, 0.74);
  font-size: 18px;
  pointer-events: none;
}

.mobile-route-select-wrap,
.mobile-competition-summary,
.mobile-refresh-button,
.mobile-route-milestones-button,
.mobile-satellite-button,
.mobile-runner-list-button,
.mobile-competition-status-button,
.mobile-map-zoom-controls {
  display: none;
}

.mobile-route-select-wrap {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 9;
  width: min(240px, calc(100% - 120px));
  overflow: visible;
  padding: 0;
  pointer-events: auto;
}

.mobile-route-select {
  width: 100%;
  min-height: 38px;
  padding: 0 34px 0 12px;
  border: 1px solid rgba(255, 220, 115, 0.68);
  border-radius: 6px;
  background: rgba(5, 10, 19, 0.82);
  color: #fff7d1;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  outline: none;
}

.mobile-route-select:focus {
  border-color: rgba(125, 243, 255, 0.82);
  box-shadow: 0 0 0 2px rgba(60, 200, 255, 0.22);
}

.mobile-competition-summary {
  position: absolute;
  top: 58px;
  left: 14px;
  z-index: 9;
  max-width: calc(100% - 100px);
  margin: 0;
  padding: 7px 10px;
  border: 1px solid rgba(125, 243, 255, 0.42);
  border-radius: 6px;
  background: rgba(5, 10, 19, 0.82);
  color: #eefaff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.mobile-refresh-button {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 9;
  width: 58px;
  height: 36px;
  padding: 0;
  border-color: rgba(255, 151, 151, 0.52);
  border-radius: 6px;
  background: rgba(56, 35, 42, 0.9);
  font-size: 13px;
  font-weight: 800;
}

.mobile-route-milestones-button {
  position: absolute;
  top: 58px;
  right: 14px;
  z-index: 9;
  width: 58px;
  height: 36px;
  padding: 0;
  border-color: rgba(120, 202, 255, 0.58);
  border-radius: 6px;
  background: rgba(5, 10, 19, 0.82);
  color: #eaf6ff;
  font-size: 12px;
  font-weight: 800;
}

.mobile-route-milestones-button[aria-pressed="true"] {
  border-color: rgba(255, 220, 115, 0.78);
  background: rgba(76, 59, 20, 0.9);
  color: #fff2bd;
}

.mobile-satellite-button {
  position: absolute;
  top: 102px;
  right: 14px;
  z-index: 9;
  width: 58px;
  height: 36px;
  padding: 0;
  border-color: rgba(120, 202, 255, 0.58);
  border-radius: 6px;
  background: rgba(5, 10, 19, 0.82);
  color: #eaf6ff;
  font-size: 12px;
  font-weight: 800;
}

.mobile-satellite-button[aria-pressed="true"] {
  border-color: rgba(255, 220, 115, 0.78);
  background: rgba(76, 59, 20, 0.9);
  color: #fff2bd;
}

.mobile-runner-list-button {
  position: absolute;
  top: 146px;
  right: 14px;
  z-index: 9;
  width: 58px;
  height: 36px;
  padding: 0;
  border-color: rgba(114, 234, 176, 0.68);
  border-radius: 6px;
  background: rgba(12, 48, 42, 0.9);
  color: #eafff5;
  font-size: 12px;
  font-weight: 900;
}

.mobile-runner-list-button[aria-expanded="true"] {
  border-color: rgba(255, 220, 115, 0.82);
  background: rgba(76, 59, 20, 0.92);
  color: #fff2bd;
}

.mobile-competition-status-button {
  position: absolute;
  top: 190px;
  right: 14px;
  z-index: 9;
  width: 58px;
  min-height: 42px;
  padding: 0 5px;
  border-color: rgba(255, 220, 115, 0.74);
  border-radius: 6px;
  background: rgba(76, 59, 20, 0.92);
  color: #fff2bd;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
}

.mobile-competition-status-button[aria-expanded="true"] {
  border-color: rgba(125, 243, 255, 0.82);
  background: rgba(17, 65, 79, 0.94);
  color: #e9fbff;
}

.mobile-competition-settings-backdrop {
  position: absolute;
  inset: 0;
  z-index: 18;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(2px);
  pointer-events: auto;
}

.mobile-competition-settings-sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 19;
  width: min(680px, calc(100% - 20px));
  max-height: min(86vh, 720px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid rgba(125, 243, 255, 0.48);
  border-radius: 14px 14px 0 0;
  background: rgba(30, 40, 61, 0.98);
  color: #f7fbff;
  box-shadow: 0 -20px 58px rgba(0, 0, 0, 0.42);
  overflow: hidden;
  transform: translateX(-50%);
  pointer-events: auto;
}

.mobile-competition-settings-header {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.mobile-competition-settings-header > div {
  display: grid;
  gap: 2px;
}

.mobile-competition-settings-header strong {
  font-size: 18px;
}

.mobile-competition-settings-header span {
  color: #9fe7ff;
  font-size: 11px;
}

.mobile-competition-settings-header button {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 32px;
  line-height: 1;
}

.mobile-competition-settings-body {
  display: grid;
  gap: 12px;
  padding: 14px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}

.mobile-competition-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mobile-competition-settings-grid label {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 700;
}

.mobile-competition-settings-grid label:nth-child(2) {
  grid-column: span 2;
}

.mobile-competition-settings-grid label.is-emphasis span {
  color: #fff2bd;
}

.mobile-competition-settings-grid input,
.mobile-competition-settings-grid select,
.mobile-competition-auth input {
  width: 100%;
  height: 40px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid rgba(125, 177, 235, 0.42);
  border-radius: 6px;
  background: rgba(8, 17, 32, 0.86);
  color: #fff;
  font-size: 14px;
}

.mobile-competition-settings-grid label.is-emphasis input {
  border-color: rgba(255, 220, 115, 0.64);
  color: #fff2bd;
  font-weight: 900;
}

.mobile-competition-settings-grid input:disabled,
.mobile-competition-settings-grid select:disabled {
  cursor: not-allowed;
  border-color: rgba(125, 150, 180, 0.24);
  background: rgba(8, 17, 32, 0.58);
  color: rgba(220, 232, 245, 0.52);
  opacity: 1;
}

.mobile-competition-auth {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 220, 115, 0.35);
  border-radius: 7px;
  background: rgba(76, 59, 20, 0.34);
}

.mobile-competition-auth p {
  grid-column: 1 / -1;
  margin: 0;
  color: #fff2bd;
  font-size: 11px;
}

.mobile-competition-live-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.mobile-competition-live-metrics span {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid rgba(103, 150, 217, 0.24);
  border-radius: 6px;
  background: rgba(4, 10, 20, 0.42);
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}

.mobile-competition-live-metrics strong {
  color: #fff;
  font-size: 15px;
}

#save-mobile-competition-settings {
  min-height: 42px;
  font-weight: 900;
}

#mobile-competition-settings-message {
  min-height: 18px;
  margin: 0;
  color: #9fe7ff;
}

.mobile-map-zoom-controls {
  position: absolute;
  right: 14px;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  z-index: 11;
  grid-template-rows: repeat(2, 54px);
  width: 54px;
  overflow: hidden;
  border: 1px solid rgba(26, 40, 62, 0.28);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
  pointer-events: auto;
}

.mobile-map-zoom-controls button {
  width: 54px;
  height: 54px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #111;
  font-size: 34px;
  font-weight: 400;
  line-height: 1;
  touch-action: manipulation;
}

.mobile-map-zoom-controls button + button {
  border-top: 1px solid rgba(26, 40, 62, 0.18);
}

.mobile-map-zoom-controls button:active:not(:disabled) {
  background: #eaf1f8;
}

.mobile-map-zoom-controls button:disabled {
  color: #aeb7c2;
  opacity: 1;
}

.mobile-runner-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  max-height: min(48vh, 390px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 12px 12px 0 0;
  background: rgba(48, 56, 79, 0.96);
  color: #f7fbff;
  box-shadow: 0 -18px 52px rgba(0, 0, 0, 0.34);
  overflow: hidden;
  pointer-events: auto;
}

.mobile-runner-sheet-header {
  min-height: 56px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.mobile-runner-sheet-avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  background: #18304f;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.mobile-runner-sheet-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nearby-runner-count {
  font-size: 15px;
}

.mobile-runner-sheet-header strong {
  min-width: 0;
  overflow: hidden;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-runner-sheet-close {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
}

.mobile-runner-sheet-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 14px;
  row-gap: 8px;
  padding: 12px 16px 18px;
  overflow-y: auto;
}

.mobile-runner-sheet-row {
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
  align-items: baseline;
  min-height: 24px;
  gap: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
}

.mobile-runner-sheet-row::before {
  content: none;
}

.mobile-runner-sheet-row span {
  grid-column: 1;
  justify-self: start;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  white-space: nowrap;
}

.mobile-runner-sheet-row strong {
  grid-column: 2;
  justify-self: start;
  font: inherit;
  color: #fff;
  text-align: left;
  word-break: break-word;
}

.stats {
  width: 100%;
  min-width: 0;
  align-self: end;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid rgba(103, 150, 217, 0.38);
  background: rgba(8, 17, 33, 0.82);
}

.stats article {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 54px;
  border-right: 1px solid rgba(103, 150, 217, 0.24);
}

.stats article:last-child {
  border-right: 0;
}

.stats strong {
  font-size: 22px;
}

.stats span {
  color: #d0d8e8;
  font-size: 12px;
  font-weight: 700;
}

.alarm-records-panel {
  display: grid;
  gap: 10px;
  min-height: 0;
  padding: 12px;
  border: 1px solid rgba(103, 150, 217, 0.32);
  border-radius: 6px;
  background: rgba(8, 17, 33, 0.84);
}

.alarm-records-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #ffdc73;
  font-weight: 800;
}

.alarm-records-panel header button {
  flex: 0 0 auto;
  min-width: 58px;
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.alarm-records-list {
  min-height: 0;
  max-height: 180px;
  display: grid;
  gap: 8px;
  overflow-y: auto;
}

.alarm-record-row {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 117, 110, 0.3);
  border-radius: 6px;
  background: rgba(57, 22, 30, 0.68);
}

.alarm-record-row strong {
  color: #ffd8d6;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.alarm-record-row span {
  color: #c9d6ea;
  font-size: 12px;
  line-height: 1.4;
}

.command-panel {
  position: absolute;
  top: 92px;
  right: 24px;
  z-index: 10;
  width: min(360px, calc(100vw - 48px));
  max-height: calc(100dvh - 120px);
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(120, 202, 255, 0.4);
  border-radius: 8px;
  background: rgba(8, 15, 29, 0.96);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  overflow-y: auto;
}

.map-config-panel {
  position: absolute;
  top: 92px;
  right: 24px;
  z-index: 11;
  width: min(390px, calc(100vw - 48px));
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(120, 202, 255, 0.4);
  border-radius: 8px;
  background: rgba(8, 15, 29, 0.96);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

.account-panel {
  position: absolute;
  top: 92px;
  right: 24px;
  z-index: 12;
  width: min(620px, calc(100vw - 48px));
  max-height: calc(100dvh - 120px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 14px;
  border: 1px solid rgba(120, 202, 255, 0.4);
  border-radius: 8px;
  background: rgba(8, 15, 29, 0.97);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  overflow-x: hidden;
  overflow-y: auto;
}

.account-panel > header,
.account-summary,
.account-panel > .primary-action,
.account-panel > .form-note,
.account-admin-section {
  grid-column: 1 / -1;
}

.account-panel > label {
  gap: 6px;
}

.map-config-panel header,
.account-panel header,
.command-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.map-config-panel header button,
.account-panel header button,
.command-panel header button {
  width: 34px;
  height: 34px;
  padding: 0;
}

.map-config-status {
  margin: 0;
  color: #9fe7ff;
  line-height: 1.5;
}

.account-summary {
  display: grid;
  grid-template-columns: max-content minmax(80px, 1fr) max-content minmax(80px, 1fr);
  align-items: center;
  gap: 8px 12px;
  padding: 9px 12px;
  border: 1px solid rgba(103, 150, 217, 0.32);
  background: rgba(12, 24, 44, 0.82);
}

.account-summary span {
  color: #c9d6ea;
}

.account-summary strong {
  color: #ffdc73;
  font-size: 18px;
}

.account-admin-section {
  display: grid;
  gap: 10px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid rgba(103, 150, 217, 0.24);
}

.account-admin-section h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.account-list {
  display: grid;
  gap: 8px;
}

.account-row {
  display: grid;
  grid-template-columns: minmax(132px, 1fr) minmax(90px, 106px) minmax(90px, 106px) minmax(108px, 0.85fr) repeat(2, minmax(48px, auto));
  gap: 6px;
  align-items: center;
  padding: 6px;
  border: 1px solid rgba(103, 150, 217, 0.28);
  background: rgba(10, 19, 36, 0.78);
}

.account-row--self {
  grid-template-columns: minmax(132px, 1fr) minmax(90px, 106px) minmax(90px, 106px) repeat(2, minmax(48px, auto));
}

.account-row-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.account-row-main strong,
.account-row-main span {
  overflow-wrap: anywhere;
}

.account-row-main span {
  color: #9fe7ff;
  font-size: 14px;
}

.account-row input,
.account-row select {
  min-height: 40px;
  padding: 8px 9px;
}

.account-row button {
  min-height: 40px;
  padding: 8px 10px;
  white-space: nowrap;
}

.account-row .password-field input {
  padding-right: 40px;
}

.account-row .password-toggle {
  width: 30px;
  height: 28px;
}

.account-create-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(92px, 108px) minmax(92px, 108px) minmax(86px, auto);
  gap: 6px;
  align-items: center;
}

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

.quick-commands button {
  min-height: 45px;
  line-height: 1.35;
  white-space: normal;
}

.primary-action {
  background: #2f6fd6;
}

body.is-mobile-mode .shell {
  --sidebar-width: 0px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

body.is-mobile-mode .topbar,
body.is-mobile-mode .sidebar,
body.is-mobile-mode .sidebar-toggle,
body.is-mobile-mode .miniprogram-link-panel,
body.is-mobile-mode .competition-panel,
body.is-mobile-mode .competition-ranking-panel,
body.is-mobile-mode .command-status-panel,
body.is-mobile-mode .track-panel,
body.is-mobile-mode .route-panel,
body.is-mobile-mode .geofence-panel,
body.is-mobile-mode .command-panel,
body.is-mobile-mode .map-config-panel,
body.is-mobile-mode .account-panel,
body.is-mobile-mode .map-badge,
body.is-mobile-mode .map-layer-mode,
body.is-mobile-mode .map-search,
body.is-mobile-mode .route-milestone-button {
  display: none !important;
}

body.is-mobile-mode .map-stage {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  border: 0;
}

body.is-mobile-mode .mobile-route-select-wrap,
body.is-mobile-mode .mobile-competition-summary:not(.is-hidden),
body.is-mobile-mode .mobile-refresh-button,
body.is-mobile-mode .mobile-route-milestones-button:not(.is-hidden),
body.is-mobile-mode .mobile-satellite-button,
body.is-mobile-mode .mobile-runner-list-button,
body.is-mobile-mode .mobile-competition-status-button,
body.is-mobile-mode .mobile-map-zoom-controls {
  display: block;
}

body.is-mobile-mode .mobile-map-zoom-controls {
  display: grid;
}

body.is-mobile-mode .amap-container {
  transform: none;
  touch-action: none;
}

body.is-mobile-mode .marker-layer {
  pointer-events: none;
}

@media (max-width: 1120px) {
  .map-search.is-open {
    width: min(430px, calc(100% - 56px));
  }

  .top-map-panels {
    gap: 32px;
  }

  .competition-panel,
  .competition-ranking-panel,
  .command-status-panel {
    top: auto;
    right: auto;
    left: auto;
    width: auto;
  }

  .competition-panel-body {
    width: min(760px, calc(100vw - 48px));
  }

  .competition-settings-row,
  .competition-time-settings-row,
  .competition-metrics-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .track-panel,
  .route-panel,
  .geofence-panel {
    top: 128px;
  }
}

@media (max-width: 640px) {
  .login-view {
    padding: 18px;
  }

  .login-panel {
    width: min(360px, calc(100vw - 36px));
    padding: 22px;
  }
}

@media (max-width: 1180px), (max-height: 640px) {
  .login-view {
    width: var(--login-design-width);
    min-height: 0;
    height: var(--login-design-height);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(var(--login-rotation)) scale(var(--login-scale));
    transform-origin: center center;
  }

  .login-panel {
    width: 390px;
  }
}

@media (max-width: 1180px) and (orientation: portrait) {
  .login-view {
    --login-rotation: 90deg;
  }

  .shell {
    --mobile-rotation: 90deg;
  }
}

@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 340px minmax(0, 1fr);
  }

  .topbar {
    display: grid;
    gap: 10px;
    padding-bottom: 10px;
  }

  .brand {
    width: auto;
    flex-basis: auto;
    padding-top: 12px;
  }

  .nav-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 0 12px;
    overflow: visible;
  }

  .nav-tabs button {
    width: 100%;
    min-width: 0;
  }

  .logout-button {
    justify-self: end;
    margin: 0 12px 0 0;
  }

  .map-config-button {
    justify-self: end;
    margin: 0 12px 0 0;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid rgba(224, 205, 101, 0.4);
  }

  .track-panel,
  .route-panel,
  .geofence-panel {
    top: 136px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .account-panel {
    top: 136px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .map-badge {
    top: 14px;
    left: 12px;
  }

  .map-search {
    top: 54px;
    left: 12px;
    width: 44px;
    min-width: 0;
    grid-template-columns: 44px;
  }

  .map-search.is-open {
    right: 12px;
    left: 12px;
    width: auto;
    grid-template-columns: 44px minmax(0, 1fr) 64px;
  }

  .route-milestone-button {
    top: 14px;
    left: calc(12px + var(--map-control-width) + 10px);
  }

  .top-map-panels {
    top: 14px;
    gap: 20px;
  }

  .competition-panel,
  .competition-ranking-panel,
  .command-status-panel {
    top: auto;
    right: auto;
    left: auto;
    width: auto;
  }

  .miniprogram-link-card {
    width: min(360px, calc(100vw - 24px));
  }

  .competition-panel-body {
    width: min(560px, calc(100vw - 24px));
    max-height: 180px;
    overflow-y: auto;
  }

  .competition-ranking-body {
    width: min(320px, calc(100vw - 24px));
  }

  .competition-settings-row,
  .competition-metrics-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .topbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .brand,
  .nav-tabs {
    grid-column: 1 / -1;
  }

  .top-map-panels {
    top: 160px;
    gap: 10px;
  }

  .miniprogram-link-toggle,
  .competition-toggle,
  .competition-ranking-toggle {
    min-width: 104px;
    padding: 0 8px;
  }

  .brand {
    padding: 12px 14px 0;
    font-size: 22px;
  }

  .brand-logo {
    height: 34px;
    max-width: 78px;
  }

  .map-config-button,
  .logout-button {
    width: auto;
    min-width: 0;
    justify-self: stretch;
  }

  .map-config-button {
    grid-column: 1;
    margin: 0 0 0 12px;
  }

  .logout-button {
    grid-column: 2;
    margin: 0 12px 0 0;
  }
}

@media (max-width: 1180px) {
  .shell {
    --mobile-design-width: 1440px;
    --mobile-design-height: 810px;
    --mobile-scale: 1;
    --sidebar-width: 340px;
    width: var(--mobile-design-width);
    max-width: none;
    height: var(--mobile-design-height);
    max-height: none;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    grid-template-rows: 72px minmax(0, 1fr);
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(var(--mobile-rotation)) scale(var(--mobile-scale));
    transform-origin: center center;
  }

  .topbar {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 0;
  }

  .brand {
    width: 430px;
    flex: 0 0 430px;
    padding: 0 22px;
    font-size: 26px;
  }

  .brand-logo {
    height: 42px;
    max-width: 96px;
  }

  .nav-tabs {
    width: auto;
    display: flex;
    grid-template-columns: none;
    gap: 10px;
    padding: 0 18px 0 0;
    overflow-x: auto;
  }

  .nav-tabs button {
    width: auto;
    min-width: 96px;
    height: 44px;
    padding: 11px 16px;
    font-size: inherit;
  }

  .map-config-button,
  .logout-button {
    width: auto;
    height: 44px;
    justify-self: auto;
    margin: 0;
    padding: 11px 16px;
    font-size: inherit;
  }

  .map-config-button {
    min-width: 96px;
  }

  .logout-button {
    min-width: 72px;
    margin-right: 18px;
  }

  .sidebar {
    width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    gap: 16px;
    padding: 24px 18px;
    border-right: 2px solid rgba(224, 205, 101, 0.65);
    border-bottom: 0;
  }

  .sidebar-toggle {
    top: 50%;
    left: calc(var(--sidebar-width) - 16px);
  }

  .shell.is-sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .shell.is-sidebar-collapsed .sidebar-toggle {
    left: 6px;
  }

  .map-badge {
    top: 24px;
    left: 28px;
  }

  .map-layer-mode {
    top: 58px;
    left: 28px;
  }

  .map-search {
    top: 94px;
    left: 28px;
  }

  .map-search.is-open {
    right: auto;
    left: 28px;
    width: min(430px, calc(100% - 56px));
  }

  .route-milestone-button {
    top: 24px;
    left: calc(28px + var(--map-control-width) + 10px);
  }

  .track-panel {
    top: 26px;
    right: 32px;
    left: auto;
    width: min(300px, calc(100% - 64px));
    max-height: calc(var(--mobile-design-height) - 52px);
  }

  .route-panel,
  .geofence-panel {
    top: 26px;
    right: 32px;
    left: auto;
    width: min(360px, calc(100% - 64px));
    max-height: calc(var(--mobile-design-height) - 52px);
  }

  .command-panel {
    top: 92px;
    right: 24px;
    left: auto;
    width: min(360px, calc(var(--mobile-design-width) - 48px));
    max-height: calc(var(--mobile-design-height) - 120px);
  }

  .map-config-panel {
    top: 92px;
    right: 24px;
    left: auto;
    width: min(390px, calc(var(--mobile-design-width) - 48px));
  }

  .account-panel {
    top: 92px;
    right: 24px;
    left: auto;
    width: min(620px, calc(var(--mobile-design-width) - 48px));
    max-height: calc(var(--mobile-design-height) - 120px);
  }

  .top-map-panels {
    top: 10px;
    right: 28px;
    left: var(--map-left-control-zone);
    max-width: calc(100% - var(--map-left-control-zone) - 28px);
    gap: clamp(18px, 3vw, 40px);
  }

  .competition-panel,
  .competition-ranking-panel {
    top: auto;
    left: auto;
    right: auto;
    width: auto;
  }

  body.is-mobile-mode .shell {
    --sidebar-width: 0px;
    --mobile-scale: 1;
    --mobile-rotation: 0deg;
    width: var(--app-viewport-width, 100vw);
    max-width: none;
    height: var(--app-viewport-height, 100dvh);
    max-height: none;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    top: 0;
    left: 0;
    transform: none;
    transform-origin: top left;
  }

  body.is-mobile-mode .login-view {
    --login-scale: 1;
    --login-rotation: 0deg;
    width: var(--app-viewport-width, 100vw);
    min-height: 0;
    height: var(--app-viewport-height, 100dvh);
    display: grid;
    place-items: center;
    top: 0;
    left: 0;
    transform: none;
    transform-origin: top left;
    padding: 18px;
    background:
      linear-gradient(180deg, rgba(4, 8, 16, 0.52), rgba(4, 8, 16, 0.72)),
      url("/assets/cover.jpg");
    background-size: cover;
    background-position: center;
  }

  body.is-mobile-mode .login-panel {
    width: min(430px, 100%);
    gap: 22px;
    padding: 34px 28px;
  }

  body.is-mobile-mode .login-title {
    font-size: 32px;
  }

  body.is-mobile-mode .login-panel label {
    gap: 10px;
    font-size: 16px;
  }

  body.is-mobile-mode .login-panel input {
    min-height: 54px;
    padding: 14px 16px;
    font-size: 18px;
  }

  body.is-mobile-mode .login-panel .password-field input {
    padding-right: 58px;
  }

  body.is-mobile-mode .login-panel .password-toggle {
    width: 42px;
    height: 38px;
  }

  body.is-mobile-mode .login-panel button[type="submit"] {
    min-height: 56px;
    font-size: 18px;
    font-weight: 900;
  }

  body.is-mobile-mode .map-stage {
    grid-column: 1 / -1;
    grid-row: 1 / -1;
  }
}
