html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(120deg, #595277 0%, #7169a6 100%);
  font-family: 'Segoe UI', Arial, sans-serif;
  position: relative;
}
#root {
  min-height: 100vh;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* --- Меню --- */
#game-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 320px;
  max-width: 96vw;
  min-height: 410px;
  padding: 36px 22px 32px 22px;
  border-radius: 28px;
  background: rgba(60, 52, 87, 0.85);
  box-shadow:
    0 8px 48px 0 #322d5a55,
    0 1.5px 10px 0 #fff1 inset;
  backdrop-filter: blur(6px);
  margin: 0 auto;
  animation: menuFadeIn 0.7s cubic-bezier(.36,1.17,.54,.99);
  position: fixed;
  z-index: 100;
  left: 0; top: 0;
  width: 100vw;
  height: 100vh;
}
@keyframes menuFadeIn {
  from { opacity: 0; transform: translateY(40px) scale(0.98);}
  to   { opacity: 1; transform: none;}
}
#game-menu h1 {
  color: #fff;
  font-family: 'JetBrains Mono', 'Fira Mono', 'Consolas', monospace;
  font-size: 2.4rem;
  margin-bottom: 36px;
  letter-spacing: 2.5px;
  text-shadow: 0 3px 24px #41278b55, 0 2px 8px #fff3;
  text-align: center;
  font-weight: 900;
  line-height: 1.12;
}
.menu-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
#game-menu button {
  width: 264px;
  max-width: 90vw;
  min-width: 140px;
  font-size: 1.12rem;
  padding: 16px 0;
  border-radius: 13px;
  border: none;
  outline: none;
  cursor: pointer;
  background: linear-gradient(92deg, #552fff 10%, #c24dd9 100%);
  color: #fff;
  box-shadow: 0 4px 24px #7134c366, 0 1.5px 12px #fff1 inset;
  font-family: monospace;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-align: center;
  margin: 0 auto;
  position: relative;
  transition:
    background 0.17s,
    transform 0.12s,
    box-shadow 0.18s;
  z-index: 1;
}
#game-menu button:hover, #game-menu button:focus {
  background: linear-gradient(95deg, #c24dd9 5%, #552fff 90%);
  transform: translateY(-2px) scale(1.055);
  box-shadow: 0 8px 32px #c24dd988, 0 3px 20px #fff1 inset;
}

/* --- Блок с игрой --- */
#game-wrapper {
  position: relative;
  z-index: 10;
  width: 95vw;
  max-width: 400px;
  aspect-ratio: 9/12;
  margin: 24px auto 0 auto;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 8px 32px #0003;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Статус змейки с иконкой */
.jelly-status {
  position: absolute;
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 12px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
}

/* Прогресс над jelly status */
.game-progress {
  position: absolute;
  top: calc(8% - 40px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 12px;
  border-radius: 15px;
  font-family: monospace;
  font-size: 12px;
  font-weight: bold;
  backdrop-filter: blur(4px);
}

.jelly-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.jelly-name {
  font-family: monospace;
  font-size: 14px;
  font-weight: bold;
  color: #333;
}

/* Подсказка для мобильного управления */
.mobile-controls-hint, .snake-controls-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 12px;
  text-align: center;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.hint-text {
  margin: 2px 0;
  font-family: monospace;
}

/* Управление змейки теперь через свайпы */

/* Чит-кнопка для победы */
.cheat-controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: none; /* Скрываем чит-кнопку */
  justify-content: center;
  z-index: 10;
}

.cheat-btn {
  width: 120px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(45deg, #ff6b6b, #ffa500);
  color: white;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  margin-top: 10px;
}

.cheat-btn:hover {
  background: linear-gradient(45deg, #ff5252, #ff8c00);
  transform: scale(1.05);
}

.cheat-btn:active {
  background: linear-gradient(45deg, #ff4444, #ff7f00);
  transform: scale(0.95);
}

/* --- Canvas прозрачный, лежит на белом фоне #game-wrapper --- */
#game-canvas {
  width: 100%;
  height: 100%;
  background: transparent;
  border-radius: inherit;
  display: block;
  object-fit: contain;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto;
}

/* --- GAME OVER кнопки --- */
.gameover-buttons {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
  z-index: 9999;
  width: 100%;
  max-width: 300px;
  pointer-events: auto;
  padding: 20px;
}

/* Скрытие Game Over элементов когда меню активно */
#game-menu[style*="display: flex"] ~ #game-wrapper .gameover-buttons,
#game-menu[style*="display: flex"] + #game-wrapper .gameover-buttons {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Отключение pointer-events на canvas когда показываются кнопки Game Over */
.gameover-buttons[style*="display: flex"] ~ #game-canvas,
.gameover-buttons[style*="display: flex"] + #game-canvas {
  pointer-events: none !important;
}

.gameover-buttons button {
  min-width: 164px;
  max-width: 270px;
  width: 82%;
  font-size: 1.14rem;
  padding: 16px 0;
  border: none;
  border-radius: 16px;
  font-family: monospace;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 32px #12f2e688, 0 2px 18px #7e3de6bb;
  transition: background 0.18s, transform 0.12s, box-shadow 0.15s;
  color: #fff;
  margin: 0 auto;
  pointer-events: auto;
  outline: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 10000;
}

#gameover-restart-btn {
  background: linear-gradient(92deg, #27ef7c 0%, #21cfd4 100%);
  box-shadow: 0 0 32px #31f8ab88, 0 2px 18px #22e0ed55;
}
#gameover-menu-btn {
  background: linear-gradient(92deg, #512da8 40%, #ab47bc 100%);
  box-shadow: 0 0 28px #9d50fa77, 0 2px 18px #e272ff55;
}
#gameover-restart-btn:hover {
  background: linear-gradient(92deg, #21cfd4 10%, #27ef7c 90%);
  transform: scale(1.045);
}
#gameover-menu-btn:hover {
  background: linear-gradient(92deg, #ab47bc 20%, #512da8 80%);
  transform: scale(1.045);
}

@media (max-width: 480px) {
  /* Основные контейнеры */
  #game-menu {
    max-width: 100vw;
    border-radius: 0;
    padding: 10px;
    margin: 0;
  }

  /* Игровой контейнер - сбалансированное позиционирование */
  #game-wrapper {
    width: 95vw;
    max-width: none;
    height: 88vh;
    aspect-ratio: auto;
    margin: 0 auto;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  #game-canvas {
    border-radius: 12px;
    touch-action: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* Кнопки меню */
  .gameover-buttons button, #game-menu button {
    width: 100%;
    min-width: auto;
    font-size: 0.9rem;
    padding: 12px 16px;
    margin: 4px 0;
  }

  .gameover-buttons {
    max-width: 90vw;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    z-index: 300;
    padding: 15px;
  }

  .gameover-buttons button {
    pointer-events: auto;
    z-index: 301;
    min-width: 200px;
    font-size: 1rem;
    padding: 14px 20px;
    border-radius: 12px;
    cursor: pointer;
    touch-action: manipulation;
    position: relative;
    z-index: 10000;
  }

  /* Модальное окно прогресса */
  .progress-modal {
    padding: 10px;
  }

  .progress-modal-content {
    max-width: 100%;
    max-height: 95vh;
    border-radius: 16px;
  }

  .progress-modal-header {
    padding: 20px 20px 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .progress-modal-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
  }

  .progress-close-btn {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  /* Виджет прогресса */
  .progress-widget {
    padding: 20px;
    margin: 0;
    border-radius: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  }

  .progress-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .progress-title {
    font-size: 1.1rem;
    font-weight: 600;
  }

  .progress-count {
    font-size: 1.1rem;
    font-weight: 700;
    color: #c24dd9;
  }

  /* Сетка достижений */
  .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 5px;
  }

  .achievement-item {
    padding: 15px 10px;
    border-radius: 15px;
    min-height: 90px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    position: relative;
  }

  .achievement-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  }

  .achievement-icon {
    font-size: 1rem;
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .achievement-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
  }

  .achievement-name {
    font-size: 0.75rem;
    line-height: 1.3;
    margin-bottom: 6px;
    word-break: break-word;
    hyphens: auto;
    -webkit-line-clamp: 2;
    min-height: 2.4em;
    font-weight: 500;
    text-align: center;
  }

  .achievement-status {
    font-size: 0.7rem;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  /* Регулятор звука */
  .sound-controls-top {
    position: fixed;
    top: 8px;
    right: 8px;
    left: auto;
    padding: 6px 8px;
    gap: 6px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.5) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  #sound-toggle-btn {
    font-size: 14px;
    padding: 2px;
    opacity: 0.8;
  }

  #sound-volume {
    width: 40px;
    height: 2px;
  }

  /* Прогресс бар */
  .progress-bar {
    height: 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
    margin-bottom: 20px;
  }

  /* Стили для кнопки Close в лидерборде */
  .leaderboard-content {
    padding: 20px;
    min-width: 300px;
  }

  .btn-secondary {
    margin-top: 15px;
    min-width: 100px;
    padding: 10px 20px;
  }

  .progress-fill {
    border-radius: 5px;
    background: linear-gradient(90deg, #552fff 0%, #c24dd9 100%);
    transition: width 0.5s ease;
  }

  /* Дополнительные улучшения для мобильных */
  .menu-buttons {
    gap: 8px;
    padding: 0 10px;
  }

  #game-menu h1 {
    font-size: 2rem;
    margin-bottom: 20px;
  }

  .user-profile {
    margin-bottom: 20px;
  }

  /* Подсказки управления */
  .mobile-controls-hint, .snake-controls-hint {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 10px;
    max-width: 90%;
    z-index: 50;
    pointer-events: none;
  }

  .hint-text {
    margin: 1px 0;
    font-size: 10px;
  }

  /* Улучшенная читаемость текста */
  .achievement-item {
    position: relative;
    overflow: hidden;
  }

  .achievement-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
  }
}

/* Стили для планшетов */
@media (min-width: 481px) and (max-width: 768px) {
  /* Игровой контейнер */
  #game-wrapper {
    width: 95vw;
    max-width: 600px;
    height: 80vh;
    aspect-ratio: auto;
    margin: 10px auto 0 auto;
    border-radius: 16px;
  }

  .progress-modal {
    padding: 15px;
  }

  .progress-modal-content {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 18px;
  }

  .progress-modal-header {
    padding: 20px 24px 16px 24px;
  }

  .progress-modal-header h2 {
    font-size: 1.5rem;
  }

  .progress-widget {
    padding: 20px;
    margin: 0;
    border-radius: 0;
  }

  .achievements-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 0 10px;
  }

  .achievement-item {
    padding: 16px 12px;
    min-height: 85px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    position: relative;
  }

  .achievement-icon img {
    width: 36px;
    height: 36px;
  }

  .achievement-name {
    font-size: 0.8rem;
    line-height: 1.3;
    -webkit-line-clamp: 2;
    min-height: 2.6em;
  }

  .progress-bar {
    height: 12px;
    border-radius: 6px;
    margin-bottom: 24px;
  }

  .sound-controls-top {
    top: 12px;
    right: 12px;
    padding: 8px 12px;
  }

  #sound-volume {
    width: 60px;
  }

  /* Подсказки управления */
  .mobile-controls-hint, .snake-controls-hint {
    bottom: 15px;
    font-size: 11px;
    padding: 10px 15px;
    pointer-events: none;
  }
  
  /* Управление змейки теперь через свайпы */
  
  .jelly-status {
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
  }

  .game-progress {
    top: calc(8% - 35px);
    padding: 4px 10px;
    font-size: 11px;
  }
  
  .jelly-icon {
    width: 20px;
    height: 20px;
  }
  
  .jelly-name {
    font-size: 12px;
  }

  /* Кнопки Game Over */
  .gameover-buttons button {
    min-width: 220px;
    font-size: 1.1rem;
    padding: 16px 24px;
    cursor: pointer;
    touch-action: manipulation;
    position: relative;
    z-index: 10000;
  }
}

/* Стили для больших экранов (iPhone XR, iPhone 11, etc.) */
@media (min-width: 400px) and (max-width: 500px) {
  /* Управление змейки теперь через свайпы */
  
  /* Улучшенное центрирование для iPhone 11 и подобных */
  #game-wrapper {
    width: 95vw;
    max-width: 400px;
    height: 80vh;
    margin: 10px auto 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  #game-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

/* Стили для средних экранов (iPhone SE, iPhone 8, etc.) */
@media (min-width: 361px) and (max-width: 399px) {
  /* Управление змейки теперь через свайпы */
  
  /* Улучшенное центрирование для средних экранов */
  #game-wrapper {
    width: 96vw;
    max-width: 380px;
    height: 82vh;
    margin: 8px auto 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  #game-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

/* Стили для очень маленьких экранов */
@media (max-width: 360px) {
  #game-wrapper {
    width: 100vw;
    height: 90vh;
    margin: 0;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #game-canvas {
    border-radius: 0;
    touch-action: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .gameover-buttons button {
    min-width: 180px;
    font-size: 0.9rem;
    padding: 12px 16px;
    cursor: pointer;
    touch-action: manipulation;
    position: relative;
    z-index: 10000;
  }

  .mobile-controls-hint, .snake-controls-hint {
    font-size: 9px;
    padding: 6px 10px;
    bottom: 5px;
    pointer-events: none;
  }

  .hint-text {
    font-size: 9px;
  }
  
  /* Управление змейки теперь через свайпы */

  /* Виджет прогресса для очень маленьких экранов */
  .progress-modal {
    padding: 5px;
  }

  .progress-modal-content {
    max-width: 100%;
    max-height: 98vh;
    border-radius: 12px;
  }

  .progress-modal-header {
    padding: 15px 15px 10px 15px;
  }

  .progress-modal-header h2 {
    font-size: 1.2rem;
  }

  .progress-close-btn {
    width: 28px;
    height: 28px;
    font-size: 1rem;
  }

  .progress-widget {
    padding: 15px;
    margin: 0;
    border-radius: 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  .progress-header {
    margin-bottom: 15px;
  }

  .progress-title {
    font-size: 1rem;
  }

  .progress-count {
    font-size: 1rem;
  }

  .achievements-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 0 2px;
  }

  .achievement-item {
    padding: 12px 8px;
    border-radius: 12px;
    min-height: 75px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    position: relative;
  }

  .achievement-icon img {
    width: 28px;
    height: 28px;
  }

  .achievement-name {
    font-size: 0.7rem;
    line-height: 1.2;
    -webkit-line-clamp: 2;
    min-height: 2.2em;
  }

  .progress-bar {
    height: 8px;
    border-radius: 4px;
    margin-bottom: 15px;
  }

  /* Стили для кнопки Close в лидерборде */
  .leaderboard-content {
    padding: 15px;
    min-width: 280px;
  }

  .btn-secondary {
    margin-top: 12px;
    min-width: 90px;
    padding: 8px 16px;
    font-size: 0.9rem;
  }

  .achievement-status {
    font-size: 0.65rem;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
}
/* --- Виджет прогресса --- */
.progress-widget {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  border-radius: 0;
  padding: 24px;
  margin: 0;
  backdrop-filter: blur(6px);
  border: none;
  width: 100%;
  box-sizing: border-box;
  box-shadow: none;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 5px;
}

.progress-title {
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-count {
  color: #c24dd9;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(194, 77, 217, 0.3);
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #552fff 0%, #c24dd9 100%);
  border-radius: 6px;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px rgba(194, 77, 217, 0.5);
}

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

.achievement-item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 100%);
  border-radius: 16px;
  padding: 20px 12px 16px 12px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.achievement-item:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.achievement-item.unlocked {
  background: linear-gradient(135deg, rgba(124, 64, 255, 0.3) 0%, rgba(194, 77, 217, 0.2) 100%);
  border-color: #7c40ff;
  box-shadow: 0 4px 16px rgba(124, 64, 255, 0.3);
}

.achievement-icon {
  font-size: 1.1rem;
  margin-bottom: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  width: 100%;
}

.achievement-icon img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.achievement-name {
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.3;
  margin-bottom: 8px;
  text-align: center;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  flex-grow: 1;
  min-height: 2.4em;
  font-weight: 500;
}

.achievement-status {
  font-size: 0.8rem;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.achievement-status.locked {
  color: rgba(255, 255, 255, 0.5);
}

.achievement-status.unlocked {
  color: #7c40ff;
}

/* --- Модальное окно прогресса --- */
.progress-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 15000;
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.progress-modal-content {
  background: linear-gradient(135deg, rgba(60, 52, 87, 0.95) 0%, rgba(85, 47, 255, 0.1) 100%);
  border-radius: 20px;
  padding: 0;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: 
    0 25px 80px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
}

.progress-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px 20px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.progress-modal-header h2 {
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.4rem;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.5px;
}

.progress-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.progress-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* --- Элементы управления звуком в правом верхнем углу --- */
.sound-controls-top {
  position: fixed;
  top: 15px;
  right: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.4) 100%);
  padding: 8px 12px;
  border-radius: 20px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  z-index: 100;
  transition: all 0.3s ease;
}

.sound-controls-top:hover {
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.5) 100%);
  transform: translateY(-1px);
  box-shadow: 
    0 6px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#sound-toggle-btn {
  font-size: 14px;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 2px;
  margin: 0;
  width: auto;
  min-width: auto;
  border-radius: 6px;
  transition: all 0.2s ease;
  opacity: 0.8;
}

#sound-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
  opacity: 1;
}

#sound-volume {
  width: 50px;
  accent-color: #7c40ff;
  margin: 0;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  cursor: pointer;
}



/* Стили для скроллбара */
.progress-widget::-webkit-scrollbar {
  width: 6px;
}

.progress-widget::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.progress-widget::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
}

.progress-widget::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Скрываем скроллбар для других элементов */
::-webkit-scrollbar { width: 0 !important; background: transparent; }

/* --- Стили авторизации --- */
#auth-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.auth-form {
  background: rgba(60, 52, 87, 0.95);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  min-width: 300px;
  max-width: 90vw;
}

.auth-form h2 {
  color: #fff;
  text-align: center;
  margin-bottom: 30px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.8rem;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  color: #fff;
  margin-bottom: 8px;
  font-family: monospace;
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-family: monospace;
  font-size: 1rem;
  box-sizing: border-box;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #552fff;
}

.form-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-family: monospace;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(92deg, #552fff 10%, #c24dd9 100%);
  color: #fff;
}

.btn-primary:hover {
  background: linear-gradient(95deg, #c24dd9 5%, #552fff 90%);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  margin-top: 20px;
  min-width: 120px;
}

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

.btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

#username-check-result {
  margin-top: 5px;
  font-size: 0.8rem;
  font-family: monospace;
}

#username-check-result.success {
  color: #4CAF50;
}

#username-check-result.error {
  color: #f44336;
}

/* --- Стили пользователя --- */
#user-info {
  margin-bottom: 20px;
  text-align: center;
}

.user-profile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  background: rgba(255, 255, 255, 0.1);
  padding: 10px 20px;
  border-radius: 15px;
  backdrop-filter: blur(5px);
}

.username {
  color: #fff;
  font-family: monospace;
  font-weight: 600;
  font-size: 1rem;
}

/* --- Стили лидерборда --- */
.leaderboard-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.leaderboard-content {
  background: rgba(60, 52, 87, 0.95);
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  min-width: 350px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.leaderboard-content h2 {
  color: #fff;
  text-align: center;
  margin-bottom: 20px;
  font-family: 'JetBrains Mono', monospace;
}

.leaderboard-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-family: monospace;
  transition: all 0.3s;
}

.tab-btn.active {
  background: linear-gradient(92deg, #552fff 10%, #c24dd9 100%);
  border-color: transparent;
}

.leaderboard-tab {
  display: none;
}

.leaderboard-tab.active {
  display: block;
}

.leaderboard-tab h3 {
  color: #fff;
  text-align: center;
  margin-bottom: 15px;
  font-family: monospace;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-entry {
  display: flex;
  align-items: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-family: monospace;
}

.rank {
  width: 30px;
  font-weight: bold;
  color: #ffd700;
}

.username {
  flex: 1;
  margin: 0 10px;
}

.score {
  font-weight: bold;
  color: #4CAF50;
}

/* Стили для виджета пасхалки */
#easter-egg-widget {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.easter-egg-header {
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  padding: 20px 40px;
  border-radius: 15px 15px 0 0;
  text-align: center;
  box-shadow: 0 4px 20px rgba(255, 107, 107, 0.3);
}

.achievement-title {
  font-size: 28px;
  font-weight: bold;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  letter-spacing: 2px;
}

.achievement-subtitle {
  font-size: 16px;
  color: #ffeaa7;
  font-weight: bold;
  margin-top: 5px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.easter-egg-content {
  background: white;
  border-radius: 0 0 15px 15px;
  padding: 20px;
  position: relative;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

#easter-egg-video {
  width: 320px;
  height: 240px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

#easter-egg-close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #ff6b6b;
  color: white;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

#easter-egg-close:hover {
  background: #ee5a24;
  transform: scale(1.1);
}

/* Стили для виджетов секретов в стиле WoW */
#kapitola-secret-widget,
#secret-found-widget,
#meta-secret-widget,
#snake-victory-widget {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wow-achievement-container {
  background: linear-gradient(135deg, #2c1810, #4a2c1a);
  border: 3px solid #d4af37;
  border-radius: 20px;
  padding: 30px;
  max-width: 90vw;
  max-height: 90vh;
  box-shadow: 
    0 0 30px rgba(212, 175, 55, 0.5),
    inset 0 0 20px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.wow-achievement-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 20%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(212, 175, 55, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.wow-achievement-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 25px;
  padding: 15px;
  background: linear-gradient(90deg, #d4af37, #f4d03f, #d4af37);
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.wow-achievement-icon {
  font-size: 48px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.wow-achievement-text {
  flex: 1;
}

.wow-achievement-title {
  font-size: 32px;
  font-weight: bold;
  color: #2c1810;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.3);
  letter-spacing: 2px;
  margin-bottom: 5px;
}

.wow-achievement-subtitle {
  font-size: 18px;
  color: #8b4513;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

.wow-video-container {
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  margin-bottom: 20px;
}

#kapitola-secret-video,
#secret-found-video,
#meta-secret-video,
#snake-victory-video {
  width: 100%;
  max-width: 600px;
  height: auto;
  display: block;
  border-radius: 15px;
}

.wow-achievement-btn {
  width: 100%;
  padding: 18px 30px;
  font-size: 20px;
  font-weight: bold;
  color: #2c1810;
  background: linear-gradient(135deg, #d4af37, #f4d03f, #d4af37);
  border: 2px solid #8b4513;
  border-radius: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 
    0 4px 15px rgba(212, 175, 55, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

.wow-achievement-btn:hover {
  background: linear-gradient(135deg, #f4d03f, #f7dc6f, #f4d03f);
  transform: translateY(-2px);
  box-shadow: 
    0 6px 20px rgba(212, 175, 55, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.wow-achievement-btn:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 10px rgba(212, 175, 55, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Анимация появления */
@keyframes wowAchievementAppear {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(50px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.wow-achievement-container {
  animation: wowAchievementAppear 0.6s ease-out;
}

.wow-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 15px 25px;
  font-size: 18px;
  font-weight: bold;
  color: white;
  background: linear-gradient(135deg, #d4af37, #f4d03f);
  border: 2px solid #8b4513;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.wow-play-btn:hover {
  background: linear-gradient(135deg, #f4d03f, #f7dc6f);
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

.wow-video-container {
  position: relative;
}

/* About PTB Modal Styles */
.about-ptb-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.about-ptb-modal-content {
  background: linear-gradient(135deg, #3c3457 0%, #4a4168 100%);
  border-radius: 20px;
  padding: 0;
  max-width: 90vw;
  max-height: 90vh;
  width: 500px;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 8px 32px rgba(85, 47, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.about-ptb-modal-header {
  background: linear-gradient(90deg, #552fff 0%, #c24dd9 100%);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.about-ptb-modal-header h2 {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 1px;
}

.about-ptb-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.about-ptb-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.about-ptb-content {
  padding: 30px 24px;
  color: #fff;
  text-align: center;
}

.about-ptb-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.about-ptb-logo img {
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.about-ptb-description {
  margin-bottom: 30px;
  line-height: 1.6;
}

.about-ptb-description p {
  font-size: 1rem;
  color: #e0e0e0;
  margin: 0;
  text-align: left;
}

.about-ptb-links h3 {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 20px;
  font-weight: 600;
}

.ptb-links-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ptb-link {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  text-decoration: none;
  color: #fff;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ptb-link:hover {
  background: rgba(85, 47, 255, 0.2);
  border-color: rgba(85, 47, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(85, 47, 255, 0.3);
}

.ptb-link-icon {
  font-size: 1.5rem;
  margin-right: 12px;
  width: 24px;
  text-align: center;
}

.ptb-link-text {
  font-size: 1rem;
  font-weight: 500;
  flex: 1;
  text-align: left;
}

/* Responsive Design for About PTB Modal */
@media (max-width: 768px) {
  .about-ptb-modal-content {
    width: 95vw;
    max-height: 85vh;
  }
  
  .about-ptb-content {
    padding: 20px 16px;
  }
  
  .about-ptb-modal-header {
    padding: 16px 20px;
  }
  
  .about-ptb-modal-header h2 {
    font-size: 1.3rem;
  }
  
  .about-ptb-description p {
    font-size: 0.95rem;
  }
  
  .ptb-link {
    padding: 14px 16px;
  }
  
  .ptb-link-text {
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .about-ptb-modal-content {
    width: 98vw;
    max-height: 90vh;
  }
  
  .about-ptb-content {
    padding: 16px 12px;
  }
  
  .about-ptb-modal-header {
    padding: 12px 16px;
  }
  
  .about-ptb-modal-header h2 {
    font-size: 1.2rem;
  }
  
  .about-ptb-logo img {
    width: 60px !important;
    height: 60px !important;
  }
  
  .about-ptb-description p {
    font-size: 0.9rem;
  }
  
  .ptb-link {
    padding: 12px 14px;
  }
  
  .ptb-link-icon {
    font-size: 1.3rem;
    margin-right: 10px;
  }
  
  .ptb-link-text {
    font-size: 0.9rem;
  }
}
