/* Keep all Quantum Games stacked as full-width cards. */
.quantum-games__grid {
  grid-template-columns: minmax(0, 1fr);
}

.quantum-maze {
  width: 100%;
  box-sizing: border-box;
}

.quantum-maze__rulebar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding: 0.58rem 0.7rem;
  border: 1px solid #eceef3;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.74);
  color: #656d77;
  font-size: 0.67rem;
}

.quantum-maze__rulebar strong {
  color: #4743ba;
}

.quantum-maze__rule-arrow {
  color: #a2a7ae;
  font-weight: 800;
}

.quantum-maze__route {
  margin-left: auto;
}

.quantum-maze__agents {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.quantum-maze__agent {
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid #eceef3;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.quantum-maze__agent-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.quantum-maze__agent-heading h4 {
  margin: 0.12rem 0 0;
  color: #303741;
  font-size: 0.92rem;
}

.quantum-maze__agent-kicker {
  color: #8b9199;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.quantum-maze__agent-chip {
  flex: 0 0 auto;
  padding: 0.26rem 0.48rem;
  border: 1px solid rgba(91, 87, 209, 0.18);
  border-radius: 999px;
  background: #f4f3ff;
  color: #514dc2;
  font-size: 0.58rem;
  font-weight: 750;
}

.quantum-maze__board {
  display: grid;
  width: min(100%, 330px);
  aspect-ratio: 1;
  margin: 0 auto;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 2px;
  padding: 2px;
  border: 1px solid #daddE5;
  border-radius: 11px;
  background: #daddE5;
  overflow: hidden;
}

.quantum-maze__cell {
  position: relative;
  isolation: isolate;
  display: grid;
  min-width: 0;
  place-items: center;
  overflow: hidden;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
}

.quantum-maze__cell--wall {
  background: #343a43;
}

.quantum-maze__cell--open {
  background: #ffffff;
}

.quantum-maze__cell--open::after {
  content: attr(data-endpoint);
  position: absolute;
  z-index: 4;
  top: 2px;
  left: 3px;
  color: #5e6670;
  font-size: clamp(0.42rem, 0.9vw, 0.55rem);
  font-weight: 900;
  line-height: 1;
}

.quantum-maze__cell--start,
.quantum-maze__cell--exit {
  box-shadow: inset 0 0 0 2px rgba(91, 87, 209, 0.45);
}

.quantum-maze__heat {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: radial-gradient(circle at center, rgba(91, 87, 209, 0.88), rgba(91, 87, 209, 0.42));
  opacity: 0;
  transition: opacity 260ms ease;
}

.quantum-maze__marker {
  position: relative;
  z-index: 3;
  color: #4e4ac1;
  font-size: clamp(0.62rem, 1.4vw, 0.9rem);
  font-weight: 900;
  line-height: 1;
}

.quantum-maze__probability {
  position: absolute;
  z-index: 2;
  right: 2px;
  bottom: 2px;
  color: #303741;
  font-size: clamp(0.35rem, 0.7vw, 0.46rem);
  font-weight: 750;
  line-height: 1;
}

.quantum-maze__cell--trail {
  background: #f1f1fb;
}

.quantum-maze__cell--classical {
  background: #e8e7ff;
  box-shadow: inset 0 0 0 2px #7571d6;
}

.quantum-maze__metrics {
  display: grid;
  gap: 0.42rem;
  margin-top: 0.72rem;
}

.quantum-maze__metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #eceef3;
  color: #767e87;
  font-size: 0.66rem;
}

.quantum-maze__metric:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.quantum-maze__metric strong {
  color: #303741;
  font-size: 0.77rem;
  font-variant-numeric: tabular-nums;
}

.quantum-maze__footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.9rem;
  padding: 0.72rem 0.82rem;
  border: 1px solid #eceef3;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.quantum-maze__status {
  margin: 0;
  color: #59616b;
  font-size: 0.72rem;
  line-height: 1.45;
}

.quantum-maze__step-counter {
  flex: 0 0 auto;
  color: #737b84;
  font-size: 0.68rem;
}

.quantum-maze__step-counter strong {
  color: #4743ba;
  font-size: 0.9rem;
}

.quantum-maze__actions {
  flex-wrap: wrap;
}

.quantum-maze__actions .quantum-game-button {
  min-width: 118px;
}

.quantum-maze .quantum-game-button:disabled {
  cursor: not-allowed;
}

@media (max-width: 820px) {
  .quantum-maze__agents {
    grid-template-columns: 1fr;
  }

  .quantum-maze__board {
    width: min(100%, 350px);
  }
}

@media (max-width: 560px) {
  .quantum-maze__rulebar {
    align-items: flex-start;
  }

  .quantum-maze__route {
    width: 100%;
    margin-left: 0;
  }

  .quantum-maze__footer-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .quantum-maze__actions .quantum-game-button {
    flex-basis: calc(50% - 0.4rem);
  }
}
