/* css/taymi-minigames.css — TM-90 Time Run v4.
   Правая сцена Q1-Q3: canvas-мини-игра и обычные кнопки движения ← / ↑ / →.
   Внешние ассеты не нужны: спрайты рисуются в js/taymi-autoplay.js. */

.pix-chase,
.pix-blast,
.pix-lock {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  min-height: 0;
}

.pix-title {
  box-sizing: border-box;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: var(--space-2, 0.5rem);
  min-height: 3.15rem;
  margin: 0;
  margin-bottom: var(--space-2, 0.5rem);
  padding: var(--space-2, 0.5rem);
  padding-bottom: calc(var(--space-2, 0.5rem) + 2px);
  border-bottom: 3px solid #121018;
  box-shadow:
    0 2px 0 rgba(95, 255, 143, 0.22),
    0 10px 18px rgba(0, 0, 0, 0.12);
  font-family: var(--font-display, "Press Start 2P", "Courier New", monospace);
  font-size: clamp(8px, 1.9vw, 11px);
  line-height: 1.35;
  letter-spacing: 0.08em;
  color: #93f0c2;
  text-align: left;
  text-wrap: balance;
  text-shadow:
    1px 1px 0 rgba(0, 0, 0, 0.88),
    0 0 14px rgba(95, 255, 143, 0.18);
  animation: pix-title-shimmer 2.8s ease-in-out infinite;
}

.pix-title::before {
  content: "TM-90\A TIME RUN";
  white-space: pre;
  display: inline-grid;
  place-items: center;
  min-width: 8.75rem;
  min-height: 2.05rem;
  padding: 0.1rem var(--space-2, 0.5rem);
  border: 2px solid rgba(238, 255, 45, 0.48);
  background:
    linear-gradient(180deg, rgba(238, 255, 45, 0.075), rgba(0, 0, 0, 0.08)),
    #191827;
  color: #eeff2d;
  font-size: clamp(9px, 2vw, 12px);
  line-height: 1.05;
  text-align: center;
  text-shadow:
    1px 1px 0 #000,
    0 0 10px rgba(238, 255, 45, 0.22);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.32),
    2px 2px 0 #05050a;
}

.pix-chase__arena,
.pix-blast__arena,
.pix-lock__arena {
  --pix-arena-h: clamp(300px, 52vmin, 424px);
  box-sizing: border-box;
  position: relative;
  flex-shrink: 0;
  width: 100%;
  height: var(--pix-arena-h);
  margin-top: var(--space-2, 0.5rem);
  border: 5px solid #121018;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 24%, rgba(95, 255, 143, 0.13), transparent 42%),
    linear-gradient(180deg, #171232 0%, #080a18 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 0 0 2px #403468,
    inset 0 -30px 42px rgba(0, 0, 0, 0.36),
    0 0 28px rgba(140, 38, 234, 0.16),
    0 0 0 1px rgba(95, 255, 143, 0.08);
  isolation: isolate;
}

.pix-chase__arena {
  background:
    radial-gradient(ellipse 92% 72% at 50% 38%, rgba(255, 77, 114, 0.14), transparent 58%),
    radial-gradient(circle at 50% 28%, rgba(95, 255, 143, 0.16), transparent 52%),
    linear-gradient(180deg, #171232 0%, #080a18 100%);
}

.pix-blast__arena {
  background:
    radial-gradient(circle at 50% 18%, rgba(24, 216, 240, 0.18), transparent 54%),
    radial-gradient(circle at 70% 50%, rgba(95, 255, 143, 0.08), transparent 42%),
    linear-gradient(180deg, #142340 0%, #0a1128 52%, #161224 100%);
}

.pix-lock__arena {
  background:
    radial-gradient(circle at 50% 36%, rgba(238, 255, 45, 0.13), transparent 48%),
    radial-gradient(circle at 25% 44%, rgba(168, 92, 242, 0.14), transparent 46%),
    linear-gradient(180deg, #171232 0%, #080a18 100%);
}

.pix-chase__arena::before,
.pix-blast__arena::before,
.pix-lock__arena::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.4;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 8%, transparent 88%, rgba(0, 0, 0, 0.24)),
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.17) 0 1px,
      transparent 1px 5px
    );
  mix-blend-mode: soft-light;
}

.pix-chase__arena::after,
.pix-blast__arena::after,
.pix-lock__arena::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: -20%;
  z-index: 1;
  opacity: 0.22;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 44%, rgba(0, 0, 0, 0.42) 100%);
  animation: pix-arena-scan-drift 16s linear infinite;
}

.pix-canvas {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  vertical-align: top;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.pix-controls {
  box-sizing: border-box;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(48px, 58px));
  justify-content: center;
  align-items: center;
  justify-items: center;
  gap: clamp(10px, 2.8vw, 20px);
  margin-top: var(--space-2, 0.5rem);
  padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
  border: 3px solid #121018;
  background:
    radial-gradient(circle at 50% 0%, rgba(95, 255, 143, 0.08), transparent 55%),
    repeating-linear-gradient(90deg, #1a1830 0 4px, #141224 4px 8px),
    #121020;
  box-shadow:
    3px 3px 0 #000,
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.pix-control-btn {
  appearance: none;
  display: grid;
  place-items: center;
  width: clamp(54px, 9.5vw, 66px);
  height: clamp(54px, 9.5vw, 66px);
  min-width: 54px;
  min-height: 54px;
  padding: 0;
  border: 3px solid #08060e;
  border-radius: 12px;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.52), transparent 0 22%, rgba(255, 255, 255, 0.18) 23%, transparent 45%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 42%),
    #241a3c;
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.38),
    inset 0 -5px 0 rgba(0, 0, 0, 0.58),
    5px 5px 0 #000,
    0 0 0 2px rgba(0, 0, 0, 0.42);
  color: #ffffff;
  font-family: var(--font-display, "Press Start 2P", "Courier New", monospace);
  font-size: clamp(18px, 3.6vw, 26px);
  line-height: 1;
  letter-spacing: 0.04em;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  touch-action: manipulation;
  transition:
    transform 90ms steps(2, end),
    filter 120ms steps(2, end),
    color 120ms steps(2, end);
}

.pix-control-btn::after {
  content: attr(data-control-caption);
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.pix-control-btn:hover {
  color: #eeff2d;
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.pix-control-btn:active,
.pix-control-btn[data-pressed="true"] {
  transform: translate(3px, 3px);
  filter: brightness(0.92);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    inset 0 -2px 0 rgba(0, 0, 0, 0.62),
    1px 1px 0 #000,
    0 0 0 2px rgba(0, 0, 0, 0.38);
}

.pix-control-btn:focus-visible {
  outline: 3px solid rgba(95, 255, 143, 0.72);
  outline-offset: 2px;
}

.pix-controls--movement {
  grid-template-columns: repeat(3, minmax(54px, 66px));
}

.pix-control-btn--left,
.pix-control-btn--right {
  background:
    radial-gradient(circle at 34% 26%, #aaf7ff 0%, #18d8f0 42%, #0b667a 100%);
}

.pix-control-btn--jump {
  background:
    radial-gradient(circle at 34% 26%, #fff7a6 0%, #eeff2d 40%, #8f8c08 100%);
  color: #18120b;
}

/* Старые классы оставлены только для обратной совместимости, если где-то остался старый HTML. */
.pix-control-btn--signal {
  background:
    radial-gradient(circle at 34% 26%, #fff7a6 0%, #eeff2d 40%, #8f8c08 100%);
  color: #18120b;
}

.pix-control-btn--dash {
  background:
    radial-gradient(circle at 34% 26%, #aaf7ff 0%, #18d8f0 42%, #0b667a 100%);
}

.pix-control-btn--focus {
  background:
    radial-gradient(circle at 34% 26%, #d8b9ff 0%, #a85cf2 42%, #42126f 100%);
}

.pix-mini-hud {
  box-sizing: border-box;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  margin-top: var(--space-3, 0.75rem);
  min-height: 3.25rem;
  padding: var(--space-3, 0.75rem);
  border: 3px solid #121018;
  background:
    linear-gradient(180deg, rgba(95, 255, 143, 0.035), transparent 38%),
    linear-gradient(180deg, #0a1220 0%, #070814 100%);
  font-family: var(--font-mono, "Courier New", monospace);
  font-size: clamp(12px, 2.65vw, var(--fs-md, 16px));
  letter-spacing: 0.05em;
  color: #9bdc78;
  box-shadow:
    3px 3px 0 #000,
    inset 0 1px 0 rgba(95, 255, 143, 0.08),
    0 0 20px rgba(140, 38, 234, 0.06);
}

.pix-mini-hud-led {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  margin-top: 1px;
  background: #224428;
  border: 2px solid #122818;
  border-radius: 1px;
  animation: pix-mini-led 1.1s steps(2, end) infinite;
}

.pix-mini-hud-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
  white-space: normal;
  text-align: start;
}

@keyframes pix-arena-scan-drift {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(4px);
  }
}

@keyframes pix-title-shimmer {
  0%,
  100% {
    color: #7bdbae;
    text-shadow:
      1px 1px 0 rgba(0, 0, 0, 0.88),
      0 0 10px rgba(95, 255, 143, 0.14);
  }

  50% {
    color: #a3ffd0;
    text-shadow:
      1px 1px 0 rgba(0, 0, 0, 0.88),
      0 0 18px rgba(95, 255, 143, 0.26);
  }
}

@keyframes pix-mini-led {
  0%,
  49% {
    background: #3dff73;
    box-shadow: 0 0 8px rgba(95, 255, 143, 0.35);
  }

  50%,
  100% {
    background: #224428;
    box-shadow: none;
  }
}

@media (max-width: 760px) {
  .pix-title {
    grid-template-columns: 1fr;
    row-gap: var(--space-2, 0.5rem);
    text-align: center;
  }

  .pix-title::before {
    justify-self: center;
    min-width: min(11rem, 100%);
  }

  .pix-controls {
    grid-template-columns: repeat(3, minmax(44px, 54px));
    gap: 10px;
    padding-inline: var(--space-2, 0.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pix-title,
  .pix-mini-hud-led,
  .pix-chase__arena::after,
  .pix-blast__arena::after,
  .pix-lock__arena::after {
    animation: none !important;
  }

  .pix-control-btn {
    transition: none;
  }
}

.pix-controls--movement {
  grid-template-columns: repeat(3, minmax(54px, 66px));
}

.pix-control-btn--left,
.pix-control-btn--right,
.pix-control-btn--dash {
  background:
    radial-gradient(circle at 34% 26%, #aaf7ff 0%, #18d8f0 42%, #0b667a 100%);
}

.pix-control-btn--jump {
  background:
    radial-gradient(circle at 34% 26%, #d8b9ff 0%, #a85cf2 42%, #42126f 100%);
  color: #ffffc8;
}

.pix-control-btn--signal,
.pix-control-btn--focus {
  background:
    radial-gradient(circle at 34% 26%, #fff7a6 0%, #eeff2d 40%, #8f8c08 100%);
  color: #18120b;
}
