.maps-index-form {
  margin-bottom: 1rem;
}

.maps-stats-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Let chart panels sit two per row on md+ without overflowing the grid track. */
.maps-stats-grid > .maps-stat-chart {
  min-width: 0;
}

@media (min-width: 768px) {
  .maps-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.maps-stats-grid__empty {
  grid-column: 1 / -1;
}

.maps-index-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 1023px) {
  .maps-index-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .maps-index-grid {
    grid-template-columns: 1fr;
  }
}

.maps-index-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.maps-index-card__media {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--panel-2);
}

.maps-index-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.maps-index-card__body {
  padding: 0.75rem 1rem 0.35rem;
}

.maps-index-card__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.maps-index-card__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: auto;
  padding: 0.7rem 0.85rem 0.85rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.12));
}

/* --- Map KPI: index = stacked icon / number / label; hero = (icon | number) row + label --- */

.maps-kpi {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
  gap: 0.25rem;
}

.maps-kpi__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0.35rem;
  box-sizing: border-box;
  border-radius: 10px;
  overflow: visible;
}

.maps-kpi__svg {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
  overflow: visible;
  flex-shrink: 0;
}

.maps-kpi__value {
  display: block;
  width: 100%;
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.maps-kpi__label {
  display: block;
  width: 100%;
  margin-top: 0.15rem;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  line-height: 1.2;
}

.maps-kpi__hero-top {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.65rem;
  width: 100%;
}

.maps-kpi--hero {
  align-items: stretch;
  text-align: left;
  min-width: 7.5rem;
  padding: 0.65rem 0.85rem 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(165deg, var(--panel-2) 0%, rgba(0, 0, 0, 0.28) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 4px 14px rgba(0, 0, 0, 0.25);
}

.maps-kpi--hero .maps-kpi__hero-top {
  gap: 0.55rem;
}

.maps-kpi--hero .maps-kpi__icon {
  width: auto;
  min-width: 2.35rem;
  height: 2.35rem;
}

.maps-kpi--hero .maps-kpi__icon--servers {
  color: var(--accent);
  background: rgba(255, 70, 85, 0.1);
  border: 1px solid rgba(255, 70, 85, 0.28);
}

.maps-kpi--hero .maps-kpi__icon--players {
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.32);
}

.maps-kpi--hero .maps-kpi__value {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  text-align: left;
  font-size: 1.55rem;
  line-height: 1;
  color: var(--text);
}

.maps-kpi--hero .maps-kpi__label {
  margin-top: 0.4rem;
  text-align: left;
  color: var(--muted);
}

/* Index card tiles */
.maps-kpi--index {
  flex: 1 1 0;
  min-width: 5rem;
  max-width: 100%;
  padding: 0.55rem 0.45rem 0.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(165deg, var(--panel-2) 0%, rgba(0, 0, 0, 0.2) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.maps-kpi--index .maps-kpi__icon--servers {
  color: var(--accent);
  background: rgba(255, 70, 85, 0.1);
  border: 1px solid rgba(255, 70, 85, 0.28);
}

.maps-kpi--index .maps-kpi__icon--players {
  color: #34d399;
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.32);
}

.maps-kpi--index .maps-kpi__value {
  font-size: 1.35rem;
  color: var(--text);
}

.maps-kpi--index .maps-kpi__label {
  color: var(--muted);
}

.maps-kpi--index.maps-kpi--link {
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.maps-kpi--index.maps-kpi--link:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.maps-kpi--index.maps-kpi--link:hover .maps-kpi__value {
  color: var(--accent);
}

/* Detail hero row (tiles use same panel look as index) */
.maps-detail-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  margin-top: 1rem;
}

.maps-stat-chart .panel__title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.maps-stat-chart__ico {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
  flex-shrink: 0;
  background: var(--accent);
}

.maps-stat-chart__ico--players {
  background: #18cc63;
}

.maps-stat-chart__body {
  padding: 0.75rem 1rem 0.65rem;
}

.maps-stat-chart__frame {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  min-height: 200px;
}

.maps-stat-chart__yaxis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted);
  padding: 0.25rem 0 1.5rem;
  width: 2.25rem;
  text-align: right;
  flex-shrink: 0;
}

.maps-stat-chart__scroll {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-color: rgba(148, 163, 184, 0.35) var(--panel-2);
}

.maps-stat-chart__plot {
  display: flex;
  /* stretch: each column gets the full plot height so __track has a definite
     height; otherwise % heights on __bar resolve to ~0 (only min-height shows). */
  align-items: stretch;
  gap: 6px;
  height: 180px;
  padding: 0 0.15rem 0 0;
}

.maps-stat-chart__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 28px;
  flex-shrink: 0;
  min-height: 0;
}

.maps-stat-chart__track {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 3px 3px 0;
  border: 1px solid var(--border);
}
.maps-stat-chart__track:hover{
  background: var(--panel);
}

.maps-stat-chart__bar {
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  min-height: 2px;
}

.maps-stat-chart__plot--servers .maps-stat-chart__bar {
  background: linear-gradient(180deg, #ff675f, var(--accent));
}

.maps-stat-chart__plot--players .maps-stat-chart__bar {
  background: linear-gradient(180deg, #34d399, #059669);
}

.maps-stat-chart__val {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  line-height: 1;
  margin-top: 4px;
  max-height: 3.2rem;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
}

.maps-stat-chart__tick {
  font-size: 0.58rem;
  color: var(--muted);
  margin-top: 4px;
  white-space: nowrap;
}

/* Hourly charts: 7 days UTC — each strip = one UTC calendar day (hours + date row). */

.maps-stat-chart--hourly-7d .maps-stat-chart__scroll--hourly-days {
  padding-bottom: 4px;
}

.maps-stat-chart__hourly-days-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.65rem;
  min-height: 200px;
}

.maps-stat-chart__utc-day {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding-right: 0.35rem;
  border-right: 1px solid var(--border);
}

.maps-stat-chart__utc-day:last-child {
  border-right: 0;
  padding-right: 0;
}

.maps-stat-chart__plot--hourly-7d {
  gap: 4px;
  height: 180px;
}

.maps-stat-chart__col--hourly-7d {
  width: 22px;
}

.maps-stat-chart__utc-day-date {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.35rem 0.15rem 0.1rem;
  letter-spacing: 0.02em;
}

.map-detail-list-form {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.maps-servers-section__title {
  margin: 0 0 0.65rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.sv-hero__map-lead {
  margin: 0.35rem 0 0;
  max-width: 40rem;
  font-size: 0.875rem;
}
