/* CUDA Status: live pill (bottom-right) and [cuda_app_status] panel. */

[data-cuda-status] {
  --cuda-status-color: #9a9aa3;
}

[data-cuda-status][data-state="up"],
.cuda-status-list li[data-state="up"] {
  --cuda-status-color: #22c55e;
}

[data-cuda-status][data-state="slow"],
[data-cuda-status][data-state="partial"],
.cuda-status-list li[data-state="slow"] {
  --cuda-status-color: #f5a524;
}

[data-cuda-status][data-state="down"],
.cuda-status-list li[data-state="down"] {
  --cuda-status-color: #ef4444;
}

.cuda-status-dot {
  display: inline-block;
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cuda-status-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--cuda-status-color) 25%, transparent);
}

[data-state="down"] > .cuda-status-dot,
[data-state="partial"] > .cuda-status-dot {
  animation: cuda-status-pulse 1.4s ease-in-out infinite;
}

@keyframes cuda-status-pulse {
  50% {
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--cuda-status-color) 10%, transparent);
  }
}

.cuda-status-pill {
  position: fixed;
  /* Bottom edge, just left of the reCAPTCHA badge (about 70px wide at the right edge):
     page text is left-aligned, so this corner stays clear even when headlines run wide. */
  right: 92px;
  bottom: 22px;
  z-index: 9997;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px 0 12.5px;
  border-radius: 999px;
  background: #2f3036;
  color: #fff !important;
  font: 600 14px/1.2 "Poppins", system-ui, sans-serif;
  letter-spacing: 0.02em;
  text-decoration: none !important;
  box-shadow: 0 6px 18px -8px rgb(0 0 0 / 0.5);
  transition: transform 150ms ease;
}

/* While all is well the pill folds down to just its dot, so it doesn't sit on page content.
   It opens on hover/keyboard focus, and stays open whenever there's a problem to report. */
.cuda-status-pill .cuda-status-text {
  display: inline-block;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition: max-width 220ms ease, opacity 160ms ease, margin-left 220ms ease;
}

.cuda-status-pill:hover .cuda-status-text,
.cuda-status-pill:focus-visible .cuda-status-text,
.cuda-status-pill:not([data-state="up"]) .cuda-status-text {
  max-width: 220px;
  margin-left: 8px;
  opacity: 1;
}

.cuda-status-pill:hover {
  transform: translateY(-2px);
}

.cuda-status-pill:focus-visible {
  outline: 3px solid #00aeef;
  outline-offset: 3px;
}

.cuda-status-panel,
.cuda-game {
  box-sizing: border-box;
  width: calc(100% - 32px);
}

.cuda-status-panel {
  max-width: 560px;
  margin: 32px auto;
  padding: 24px 28px;
  border: 1px solid #e3e3e8;
  border-radius: 18px;
  background: #fff;
  box-shadow: 4px 4px 0 #2f3036;
  font-family: "Poppins", system-ui, sans-serif;
}

.cuda-status-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
  color: #2f3036;
}

.cuda-status-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cuda-status-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid #efeff2;
  font-size: 15px;
  color: #55555c;
}

.cuda-status-list li strong {
  min-width: 90px;
  color: #2f3036;
}

.cuda-status-checked {
  margin: 12px 0 0;
  font-size: 14px;
  color: #8a8a93;
}

/* ---- Barracuda minigame (shown while the app is down) ---- */

.cuda-game {
  max-width: 560px;
  margin: 0 auto 40px;
  padding: 20px;
  border: 1px solid #e3e3e8;
  border-radius: 18px;
  background: #fff;
  box-shadow: 4px 4px 0 #2f3036;
  font-family: "Poppins", system-ui, sans-serif;
  color: #2f3036;
}

.cuda-game-back {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #e8f9ee;
  color: #146c34;
  font-weight: 600;
  font-size: 14px;
}

.cuda-game-back a {
  color: inherit;
  text-decoration: underline;
}

.cuda-game-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 12px;
}

.cuda-game-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.cuda-game-score {
  margin: 0;
  font-size: 13px;
  color: #55555c;
}

.cuda-game-score b {
  color: #f26722;
}

.cuda-game-stage {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 20 / 14;
}

.cuda-game-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.cuda-game-stage canvas:focus-visible {
  outline: 3px solid #00aeef;
  outline-offset: -3px;
}

.cuda-game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  background: rgb(6 36 58 / 0.72);
  color: #fff;
  text-align: center;
}

.cuda-game-overlay[hidden] {
  display: none;
}

.cuda-game-msg {
  max-width: 34ch;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.cuda-game-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 22px;
  background: #f26722;
  color: #fff;
  font: 700 14px/1 "Poppins", system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 3px 3px 0 #2f3036;
}

.cuda-game-btn:focus-visible,
.cuda-game-pad button:focus-visible {
  outline: 3px solid #00aeef;
  outline-offset: 2px;
}

/* On-screen arrows for phones. */
.cuda-game-pad {
  display: none;
  grid-template-areas: ". up ." "left down right";
  grid-template-columns: repeat(3, 56px);
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}

.cuda-game-pad button {
  height: 48px;
  border: 0;
  border-radius: 12px;
  background: #2f3036;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.cuda-game-pad [data-dir="up"] { grid-area: up; }
.cuda-game-pad [data-dir="left"] { grid-area: left; }
.cuda-game-pad [data-dir="down"] { grid-area: down; }
.cuda-game-pad [data-dir="right"] { grid-area: right; }

.cuda-game-help {
  margin: 12px 0 0;
  font-size: 12px;
  color: #8a8a93;
  text-align: center;
}

@media (hover: none), (max-width: 768px) {
  .cuda-game-pad {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-state] > .cuda-status-dot {
    animation: none;
  }

  .cuda-status-pill,
  .cuda-status-pill .cuda-status-text {
    transition: none;
  }
}

@media print {
  .cuda-status-pill {
    display: none;
  }
}
