:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(120deg, #063622, #0b5e3a);
  color: #1f2937;
}

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  background: linear-gradient(120deg, #063622, #0b5e3a);
}

.game-wrapper {
  width: 100%;
  max-width: 900px;
  min-height: 100svh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.game-card {
  border-radius: 1.5rem;
  /* padding: 1rem; */
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.game-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: fit-content;
padding: 10px;
border-bottom: 4px solid #7c5009;
}

.title-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.header-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.header-row-bottom {
  /* Level + Restart на другой строке на мобилке */
  display: none; /* Скрыто на десктопе */
}

.title-section {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.header-row-top .currency-display {
  flex-shrink: 0;
}

/* На десктопе показываем Level и Restart в первой строке */
.header-controls-desktop {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-row-top .currency-mobile-only {
  display: none !important; /* Скрыто на десктопе */
}

.level-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.level-label {
  color: #ffffff;
}

.level-value {
  color: #ffffff;
  font-size: 1.1rem;
}

.title-group h1 {
  font-size: 1.5rem;
  margin: 0;
  color: #ffffff;
}

.btn-download {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.5rem;
  padding: 0.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: all 0.2s ease;
}

.btn-download:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

.btn-download svg {
  width: 20px;
  height: 20px;
}

.title-group p {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  color: #acafb7;
}

.currency-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 999px;
  font-size: 1.1rem;
  font-weight: bold;
  color: #ffffff;
  white-space: nowrap;
}

.currency-icon {
  width: 1.3rem;
  height: 1.3rem;
  object-fit: contain;
  display: block;
}

.stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.stat-pill {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.stat-label {
  color: #ffffff;
}

.controls {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.level-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.level-label {
  color: #ffffff;
  font-size: 1.2rem;
}

.level-value {
  color: #ffffff;
  font-size: 1.2rem;
}

button {
  font: inherit;
}

select.btn {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231f2937' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2.5rem;
}

.btn {
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 2px solid;
  border-image: linear-gradient(135deg, #8b6f47 0%, #a0826d 50%, #8b6f47 100%) 1;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #1f2937;
  cursor: pointer;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
  font-weight: 500;
}

.btn:hover {
  /* background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
  box-shadow: 0 4px 12px rgba(139, 111, 71, 0.4); */
  transform: translateY(-1px);
}

.btn-restart {
  background: transparent;
  border: 1.5px solid;
  border-radius: 20px;
  color: #ffffff;
  font-weight: 600;
  margin-left: auto;
  gap: 0px;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
}

.btn-restart:hover {
  background: transparent;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  border-style: solid;
  border-image: linear-gradient(135deg, #8b6f47 0%, #a0826d 50%, #8b6f47 100%) 1;
  opacity: 0.9;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.95);
  opacity: 1;
  box-shadow: 0 4px 12px rgba(139, 111, 71, 0.3);
}

.btn-booster {
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: transparent;
  border: none;
  align-items: center;
}

@media (max-width: 768px) {
  .btn-booster {
    padding: 0.2rem 0.5rem;
    gap: 0.25rem;
  }
}

.btn-booster:hover {
  background: none;
  /* transform: translateY(-2px); */
}

.booster-icon-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(47, 23, 0, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  border: 3px solid #7c5009;
}

.btn-booster:hover .booster-icon-circle {
  transform: scale(1.1);
}

.booster-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: rgba(47, 23, 0, 1);
  color: #ffffff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: bold;
  border: 2px solid #7c5009;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  line-height: 1;
  padding: 0;
  margin: 0;
  line-height: 18px;
}

.booster-plus {
  position: absolute;
  top: -8px;
  right: -8px;
  background: rgba(47, 23, 0, 1);
  color: #ffffff;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  border: 2px solid #7c5009;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  line-height: 1;
  padding: 0;
  margin: 0;
  line-height: 18px;
}

.booster-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: #ffffff;
  font-weight: 500;
}

.booster-lock {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.8rem;
  z-index: 10;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)) brightness(1.3) contrast(1.2);
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.8), 0 2px 4px rgba(0, 0, 0, 0.8);
}

.btn-booster.locked {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: auto;
}

.btn-booster.locked:hover {
  transform: none;
}

.btn-booster.locked .booster-icon-circle {
  filter: grayscale(0.5) brightness(0.7);
}

.btn-booster.locked .booster-icon-circle .booster-lock {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)) brightness(1.5) contrast(1.3) !important;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 1), 0 2px 6px rgba(0, 0, 0, 0.9);
}

.btn-booster.locked .booster-icon-circle img,
.btn-booster.locked .booster-icon-circle span:not(.booster-lock) {
  opacity: 0.5;
}

/* Tooltip for locked boosters */
.btn-booster.locked {
  position: relative;
  isolation: isolate;
}

.btn-booster.locked::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 0.5rem 0.75rem;
  background: #000000;
  color: #ffffff;
  font-size: 0.85rem;
  white-space: nowrap;
  border-radius: 0.5rem;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
  will-change: opacity, visibility;
  isolation: isolate;
}

.btn-booster.locked::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 2px;
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.95);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 10001;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  filter: none;
}

.btn-booster.locked:hover::after,
.btn-booster.locked:hover::before {
  opacity: 1;
  visibility: visible;
}

.board {
  display: flex;
  flex-direction: column;
  padding: 0px 12px;
  border-radius: 8px;
  border: 0px solid transparent;
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: auto;
  position: relative;
  /* Ensure scrolling works properly */
  -webkit-overflow-scrolling: touch;
}

.board-stats {
  display: flex;
  gap: 0.75rem;
  font-size: 0.95rem;
  padding: 0.25rem 12px;
  justify-content: center;
  flex-wrap: wrap;
  flex-shrink: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
}

.tiles-container {
  flex: 1 1 0;
  min-height: 0;
  position: relative;
  padding: 0.7rem;
  overflow: visible;
  z-index: 1;
  min-width: 100%;
  /* Width will be set via JavaScript based on tile positions to enable horizontal scrolling */
  box-sizing: border-box;
}

.tile {
  position: relative;
  aspect-ratio: 3 / 4;
  /* Border-radius always stays 0.6rem */
  border-radius: 0.6rem;
  /* No borders - using box-shadow for 3D edges that don't affect content size */
  border: none;
  /* 3D effect: light top-left, dark bottom-right */
  background: linear-gradient(145deg, #ffffff 0%, #f9fafb 30%, #e5e7eb 70%, #d1d5db 100%);
  /* 3D shadow effect: highlight on top-left, shadow on bottom-right */
  /* Using box-shadow for edges that don't affect content size */
  /* Multiple shadows create depth: light from top-left, dark on bottom-right */
  box-shadow:
    /* Light highlight on top-left corner */
    inset -2px -2px 3px rgba(255, 255, 255, 0.9),
    /* Dark shadow on bottom-right corner */
    inset 3px 3px 6px rgba(0, 0, 0, 0.5),
    /* Subtle outer shadows for depth */
    0 1px 1px rgba(0, 0, 0, 0.2),
    0 2px 2px rgba(0, 0, 0, 0.3),
    0 4px 8px rgba(0, 0, 0, 0.4),
    /* Light edge on top-left for 3D effect */
    -1px -1px 0 0 rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0px;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    filter 0.15s ease,
    background 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  overflow: hidden;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.tile.blocked {
  cursor: not-allowed;
  filter: brightness(0.7);
  box-shadow: none;
  z-index: 0;
}

.tile-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0.5rem;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.tile:hover {
  transform: translateY(-2px);
  box-shadow:
    inset -2px -2px 3px rgba(255, 255, 255, 1),
    inset 3px 3px 6px rgba(0, 0, 0, 0.6),
    0 1px 0 #f9fafb,
    0 6px 0 #6b7280,
    0 14px 28px rgba(15, 23, 42, 0.8);
}

.tile.selected {
  box-shadow:
    inset -2px -2px 3px rgba(255, 255, 255, 1),
    inset 3px 3px 6px rgba(0, 0, 0, 0.6),
    0 0 0 2px rgba(37, 99, 235, 0.9),
    0 4px 0 #6b7280,
    0 12px 24px rgba(37, 99, 235, 0.8);
  transform: translateY(-3px);
}

.tile.hint {
  animation: goldLightning 0.6s ease-in-out;
  box-shadow:
    inset -2px -2px 3px rgba(255, 255, 255, 0.8),
    inset 3px 3px 6px rgba(0, 0, 0, 0.3),
    0 0 0 3px rgba(251, 191, 36, 0.8),
    0 0 20px rgba(251, 191, 36, 0.6),
    0 0 40px rgba(251, 191, 36, 0.4),
    0 4px 0 #6b7280,
    0 12px 24px rgba(251, 191, 36, 0.5);
  transform: translateY(-3px);
}

@keyframes goldLightning {
  0% {
    box-shadow:
      inset -2px -2px 3px rgba(255, 255, 255, 0.8),
      inset 3px 3px 6px rgba(0, 0, 0, 0.3),
      0 0 0 3px rgba(251, 191, 36, 0.8),
      0 0 20px rgba(251, 191, 36, 0.6),
      0 0 40px rgba(251, 191, 36, 0.4),
      0 4px 0 #6b7280,
      0 12px 24px rgba(251, 191, 36, 0.5);
    filter: brightness(1);
  }
  25% {
    box-shadow:
      inset -2px -2px 3px rgba(255, 255, 255, 1),
      inset 3px 3px 6px rgba(0, 0, 0, 0.35),
      0 0 0 5px rgba(251, 191, 36, 1),
      0 0 30px rgba(251, 191, 36, 0.9),
      0 0 60px rgba(251, 191, 36, 0.7),
      0 0 90px rgba(251, 191, 36, 0.3),
      0 4px 0 #6b7280,
      0 12px 24px rgba(251, 191, 36, 0.8);
    filter: brightness(1.3);
  }
  50% {
    box-shadow:
      inset -2px -2px 3px rgba(255, 255, 255, 0.8),
      inset 3px 3px 6px rgba(0, 0, 0, 0.3),
      0 0 0 3px rgba(251, 191, 36, 0.8),
      0 0 20px rgba(251, 191, 36, 0.6),
      0 0 40px rgba(251, 191, 36, 0.4),
      0 4px 0 #6b7280,
      0 12px 24px rgba(251, 191, 36, 0.5);
    filter: brightness(1);
  }
  75% {
    box-shadow:
      inset -2px -2px 3px rgba(255, 255, 255, 1),
      inset 3px 3px 6px rgba(0, 0, 0, 0.35),
      0 0 0 5px rgba(251, 191, 36, 1),
      0 0 30px rgba(251, 191, 36, 0.9),
      0 0 60px rgba(251, 191, 36, 0.7),
      0 0 90px rgba(251, 191, 36, 0.3),
      0 4px 0 #6b7280,
      0 12px 24px rgba(251, 191, 36, 0.8);
    filter: brightness(1.3);
  }
  100% {
    box-shadow:
      inset -2px -2px 3px rgba(255, 255, 255, 0.8),
      inset 3px 3px 6px rgba(0, 0, 0, 0.3),
      0 0 0 3px rgba(251, 191, 36, 0.8),
      0 0 20px rgba(251, 191, 36, 0.6),
      0 0 40px rgba(251, 191, 36, 0.4),
      0 4px 0 #6b7280,
      0 12px 24px rgba(251, 191, 36, 0.5);
    filter: brightness(1);
  }
}

.tile.matched {
  background: linear-gradient(145deg, #bbf7d0, #a7f3d0);
  border-color: #22c55e;
  filter: grayscale(0.1) saturate(1.1);
  transform: translateY(3px) scale(0.96);
  opacity: 0.2;
  cursor: default;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

.tile.matched span {
  opacity: 0;
}

.tile.disabled {
  pointer-events: none;
}

.matching-area {
  padding: 0.25rem;
  flex-shrink: 0;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.boosters-container {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.5rem 0 0.5rem;
  flex-shrink: 0;
  z-index: 10;
  isolation: isolate;
}

@media (max-width: 768px) {
  .boosters-container {
    padding: 0.5rem 0 0rem;
  }
}

.matching-area-label {
  font-size: 0.85rem;
  color: #ffffff;
  margin-bottom: 0.75rem;
  text-align: center;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.matching-slots {
  display: flex;
  gap: 0;
  justify-content: center;
  align-items: center;
  border: 4px solid #7c5009;
  border-radius: 10px;
  background: rgba(47, 23, 0, 1);
  width: fit-content;
  margin: 0 auto;
}

.matching-slot {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
  padding: 0;
  margin: 0;
}

.matching-slot:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 10%;
  bottom: 10%;
  width: 1px;
  background: rgba(124, 80, 9, 0.3);
  z-index: 1;
}

.matching-slot.filled {
  border: none;
  background: transparent;
  box-shadow: none;
  /* Removed tileAppear animation to prevent flicker when tile lands */
  opacity: 1;
}

@keyframes tileAppear {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes tileMatch {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.3);
    opacity: 0.9;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

.matching-slot.matching {
  animation: tileMatch 0.32s ease-out forwards;
  z-index: 10;
}

/* Animation for tiles matching on the board (wand booster) */
.tile.matching {
  animation: tileMatch 0.6s ease-out forwards;
  z-index: 10;
  pointer-events: none;
}

.matching-slot {
  transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}

.matching-slot .tile-content {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.5rem;
}

.message {
  margin-top: 0.5rem;
  font-size: 0.95rem;
  min-height: 1.2em;
  color: #1f2937;
  flex-shrink: 0;
  max-height: 2em;
  overflow: hidden;
  display: none;
}

.message span {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid rgba(22, 163, 74, 0.4);
}

.message.error span {
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.4);
}

.flying-tile {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  aspect-ratio: 3 / 4;
  border-radius: 0.6rem;
  border: 1px solid #d1d5db;
  background: linear-gradient(145deg, #f9fafb, #e5e7eb);
  box-shadow:
    0 1px 0 #f9fafb,
    0 4px 0 #9ca3af,
    0 8px 16px rgba(15, 23, 42, 0.5),
    0 0 0 2px rgba(37, 99, 235, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  will-change: transform, opacity;
}

.flying-tile img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0.5rem;
}

/* Win Popup */
.win-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.win-popup-content {
  background: linear-gradient(to bottom right, #fffaf5, #faf2e7, #f6f0e5, #f6e9cb, #fffae9);
  border-radius: 1.5rem;
  padding: 1.5rem 1.5rem 1.5rem 1.5rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  border: 8px solid;
  max-width: 350px;
  width: 90%;
  text-align: center;
  animation: popupAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-color: #ffffff;
}

@keyframes popupAppear {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.win-popup-header {
  background: rgba(47, 23, 0, 1);
  padding: 1.5rem;
  border-radius: 1rem 1rem 0 0;
  margin: -2rem -2rem 0rem -2rem;
}

.win-popup-header h2 {
  margin: 0 0 0rem 0;
  font-size: 2rem;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.win-popup-subtitle {
  margin: 1.2rem 0 0rem 0;
  font-size: 1.2rem;
  color: #000000;
  font-weight: 500;
}

.win-popup-stats {
  display: flex;
  flex-direction: column;
  gap: 0rem;
  max-width: 200px;
  margin: 0 auto;
  margin-top: 1.2rem;
}

.win-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.win-popup-reward {
  margin: 1.5rem 0 1.5rem 0;
}

/* Progress Bar Styles */
.win-progress-container {
  margin: 1.5rem 0;
  padding: 0 0.5rem;
}

.win-progress-label {
  font-size: 0.9rem;
  color: #4b5563;
  margin-bottom: 0.5rem;
  text-align: center;
  font-weight: 500;
}

.win-progress-wrapper {
  position: relative;
  width: 100%;
}

.win-progress-bar {
  width: 100%;
  height: 1.5rem;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0.75rem;
  overflow: visible;
  position: relative;
  border: 2px solid rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 300px;
  margin: 0 auto;
}

.win-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(to right, #08a942, #066127);
  border-radius: 0.75rem;
  transition: width 0.3s ease;
  width: 0%;
  z-index: 1;
}

.win-progress-text {
  position: relative;
  z-index: 2;
  font-size: 0.9rem;
  color: #1f2937;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.win-progress-gift-icon {
  position: absolute;
  right: -1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 4rem;
  height: 4rem;
  object-fit: contain;
  z-index: 3;
}

.win-reward-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
}

.win-reward-icon {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
}

.win-reward-label {
  color: #4b5563;
  font-size: 0.9rem;
  font-weight: 500;
  margin-left: 0.25rem;
}

.win-reward-value {
  color: #1f2937;
  font-size: 2rem;
  font-weight: bold;
}

.win-stat-label {
  color: #4b5563;
  font-size: 0.95rem;
}

.win-stat-value {
  color: #1f2937;
  font-size: 1.2rem;
  font-weight: bold;
}

.win-popup-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

/* Buy popups - buttons in column */
#buy-hints-popup .win-popup-actions,
#buy-undo-popup .win-popup-actions,
#buy-clean-popup .win-popup-actions,
#buy-match-popup .win-popup-actions,
#buy-shuffle-popup .win-popup-actions {
  flex-direction: column;
  align-items: center;
}

/* Cancel buttons in buy popups - same style as share popup close button */
#cancel-buy-hints-btn,
#cancel-buy-undo-btn,
#cancel-buy-clean-btn,
#cancel-buy-match-btn,
#cancel-buy-shuffle-btn {
  padding: 0.75rem 1.5rem;
  font-size: 1.2rem;
  background: transparent;
  border: 2px solid #7c5009;
  color: rgba(47, 23, 0, 1);
  font-weight: 500;
}

#cancel-buy-hints-btn:hover,
#cancel-buy-undo-btn:hover,
#cancel-buy-clean-btn:hover,
#cancel-buy-match-btn:hover,
#cancel-buy-shuffle-btn:hover {
  background: #a0826d;
  border-color: #8b6f47;
  transform: translateY(-1px);
}

/* Red color for insufficient funds */
#buy-hints-btn span.insufficient-funds,
#buy-undo-btn span.insufficient-funds,
#buy-clean-btn span.insufficient-funds,
#buy-match-btn span.insufficient-funds,
#buy-shuffle-btn span.insufficient-funds {
  color: #dc2626;
}

.win-popup-level-input {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.win-popup-level-input label {
  color: #4b5563;
  font-size: 0.9rem;
}

.win-popup-actions .btn {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  background: linear-gradient(to bottom right, #08a942, #066127);
  border: 0px solid;
  /* border-image: linear-gradient(135deg, #8b6f47 0%, #a0826d 50%, #8b6f47 100%) 1; */
  color: #ffffff;
  font-weight: 600;
}

#next-level-btn {
  padding: 1.1rem 3rem;
  font-size: 1.2rem;
}

.win-popup-actions .btn:hover {
  background: linear-gradient(135deg, #277343 0%, #038131 100%);
  /* box-shadow: 0 4px 12px rgba(139, 111, 71, 0.4); */
}

.game-over-popup .win-popup-header {
  background: rgba(47, 23, 0, 1);
}

.game-over-popup .win-popup-header h2 {
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.game-over-popup .win-popup-subtitle {
  color: #000000;
}

.game-over-popup .win-popup-actions {
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.game-over-popup .win-popup-actions .btn {
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
  background: linear-gradient(to bottom right, #08a942, #066127);
  border: 0px solid;
  color: #ffffff;
  font-weight: 600;
  gap: 0rem;
}

.game-over-popup .win-popup-actions .btn:hover {
  background: linear-gradient(135deg, #277343 0%, #038131 100%);
}

/* Share Popup Styles */
.share-popup-content {
  padding: 1rem 0 1.5rem;
}

#share-popup .win-popup-subtitle {
  margin: 1.2rem 0 1rem 0;
}

#close-share-popup-btn {
  padding: 0.75rem 1.5rem;
  font-size: 1.2rem;
  background: transparent;
  border: 2px solid #7c5009;
  color: rgba(47, 23, 0, 1);
  font-weight: 500;
}

#close-share-popup-btn:hover {
  background: #a0826d;
  border-color: #8b6f47;
  transform: translateY(-1px);
}

.share-link-container {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0rem;
}

.share-link-input {
  flex: 1;
  padding: 0.75rem;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  background: #ffffff;
  color: #1f2937;
}

.share-link-input:focus {
  outline: none;
  border-color: #08a942;
}

.btn-copy {
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  background: linear-gradient(to bottom right, #08a942, #066127);
  border: none;
  border-radius: 0.5rem;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-copy:hover {
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  box-shadow: 0 4px 12px rgba(139, 111, 71, 0.4);
}

.share-message {
  padding: 0.75rem;
  border-radius: 0.5rem;
  text-align: center;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.share-message.success {
  background: #ffffff;
  color: #00430e;
  border: 1px solid #0b4e19;
}

.share-message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

/* Mahjong Article Styles */
.mahjong-article {
  padding: 3rem 1rem;
  margin-top: 2rem;
}

.article-container {
  max-width: 900px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 1.5rem;
  padding: 2.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.article-container h2 {
  font-size: 2rem;
  color: #1f2937;
  margin: 0 0 1.5rem 0;
  text-align: center;
  border-bottom: 3px solid #08a942;
  padding-bottom: 1rem;
}

.article-container h3 {
  font-size: 1.5rem;
  color: #065f46;
  margin: 2rem 0 1rem 0;
  font-weight: 600;
}

.article-content {
  color: #374151;
  line-height: 1.8;
  font-size: 1rem;
}

.article-content p {
  margin: 1rem 0;
  text-align: justify;
}

.article-content ul {
  margin: 1rem 0;
  padding-left: 2rem;
}

.article-content li {
  margin: 0.75rem 0;
  line-height: 1.6;
}

@media (max-width: 768px) {
  .mahjong-article {
    padding: 2rem 0.5rem;
    margin-top: 1rem;
  }
  
  .article-container {
    padding: 1.5rem;
    border-radius: 1rem;
  }
  
  .article-container h2 {
    font-size: 1.5rem;
  }
  
  .article-container h3 {
    font-size: 1.25rem;
  }
  
  .article-content {
    font-size: 0.9rem;
  }
}

/* Footer Styles */
.site-footer {
  background: linear-gradient(120deg, #063622, #0b5e3a);
  padding: 2rem 1rem;
  margin-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
}

.footer-container {
  max-width: 900px;
  margin: 0 auto;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.footer-title h3 {
  margin: 0;
  font-size: 1.5rem;
  color: #ffffff;
  font-weight: 600;
}

.footer-menu {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link {
  color: #acafb7;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
  cursor: pointer;
}

.footer-link:hover {
  color: #ffffff;
}

@media (max-width: 768px) {
  .site-footer {
    padding: 1.5rem 0rem;
    margin-top: 1rem;
  }
  
  .footer-title h3 {
    font-size: 1.25rem;
  }
  
  .footer-menu {
    gap: 1.5rem;
    font-size: 0.9rem;
  }
}

/* Undo Tutorial Overlay */
.undo-tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.undo-tutorial-message {
  background: linear-gradient(to bottom right, #fffaf5, #faf2e7);
  padding: 2rem 3rem;
  border-radius: 1.5rem;
  border: 8px solid rgba(47, 23, 0, 1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 400px;
  z-index: 10003;
  position: relative;
  pointer-events: none;
}

.undo-tutorial-message p {
  margin: 0;
  font-size: 1.3rem;
  color: #1f2937;
  font-weight: 600;
  line-height: 1.5;
}

/* Highlight undo button during tutorial - keep it bright and visible */
.undo-tutorial-active .boosters-container {
  position: relative;
  z-index: 10005 !important;
  isolation: isolate;
}

.undo-tutorial-active .btn-booster#undo-btn {
  position: relative;
  z-index: 10006 !important;
  background: transparent !important;
  border: 4px solid rgba(251, 191, 36, 0.9) !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  filter: none !important;
  isolation: isolate;
  animation: undoPulse 1.5s ease-in-out infinite;
}

.undo-tutorial-active .btn-booster#undo-btn .booster-icon-circle {
  opacity: 1 !important;
  filter: none !important;
  background: rgba(47, 23, 0, 1) !important;
}

.undo-tutorial-active .btn-booster#undo-btn .booster-icon-circle img,
.undo-tutorial-active .btn-booster#undo-btn .booster-icon-circle span {
  opacity: 1 !important;
  filter: none !important;
}

.undo-tutorial-active .btn-booster#undo-btn .booster-label {
  opacity: 1 !important;
  filter: none !important;
  color: #ffffff !important;
}

/* Block all interactions except undo button during tutorial */
.undo-tutorial-active * {
  pointer-events: none !important;
}

/* Overlay should block clicks */
.undo-tutorial-active .undo-tutorial-overlay {
  pointer-events: auto !important;
}

/* Undo button should be clickable */
.undo-tutorial-active .btn-booster#undo-btn,
.undo-tutorial-active .btn-booster#undo-btn *,
.undo-tutorial-active .boosters-container {
  pointer-events: auto !important;
}

@keyframes undoPulse {
  0%, 100% {
    transform: scale(1.2);
    box-shadow: 
      0 0 30px rgba(251, 191, 36, 0.6),
      0 0 60px rgba(251, 191, 36, 0.4),
      0 0 90px rgba(251, 191, 36, 0.2),
      0 4px 12px rgba(0, 0, 0, 0.3);
  }
  50% {
    transform: scale(1.3);
    box-shadow: 
      0 0 40px rgba(251, 191, 36, 0.9),
      0 0 80px rgba(251, 191, 36, 0.7),
      0 0 120px rgba(251, 191, 36, 0.5),
      0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

/* General tutorial pulse animation for all tutorials */
@keyframes tutorialPulse {
  0%, 100% {
    transform: scale(1.2);
    box-shadow: 
      0 0 30px rgba(251, 191, 36, 0.6),
      0 0 60px rgba(251, 191, 36, 0.4),
      0 0 90px rgba(251, 191, 36, 0.2),
      0 4px 12px rgba(0, 0, 0, 0.3);
  }
  50% {
    transform: scale(1.3);
    box-shadow: 
      0 0 40px rgba(251, 191, 36, 0.9),
      0 0 80px rgba(251, 191, 36, 0.7),
      0 0 120px rgba(251, 191, 36, 0.5),
      0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

/* Hint Tutorial Overlay */
.hint-tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.hint-tutorial-message {
  background: linear-gradient(to bottom right, #fffaf5, #faf2e7);
  padding: 2rem 3rem;
  border-radius: 1.5rem;
  border: 8px solid rgba(47, 23, 0, 1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 400px;
  z-index: 10003;
  position: relative;
  pointer-events: none;
}

.hint-tutorial-message p {
  margin: 0;
  font-size: 1.3rem;
  color: #1f2937;
  font-weight: 600;
  line-height: 1.5;
}

/* Highlight hint button during tutorial - keep it bright and visible */
.hint-tutorial-active .boosters-container {
  position: relative;
  z-index: 10005 !important;
  isolation: isolate;
}

.hint-tutorial-active .btn-booster#hint-btn {
  position: relative;
  z-index: 10006 !important;
  background: transparent !important;
  border: 4px solid rgba(251, 191, 36, 0.9) !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  filter: none !important;
  isolation: isolate;
  animation: tutorialPulse 1.5s ease-in-out infinite;
}

.hint-tutorial-active .btn-booster#hint-btn .booster-icon-circle {
  opacity: 1 !important;
  filter: none !important;
  background: rgba(47, 23, 0, 1) !important;
}

.hint-tutorial-active .btn-booster#hint-btn .booster-icon-circle img,
.hint-tutorial-active .btn-booster#hint-btn .booster-icon-circle span {
  opacity: 1 !important;
  filter: none !important;
}

.hint-tutorial-active .btn-booster#hint-btn .booster-label {
  opacity: 1 !important;
  filter: none !important;
  color: #ffffff !important;
}

/* Block all interactions except hint button during tutorial */
.hint-tutorial-active * {
  pointer-events: none !important;
}

/* Overlay should block clicks */
.hint-tutorial-active .hint-tutorial-overlay {
  pointer-events: auto !important;
}

/* Hint button should be clickable */
.hint-tutorial-active .btn-booster#hint-btn,
.hint-tutorial-active .btn-booster#hint-btn *,
.hint-tutorial-active .boosters-container {
  pointer-events: auto !important;
}

/* Wand Tutorial Overlay */
.wand-tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.wand-tutorial-message {
  background: linear-gradient(to bottom right, #fffaf5, #faf2e7);
  padding: 2rem 3rem;
  border-radius: 1.5rem;
  border: 8px solid rgba(47, 23, 0, 1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 400px;
  z-index: 10003;
  position: relative;
  pointer-events: none;
}

.wand-tutorial-message p {
  margin: 0;
  font-size: 1.3rem;
  color: #1f2937;
  font-weight: 600;
  line-height: 1.5;
}

/* Highlight wand button during tutorial - keep it bright and visible */
.wand-tutorial-active .boosters-container {
  position: relative;
  z-index: 10005 !important;
  isolation: isolate;
}

.wand-tutorial-active .btn-booster#match-booster-btn {
  position: relative;
  z-index: 10006 !important;
  background: transparent !important;
  border: 4px solid rgba(251, 191, 36, 0.9) !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  filter: none !important;
  isolation: isolate;
  animation: tutorialPulse 1.5s ease-in-out infinite;
}

.wand-tutorial-active .btn-booster#match-booster-btn .booster-icon-circle {
  opacity: 1 !important;
  filter: none !important;
  background: rgba(47, 23, 0, 1) !important;
}

.wand-tutorial-active .btn-booster#match-booster-btn .booster-icon-circle img,
.wand-tutorial-active .btn-booster#match-booster-btn .booster-icon-circle span {
  opacity: 1 !important;
  filter: none !important;
}

.wand-tutorial-active .btn-booster#match-booster-btn .booster-label {
  opacity: 1 !important;
  filter: none !important;
  color: #ffffff !important;
}

/* Block all interactions except wand button during tutorial */
.wand-tutorial-active * {
  pointer-events: none !important;
}

/* Overlay should block clicks */
.wand-tutorial-active .wand-tutorial-overlay {
  pointer-events: auto !important;
}

/* Wand button should be clickable */
.wand-tutorial-active .btn-booster#match-booster-btn,
.wand-tutorial-active .btn-booster#match-booster-btn *,
.wand-tutorial-active .boosters-container {
  pointer-events: auto !important;
}

/* Shuffle Tutorial Overlay */
.shuffle-tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.shuffle-tutorial-message {
  background: linear-gradient(to bottom right, #fffaf5, #faf2e7);
  padding: 2rem 3rem;
  border-radius: 1.5rem;
  border: 8px solid rgba(47, 23, 0, 1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 400px;
  z-index: 10003;
  position: relative;
  pointer-events: none;
}

.shuffle-tutorial-message p {
  margin: 0;
  font-size: 1.3rem;
  color: #1f2937;
  font-weight: 600;
  line-height: 1.5;
}

/* Highlight shuffle button during tutorial - keep it bright and visible */
.shuffle-tutorial-active .boosters-container {
  position: relative;
  z-index: 10005 !important;
  isolation: isolate;
}

.shuffle-tutorial-active .btn-booster#shuffle-booster-btn {
  position: relative;
  z-index: 10006 !important;
  background: transparent !important;
  border: 4px solid rgba(251, 191, 36, 0.9) !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  filter: none !important;
  isolation: isolate;
  animation: tutorialPulse 1.5s ease-in-out infinite;
}

.shuffle-tutorial-active .btn-booster#shuffle-booster-btn .booster-icon-circle {
  opacity: 1 !important;
  filter: none !important;
  background: rgba(47, 23, 0, 1) !important;
}

.shuffle-tutorial-active .btn-booster#shuffle-booster-btn .booster-icon-circle img,
.shuffle-tutorial-active .btn-booster#shuffle-booster-btn .booster-icon-circle span {
  opacity: 1 !important;
  filter: none !important;
}

.shuffle-tutorial-active .btn-booster#shuffle-booster-btn .booster-label {
  opacity: 1 !important;
  filter: none !important;
  color: #ffffff !important;
}

/* Block all interactions except shuffle button during tutorial */
.shuffle-tutorial-active * {
  pointer-events: none !important;
}

/* Overlay should block clicks */
.shuffle-tutorial-active .shuffle-tutorial-overlay {
  pointer-events: auto !important;
}

/* Shuffle button should be clickable */
.shuffle-tutorial-active .btn-booster#shuffle-booster-btn,
.shuffle-tutorial-active .btn-booster#shuffle-booster-btn *,
.shuffle-tutorial-active .boosters-container {
  pointer-events: auto !important;
}

/* Share Tutorial Overlay */
.share-tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto; /* Block all clicks */
}

.share-tutorial-message {
  background: linear-gradient(to bottom right, #fffaf5, #faf2e7);
  padding: 2rem 3rem;
  border-radius: 1.5rem;
  border: 8px solid rgba(47, 23, 0, 1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  text-align: center;
  max-width: 400px;
  z-index: 10003;
  position: relative;
  pointer-events: none;
}

.share-tutorial-message p {
  margin: 0;
  font-size: 1.3rem;
  color: #1f2937;
  font-weight: 600;
  line-height: 1.5;
}

/* Highlight share button during tutorial - keep it bright and visible */
.share-tutorial-active .game-header {
  position: relative;
  z-index: 10005 !important;
  isolation: isolate;
}

.share-tutorial-active .btn-download {
  position: relative;
  z-index: 10006 !important;
  background: transparent !important;
  border: 4px solid rgba(251, 191, 36, 0.9) !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  filter: none !important;
  isolation: isolate;
  animation: tutorialPulse 1.5s ease-in-out infinite;
}

/* Block all interactions except share button during tutorial */
.share-tutorial-active * {
  pointer-events: none !important;
}

/* Overlay should block clicks */
.share-tutorial-active .share-tutorial-overlay {
  pointer-events: auto !important;
}

/* Share button should be clickable */
.share-tutorial-active .btn-download#download-btn,
.share-tutorial-active .btn-download#download-btn * {
  pointer-events: auto !important;
}

.shuffle-tutorial-active .btn-booster#shuffle-booster-btn,
.shuffle-tutorial-active .btn-booster#shuffle-booster-btn *,
.shuffle-tutorial-active .boosters-container {
  pointer-events: auto !important;
}

/* Start Screen */
.start-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-height: 0;
  padding: 2rem;
  text-align: center;
}

.start-screen-title {
  font-size: 3rem;
  color: #ffffff;
  margin: 0 0 2rem 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  font-weight: bold;
}

.start-btn {
  padding: 1rem 3rem;
  font-size: 1.5rem;
  background: linear-gradient(to bottom right, #08a942, #066127);
  border: 0px solid;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
}

.start-btn:hover {
  background: linear-gradient(135deg, #277343 0%, #038131 100%);
  /* box-shadow: 0 4px 12px rgba(139, 111, 71, 0.4); */
}

.start-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Scrollbar styling for board */
.board::-webkit-scrollbar {
  width: 2px;
  height: 2px;
}

.board::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 1px;
}

.board::-webkit-scrollbar-thumb {
  background: rgba(139, 111, 71, 0.6);
  border-radius: 1px;
}

.board::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 111, 71, 0.8);
}

/* Horizontal scrollbar styling */
.board::-webkit-scrollbar:horizontal {
  height: 2px;
}

@media (max-width: 768px) {
  .game-header {
    padding: 0rem 0.25rem 0.5rem 0.25rem;
  }
  .game-wrapper {
    padding: 0.5rem;
  }
  .game-card {
    padding: 0rem;
  }
  .board {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
  
  .title-group {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .header-row-top {
    /* Заголовок + деньги на одной строке */
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  .header-row-bottom {
    /* Level + Restart на другой строке */
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
  }
  
  .header-controls-desktop {
    display: none; /* Скрываем на мобилке */
  }
  
  .header-row-top .currency-mobile-only {
    display: flex !important; /* Показываем на мобилке */
  }
  
  .header-row-bottom {
    display: flex; /* Показываем на мобилке */
  }
  
  .win-popup-content {
    padding: 1.5rem;
  }
  
  .win-popup-header h2 {
    font-size: 1.5rem;
  }
}

.booster-actions {
  margin-top: 1.5rem;
}

#insufficient-funds-message {
  margin-bottom: 1.5rem;
}

/* Auth UI Styles */
.auth-form-container {
  padding: 1.5rem 0;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #1f2937;
  font-size: 0.95rem;
  font-weight: 500;
}

.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  font-size: 1rem;
  background: #ffffff;
  color: #1f2937;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: #08a942;
}

.form-input::placeholder {
  color: #9ca3af;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: center;
}

.form-actions .btn {
  flex: 1;
  padding: 0.75rem 1.5rem;
}

.form-links {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: #4b5563;
}

.form-links a {
  color: #08a942;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.form-links a:hover {
  color: #066127;
  text-decoration: underline;
}

.form-error {
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #ef4444;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.form-success {
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #10b981;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* User Info in Header */
.user-info-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#user-info {
  color: #ffffff;
  font-size: 0.9rem;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#login-btn,
#logout-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  cursor: pointer;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

#login-btn:hover,
#logout-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 768px) {
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions .btn {
    width: 100%;
  }
  
  #user-info {
    max-width: 100px;
    font-size: 0.8rem;
  }
}