.gt-game-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100% !important;
  max-width: none !important;
  padding: 0 !important;
  background: transparent;
  color: var(--text-color-game);
  border-radius: var(--dialog-radius-game);
  box-shadow: var(--dialog-shadow-game);
  outline: none;
}


.gt-game-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg-game);
  z-index: var(--z-overlay-game);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}


.gt-game-frame {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  inline-size: 100%;
  block-size: 100%;
  min-block-size: 0;
}

.gt-topbar {
  position: relative;
  height: var(--topbar-h-game);
  background: var(--topbar-bg-game) !important;
  border: var(--topbar-border-w-game) solid var(--topbar-border-game) !important;
  box-sizing: border-box;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--topbar-pad-x-game);
  overflow: visible;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: none !important;
}

.gt-topbar::after {
  content: "";
  position: absolute;
  inset: -2px;
  background: var(--topbar-bg-game);
  border: var(--topbar-border-w-game) solid var(--topbar-border-game);
  filter: blur(var(--topbar-glow-blur-game));
  z-index: 0;
  pointer-events: none;
}

.gt-topbar > * {
  position: relative;
  z-index: 1;
}


.gt-topbar__left {
  display: flex;
  align-items: center;
  gap: var(--topbar-gap-lr-game);
  flex: 0 0 auto;
}

.gt-topbar__center {
  display: flex;
  align-items: center;
  gap: var(--topbar-gap-center-game);
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
}

.gt-topbar__right {
  display: flex;
  align-items: center;
  gap: var(--topbar-gap-lr-game);
  flex: 0 0 auto;
}

.gt-topbar__title,
.gt-topbar__label,
.gt-topbar__value,
.gt-topbar__nick {
  font-family: var(--title-font-family-game);
  color: var(--title-color-game);
  text-shadow: -5px 3px 3px var(--text-shadow-light-game);
  line-height: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.gt-topbar__title {
  font-size: var(--title-font-size-game);
}

.gt-topbar__label,
.gt-topbar__value {
  font-size: var(--label-font-size-game);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gt-topbar__value {
  font-size: var(--value-font-size-game);
  min-width: var(--value-min-w-game) !important;
  justify-content: center;
}

.gt-topbar__nick {
  font-size: var(--nick-font-size-game);
}


.gt-topbar__pause,
.gt-topbar__close {
  appearance: none;
  background: transparent;
  border: none;
  color: var(--title-color-game);
  font: inherit;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.gt-topbar__pause {
  width: auto;
  height: auto;
  padding: 0;
  color: var(--title-color-game);
  font-size: var(--label-font-size-game);
  line-height: 1;
}

.gt-topbar__pause svg,
.gt-topbar__pause img {
  display: block;
  width: 1em;
  height: auto;
  flex: 0 0 auto;
}

.gt-topbar__close {
  width: auto;
  height: auto;
  padding: 0;
  color: var(--title-color-game);
  font-size: var(--label-font-size-game);
  line-height: 1;
}

.gt-topbar__close svg,
.gt-topbar__close img {
  display: block;
  width: 1em;
  height: auto;
  flex: 0 0 auto;
}

.gt-topbar__pause:focus-visible,
.gt-topbar__close:focus-visible {
  outline: 2px solid rgba(17, 24, 39, 0.5);
  outline-offset: 2px;
}

.gt-topbar__pause:hover,
.gt-topbar__close:hover {
  opacity: .9;
}

.gt-game-canvas {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  outline: none !important;
  image-rendering: auto;
}

.gt-game-hud {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: var(--hud-gap-game);
  font-family: var(--hud-font-family-game);
  font-size: var(--hud-font-size-game);
  margin-bottom: 8px;
  color: var(--text-color-game);
  user-select: none;
}


.gt-game-hint {
  margin-top: 8px;
  font-size: var(--hint-font-size-game);
  color: var(--hint-color-game);
  text-align: center;
  user-select: none;
}

.top-bar {
  position: relative;
  z-index: 1000;
}

.gt-game-overlay--scoped {
  position: absolute;
  inset: 0;
  z-index: 2000;
}

#app.layout {
  position: relative;
}

.gt-nick-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.gt-nick-dialog {
  position: relative;
  width: var(--nickdlg-w-game);
  height: var(--nickdlg-h-game);
  background: var(--nickdlg-bg-game);
  box-shadow: var(--nickdlg-shadow-game);
  border-radius: var(--nickdlg-radius-game);
}

.gt-nick-header {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 70px;
  background: var(--nickdlg-header-bg-game);
  color: var(--nickdlg-header-fg-game);
  border-radius: var(--nickdlg-radius-game) var(--nickdlg-radius-game) 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--title-font-family-game);
  font-weight: 400;
  font-size: var(--nickdlg-title-size-game);
  line-height: 1;
}

.gt-nick-input {
  position: absolute;
  left: 50%;
  top: 100px;
  transform: translateX(-50%);
  width: 402px;
  height: var(--nickdlg-input-h-game);
  background: var(--nickdlg-input-bg-game);
  border: 3px solid var(--nickdlg-input-border-game);
  border-radius: 5px;
  padding: 6px 12px;
  font-family: var(--title-font-family-game);
  font-size: var(--nickdlg-input-font-size-game);
  line-height: 1;
  color: #111827;
}

.gt-nick-submit {
  position: absolute;
  left: 50%;
  top: 179px;
  transform: translateX(-50%);
  width: 194px;
  height: 48px;
  background: var(--nickdlg-btn-bg-game);
  color: var(--nickdlg-btn-fg-game);
  border: 0;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  font-family: var(--title-font-family-game);
  font-weight: 400;
  font-size: var(--nickdlg-btn-font-size-game);
  line-height: 1;
  cursor: pointer;
}

.gt-nick-error {
  position: absolute;
  left: 0;
  right: 0;
  top: 154px;
  text-align: center;
  font-size: 12px;
  color: #F87171;
}

.gt-score-card .gt-score-col::before {
  content: none !important;
  display: none !important;
  background: none !important;
  width: 0;
  height: 0;
}


/* Мобильная версия окна ввода ника */
@media (max-width: 520px) {
  .gt-nick-dialog {
    /* окно уже и ниже, чем десктопное */
    width: min(320px, 92vw);
    height: 210px;
  }

  .gt-nick-header {
    /* понижаем шапку и шрифт */
    height: 56px;
    font-size: 26px;
  }

  .gt-nick-input {
    /* подвигаем выше и делаем уже/ниже */
    top: 78px;
    width: calc(100% - 48px);
    height: 40px;
    font-size: 22px;
  }

  .gt-nick-error {
    /* поджимаем ошибку */
    top: 130px;
    font-size: 11px;
  }

  .gt-nick-submit {
    /* кнопка ближе к полю, меньше по размеру */
    top: 150px;
    width: min(190px, calc(100% - 64px));
    height: 40px;
    font-size: 20px;
  }
}


@media (max-width: 520px) {
  :root {
    --topbar-h-mobile-game: 44px;
  }

  .gt-topbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-h-mobile-game);
    padding-left: 8px;
    padding-right: 8px;
    gap: 8px;
  }

  .gt-topbar__left,
  .gt-topbar__right {
    gap: calc(var(--topbar-gap-lr-game) * 0.6);
    flex: 0 0 auto;
  }

  .gt-topbar__center {
    gap: calc(var(--topbar-gap-center-game) * 0.7);
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
  }

  .gt-topbar__title,
  .gt-topbar__label,
  .gt-topbar__value,
  .gt-topbar__nick {
    line-height: var(--topbar-h-mobile-game);
    height: var(--topbar-h-mobile-game);
  }

  .gt-topbar__title {
    font-size: calc(var(--title-font-size-game) * 0.88);
  }

  .gt-topbar__label {
    font-size: calc(var(--label-font-size-game) * 0.9);
  }

  .gt-topbar__value {
    font-size: calc(var(--value-font-size-game) * 0.9);
    min-width: 56px !important;
  }

  .gt-topbar__nick {
    font-size: calc(var(--nick-font-size-game) * 0.9);
  }

  .gt-topbar__pause {
    font-size: calc(var(--label-font-size-game) * 0.9);
  }

  .gt-topbar__close {
    font-size: calc(var(--label-font-size-game) * 0.9);
  }


  .gt-game-hud {
    font-size: 12px;
  }
}

.gt-score-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 70px 16px 24px;
}

.gt-score-card {
  position: relative;
  width: min(1100px, 96vw);
  min-height: 720px;
  margin: 0 auto;
}

.gt-score-back {
  position: absolute;
  left: -8px;
  top: -6px;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 6px;
  line-height: 0;
  filter: drop-shadow(var(--score-back-shadow));
  color: var(--score-accent);
  z-index: 3;
}

.gt-score-back svg path {
  fill: var(--score-back-color-game, #22418C);
}


.gt-score-ribbon {
  position: relative;
  height: 60px;
  display: grid;
  grid-template-columns: 100px 1fr 132px;
  align-items: stretch;
  margin: 14px auto 22px;
  width: 100%;
  background: linear-gradient(90deg, var(--score-grad-from) 35%, var(--score-grad-to) 90%);
  box-shadow: var(--score-box-shadow);
}


.gt-ribbon__me {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-110%, -50%);
  font-family: var(--title-font-family-game);
  font-weight: 400;
  font-size: 40px;
  line-height: 50px;
  color: var(--score-on-base, var(--title-color-game));
  text-shadow: -5px 3px 3px var(--text-shadow-light-game);
  user-select: none;
  padding: 0;
  white-space: nowrap;
}


.gt-ribbon__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: var(--title-font-family-game);
  font-weight: 400;
  font-size: 40px;
  line-height: 50px;
  border-radius: 0;
  box-shadow: none;
}


.gt-ribbon__badge--place {
  grid-column: 1;
  background: var(--score-accent-2);
  color: var(--score-on-accent);
}


.gt-ribbon__nick {
  grid-column: 2;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 18px;
  background: transparent;
  color: var(--score-on-accent);
  font-family: var(--title-font-family-game);
  font-weight: 400;
  font-size: 40px;
  line-height: 50px;
  box-shadow: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.gt-ribbon__badge--best {
  grid-column: 3;
  min-width: auto;
  background: transparent;
  color: var(--score-accent-2);
  box-shadow: none;
}


.gt-score-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(300px, 500px));
  gap: 32px;
  justify-content: center;
}

.gt-score-col {
  position: relative;
  display: grid;
  row-gap: 10px;
}

.gt-score-col__title {
  height: 60px;
  display: grid;
  place-items: center;
  background: var(--score-accent);
  color: var(--score-on-accent);
  font-family: var(--title-font-family-game);
  font-weight: 400;
  font-size: 40px;
  line-height: 50px;
  margin: 0;
  border-radius: 50px 0 0 0;
}

.gt-score-col:last-child .gt-score-col__title {
  border-radius: 0 50px 0 0;
  box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.25);
}

.gt-score-list {
  display: grid;
  row-gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: rank;
}

.gt-score-row {
  display: grid;
  grid-template-columns: 100px 1fr 132px;
  align-items: center;
  height: 60px;
  background: linear-gradient(90deg, var(--score-grad-from) 35%, var(--score-grad-to) 90%);
  position: relative;
  box-shadow: 0 0.5px 0 var(--score-row-divider) inset;
}

.gt-score-row__rank {
  background: var(--score-accent-2);
  color: var(--score-on-accent);
  height: 100%;
  display: grid;
  place-items: center;
  font-family: var(--title-font-family-game);
  font-size: 28px;
}

.gt-score-row__nick {
  padding: 0 16px;
  font-family: var(--title-font-family-game);
  font-size: 28px;
  color: var(--score-on-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gt-score-row__val {
  display: grid;
  place-items: center;
  height: 100%;
  background: transparent;
  color: var(--score-accent-2);
  font-family: var(--title-font-family-game);
  font-size: 28px;
}

.gt-score-col:first-child .gt-score-list > li:last-child {
  border-radius: 0 0 0 50px;
  overflow: hidden;
}

.gt-score-col:last-child .gt-score-list > li:last-child {
  border-radius: 0 0 50px 0;
  overflow: hidden;
}

@media (max-width: 640px) {
  .gt-score-col {
    row-gap: 8px;
  }

  .gt-score-list {
    row-gap: 8px;
  }
}

@media (max-width: 980px) {
  .gt-score-cols {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .gt-score-col__title {
    border-radius: 24px 24px 0 0 !important;
    height: clamp(40px, 2.4vh, 60px);;
  }

  .gt-score-col:first-child .gt-score-list > li:last-child {
    border-radius: 0 0 24px 24px;
  }

  .gt-score-col:last-child .gt-score-list > li:last-child {
    border-radius: 0 0 24px 24px;
  }

  .gt-score-ribbon {
    width: 100%;
    height: clamp(40px, 6vh, 60px);
    grid-template-columns: 80px 1fr 110px;
  }

  .gt-ribbon__badge, .gt-ribbon__nick {
    font-size: 32px;
    line-height: 1;
  }

  .gt-score-row {
    grid-template-columns: 80px 1fr 110px;
    height: 52px;
  }

  .gt-score-row__rank, .gt-score-row__val, .gt-score-row__nick {
    font-size: 24px;
  }
}

.gt-score-overlay {
  padding: 40px 16px 24px;
  overflow-y: auto;
  background: var(--score-overlay-bg);
}

.gt-score-card {
  width: min(1100px, 100%);
  min-height: auto;
  max-height: calc(100vh - 64px);
  box-sizing: border-box;
}

.gt-score-ribbon {
  width: min(745px, 100%);
  margin: 12px auto 18px;
}

.gt-ribbon__me {
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.15;
}

.gt-ribbon__badge,
.gt-ribbon__nick {
  font-size: clamp(20px, 2.5vw, 30px);
}

.gt-score-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(16px, 3vw, 32px);
}

.gt-score-col__title {
  min-height: clamp(44px, 6vw, 60px);
  font-size: clamp(23px, 2.2vw, 30px);
  box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.25);

}

.gt-score-list {
  row-gap: clamp(6px, 1.4vh, 10px);
}

.gt-score-row {
  grid-template-columns:
        minmax(70px, 100px)
        minmax(0, 1fr)
        minmax(72px, 132px);
  height: clamp(40px, 6vh, 60px);
  box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.25);
}

.gt-score-row__rank,
.gt-score-row__nick,
.gt-score-row__val {
  font-size: clamp(20px, 2.4vw, 30px);
}

.gt-topbar__title--active,
.gt-topbar__nick--active {
  text-shadow: -3px 0 0 var(--topbar-active-border-game),
  3px 0 0 var(--topbar-active-border-game),
  0 -3px 0 var(--topbar-active-border-game),
  0 3px 0 var(--topbar-active-border-game),
  -3px -3px 0 var(--topbar-active-border-game),
  3px -3px 0 var(--topbar-active-border-game),
  -3px 3px 0 var(--topbar-active-border-game),
  3px 3px 0 var(--topbar-active-border-game);
}

.gt-topbar__pause--active svg {
  filter: drop-shadow(-1px 0 0 var(--topbar-active-border-game)) drop-shadow(1px 0 0 var(--topbar-active-border-game)) drop-shadow(0 -1px 0 var(--topbar-active-border-game)) drop-shadow(0 1px 0 var(--topbar-active-border-game)) drop-shadow(-1px -1px 0 var(--topbar-active-border-game)) drop-shadow(1px -1px 0 var(--topbar-active-border-game)) drop-shadow(-1px 1px 0 var(--topbar-active-border-game)) drop-shadow(1px 1px 0 var(--topbar-active-border-game));
}


@media (max-width: 980px) {
  .gt-score-overlay {
    padding-top: 32px;
  }

  .gt-score-card {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 48px);
    padding-top: 56px;
    margin: 0;
    box-sizing: border-box;
  }

  .gt-score-cols {
    grid-template-columns: 1fr;
    row-gap: clamp(14px, 3vh, 20px);
  }

  .gt-score-back {
    left: 50%;
    top: 0;
    transform: translateX(-50%);
  }

  .gt-score-ribbon {
    width: 80%;
    margin-top: 48px;
  }


  .gt-ribbon__me {
    padding-right: 10px;
  }
}


@media (max-width: 640px) {
  .gt-score-overlay {
    padding-top: 24px;
  }

  .gt-score-card {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    padding-top: 56px;
    box-sizing: border-box;
  }

  .gt-score-back {
    left: 50%;
    top: 0;
    transform: translateX(-50%);
  }

  .gt-score-ribbon {
    width: 80%;
    height: clamp(10px, 7vh, 30px);
    margin: 8px auto 16px;
  }

  .gt-ribbon__me {
    font-size: clamp(22px, 5vw, 28px);
    padding-right: 5px;
  }

  .gt-score-row {
    height: clamp(10px, 7vh, 30px);
  }
}

