.relaxation-gorodki-program {
  --pocket-ink: #0f380f;
  --pocket-dark: #306230;
  --pocket-mid: #8bac0f;
  --pocket-light: #9bbc0f;
  --terminal-case: #526a7e;
  --terminal-case-light: #71879a;
  --terminal-case-dark: #314452;
  --terminal-seam: #1c2931;
  --terminal-rubber: #141817;
  --terminal-cream: #d2c39d;
  --terminal-red: #b43a33;
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(180deg, transparent 0 72%, rgba(0, 0, 0, 0.42) 72.2%),
    linear-gradient(180deg, #262a21 0 71.8%, #4d5143 72% 100%);
}

.relaxation-gorodki-program::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 22% 0%, rgba(230, 211, 159, 0.17), transparent 34%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.22), transparent 18% 82%, rgba(0, 0, 0, 0.22)),
    repeating-linear-gradient(90deg, transparent 0 108px, rgba(211, 208, 169, 0.025) 109px 110px);
}

.relaxation-gorodki-program::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  top: 72%;
  height: 2px;
  pointer-events: none;
  background: #1b201a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.36);
}

.relaxation-screen[data-relaxation-program="gorodki"] .relaxation-header,
.relaxation-screen[data-relaxation-program="gorodki"] .relaxation-program-tabs {
  display: none;
}

.relaxation-gorodki-mount,
.gorodki-workspace {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.gorodki-workspace {
  position: relative;
  z-index: 3;
  display: grid;
  padding: 10px clamp(12px, 2vw, 28px) 8px;
}

.gorodki-lane-shell,
.gorodki-lane {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.gorodki-lane-shell {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.gorodki-lane {
  place-items: stretch center;
  outline: none;
}

.gorodki-lane:focus-visible {
  box-shadow: inset 0 0 0 3px rgba(155, 188, 15, 0.72);
}

.gorodki-handheld {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) clamp(106px, 17vh, 150px);
  gap: clamp(8px, 1.3vh, 14px);
  width: min(100%, 1120px);
  height: 100%;
  min-height: 0;
  background: none;
  box-shadow: none;
}

.gorodki-crt {
  position: relative;
  align-self: stretch;
  justify-self: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(96px, 12vw, 142px);
  gap: clamp(10px, 1.2vw, 16px);
  width: min(100%, 980px);
  min-height: 0;
  padding: clamp(11px, 1.3vw, 17px);
  border: 2px solid var(--terminal-seam);
  border-radius: clamp(18px, 2.2vw, 30px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 24% 76%, rgba(0, 0, 0, 0.15)),
    var(--terminal-case);
  box-shadow:
    inset 2px 2px rgba(255, 255, 255, 0.16),
    inset -4px -5px rgba(20, 32, 39, 0.42),
    0 5px 0 #1a2328,
    0 15px 28px rgba(0, 0, 0, 0.42);
}

.gorodki-crt::before,
.gorodki-crt::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 3px;
  border-radius: 3px;
  background: rgba(210, 195, 157, 0.32);
  pointer-events: none;
}

.gorodki-crt::before {
  top: 7px;
  left: 12%;
}

.gorodki-crt::after {
  right: 16%;
  bottom: 8px;
  rotate: -3deg;
}

.gorodki-handheld__screen {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: clamp(10px, 1.2vw, 15px);
  border: 2px solid #111716;
  border-radius: 9% / 7%;
  background: #080d0b;
  box-shadow:
    inset 6px 7px 16px rgba(0, 0, 0, 0.9),
    inset -4px -5px 9px rgba(106, 133, 105, 0.11),
    0 0 0 3px #283a43;
}

.gorodki-handheld__screen::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset: clamp(10px, 1.2vw, 15px);
  border-radius: 5% / 4%;
  pointer-events: none;
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0.11), transparent 14% 74%, rgba(15, 56, 15, 0.05)),
    repeating-linear-gradient(0deg, rgba(15, 56, 15, 0.09) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse at center, transparent 58%, rgba(5, 12, 7, 0.3) 100%);
  mix-blend-mode: multiply;
}

.gorodki-handheld__screen::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: clamp(10px, 1.2vw, 15px);
  border-radius: 5% / 4%;
  pointer-events: none;
  box-shadow: inset 0 0 18px rgba(7, 19, 9, 0.36);
}

#gorodki-canvas {
  position: absolute;
  z-index: 2;
  display: block;
  box-sizing: border-box;
  top: 50%;
  left: 50%;
  width: calc(100% - clamp(20px, 2.4vw, 30px));
  height: calc(100% - clamp(20px, 2.4vw, 30px));
  aspect-ratio: 160 / 144;
  object-fit: contain;
  transform: translate(-50%, -50%);
  border: 1px solid #1b3e1d;
  background: #080d0b;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-shadow:
    0 0 0 1px #426342,
    0 0 20px rgba(155, 188, 15, 0.2);
}

.gorodki-crt__service {
  display: grid;
  grid-template-rows: auto 1fr 1fr auto auto;
  place-items: center;
  gap: clamp(5px, 1vh, 10px);
  min-width: 0;
  padding: 4px 2px 8px;
}

.gorodki-crt__service strong {
  align-self: start;
  color: var(--terminal-cream);
  font-family: var(--font-mono);
  font-size: clamp(8px, 0.92vw, 12px);
  letter-spacing: 0.08em;
  text-align: center;
}

.gorodki-crt__knob {
  width: clamp(32px, 4vw, 48px);
  aspect-ratio: 1;
  border: 2px solid #080c0d;
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 47%, rgba(210, 195, 157, 0.72) 48% 52%, transparent 53%) 50% 16% / 100% 28% no-repeat,
    radial-gradient(circle at 36% 31%, #414747, #101414 68%);
  box-shadow:
    inset 2px 2px rgba(255, 255, 255, 0.12),
    inset -3px -4px rgba(0, 0, 0, 0.74),
    0 3px 0 #1c2a31;
}

.gorodki-crt__lamp {
  width: clamp(15px, 1.8vw, 21px);
  aspect-ratio: 1;
  border: 3px solid #1a272b;
  border-radius: 50%;
  background: #6bc82c;
  box-shadow:
    inset 2px 2px rgba(235, 255, 188, 0.56),
    0 0 9px rgba(126, 213, 62, 0.7);
}

.gorodki-crt__speaker {
  display: grid;
  gap: 4px;
  width: min(76%, 78px);
  padding: 8px 7px;
  border: 1px solid #1d2b31;
  border-radius: 5px;
  background: var(--terminal-case-dark);
}

.gorodki-crt__speaker span {
  height: 4px;
  border-radius: 999px;
  background: #111718;
  box-shadow: 0 1px rgba(255, 255, 255, 0.08);
}

.gorodki-desk {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 620px) minmax(88px, 126px);
  justify-content: center;
  align-items: center;
  gap: clamp(18px, 3vw, 46px);
  min-height: 0;
}

.gorodki-handheld__deck {
  position: relative;
  display: grid;
  grid-template-columns: 96px minmax(72px, 1fr) 154px;
  align-items: center;
  min-width: 0;
  height: clamp(96px, 14vh, 122px);
  padding: 8px clamp(12px, 2vw, 22px);
  border: 2px solid #1d2930;
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 26% 72%, rgba(0, 0, 0, 0.17)),
    var(--terminal-case-dark);
  box-shadow:
    inset 2px 2px rgba(255, 255, 255, 0.12),
    inset -3px -4px rgba(0, 0, 0, 0.32),
    0 5px 0 #192228,
    0 11px 18px rgba(0, 0, 0, 0.36);
}

.gorodki-handheld__deck::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 12px;
  height: clamp(18px, 3vh, 32px);
  border-radius: 8px 8px 0 0;
  background: #171d1d;
  transform: translateX(-50%);
  box-shadow: inset 3px 0 rgba(255, 255, 255, 0.06);
}

.gorodki-dpad {
  position: relative;
  display: grid;
  grid-template: repeat(3, 25px) / repeat(3, 25px);
  width: 75px;
  height: 75px;
  filter: drop-shadow(0 4px 2px rgba(0, 0, 0, 0.42));
}

.gorodki-dpad::before,
.gorodki-dpad::after {
  content: "";
  position: absolute;
  z-index: 0;
  border: 1px solid #070909;
  border-radius: 5px;
  background: linear-gradient(145deg, #363a38, var(--terminal-rubber) 58%, #050707);
  box-shadow:
    inset 2px 2px rgba(255, 255, 255, 0.09),
    inset -3px -3px rgba(0, 0, 0, 0.72);
}

.gorodki-dpad::before {
  inset: 0 25px;
}

.gorodki-dpad::after {
  inset: 25px 0;
}

.gorodki-dpad__key,
.gorodki-dpad__centre {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  color: #777f7d;
  background: transparent;
}

.gorodki-dpad__key {
  cursor: pointer;
}

.gorodki-dpad__key span {
  font-size: 8px;
  line-height: 1;
  opacity: 0.7;
}

.gorodki-dpad__key--up { grid-area: 1 / 2; }
.gorodki-dpad__key--left { grid-area: 2 / 1; }
.gorodki-dpad__centre { grid-area: 2 / 2; }
.gorodki-dpad__key--right { grid-area: 2 / 3; }
.gorodki-dpad__key--down { grid-area: 3 / 2; }

.gorodki-dpad__centre::after {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #0c0f0e;
  box-shadow: inset 1px 1px rgba(255, 255, 255, 0.08);
}

.gorodki-dpad__key:hover,
.gorodki-dpad__key:focus-visible,
.gorodki-start:hover,
.gorodki-start:focus-visible,
.gorodki-secondary:hover,
.gorodki-secondary:focus-visible,
.gorodki-action:hover,
.gorodki-action:focus-visible {
  outline: 2px solid var(--pocket-light);
  outline-offset: 2px;
}

.gorodki-dpad__key:active,
.gorodki-dpad__key.is-pressed {
  translate: 0 2px;
  color: var(--pocket-light);
}

.gorodki-console-centre {
  display: grid;
  place-items: center;
}

.gorodki-start {
  min-width: 70px;
  min-height: 25px;
  padding: 3px 12px 1px;
  border: 1px solid #090c0c;
  border-radius: 7px;
  color: var(--terminal-cream);
  background: #222827;
  box-shadow:
    inset 1px 1px rgba(255, 255, 255, 0.11),
    0 3px 0 #0d1111;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.gorodki-action-cluster {
  display: grid;
  grid-template-columns: 42px 72px;
  grid-template-rows: 1fr auto;
  place-items: center;
  justify-content: end;
  gap: 4px 12px;
}

.gorodki-action,
.gorodki-secondary {
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  font-family: var(--font-mono);
  font-weight: 900;
  cursor: pointer;
}

.gorodki-secondary {
  width: 36px;
  height: 36px;
  border: 1px solid #070909;
  color: var(--terminal-cream);
  background: #1a1e1d;
  box-shadow:
    inset 2px 2px rgba(255, 255, 255, 0.09),
    0 3px 0 #090b0b;
  font-size: 13px;
}

.gorodki-action {
  width: 62px;
  height: 62px;
  border: 2px solid #5d1816;
  color: #f1d8b9;
  background:
    radial-gradient(circle at 37% 29%, rgba(255, 208, 181, 0.34) 0 8%, transparent 9%),
    var(--terminal-red);
  box-shadow:
    inset 3px 3px rgba(255, 255, 255, 0.15),
    inset -5px -6px rgba(74, 13, 13, 0.32),
    0 0 0 4px #6d2924,
    0 5px 0 #321211;
  font-size: 22px;
}

.gorodki-action-cluster strong {
  grid-column: 1 / -1;
  color: rgba(210, 195, 157, 0.76);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.12em;
  text-align: center;
}

.gorodki-start:active:not(:disabled),
.gorodki-secondary:active:not(:disabled),
.gorodki-action:active:not(:disabled),
.gorodki-handheld.is-charging .gorodki-action {
  translate: 0 3px;
}

.gorodki-handheld.is-charging .gorodki-action {
  box-shadow:
    inset 4px 5px rgba(82, 14, 12, 0.42),
    0 0 0 4px #6d2924,
    0 1px 0 #321211,
    0 0 17px rgba(155, 188, 15, 0.34);
}

.gorodki-action:disabled,
.gorodki-secondary:disabled,
.gorodki-start:disabled,
.gorodki-dpad__key:disabled {
  cursor: default;
  opacity: 0.62;
}

.gorodki-archive-disk {
  position: relative;
  width: clamp(92px, 10vw, 122px);
  aspect-ratio: 1.16;
  align-self: center;
  border: 2px solid #151a1a;
  border-radius: 5px 5px 10px 10px;
  background:
    linear-gradient(90deg, transparent 0 66%, #9ca09a 66% 84%, transparent 84%) 50% 9% / 100% 24% no-repeat,
    #303534;
  box-shadow:
    inset 2px 2px rgba(255, 255, 255, 0.1),
    0 5px 0 #171b1a,
    0 9px 14px rgba(0, 0, 0, 0.34);
  rotate: 2deg;
}

.gorodki-archive-disk::after {
  content: "";
  position: absolute;
  right: 8%;
  bottom: 8%;
  width: 8%;
  aspect-ratio: 1;
  border: 1px solid #101414;
  background: #141918;
}

.gorodki-archive-disk span {
  position: absolute;
  left: 9%;
  right: 9%;
  bottom: 13%;
  display: grid;
  place-items: center;
  height: 37%;
  border: 1px solid #8f835f;
  color: #191d19;
  background: #d8c99e;
  font-family: var(--font-mono);
  font-size: clamp(7px, 0.85vw, 10px);
  font-weight: 800;
  letter-spacing: 0.05em;
}

.gorodki-handheld.is-won .gorodki-handheld__screen {
  animation: gorodki-victory-pulse 680ms steps(2, jump-none) infinite;
}

.gorodki-handheld.is-throwing .gorodki-handheld__screen {
  box-shadow:
    inset 6px 7px 16px rgba(0, 0, 0, 0.9),
    inset -4px -5px 9px rgba(106, 133, 105, 0.11),
    0 0 0 3px #283a43,
    0 0 20px rgba(155, 188, 15, 0.28);
}

@keyframes gorodki-victory-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2); }
}

.gorodki-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gorodki-shell-menu {
  position: absolute;
  z-index: 12;
  top: 14px;
  left: 16px;
  width: clamp(132px, 12vw, 164px);
}

.gorodki-shell-menu .new-basecamp-menu__toggle,
.gorodki-shell-menu .new-basecamp-menu__item {
  border: 1px solid rgba(210, 195, 157, 0.18);
  background: rgba(20, 28, 27, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.gorodki-shell-menu .new-basecamp-menu__toggle {
  min-height: 44px;
}

.gorodki-shell-menu .new-basecamp-menu__toggle span {
  position: relative;
  background: rgba(82, 106, 126, 0.28);
}

.gorodki-shell-menu .new-basecamp-menu__toggle span::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 17px;
  height: 2px;
  background: var(--terminal-cream);
  box-shadow: 0 -6px #788c82, 0 6px #788c82;
  transform: translate(-50%, -50%);
}

.gorodki-shell-menu .new-basecamp-menu__list {
  background: rgba(12, 17, 16, 0.97);
}

.gorodki-shell-menu .new-basecamp-menu__item[data-gorodki-menu-program] {
  color: #a9c3b9;
}

.gorodki-shell-menu .new-basecamp-menu__toggle:hover,
.gorodki-shell-menu .new-basecamp-menu__toggle:focus-visible,
.gorodki-shell-menu .new-basecamp-menu__item:hover,
.gorodki-shell-menu .new-basecamp-menu__item:focus-visible,
.gorodki-shell-menu .new-basecamp-menu__item.is-active {
  color: var(--pocket-light);
  background: rgba(48, 72, 67, 0.96);
}

@media (max-width: 760px), (max-height: 660px) {
  .relaxation-gorodki-program {
    overflow-y: auto;
  }

  .gorodki-workspace {
    height: auto;
    min-height: 100%;
    padding: 56px 8px 14px;
  }

  .gorodki-lane-shell,
  .gorodki-lane {
    height: auto;
  }

  .gorodki-handheld {
    grid-template-rows: auto auto;
    width: min(100%, 700px);
    height: auto;
  }

  .gorodki-crt {
    grid-template-columns: minmax(0, 1fr) 70px;
    width: 100%;
    min-height: 300px;
    padding: 8px;
    border-radius: 16px;
  }

  .gorodki-handheld__screen {
    min-height: 280px;
    padding: 8px;
  }

  .gorodki-handheld__screen::before,
  .gorodki-handheld__screen::after {
    inset: 8px;
  }

  .gorodki-crt__service {
    gap: 4px;
  }

  .gorodki-crt__service strong {
    font-size: 7px;
  }

  .gorodki-crt__knob {
    width: 28px;
  }

  .gorodki-crt__speaker {
    width: 52px;
    padding: 5px;
  }

  .gorodki-desk {
    grid-template-columns: minmax(0, 440px);
  }

  .gorodki-handheld__deck {
    grid-template-columns: 72px 1fr 112px;
    height: 84px;
    padding: 5px 10px;
  }

  .gorodki-dpad {
    grid-template: repeat(3, 20px) / repeat(3, 20px);
    width: 60px;
    height: 60px;
  }

  .gorodki-dpad::before { inset: 0 20px; }
  .gorodki-dpad::after { inset: 20px 0; }

  .gorodki-start {
    min-width: 58px;
    min-height: 22px;
    padding-inline: 7px;
    font-size: 7px;
  }

  .gorodki-action-cluster {
    grid-template-columns: 32px 53px;
    gap: 3px 8px;
  }

  .gorodki-secondary {
    width: 30px;
    height: 30px;
    font-size: 11px;
  }

  .gorodki-action {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }

  .gorodki-archive-disk {
    display: none;
  }
}

@media (max-width: 430px) {
  .gorodki-crt {
    grid-template-columns: minmax(0, 1fr) 58px;
    min-height: 270px;
  }

  .gorodki-handheld__screen {
    min-height: 250px;
  }

  .gorodki-crt__service strong {
    max-width: 48px;
    overflow-wrap: anywhere;
    line-height: 1.3;
  }

  .gorodki-crt__speaker {
    width: 43px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gorodki-handheld.is-won .gorodki-handheld__screen {
    animation: none;
    filter: brightness(1.08);
  }
}
