/* Local clone polish / bugfixes */

html {
  scroll-behavior: smooth;
}

body.t-body {
  overflow-x: hidden;
}

/* Prevent stuck intro opacity flash on main records wrapper only */
#allrecords.t-records {
  opacity: 1 !important;
}

/* Keep zero-block content from causing horizontal bleed */
.t396__artboard {
  max-width: 100vw;
}

/* Menu panel (EN/RU): smooth open/close */
.menu__close {
  cursor: pointer !important;
}

.menu__open {
  cursor: pointer !important;
}

.r.t-rec:has(.menu__close) {
  transition: opacity 0.2s ease, transform 0.35s ease !important;
}

/* Game page: center board cleanly */
body:has(#game-board) {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-direction: column !important;
  margin: 0 !important;
  min-height: 100vh;
  width: 100% !important;
  box-sizing: border-box;
  background-color: #8bc400;
  background-image:
    linear-gradient(rgba(39, 54, 13, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(39, 54, 13, 0.08) 1px, transparent 1px);
  background-size: 8px 8px;
}

body:has(#game-board) .scores {
  position: absolute;
  top: 24px;
  right: 24px;
}

body:has(#game-board) #logo {
  position: relative !important;
  width: min(300px, 70vw) !important;
  margin: 0 auto 12px !important;
}

body:has(#game-board) #instruction-text {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: max-content;
  max-width: 90vw;
  pointer-events: none;
}

body:has(#game-board) .button {
  position: fixed !important;
  left: 20px !important;
  top: 20px !important;
  margin: 0 !important;
  z-index: 20;
}

/* Hide Tilda "Made on Tilda" footer (backup if HTML reappears) */
#tildacopy,
.t-tildalabel,
.t-tildalabel__link,
.t-tildalabel__wrapper {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

/* Designer / social: keep hands, show only X (Twitter) */
.t396__elem:has(a[data-social="x-hide"]) {
  display: none !important;
  pointer-events: none !important;
}

a[data-social="x"] {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

a[data-social="x"] img {
  width: 40px !important;
  height: 40px !important;
  object-fit: contain;
  image-rendering: auto;
  filter: none;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

a[data-social="x"]:hover img {
  transform: scale(1.08);
  opacity: 0.85;
}

/* Back to top — bottom right */
#back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100001;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #27360d;
  background: #8bc400;
  color: #27360d;
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease, background 0.15s ease, color 0.15s ease;
}

#back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#back-to-top:hover {
  background: #27360d;
  color: #8bc400;
}

@media (max-width: 640px) {
  #back-to-top {
    right: 14px;
    bottom: 14px;
    width: 44px;
    height: 44px;
    font-size: 14px;
  }
}
