/* Страница мини-игры — киберпанк / терминал */
.body--game {
  --game-neon: #00ffc8;
  --game-neon-dim: rgba(0, 255, 200, 0.35);
  --game-magenta: #ff00aa;
  --game-grid: rgba(0, 255, 200, 0.04);
}

.body--game .inner-main {
  max-width: 720px;
}

.game-page__lead {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  color: #8a8a8a;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.game-page__lead kbd {
  display: inline-block;
  padding: 0.1em 0.35em;
  font-size: 0.8em;
  font-family: inherit;
  background: #141418;
  border: 1px solid #333;
  border-radius: 3px;
  color: #c8c8c8;
}

.game-shell {
  position: relative;
  border: 1px solid var(--game-neon-dim);
  border-radius: 4px;
  background: radial-gradient(
      ellipse 120% 80% at 50% 0%,
      rgba(0, 28, 22, 0.35) 0%,
      #020202 60%
    ),
    linear-gradient(var(--game-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--game-grid) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px, 24px 24px;
  box-shadow:
    0 0 40px rgba(0, 255, 200, 0.08),
    inset 0 0 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.game-shell--glitch {
  animation: game-hue 12s ease-in-out infinite;
}

@keyframes game-hue {
  0%,
  100% {
    filter: hue-rotate(0deg) saturate(1);
  }
  33% {
    filter: hue-rotate(-8deg) saturate(1.15);
  }
  66% {
    filter: hue-rotate(12deg) saturate(1.1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-shell--glitch {
    animation: none;
  }
}

.game-shell::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.35;
  z-index: 2;
}

.game-canvas-wrap {
  position: relative;
  z-index: 1;
}

#game-canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
  position: relative;
  z-index: 0;
  cursor: default;
}

.game-shell--running #game-canvas {
  cursor: crosshair;
}

.game-hud {
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.85rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--game-neon);
  text-shadow: 0 0 8px rgba(0, 255, 200, 0.4);
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.92) 0%,
    rgba(0, 0, 0, 0.5) 100%
  );
  border-bottom: 1px solid var(--game-neon-dim);
}

.game-hud__stat--wide {
  flex: 1 1 auto;
  min-width: 0;
}

.game-hud__sep {
  margin: 0 0.5rem;
  opacity: 0.45;
  font-weight: 400;
}

.game-hud__tier {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: #7a9a92;
}

.game-hud__tier strong {
  color: #9ed4c4;
}

.game-hud__stat {
  color: #c4c4c4;
}

.game-hud__stat strong {
  color: var(--game-neon);
  font-weight: 600;
}

/* Сворачиваемая панель настроек */
.game-settings {
  position: relative;
  z-index: 3;
  border-bottom: 1px solid rgba(0, 255, 200, 0.15);
  background: linear-gradient(
    180deg,
    rgba(0, 12, 10, 0.95) 0%,
    rgba(0, 6, 5, 0.88) 100%
  );
}

.game-settings__toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.85rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  text-align: left;
  border: none;
  border-radius: 0;
  background: rgba(0, 255, 200, 0.06);
  color: var(--game-neon);
  cursor: pointer;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.game-settings__toggle:hover:not(:disabled) {
  background: rgba(0, 255, 200, 0.12);
  box-shadow: inset 0 0 24px rgba(0, 255, 200, 0.08);
}

.game-settings__toggle:focus-visible {
  outline: 2px solid var(--game-neon);
  outline-offset: -2px;
}

.game-settings__toggle:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.game-settings__toggle-chevron {
  flex-shrink: 0;
  width: 1.15rem;
  height: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.game-settings__toggle-chevron::before {
  content: "";
  display: block;
  width: 0.42rem;
  height: 0.42rem;
  border-right: 2px solid var(--game-neon);
  border-bottom: 2px solid var(--game-neon);
  transform: rotate(45deg);
  margin-top: -0.15rem;
  transition: transform 0.3s ease;
  box-shadow: 1px 1px 0 rgba(0, 255, 200, 0.35);
}

.game-settings--open .game-settings__toggle-chevron::before {
  transform: rotate(-135deg);
  margin-top: 0.12rem;
}

.game-settings__toggle-main {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.game-settings__toggle-text {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #e0fff8;
  text-shadow: 0 0 12px rgba(0, 255, 200, 0.35);
}

.game-settings__toggle-hint {
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  color: #6a9088;
  text-transform: none;
  font-weight: 400;
}

.game-settings__collapsible {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-settings--open .game-settings__collapsible {
  grid-template-rows: 1fr;
}

.game-settings__inner {
  overflow: hidden;
  min-height: 0;
}

.game-settings__done {
  display: block;
  width: calc(100% - 1.7rem);
  max-width: 22rem;
  margin: 0.35rem auto 0.75rem;
  padding: 0.5rem 0.85rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid rgba(0, 255, 200, 0.45);
  border-radius: 3px;
  background: rgba(0, 255, 200, 0.08);
  color: #b8ffe8;
  cursor: pointer;
  transition:
    background 0.15s,
    box-shadow 0.15s;
}

.game-settings__done:hover {
  background: rgba(0, 255, 200, 0.16);
  box-shadow: 0 0 20px rgba(0, 255, 200, 0.2);
}

.game-settings__done:focus-visible {
  outline: 2px solid var(--game-neon);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .game-settings__collapsible {
    transition: none;
  }

  .game-settings__toggle-chevron::before {
    transition: none;
  }
}

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.82);
  text-align: center;
}

.game-overlay[hidden] {
  display: none !important;
}

.game-overlay--end {
  z-index: 6;
  background: rgba(0, 0, 0, 0.92);
  border: 1px solid rgba(255, 0, 80, 0.35);
  box-shadow: inset 0 0 80px rgba(80, 0, 20, 0.35);
}

.game-overlay__summary {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  color: #b0b0b0;
  max-width: 26rem;
  line-height: 1.5;
}

.game-shell--shake {
  animation: game-shell-shake 0.38s ease;
}

@keyframes game-shell-shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  18% {
    transform: translate(-6px, 3px);
  }
  36% {
    transform: translate(5px, -4px);
  }
  54% {
    transform: translate(-4px, -2px);
  }
  72% {
    transform: translate(3px, 3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-shell--shake {
    animation: none;
  }
}

/* Пресеты сложности */
.game-presets {
  padding: 0.65rem 0.85rem 0.5rem;
  border-bottom: 1px solid rgba(0, 255, 200, 0.12);
  background: rgba(0, 6, 5, 0.65);
}

.game-presets__title {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #5a7a72;
  margin: 0 0 0.5rem;
}

.game-presets__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.game-preset {
  position: relative;
  flex: 1 1 5.5rem;
  max-width: 10rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.45rem 0.5rem;
  font-size: 0.62rem;
  border-width: 1px;
  border-style: solid;
  border-color: rgba(0, 255, 200, 0.22);
  background: rgba(0, 18, 14, 0.55);
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}

.game-preset__mult {
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #5a9a88;
  transition: color 0.15s;
}

.game-preset__name {
  font-size: 0.55rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4a6058;
  transition: color 0.15s;
}

.game-preset.is-active {
  border-width: 2px;
  border-color: #00ffc8;
  background: rgba(0, 255, 200, 0.22);
  box-shadow:
    0 0 0 1px rgba(0, 255, 200, 0.5),
    0 0 28px rgba(0, 255, 200, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.game-preset.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: #00ffc8;
  box-shadow: 0 0 12px rgba(0, 255, 200, 0.9);
}

.game-preset.is-active .game-preset__mult {
  color: #f0fffc;
  text-shadow: 0 0 14px rgba(0, 255, 200, 0.65);
}

.game-preset.is-active .game-preset__name {
  color: #9ed4c4;
}

.game-preset:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.game-preset[data-diff="2"].is-active {
  border-color: #ff44cc;
  background: rgba(255, 0, 170, 0.18);
  box-shadow:
    0 0 0 1px rgba(255, 0, 170, 0.55),
    0 0 32px rgba(255, 0, 170, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.game-preset[data-diff="2"].is-active::before {
  background: #ff00aa;
  box-shadow: 0 0 14px rgba(255, 0, 170, 0.95);
}

.game-preset[data-diff="2"].is-active .game-preset__mult {
  color: #fff0fb;
  text-shadow: 0 0 16px rgba(255, 0, 170, 0.7);
}

.game-preset[data-diff="2"].is-active .game-preset__name {
  color: #e8a8d8;
}

.game-preset.game-btn:hover:not(:disabled):not(.is-active) {
  background: rgba(0, 32, 26, 0.75);
  border-color: rgba(0, 255, 200, 0.42);
  box-shadow: 0 0 18px rgba(0, 255, 200, 0.2);
}

.game-preset.game-btn.is-active:hover:not(:disabled) {
  background: rgba(0, 255, 200, 0.26);
  border-color: #00ffc8;
  box-shadow:
    0 0 0 1px rgba(0, 255, 200, 0.55),
    0 0 34px rgba(0, 255, 200, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.game-preset[data-diff="2"].game-btn.is-active:hover:not(:disabled) {
  background: rgba(255, 0, 170, 0.24);
  border-color: #ff55d0;
  box-shadow:
    0 0 0 1px rgba(255, 0, 170, 0.6),
    0 0 36px rgba(255, 0, 170, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Уровень чисел в примерах */
.game-numbers {
  padding: 0.55rem 0.85rem 0.65rem;
  border-bottom: 1px solid rgba(0, 255, 200, 0.12);
  background: rgba(0, 8, 6, 0.45);
}

.game-numbers__title {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #5a7a72;
  margin: 0 0 0.45rem;
}

.game-numbers__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin-bottom: 0.55rem;
}

.game-tier {
  position: relative;
  flex: 1 1 5rem;
  max-width: 9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.4rem 0.45rem;
  font-size: 0.62rem;
  border-width: 1px;
  border-style: solid;
  border-color: rgba(0, 255, 200, 0.2);
  background: rgba(0, 18, 14, 0.5);
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}

.game-tier__label {
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #5a9080;
  transition: color 0.15s;
}

.game-tier__hint {
  font-size: 0.52rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #4a5c54;
  transition: color 0.15s;
}

.game-tier.is-active {
  border-width: 2px;
  border-color: #00ffc8;
  background: rgba(0, 255, 200, 0.2);
  box-shadow:
    0 0 0 1px rgba(0, 255, 200, 0.45),
    0 0 22px rgba(0, 255, 200, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.game-tier.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: #00ffc8;
  box-shadow: 0 0 12px rgba(0, 255, 200, 0.85);
}

.game-tier.is-active .game-tier__label {
  color: #f0fffc;
  text-shadow: 0 0 12px rgba(0, 255, 200, 0.6);
}

.game-tier.is-active .game-tier__hint {
  color: #8ec4b4;
}

.game-tier.game-btn:hover:not(:disabled):not(.is-active) {
  background: rgba(0, 30, 24, 0.72);
  border-color: rgba(0, 255, 200, 0.38);
  box-shadow: 0 0 16px rgba(0, 255, 200, 0.18);
}

.game-tier.game-btn.is-active:hover:not(:disabled) {
  background: rgba(0, 255, 200, 0.24);
  border-color: #00ffc8;
  box-shadow:
    0 0 0 1px rgba(0, 255, 200, 0.5),
    0 0 28px rgba(0, 255, 200, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* Скорость падения шаров */
.game-fall {
  padding: 0.5rem 0.85rem 0.6rem;
  border-bottom: 1px solid rgba(0, 255, 200, 0.12);
  background: rgba(0, 10, 8, 0.4);
}

.game-fall__title {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #5a7a72;
  margin: 0 0 0.45rem;
}

.game-fall__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
}

.game-fall-opt {
  position: relative;
  flex: 1 1 4.5rem;
  max-width: 8.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  padding: 0.38rem 0.4rem;
  font-size: 0.58rem;
  border-width: 1px;
  border-style: solid;
  border-color: rgba(0, 255, 200, 0.2);
  background: rgba(0, 18, 14, 0.5);
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}

.game-fall-opt__label {
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #5a9080;
  transition: color 0.15s;
}

.game-fall-opt__hint {
  font-size: 0.48rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #4a5c54;
  transition: color 0.15s;
}

.game-fall-opt.is-active {
  border-width: 2px;
  border-color: #00ffc8;
  background: rgba(0, 255, 200, 0.2);
  box-shadow:
    0 0 0 1px rgba(0, 255, 200, 0.45),
    0 0 22px rgba(0, 255, 200, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.game-fall-opt.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: #00ffc8;
  box-shadow: 0 0 12px rgba(0, 255, 200, 0.85);
}

.game-fall-opt.is-active .game-fall-opt__label {
  color: #f0fffc;
  text-shadow: 0 0 12px rgba(0, 255, 200, 0.6);
}

.game-fall-opt.is-active .game-fall-opt__hint {
  color: #8ec4b4;
}

.game-fall-opt:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.game-fall-opt.game-btn:hover:not(:disabled):not(.is-active) {
  background: rgba(0, 30, 24, 0.72);
  border-color: rgba(0, 255, 200, 0.38);
  box-shadow: 0 0 16px rgba(0, 255, 200, 0.18);
}

.game-fall-opt.game-btn.is-active:hover:not(:disabled) {
  background: rgba(0, 255, 200, 0.24);
  border-color: #00ffc8;
  box-shadow:
    0 0 0 1px rgba(0, 255, 200, 0.5),
    0 0 28px rgba(0, 255, 200, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.game-tier:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.game-numbers__fixed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.62rem;
  color: #6a8a82;
}

.game-numbers__fixed-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

.game-numbers__fixed-label input {
  accent-color: var(--game-neon);
}

.game-tier-level {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.65rem;
  padding: 0.3rem 0.45rem;
  min-width: 3.5rem;
  border: 1px solid rgba(0, 255, 200, 0.35);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--game-neon);
  cursor: pointer;
}

.game-tier-level:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.game-btn--hud {
  margin-left: auto;
  padding: 0.4rem 0.75rem;
  font-size: 0.65rem;
  flex-shrink: 0;
}

.game-btn--hud:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.game-pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: rgba(0, 8, 6, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-align: center;
  border: 1px solid rgba(0, 255, 200, 0.25);
}

.game-pause-overlay[hidden] {
  display: none !important;
}

.game-pause-overlay__title {
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: 1rem;
  margin: 0;
  color: var(--game-neon);
  letter-spacing: 0.15em;
}

.game-pause-overlay__text {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  color: #8a9a96;
  margin: 0;
  max-width: 22rem;
  line-height: 1.45;
}

.game-pause-overlay__text kbd {
  display: inline-block;
  padding: 0.08em 0.3em;
  font-size: 0.9em;
  font-family: inherit;
  background: #141418;
  border: 1px solid #333;
  border-radius: 3px;
  color: #c8c8c8;
}

.game-overlay h2 {
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: 1.15rem;
  margin: 0;
  color: var(--game-neon);
  text-shadow: 0 0 20px rgba(0, 255, 200, 0.35);
}

.game-overlay p {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  color: #9a9a9a;
  max-width: 28rem;
  margin: 0;
  line-height: 1.5;
}

.game-btn {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.65rem 1.4rem;
  border: 1px solid var(--game-neon);
  background: rgba(0, 255, 200, 0.08);
  color: var(--game-neon);
  cursor: pointer;
  border-radius: 2px;
  transition:
    background 0.15s,
    box-shadow 0.15s;
}

.game-btn:hover {
  background: rgba(0, 255, 200, 0.18);
  box-shadow: 0 0 24px rgba(0, 255, 200, 0.25);
}

.game-btn:focus-visible {
  outline: 2px solid var(--game-neon);
  outline-offset: 3px;
}

.game-muted {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  color: #555;
  margin-top: 1rem;
}

.game-audio-toggle {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: #666;
}

.game-audio-toggle input {
  vertical-align: middle;
  margin-right: 0.35rem;
}
