/* Neo-retro Asteroids. The whole game is drawn on a canvas; this stylesheet
   only handles the HUD, overlays, touch controls and CRT treatment. */

:root {
  --ast-icon: url("data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2032%2032%22%3E%3Crect%20width=%2232%22%20height=%2232%22%20rx=%225%22%20fill=%22%230b0620%22/%3E%3Cpolygon%20points=%2216,3%2026,8%2029,18%2023,29%2012,28%203,19%206,7%22%20fill=%22none%22%20stroke=%22%23ff4fd8%22%20stroke-width=%222%22/%3E%3Ccircle%20cx=%2212%22%20cy=%2212%22%20r=%222%22%20fill=%22%234ff5ff%22/%3E%3Ccircle%20cx=%2220%22%20cy=%2216%22%20r=%221.6%22%20fill=%22%23ff8a3d%22/%3E%3Ccircle%20cx=%2215%22%20cy=%2222%22%20r=%221.4%22%20fill=%22%234ff5ff%22/%3E%3C/svg%3E");
}

.ast-app {
  position: relative;
  outline: none;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #070312;
  color: #eee6ff;
  font-family: "Courier New", Courier, monospace;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.ast-app:focus-visible {
  outline: 2px solid #ffe66d;
  outline-offset: -2px;
}

.ast-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  cursor: crosshair;
}

.ast-crt,
.ast-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.ast-crt {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, .025) 0,
    rgba(255, 255, 255, .025) 1px,
    rgba(0, 0, 0, .18) 2px,
    rgba(0, 0, 0, .18) 3px
  );
  opacity: .7;
}
.ast-vignette {
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, .6) 100%);
}

.ast-hud {
  position: absolute;
  z-index: 4;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  pointer-events: none;
  text-shadow: 0 0 5px currentColor, 0 0 14px currentColor;
}

.ast-hud-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ast-hud-label {
  color: #a99be0;
  font-size: 10px;
  letter-spacing: .18em;
}
.ast-hud-value {
  color: #4ff5ff;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: .08em;
  line-height: 1;
}
.ast-hud-centre { text-align: center; }
.ast-hud-centre .ast-hud-value { color: #ff4fd8; }

.ast-hud-right {
  align-items: flex-end;
  text-align: right;
}
.ast-lives {
  color: #ffe66d;
  font-size: 15px;
  letter-spacing: .12em;
  white-space: nowrap;
}
.ast-hud-actions {
  display: flex;
  gap: 6px;
  margin-top: 5px;
  pointer-events: auto;
}
.ast-hud-button,
.ast-button,
.ast-touch button {
  font: inherit;
  border: 1px solid rgba(79, 245, 255, .65);
  color: #bffaff;
  background: rgba(8, 4, 27, .72);
  box-shadow: 0 0 6px rgba(79, 245, 255, .3), inset 0 0 6px rgba(79, 245, 255, .12);
  text-shadow: 0 0 5px currentColor;
  cursor: pointer;
}
.ast-hud-button {
  padding: 3px 7px;
  border-radius: 3px;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.ast-hud-button[aria-pressed="true"] {
  color: #ff8acb;
  border-color: rgba(255, 79, 216, .8);
  box-shadow: 0 0 6px rgba(255, 79, 216, .35), inset 0 0 6px rgba(255, 79, 216, .16);
}
.ast-hud-button:focus-visible,
.ast-button:focus-visible,
.ast-touch button:focus-visible {
  outline: 2px solid #ffe66d;
  outline-offset: 2px;
}

.ast-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(ellipse at center, rgba(12, 4, 36, .58), rgba(3, 0, 12, .84));
}
.ast-overlay[hidden] { display: none; }

.ast-panel {
  width: min(540px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: clamp(18px, 4vw, 34px);
  border: 1px solid rgba(79, 245, 255, .45);
  border-radius: 4px;
  background: rgba(8, 3, 25, .84);
  box-shadow:
    0 0 18px rgba(79, 245, 255, .18),
    0 0 80px rgba(255, 79, 216, .12),
    inset 0 0 40px rgba(79, 245, 255, .04);
  text-align: center;
}

.ast-title {
  margin: 0;
  padding: 0;
  border: 0;
  color: #f7f2ff;
  font-size: clamp(34px, 8vw, 68px);
  line-height: .95;
  letter-spacing: .12em;
  text-shadow:
    0 0 4px #fff,
    0 0 12px #4ff5ff,
    0 0 26px #4ff5ff,
    0 0 48px #ff4fd8;
}
.ast-subtitle {
  margin: 8px 0 0;
  color: #ff4fd8;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(255, 79, 216, .9);
}
.ast-copy {
  margin: 18px 0 0;
  color: #bfb2ea;
  font-size: 12px;
  line-height: 1.6;
}
.ast-keys {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 16px;
  margin: 16px auto 0;
  max-width: 420px;
  text-align: left;
  font-size: 11px;
  color: #9c8fce;
}
.ast-copy kbd,
.ast-keys kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 4px;
  border: 1px solid rgba(79, 245, 255, .35);
  border-radius: 2px;
  color: #bffaff;
  background: rgba(79, 245, 255, .06);
  font: inherit;
  text-align: center;
}
.ast-final-score {
  margin: 14px 0 0;
  color: #ffe66d;
  font-size: 20px;
  letter-spacing: .1em;
  text-shadow: 0 0 10px rgba(255, 230, 109, .8);
}

.ast-button {
  margin-top: 20px;
  padding: 9px 22px;
  border-radius: 3px;
  color: #fff;
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  background: linear-gradient(180deg, rgba(79, 245, 255, .16), rgba(255, 79, 216, .18));
}
.ast-button:hover {
  color: #fff;
  border-color: #ffe66d;
  box-shadow: 0 0 10px rgba(255, 230, 109, .4), inset 0 0 10px rgba(255, 230, 109, .15);
}
.ast-button:active { transform: translateY(1px); }

.ast-touch {
  position: absolute;
  z-index: 4;
  left: 0; right: 0; bottom: 10px;
  display: none;
  align-items: flex-end;
  justify-content: space-between;
  padding: 18px 14px 0;
  background: linear-gradient(to top, rgba(3, 0, 12, .82), rgba(3, 0, 12, .42) 55%, rgba(3, 0, 12, 0));
  pointer-events: none;
}
.ast-overlay:not([hidden]) ~ .ast-touch { visibility: hidden; }
.ast-touch-group {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
}
.ast-touch button {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  color: #bffaff;
  font-size: 17px;
  line-height: 1;
  touch-action: none;
  background: rgba(8, 4, 27, .88);
}
.ast-touch button:active {
  color: #ffe66d;
  border-color: #ffe66d;
  box-shadow: 0 0 14px rgba(255, 230, 109, .5), inset 0 0 12px rgba(255, 230, 109, .2);
}
.ast-touch .ast-fire {
  width: 68px;
  height: 68px;
  color: #ffe66d;
  border-color: rgba(255, 230, 109, .7);
  font-size: 21px;
}
.ast-touch .ast-hyperspace {
  width: 48px;
  height: 48px;
  color: #ff8acb;
  border-color: rgba(255, 79, 216, .65);
}
.ast-touch-key {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.ast-loading,
.ast-error {
  margin: 0;
  padding: 24px 12px;
  color: #bffaff;
  text-align: center;
}
.asteroids-body > .ast-loading,
.asteroids-body > .ast-error { margin: auto; }
.ast-error { color: #ff8acb; max-width: 460px; }

@media (max-width: 650px), (pointer: coarse) {
  .ast-touch { display: flex; }
}

@media (max-width: 650px) {
  .ast-hud { padding: 8px 10px; gap: 8px; }
  .ast-hud-value { font-size: 15px; }
  .ast-hud-label { font-size: 9px; }
  .ast-hud-button { padding: 3px 5px; font-size: 9px; }
  .ast-panel { padding: 18px 14px; }
  .ast-keys { grid-template-columns: 1fr; font-size: 10px; }
  .ast-copy { font-size: 11px; }
  .ast-touch { bottom: 8px; padding: 16px 10px 0; }
  .ast-touch button { width: 50px; height: 50px; }
  .ast-touch .ast-fire { width: 62px; height: 62px; }
  .ast-touch .ast-hyperspace { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .ast-crt { opacity: .35; }
}

@media (max-width: 360px) {
  .ast-touch { padding-left: 6px; padding-right: 6px; }
  .ast-touch-group { gap: 7px; }
  .ast-touch button { width: 46px; height: 46px; }
  .ast-touch .ast-fire { width: 56px; height: 56px; }
  .ast-touch .ast-hyperspace { width: 40px; height: 40px; }
}
