
/* =========================================
   DON'T FALL — VS AI CAMPAIGN GAME OVER
   ========================================= */

.ai-campaign-game-over {
  position: fixed;
  inset: 0;
  z-index: 10001;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 100%;
  padding: clamp(12px, 3vw, 30px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;

  color: var(--text, #f5f7ef);
  font-family: inherit;

  background:
    radial-gradient(
      ellipse at 50% 18%,
      rgba(181, 247, 71, 0.12),
      transparent 58%
    ),
    rgba(8, 12, 8, 0.86);

  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);

  animation: ai-game-over-fade-in 200ms ease-out;
}

.ai-campaign-game-over[hidden],
.ai-campaign-game-over__standings[hidden],
.ai-campaign-game-over__button[hidden] {
  display: none !important;
}

.ai-campaign-game-over *,
.ai-campaign-game-over *::before,
.ai-campaign-game-over *::after {
  box-sizing: border-box;
}

.ai-campaign-game-over__panel {
  position: relative;

  width: min(100%, 510px);
  max-height: calc(100vh - 2 * clamp(12px, 3vw, 30px));
  max-height: calc(100dvh - 2 * clamp(12px, 3vw, 30px));
  min-height: 0;
  overflow-y: auto;
  margin: auto;
  padding: clamp(20px, 4vw, 32px);

  border: 1px solid rgba(181, 247, 71, 0.3);
  border-radius: 12px;

  background:
    linear-gradient(
      145deg,
      var(--panel, #20271b),
      var(--bg, #11150f)
    );

  box-shadow:
    0 0 36px rgba(181, 247, 71, 0.07),
    0 22px 65px rgba(0, 0, 0, 0.48);

  text-align: center;

  animation: ai-game-over-pop-in 260ms ease-out;
}

.ai-campaign-game-over__close {
  position: absolute;
  top: 12px;
  right: 12px;

  display: grid;
  place-items: center;

  width: 34px;
  height: 34px;
  padding: 0;

  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 7px;

  background: rgba(255, 255, 255, 0.035);
  color: var(--muted, #aeb8a3);

  font-family: inherit;
  font-size: 25px;
  font-weight: 400;
  line-height: 1;

  cursor: pointer;
  touch-action: manipulation;
}

.ai-campaign-game-over__close:hover {
  border-color: var(--accent, #b5f747);
  color: var(--accent, #b5f747);
}

.ai-campaign-game-over__close:focus-visible,
.ai-campaign-game-over__button:focus-visible {
  outline: 2px solid var(--accent, #b5f747);
  outline-offset: 3px;
}

/* Heading */

.ai-campaign-game-over__eyebrow {
  margin: 4px 28px 11px;

  color: var(--accent, #b5f747);

  font-family: ui-monospace, Consolas, monospace;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.15em;
  line-height: 1.6;
}

.ai-campaign-game-over__title {
  margin: 0;

  color: var(--accent, #b5f747);

  font-size: clamp(27px, 6vw, 42px);
  font-weight: 950;
  letter-spacing: -0.045em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.ai-campaign-game-over.is-eliminated
.ai-campaign-game-over__title {
  color: var(--danger, #ff766d);
}

.ai-campaign-game-over__message {
  max-width: 390px;
  margin: 13px auto 22px;

  color: var(--muted, #aeb8a3);

  font-size: 12px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

/* Result statistics */

.ai-campaign-game-over__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;

  margin-bottom: 18px;
}

.ai-campaign-game-over__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;

  min-width: 0;
  min-height: 77px;
  padding: 12px 8px;

  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;

  background: rgba(255, 255, 255, 0.035);
}

.ai-campaign-game-over__stat-label {
  color: var(--muted, #aeb8a3);

  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.ai-campaign-game-over__stat-value {
  color: var(--text, #f5f7ef);

  font-size: clamp(20px, 4vw, 27px);
  font-weight: 950;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.ai-campaign-game-over__stat:last-child
.ai-campaign-game-over__stat-value {
  color: var(--accent, #b5f747);
}

/* Race standings */

.ai-campaign-game-over__standings {
  margin: 0 0 20px;
  padding: 14px;

  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;

  background: rgba(0, 0, 0, 0.12);
  text-align: left;
}

.ai-campaign-game-over__standings-title {
  margin: 0 0 10px;

  color: var(--muted, #aeb8a3);

  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.ai-campaign-game-over__standings-list {
  display: grid;
  gap: 6px;

  margin: 0;
  padding: 0;

  list-style: none;
}

.ai-campaign-game-over__standing {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;

  min-width: 0;
  padding: 8px 9px;

  border-radius: 5px;
  background: rgba(255, 255, 255, 0.035);
}

.ai-campaign-game-over__standing.is-player {
  background: rgba(181, 247, 71, 0.09);
}

.ai-campaign-game-over__standing-rank {
  color: var(--accent, #b5f747);

  font-size: 10px;
  font-weight: 950;
}

.ai-campaign-game-over__standing-name {
  min-width: 0;
  overflow: hidden;

  color: var(--text, #f5f7ef);

  font-size: 10px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-campaign-game-over__standing-status {
  color: var(--muted, #aeb8a3);

  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: right;
}

/* Action buttons */

.ai-campaign-game-over__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.ai-campaign-game-over__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 0;
  min-height: 45px;
  padding: 11px 9px;

  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;

  background: rgba(255, 255, 255, 0.035);
  color: var(--text, #f5f7ef);

  font-family: inherit;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.055em;
  line-height: 1.4;
  text-align: center;
  overflow-wrap: anywhere;

  cursor: pointer;
  touch-action: manipulation;

  transition:
    transform 140ms ease,
    filter 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.ai-campaign-game-over__button:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.ai-campaign-game-over__button:active {
  transform: translateY(0);
}

.ai-campaign-game-over__button--primary {
  grid-column: 1 / -1;

  min-height: 49px;

  border-color: var(--accent, #b5f747);
  background: var(--accent, #b5f747);
  color: #192011;

  box-shadow: 0 5px 20px rgba(181, 247, 71, 0.1);
}

.ai-campaign-game-over__button--primary:hover {
  background: #d0ff82;
  color: #192011;
}

.ai-campaign-game-over__button--next {
  border-color: rgba(181, 247, 71, 0.3);
  color: var(--accent, #b5f747);
}

.ai-campaign-game-over__button--secondary {
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--muted, #aeb8a3);
}

/* Footer */

.ai-campaign-game-over__footer {
  margin: 19px 0 0;

  color: #77836c;

  font-family: ui-monospace, Consolas, monospace;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.6;
}

/* Animations */

@keyframes ai-game-over-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes ai-game-over-pop-in {
  from {
    opacity: 0;
    transform: translateY(9px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Compact landscape phones */

@media (max-height: 560px) {
  .ai-campaign-game-over {
    padding: 8px;
  }

  .ai-campaign-game-over__panel {
    width: min(100%, 620px);
    padding: 15px 18px;
  }

  .ai-campaign-game-over__eyebrow {
    margin-top: 0;
    margin-bottom: 6px;
  }

  .ai-campaign-game-over__title {
    font-size: clamp(23px, 5vh, 32px);
  }

  .ai-campaign-game-over__message {
    margin: 7px auto 12px;
  }

  .ai-campaign-game-over__stat {
    min-height: 58px;
    gap: 5px;
    padding: 8px;
  }

  .ai-campaign-game-over__stats {
    gap: 7px;
    margin-bottom: 12px;
  }

  .ai-campaign-game-over__standings {
    margin-bottom: 12px;
    padding: 9px;
  }

  .ai-campaign-game-over__standing {
    padding: 5px 7px;
  }

  .ai-campaign-game-over__button {
    min-height: 39px;
    padding: 8px;
  }

  .ai-campaign-game-over__footer {
    margin-top: 10px;
  }
}

@media (max-width: 360px) {
  .ai-campaign-game-over__panel {
    padding: 17px 13px;
  }

  .ai-campaign-game-over__actions {
    gap: 7px;
  }

  .ai-campaign-game-over__button {
    font-size: 8px;
    letter-spacing: 0.025em;
  }

  .ai-campaign-game-over__standing {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ai-campaign-game-over,
  .ai-campaign-game-over__panel {
    animation: none;
  }

  .ai-campaign-game-over__button {
    transition: none;
  }
}

