* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Ubuntu', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: #344A5E;
  background: #1c2333;
  overflow-x: hidden;
}

.rect-bg {
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3vw, 30px);
  padding: 0 clamp(15px, 4%, 8%);
  flex: 1;
}

.rect-row {
  display: flex;
  width: 100%;
  flex: 1;
  gap: clamp(10px, 2%, 4%);
  min-height: 0;
}

.rect-row-full {
  display: flex;
  width: 100%;
  height: clamp(140px, 20vh, 180px);
  flex-shrink: 0;
  gap: 0;
}

/* ШАПКА */
.rect-purple {
  background: #543963;
  flex: 1;
  border-radius: 0 0 12px 12px;
  margin: 0 2%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 15px 30px;
  gap: 5px;
}

.header-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.logo {
  width: auto;
  height: auto;
  max-width: min(80%, 500px);
  max-height: 85%;
  object-fit: contain;
}

.ip-text {
  font-size: clamp(14px, 1.4vw, 18px);
  color: #ffffff;
  font-weight: 400;
  letter-spacing: 1px;
  opacity: 0.8;
  text-align: center;
}

/* АВТОРИЗАЦИЯ */
.auth-container {
  position: absolute;
  top: 12px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  z-index: 10;
}

.auth-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Ubuntu', sans-serif;
  font-size: clamp(12px, 1vw, 14px);
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

.auth-btn:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.05);
}

.auth-btn.logout-btn {
  background: rgba(231, 76, 60, 0.3);
  border-color: rgba(231, 76, 60, 0.5);
}

.auth-btn.logout-btn:hover {
  background: rgba(231, 76, 60, 0.5);
}

.balance-display {
  color: #fff;
  font-size: clamp(13px, 1.1vw, 15px);
  background: rgba(46, 204, 113, 0.2);
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid rgba(46, 204, 113, 0.3);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.balance-display:hover {
  background: rgba(46, 204, 113, 0.35);
  transform: scale(1.05);
}

.balance-display .coin-icon {
  width: clamp(18px, 1.3vw, 22px);
  height: clamp(18px, 1.3vw, 22px);
  image-rendering: pixelated;
  object-fit: contain;
}

.balance-display .balance-amount {
  font-weight: 600;
}

.user-name-display {
  color: rgba(255,255,255,0.8);
  font-size: clamp(12px, 1vw, 14px);
  white-space: nowrap;
}

/* СОЦСЕТИ */
.social-row {
  display: flex;
  width: 100%;
  height: clamp(80px, 10vh, 100px);
  flex-shrink: 0;
  padding: 0 2%;
}

.social-container {
  background: rgba(255, 255, 255, 0.05);
  flex: 1;
  border-radius: 12px;
  margin: 0 2%;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(40px, 6%, 80px);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  padding: 8px 25px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.3s ease, transform 0.2s ease;
}

.social-link:hover {
  opacity: 1;
  transform: scale(1.1);
}

.social-link img {
  width: clamp(100px, 10vw, 220px);
  height: clamp(90px, 9vw, 90px);
  object-fit: contain;
}

/* СЛАЙДЕР */
.switch-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.5%, 2%);
  width: 100%;
  margin: 0 auto;
}

.switch-wrapper {
  width: clamp(65%, 72%, 78%);
  height: clamp(320px, 50vh, 500px);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}

.switch-slider {
  display: flex;
  width: 200%;
  height: 100%;
  transition: transform 1.5s linear;
}

.switch-slider.fast {
  transition: transform 0.75s linear;
}

.switch-slide {
  width: 50%;
  height: 100%;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.slide-green {
  background: #2ecc71;
}

.slide-white {
  background: #ffffff;
}

.card-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* КАРТОЧКИ */
.vanilla-wrapper, .sky-wrapper {
  position: absolute;
  top: 3%;
  left: 3%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  max-width: 94%;
}

.vanilla-img, .sky-img {
  width: clamp(180px, 35%, 450px);
  max-width: 450px;
  height: auto;
  object-fit: contain;
  display: block;
}

.vanilla-text-block, .sky-text-block {
  margin-top: 2%;
  width: clamp(28%, 33%, 38%);
  background: rgba(50, 50, 50, 0.7);
  padding: clamp(8px, 1.5%, 14px) clamp(10px, 2%, 18px);
  border-radius: 8px;
  z-index: 3;
}

.vanilla-text-block p, .sky-text-block p {
  font-size: clamp(11px, 1.1vw, 15px);
  font-weight: 500;
  color: #ffffff;
  line-height: 1.4;
  margin: 0;
}

.vanilla-card-link {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  text-decoration: none;
  cursor: pointer;
}

.vanilla-apply-btn {
  position: absolute;
  bottom: 15px;
  right: 15px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.9);
  color: #1c2333;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: clamp(12px, 1.1vw, 14px);
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  border: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  pointer-events: none;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
}

.switch-slide:hover .vanilla-apply-btn {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.vanilla-apply-btn:hover {
  background: #ffffff;
  transform: scale(1.05);
}

.vanilla-apply-btn .btn-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  image-rendering: pixelated;
}

/* СТРЕЛКИ */
.arrow-btn {
  width: clamp(35px, 4%, 60px);
  max-width: 60px;
  aspect-ratio: 1/1;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  flex-shrink: 0;
  padding: 0;
}

.arrow-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.arrow-btn:hover:not(.hidden) {
  transform: scale(1.2);
}

.arrow-btn.hidden {
  opacity: 0;
  cursor: default;
  pointer-events: none;
}

.arrow-left img {
  transform: rotate(-135deg);
}

.arrow-right img {
  transform: rotate(45deg);
}

/* КРАСНАЯ ЗОНА */
.rect-red {
  background: #e74c3c;
  flex: 1;
  border-radius: 12px;
  margin: 0 auto;
  padding: clamp(10px, 1.5%, 18px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  color: #fff;
  min-height: 200px;
  max-width: 92%;
  width: 100%;
  position: relative;
}

.menu-header {
  text-align: center;
  padding: 8px 0 12px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.menu-header img {
  width: clamp(28px, 3vw, 36px);
  height: clamp(28px, 3vw, 36px);
  image-rendering: pixelated;
}

.menu-header span {
  font-size: clamp(15px, 1.8vw, 20px);
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  letter-spacing: 0.5px;
  text-align: center;
}

.menu-header.hidden {
  display: none;
}

.btn-back {
  position: absolute;
  bottom: 12px;
  right: 15px;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: clamp(13px, 1vw, 15px);
  font-weight: 500;
  transition: background 0.3s;
  display: none;
  z-index: 10;
  font-family: inherit;
}

.btn-back:hover {
  background: rgba(255,255,255,0.4);
}

.btn-back.visible {
  display: block;
}

/* СЕТКИ КАТАЛОГА */
.menu-grid {
  display: grid;
  gap: clamp(8px, 1vw, 12px);
  flex: 1;
  align-content: start;
}

.menu-grid.categories {
  grid-template-columns: repeat(6, 1fr);
}

.menu-grid.images {
  grid-template-columns: repeat(8, 1fr);
}

.category-card {
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: clamp(8px, 1vw, 12px);
  text-align: center;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: clamp(55px, 10vh, 80px);
}

.category-card:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.03);
}

.category-card .cat-icon {
  width: clamp(32px, 4vw, 44px);
  height: clamp(32px, 4vw, 44px);
  object-fit: contain;
  image-rendering: pixelated;
}

.category-card .cat-name {
  font-size: clamp(11px, 1.1vw, 14px);
  font-weight: 500;
  line-height: 1.2;
}

.image-card {
  background: rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: clamp(6px, 0.8vw, 10px);
  text-align: center;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: clamp(50px, 8vh, 70px);
  justify-content: center;
}

.image-card:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.05);
}

.image-card img {
  width: 100%;
  max-width: clamp(32px, 4vw, 52px);
  max-height: clamp(32px, 4vw, 52px);
  object-fit: contain;
  image-rendering: pixelated;
}

/* ПАГИНАЦИЯ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  padding-bottom: 45px;
}

.pagination button {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: clamp(12px, 1vw, 14px);
  transition: background 0.3s;
}

.pagination button:hover:not(:disabled) {
  background: rgba(255,255,255,0.3);
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}

.pagination .page-num {
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: clamp(12px, 1vw, 14px);
  transition: background 0.3s;
  background: transparent;
  border: none;
  color: #fff;
}

.pagination .page-num.active {
  background: rgba(255,255,255,0.3);
  font-weight: 600;
}

.pagination .page-num:hover:not(.active) {
  background: rgba(255,255,255,0.15);
}

/* ТОСТ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: clamp(12px, 1vw, 14px);
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: all 0.4s ease;
  pointer-events: none;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0px);
}

/* ПОДВАЛ */
.bottom-content {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 0 20px 0;
}

.ref {
  font-size: clamp(12px, 1vw, 14px);
  color: #0279C0;
}

/* МОДАЛЬНОЕ ОКНО */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: #2c3e50;
  padding: 30px 40px;
  border-radius: 16px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.1);
}

.modal h2 {
  color: #fff;
  text-align: center;
  margin-bottom: 20px;
  font-size: clamp(20px, 2.5vw, 28px);
  font-weight: 500;
}

.modal input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-family: 'Ubuntu', sans-serif;
  font-size: 14px;
  transition: border-color 0.3s;
}

.modal input::placeholder {
  color: rgba(255,255,255,0.4);
}

.modal input:focus {
  outline: none;
  border-color: rgba(46, 204, 113, 0.5);
}

.modal .modal-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-family: 'Ubuntu', sans-serif;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 5px;
}

.modal .modal-btn.primary {
  background: #2ecc71;
  color: #fff;
}

.modal .modal-btn.primary:hover {
  background: #27ae60;
  transform: scale(1.02);
}

.modal .modal-btn.secondary {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.modal .modal-btn.secondary:hover {
  background: rgba(255,255,255,0.2);
}

.modal .auth-switch {
  text-align: center;
  margin-top: 15px;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.3s;
}

.modal .auth-switch:hover {
  color: #fff;
}

.modal .auth-switch span {
  color: #2ecc71;
  font-weight: 500;
}

.modal .error-msg {
  color: #e74c3c;
  font-size: 13px;
  text-align: center;
  margin-bottom: 10px;
  min-height: 20px;
}

/* АДАПТИВНОСТЬ */
@media (max-width: 768px) {
  .auth-container {
    position: relative;
    top: 0;
    right: 0;
    justify-content: center;
    width: 100%;
    padding: 5px 0;
  }
  .rect-purple {
    padding: 10px 15px;
  }
  .logo {
    max-width: 60%;
  }
  .social-link img {
    width: clamp(70px, 8vw, 100px);
    height: clamp(60px, 7vw, 80px);
  }
}

@media (max-width: 950px) {
  .social-row {
    height: auto;
    min-height: clamp(140px, 18vh, 180px);
    padding: 5px 2%;
  }
  .social-container {
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px 30px;
    padding: 10px 15px;
  }
  .social-link {
    flex: 0 0 calc(50% - 30px);
    max-width: calc(50% - 30px);
  }
  .social-link img {
    width: clamp(80px, 10vw, 130px);
    height: clamp(70px, 9vw, 130px);
  }
}

@media (max-width: 480px) {
  .menu-grid.categories { grid-template-columns: repeat(2, 1fr); }
  .menu-grid.images { grid-template-columns: repeat(3, 1fr); }
  .rect-red { max-width: 98%; padding: 8px; min-height: 150px; }
  .switch-wrapper { width: 82%; height: 220px; }
  .vanilla-img, .sky-img { width: 120px; }
  .vanilla-text-block, .sky-text-block { width: 75%; }
  .arrow-btn { width: 28px; }
  .vanilla-apply-btn { font-size: 10px; padding: 5px 12px; bottom: 10px; right: 10px; }
  .vanilla-apply-btn .btn-icon { width: 16px; height: 16px; }
  .btn-back { bottom: 8px; right: 10px; padding: 4px 12px; font-size: 12px; }
  .modal { padding: 20px; }
  .auth-container { gap: 8px; }
  .social-link {
    flex: 0 0 calc(50% - 20px);
    max-width: calc(50% - 20px);
  }
  .social-link img {
    width: 60px;
    height: 60px;
  }
  .social-container {
    gap: 10px 20px;
    padding: 8px 10px;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .menu-grid.categories { grid-template-columns: repeat(3, 1fr); }
  .menu-grid.images { grid-template-columns: repeat(4, 1fr); }
  .rect-red { max-width: 96%; }
  .switch-wrapper { width: 80%; height: 280px; }
  .vanilla-img, .sky-img { width: 160px; }
  .arrow-btn { width: 32px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .menu-grid.categories { grid-template-columns: repeat(4, 1fr); }
  .menu-grid.images { grid-template-columns: repeat(6, 1fr); }
  .rect-red { max-width: 90%; }
  .switch-wrapper { width: 76%; height: 380px; }
}

@media (min-width: 1025px) {
  .menu-grid.categories { grid-template-columns: repeat(6, 1fr); }
  .menu-grid.images { grid-template-columns: repeat(8, 1fr); }
  .rect-red { max-width: 70%; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .rect-row-full { height: 100px; }
  .switch-wrapper { height: 180px; }
  .rect-red { min-height: 120px; }
  .social-row { height: 55px; }
  .social-link img { width: 40px; height: 40px; }
  .category-card { min-height: 40px; padding: 4px; }
  .category-card .cat-icon { width: 24px; height: 24px; }
  .category-card .cat-name { font-size: 10px; }
  .image-card { min-height: 30px; padding: 4px; }
  .image-card img { max-width: 24px; max-height: 24px; }
  .vanilla-img, .sky-img { width: 100px; }
  .vanilla-text-block, .sky-text-block { width: 60%; }
  .vanilla-text-block p, .sky-text-block p { font-size: 10px; }
  .pagination { padding-bottom: 35px; }
}