.btn {
  border: 1px solid var(--stroke2);
  color: var(--text);
  background: rgba(0, 0, 0, 0.12);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
  -webkit-user-select: none;
  user-select: none;
}

.stats .btn {
  grid-area: btn;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.10);
}

.btn:active {
  transform: translateY(0px);
}

.btn.primary {
  border-color: rgba(124, 58, 237, 0.55);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.95), rgba(59, 130, 246, 0.92));
}

.iconBtn {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 14px;
  line-height: 0;
}

.iconBtnSvg {
  width: 28px;
  height: 28px;
  display: block;
  overflow: visible;
  transform: translateY(0.5px);
  transform-origin: 50% 50%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.95;
}

.gameMenuBackdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding:
    calc(var(--appPad) + env(safe-area-inset-top))
    calc(var(--appPad) + env(safe-area-inset-right))
    calc(var(--appPad) + env(safe-area-inset-bottom))
    calc(var(--appPad) + env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
}

.gameMenuBackdrop.hidden {
  display: none;
}

.gameMenuCard {
  width: min(480px, 90vw);
  min-height: 440px;
  padding: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  will-change: transform, opacity;
}

.wood-panel {
  background: linear-gradient(135deg, rgba(196,162,101,0.95), rgba(139,105,20,0.95));
  border: 3px solid #8B6914;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
}

.game-btn-primary {
  background: linear-gradient(to bottom, #6BBF59, #4A8B3C) !important;
  border-color: #2D5A27 !important;
  color: #F5F0E0 !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.game-btn-primary:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.4), 0 0 20px rgba(107,191,89,0.4) !important;
}

.gameMenuBackdrop:not(.hidden) .gameMenuCard {
  animation: scaleIn 0.3s ease-out both;
}

.gameMenuHeader {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 16px 14px 14px;
  background: transparent;
  color: #F5F0E0;
  direction: ltr;
  border-bottom: 2px solid rgba(139, 105, 20, 0.4);
}

.gameMenuHeaderTitle {
  grid-column: 2;
  justify-self: center;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #F5F0E0;
  text-shadow:
    0 2px 8px rgba(0,0,0,0.5),
    0 0 30px rgba(240,192,64,0.4);
}

.gameMenuCloseBtn {
  grid-column: 3;
  justify-self: end;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 2px solid rgba(139, 105, 20, 0.5);
  background: rgba(0, 0, 0, 0.2);
  color: #F5F0E0;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

.gameMenuCloseBtn:hover {
  background: rgba(0, 0, 0, 0.35);
  transform: scale(1.1);
}

.gameMenuCloseSvg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.gameMenuBody {
  padding: 14px 16px;
  min-height: 200px;
  display: grid;
  gap: 10px;
  background: transparent;
}

.gameMenuBodyButtons {
  display: grid;
  gap: 10px;
}

.gameMenuBodyButtons.hidden {
  display: none;
}

.gameMenuBodyBtn {
  width: 100%;
  font-weight: 800;
  font-size: 16px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px solid #8B6914;
  background: linear-gradient(to bottom, #D4A843, #B8932F);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
  color: #2C1810;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-start;
  direction: ltr;
  text-shadow: 0 1px 0 rgba(255,255,255,0.2);
}

.gameMenuBodyBtn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 55%);
  opacity: 0.85;
  pointer-events: none;
}

.gameMenuBodyBtn:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4), 0 0 20px rgba(144,238,144,0.3);
}

.gameMenuBodyBtn:active {
  transform: scale(0.97);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.3);
}

.gameMenuBodyBtn > span {
  flex: 1;
  text-align: center;
}

.gameMenuBodyBtnSvg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
  flex-shrink: 0;
}

.gameMenuBodyButtons .gameMenuReplayBtn {
  font-size: 18px;
  width: 100%;
  justify-content: flex-start;
  direction: ltr;
}

.gameMenuBodyButtons .gameMenuReplayBtn .skinPreview {
  flex: 0 0 auto;
}

.gameMenuBodyButtons .gameMenuReplayBtn .skinLabel {
  flex: 1;
  text-align: center;
}

.gameMenuFooter {
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: flex-start;
  direction: ltr;
  border-top: 1px solid rgba(139, 105, 20, 0.3);
  position: relative;
}

.gameMenuVersion {
  position: absolute;
  right: 14px;
  bottom: 10px;
  left: auto;
  top: auto;
  transform: none;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.62);
  opacity: 0.9;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

.gameMenuLangSelect {
  background: rgba(0,0,0,0.25);
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

.gameMenuReplayBtn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 2px solid #8B6914;
  background: linear-gradient(to bottom, #D4A843, #B8932F);
  color: #2C1810;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 120ms ease, box-shadow 120ms ease;
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 0 rgba(255,255,255,0.2);
}

.gameMenuReplayBtn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 55%);
  opacity: 0.85;
  pointer-events: none;
}

.gameMenuReplayBtn:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4), 0 0 20px rgba(144,238,144,0.3);
}

.gameMenuReplayBtn:active {
  transform: scale(0.97);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.3);
}

.gameMenuReplaySvg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.8;
}

.skinPreview {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.10);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 10px 16px rgba(0, 0, 0, 0.25);
    transform: translateX(15px);
}

.skinPreview > span {
  display: block;
}

.skinPreview .a {
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
}

.skinPreview .b {
  background: linear-gradient(180deg, #a855f7, #6d28d9);
}

.skinLabel {
  flex: 1;
  text-align: center;
}

.skinArrow {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.8;

}

.gameMenuMiniLinks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 6px;
}

.gameMenuMiniBtn {
  border-radius: 14px;
  border: 2px solid rgba(220, 60, 60, 0.80);
  background: linear-gradient(to bottom, #d94040, #b52222);
  color: #fff;
  padding: 14px 18px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 120ms ease, box-shadow 120ms ease;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.gameMenuMiniBtn:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4), 0 0 20px rgba(255,100,100,0.3);
}

.gameMenuMiniBtn:active {
  transform: scale(0.97);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.3);
}

.gameMenuMiniBtnSvg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.8;

}

.skinPanel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  -webkit-backdrop-filter: blur(10px) saturate(1.08);
  backdrop-filter: blur(10px) saturate(1.08);
  box-shadow:
    0 24px 52px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  min-height: 200px;
}

.skinPanel.hidden {
  display: none;
}

.skinPanelHeader {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.skinPanelTitle {
  justify-self: center;
  font-weight: 900;
  letter-spacing: 0.6px;
  color: rgba(255, 255, 255, 0.92);
}

.skinBackBtn {
  justify-self: start;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.16);
  color: rgba(255, 255, 255, 0.88);
  padding: 10px 12px;
  font-weight: 850;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 12px 24px rgba(0, 0, 0, 0.22);
}

.skinBackSvg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}

.skinGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 420px) {
  .skinGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.skinCard {
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 14px 26px rgba(0, 0, 0, 0.28);
  transition: transform 120ms ease, filter 120ms ease;
  position: relative;
  min-height: 70px;
}

.skinCard::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 60%);
  opacity: 0.85;
  pointer-events: none;
}

.skinCard:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.skinCard:active {
  transform: translateY(0px) scale(0.99);
}

.skinSwatch {
  height: 100%;
  width: 100%;
}

.skinCardInner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: end start;
  padding: 10px;
}

.skinName {
  font-weight: 900;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.skinCard.isActive {
  outline: 2px solid rgba(250, 204, 21, 0.9);
  outline-offset: 2px;
}

.gameMenuBackdrop:not(.hidden) .gameMenuBodyButtons > * {
  animation: menuItemIn 220ms ease-out both;
}

.gameMenuBackdrop:not(.hidden) .gameMenuBodyButtons > *:nth-child(1) { animation-delay: 40ms; }
.gameMenuBackdrop:not(.hidden) .gameMenuBodyButtons > *:nth-child(2) { animation-delay: 80ms; }
.gameMenuBackdrop:not(.hidden) .gameMenuBodyButtons > *:nth-child(3) { animation-delay: 120ms; }
.gameMenuBackdrop:not(.hidden) .gameMenuBodyButtons > *:nth-child(4) { animation-delay: 160ms; }
.gameMenuBackdrop:not(.hidden) .gameMenuBodyButtons > *:nth-child(5) { animation-delay: 200ms; }

@keyframes menuPop {
  0% { opacity: 0; transform: translateY(10px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes menuItemIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.15); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.animate-fade-in {
  animation: fadeIn 0.3s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease-out;
}

.animate-bounce-in {
  animation: bounceIn 0.4s ease-out;
}
