:root {
  color-scheme: dark;
  background: #050619;
}

html,
body,
#unity-canvas {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

html,
body {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

#unity-canvas {
  position: fixed;
  inset: 0;
  display: block;
  border: 0;
  outline: 0;
  background: #231f20;
}

#game-status {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  color: #f4efea;
  background:
    radial-gradient(circle at 76% 18%, rgba(255, 60, 124, 0.16), transparent 28%),
    radial-gradient(circle at 18% 82%, rgba(60, 213, 255, 0.12), transparent 30%),
    linear-gradient(160deg, #0d0924 0%, #050619 64%, #07111d 100%);
  font: 600 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: center;
}

#game-status::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.018) 0,
    rgba(255, 255, 255, 0.018) 1px,
    transparent 1px,
    transparent 4px
  );
}

#game-status.hidden {
  display: none;
}

.loading-card {
  position: relative;
  box-sizing: border-box;
  width: min(100%, 560px);
  max-width: 560px;
  padding: clamp(28px, 6vw, 48px);
  overflow: hidden;
  background: rgba(10, 12, 35, 0.94);
  border: 2px solid rgba(60, 213, 255, 0.38);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45), 8px 8px 0 rgba(255, 60, 124, 0.16);
}

.loading-card::after {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 6px;
  content: "";
  background: #a7ff52;
}

.loading-live {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  color: #a7ff52;
  font-size: 12px;
  letter-spacing: 0.16em;
}

.loading-live-dot {
  width: 9px;
  height: 9px;
  background: #ff3c7c;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(255, 60, 124, 0.14);
  animation: live-pulse 1.1s ease-in-out infinite;
}

.loading-title {
  margin: 25px 0 18px;
  color: #f7f8ff;
  font-weight: 900;
  font-size: clamp(38px, 9vw, 64px);
  line-height: 0.94;
  letter-spacing: -0.055em;
  text-transform: uppercase;
}

.loading-title span {
  color: #ff3c7c;
}

#loading-message {
  min-height: 25px;
  margin-bottom: 22px;
  color: #a8adc6;
  font-size: clamp(14px, 3.6vw, 17px);
}

.loading-progress-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

#loading-progress {
  position: relative;
  flex: 1;
  height: 14px;
  overflow: hidden;
  background: #20233c;
  border-radius: 999px;
}

#loading-progress-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #3cd5ff 0%, #a7ff52 100%);
  border-radius: inherit;
  box-shadow: 0 0 18px rgba(167, 255, 82, 0.42);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 120ms linear;
}

#loading-percent {
  min-width: 45px;
  color: #f7f8ff;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.loading-hint {
  margin-top: 26px;
  padding-top: 18px;
  color: #737a9a;
  font-size: 12px;
  letter-spacing: 0.04em;
  border-top: 1px solid rgba(168, 173, 198, 0.18);
}

#game-status.error .loading-live,
#game-status.error .loading-progress-row,
#game-status.error .loading-hint {
  display: none;
}

#game-status.error #loading-message {
  margin: 24px 0 4px;
  color: #f7f8ff;
}

#error-actions {
  display: none;
  margin-top: 20px;
}

#game-status.error #error-actions {
  display: block;
}

#error-reference {
  margin-bottom: 12px;
  color: #a8adc6;
  font-size: 12px;
}

#copy-diagnostics {
  padding: 10px 18px;
  color: #10151d;
  font: inherit;
  font-weight: 800;
  font-size: 13px;
  background: #a7ff52;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

#error-details-wrapper {
  margin-top: 16px;
  color: #a8adc6;
  font-size: 12px;
  text-align: left;
}

#error-details-wrapper summary {
  text-align: center;
  cursor: pointer;
}

#error-details {
  box-sizing: border-box;
  max-height: 150px;
  margin: 10px 0 0;
  padding: 12px;
  overflow: auto;
  color: #dfe5ff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #050619;
  border-radius: 10px;
  user-select: text;
}

@keyframes live-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.45;
    transform: scale(0.76);
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-live-dot {
    animation: none;
  }

  #loading-progress-bar {
    transition: none;
  }
}
