:root {
  --fm-ink: #052649;
  --fm-muted: #64748b;
  --fm-line: #e6edf5;
  --fm-green: #078443;
  --fm-lime: #22c55e;
  --fm-yellow: #facc15;
  --fm-orange: #f97316;
  --fm-red: #dc2626;
  --fm-blue: #2563eb;
}
.fm-page {
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 10% 0, rgba(7, 132, 67, 0.1), transparent 26%),
    linear-gradient(135deg, #f8fafc, #eef6ff);
  color: var(--fm-ink);
}
.fm-shell {
  max-width: 1360px;
  margin: 0 auto;
}
.fm-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--fm-line);
  box-shadow: 0 16px 45px rgba(15, 23, 42, 0.06);
}
.fm-top {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.fm-back,
.fm-kicker {
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
}
.fm-back {
  background: #fff;
  color: var(--fm-blue);
  border: 1px solid #dbeafe;
}
.fm-back:hover {
  background: #eff6ff;
}
.fm-kicker {
  background: #ecfdf5;
  color: var(--fm-green);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.fm-hero h1 {
  margin: 0;
  font-size: clamp(25px, 3vw, 40px);
  font-weight: 950;
  letter-spacing: -1px;
  line-height: 1.05;
}
.fm-hero p {
  margin: 7px 0 0;
  color: var(--fm-muted);
  font-size: 12.5px;
  font-weight: 650;
}
.fm-hero-stats {
  display: flex;
  gap: 10px;
}
.fm-hero-stats div {
  min-width: 118px;
  padding: 12px 14px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #edf2f7;
}
.fm-hero-stats strong {
  display: block;
  font-size: 22px;
  font-weight: 950;
}
.fm-hero-stats span {
  font-size: 10.5px;
  font-weight: 850;
  color: var(--fm-muted);
}
.fm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
}
.fm-card,
.fm-rank-card {
  padding: 15px;
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.9);
}
.fm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}
.fm-search {
  height: 42px;
  min-width: 340px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px;
  border-radius: 15px;
  border: 1px solid #dbe4ef;
  background: #fff;
}
.fm-search input {
  border: 0;
  outline: 0;
  width: 100%;
  font-size: 13px;
  font-weight: 750;
}
.fm-btn {
  height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0 15px;
  background: var(--fm-ink);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.fm-map {
  height: calc(100vh - 242px);
  min-height: 540px;
  border-radius: 22px;
  overflow: hidden;
  background: #dbeafe;
}
.fm-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 10.5px;
  font-weight: 850;
  color: #475569;
}
.fm-c {
  width: 11px;
  height: 11px;
  display: inline-flex;
  border-radius: 4px;
  margin-right: 4px;
}
.fm-green {
  background: var(--fm-green);
}
.fm-lime {
  background: var(--fm-lime);
}
.fm-yellow {
  background: var(--fm-yellow);
}
.fm-orange {
  background: var(--fm-orange);
}
.fm-red {
  background: var(--fm-red);
}
.fm-marker {
  position: relative;
  width: 38px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--fm-marker-color);
  filter: drop-shadow(0 9px 16px rgba(15, 23, 42, 0.25));
  animation: fmPop 0.22s ease;
}
.fm-marker i {
  font-size: 42px;
  line-height: 1;
}
.fm-marker span {
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--fm-marker-color);
  font-size: 10px;
  font-weight: 950;
  z-index: 3;
}
@keyframes fmPop {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.fm-popup {
  min-width: 220px;
}
.fm-popup b {
  display: block;
  font-size: 15px;
  color: var(--fm-ink);
  margin-bottom: 6px;
}
.fm-popup small {
  display: block;
  color: var(--fm-muted);
  font-size: 11.5px;
  font-weight: 750;
  margin-bottom: 8px;
}
.fm-popup-score {
  display: flex;
  gap: 8px;
  margin: 8px 0;
}
.fm-popup-score div {
  flex: 1;
  padding: 8px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
}
.fm-popup-score strong {
  display: block;
  font-size: 18px;
  color: var(--fm-ink);
  font-weight: 950;
}
.fm-popup-score span {
  font-size: 10px;
  color: var(--fm-muted);
  font-weight: 800;
}
.fm-popup-actions {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}
.fm-popup-actions a {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--fm-ink);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}
.fm-popup-actions a:hover {
  background: var(--fm-green);
  color: #fff;
}
.fm-rank-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.fm-rank-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 950;
  color: var(--fm-ink);
}
.fm-rank-head p {
  margin: 3px 0 0;
  font-size: 11.5px;
  color: var(--fm-muted);
  font-weight: 650;
}
.fm-rank-list {
  display: grid;
  gap: 9px;
  max-height: calc(100vh - 330px);
  overflow: auto;
  padding-right: 4px;
}
.fm-rank-item {
  width: 100%;
  border: 1px solid #edf2f7;
  background: #fff;
  border-radius: 16px;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  transition: 0.18s ease;
}
.fm-rank-item:hover,
.fm-rank-item.active {
  border-color: #bfdbfe;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}
.fm-rank-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.fm-rank-badge {
  width: 30px;
  height: 30px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--rank-color);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
}
.fm-rank-name {
  display: block;
  font-size: 12.5px;
  font-weight: 950;
  color: var(--fm-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.fm-rank-sub {
  display: block;
  font-size: 10.5px;
  color: var(--fm-muted);
  font-weight: 750;
  margin-top: 1px;
}
.fm-rank-score {
  font-size: 13px;
  font-weight: 950;
  color: var(--rank-color);
}
.fm-empty {
  padding: 18px;
  border-radius: 18px;
  background: #f8fafc;
  color: var(--fm-muted);
  font-weight: 750;
  font-size: 12px;
}
.leaflet-popup-content-wrapper {
  border-radius: 18px !important;
  box-shadow: 0 20px 55px rgba(15, 23, 42, 0.2) !important;
}
.leaflet-popup-content {
  margin: 14px !important;
}
.leaflet-control-zoom a {
  border-radius: 12px !important;
  margin-bottom: 5px !important;
  border: 0 !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12) !important;
}
@media (max-width: 1050px) {
  .fm-grid {
    grid-template-columns: 1fr;
  }
  .fm-rank-list {
    max-height: none;
  }
  .fm-map {
    height: 68vh;
  }
}
@media (max-width: 768px) {
  .fm-page {
    padding: 14px;
  }
  .fm-hero,
  .fm-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .fm-hero-stats {
    width: 100%;
  }
  .fm-hero-stats div {
    flex: 1;
  }
  .fm-search {
    min-width: 0;
    width: 100%;
  }
  .fm-map {
    min-height: 430px;
  }
  .fm-rank-name {
    max-width: 220px;
  }
}

.fm-rank-card {
    padding: 18px;
}

.fm-ranking-list {
    display: grid;
    gap: 10px;
}

.fm-school-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 90px;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 18px;
    background: #fff;
    border: 1px solid #edf2f7;
    box-shadow: 0 10px 28px rgba(15,23,42,.045);
}

.fm-rank-number {
    width: 42px;
    height: 42px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    background: #f1f5f9;
    color: #052649;
    font-size: 13px;
    font-weight: 950;
}

.fm-rank-number.top {
    background: #ecfdf5;
    color: #078443;
    font-size: 20px;
}

.fm-school-main strong {
    display: block;
    color: #052649;
    font-size: 14px;
    font-weight: 950;
}

.fm-school-main span {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
    font-weight: 650;
}

.fm-progress {
    height: 7px;
    margin-top: 9px;
    border-radius: 999px;
    background: #e5eaf3;
    overflow: hidden;
}

.fm-progress i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #078443, #22c55e);
}

.fm-score {
    text-align: right;
}

.fm-score strong {
    display: block;
    color: #052649;
    font-size: 18px;
    font-weight: 950;
}

.fm-score span {
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
}

.fm-empty {
    padding: 28px;
    border-radius: 18px;
    background: #f8fafc;
    color: #64748b;
    text-align: center;
    font-weight: 800;
}

@media (max-width: 768px) {
    .fm-school-row {
        grid-template-columns: 44px 1fr;
    }

    .fm-score {
        grid-column: 2;
        text-align: left;
    }
}