/* ============================================
   MAGIUS CASINO — Optimised Stylesheet
   Target: PageSpeed 90+ mobile
   Strategy: no heavy box-shadow on scroll,
   will-change only on interactive elements,
   contain:layout on cards, GPU-cheap transforms
   ============================================ */

/* ---- VARIABLES ---- */
:root {
  --bg:          #1A0608;
  --bg2:         #2B0C10;
  --bg3:         #3A1212;
  --bg4:         #4A1818;
  --gold:        #D8A62A;
  --gold-l:      #F5D24A;
  --gold-d:      #A67C15;
  --border:      #C58A2B;
  --green:       #2EA83A;
  --red:         #D24B2A;
  --purple:      #8F1B62;
  --txt:         #FFFFFF;
  --txt2:        #F6E8C9;
  --txt3:        #D9C9A7;
  --sw:          230px; /* sidebar width */
  --hh:          56px;  /* header height */
}

/* ---- RESET ---- */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--txt2);
  min-height: 100vh;
}
img { display: block; max-width: 100%; height: auto; }
/* game card images are absolute — override the global max-width */
.game-card-img { max-width: none; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--gold-d); border-radius: 2px; }

/* ============================================
   LAYOUT
   ============================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sw);
  height: 100vh;
  background: var(--bg3);
  border-right: 1px solid rgba(197,138,43,.3);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  /* GPU layer only when animating (mobile) */
}

.sidebar-logo {
  padding: 14px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(197,138,43,.2);
}
.sidebar-logo img { width: 150px; height: auto; mix-blend-mode: screen; }

.sidebar-nav { flex: 1; padding: 6px 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  color: var(--txt3);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  border-left: 3px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.nav-item:hover,
.nav-item.active {
  background: rgba(197,138,43,.1);
  color: var(--gold-l);
  border-left-color: var(--gold);
}
.nav-item i { width: 16px; text-align: center; color: var(--gold); font-size: 13px; flex-shrink: 0; }
.nav-item.active i { color: var(--gold-l); }

.nav-badge {
  margin-left: auto;
  background: var(--green);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 6px;
}

.nav-sep {
  height: 1px;
  background: linear-gradient(90deg,transparent,rgba(197,138,43,.25),transparent);
  margin: 4px 14px;
}

.sidebar-bottom {
  padding: 10px 14px;
  border-top: 1px solid rgba(197,138,43,.2);
}
.lang-btn {
  background: rgba(0,0,0,.3);
  border: 1px solid rgba(197,138,43,.35);
  color: var(--txt3);
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* HEADER */
.site-header {
  position: fixed;
  top: 0;
  left: var(--sw);
  right: 0;
  height: var(--hh);
  background: var(--bg3);
  border-bottom: 1px solid rgba(197,138,43,.3);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 16px;
  gap: 10px;
  z-index: 100;
}

.header-search {
  display: flex;
  align-items: center;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(197,138,43,.4);
  border-radius: 18px;
  padding: 5px 12px;
  gap: 7px;
  flex: 1;
  max-width: 280px;
}
.header-search input {
  background: none;
  border: none;
  outline: none;
  color: var(--txt2);
  font-size: 13px;
  width: 100%;
}
.header-search input::placeholder { color: var(--txt3); }
.header-search i { color: var(--gold); font-size: 12px; }

.btn-login {
  border: 1px solid var(--border);
  color: var(--gold-l);
  padding: 7px 16px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background .15s;
}
.btn-login:hover { background: rgba(197,138,43,.15); }

.btn-register {
  background: linear-gradient(135deg, var(--gold-d), var(--gold), var(--gold-l));
  color: #1A0608;
  padding: 7px 16px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .4px;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity .15s;
}
.btn-register:hover { opacity: .9; }

/* MAIN */
.main-content {
  margin-left: var(--sw);
  margin-top: var(--hh);
  min-height: calc(100vh - var(--hh));
  width: calc(100% - var(--sw));
  box-sizing: border-box;
  /* НЕ ставим overflow-x:hidden — это блокирует горизонтальный скролл карточек */
}

/* MOBILE TOGGLE */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 10px; left: 10px;
  z-index: 300;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--gold);
  width: 36px; height: 36px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 150;
}

/* ============================================
   HERO BANNER
   ============================================ */
.hero-banner {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-bottom: 2px solid rgba(197,138,43,.4);
  line-height: 0;
  display: block;
}
.hero-banner-link {
  display: block;
  position: relative;
  width: 100%;
  max-width: 100%;
  line-height: 0;
  overflow: hidden;
}
.hero-banner-img {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  object-fit: fill; /* растягивает баннер на всю ширину без обрезки */
  vertical-align: bottom;
  /* Убираем любые унаследованные отступы */
  margin: 0 !important;
  padding: 0 !important;
}
.hero-banner-cta {
  position: absolute;
  bottom: 20px;
  right: 32px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: linear-gradient(180deg,#3DD44A,#2EA83A 60%,#1D6F25);
  border: 2px solid #5BF06A;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .8px;
  padding: 12px 28px;
  border-radius: 28px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s, opacity .15s;
}
.btn-hero:hover { will-change: transform; transform: translateY(-2px); opacity: .92; }

.btn-play {
  background: linear-gradient(135deg, var(--gold-d), var(--gold));
  color: #1A0608;
  padding: 8px 18px;
  border-radius: 18px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.btn-bonus {
  display: block;
  width: 100%;
  text-align: center;
  background: linear-gradient(180deg,#3DD44A,#2EA83A 60%,#1D6F25);
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 22px;
  margin-bottom: 8px;
  transition: opacity .15s;
}
.btn-bonus:hover { opacity: .88; }

/* ============================================
   TRUST BAR
   ============================================ */
.trust-bar {
  background: rgba(0,0,0,.35);
  border-bottom: 1px solid rgba(197,138,43,.15);
  padding: 10px 16px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--txt3);
}
.trust-item i { color: var(--gold); font-size: 15px; }
.trust-item strong { color: var(--txt2); }

/* ============================================
   CATEGORY PILLS
   ============================================ */
.category-pills {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid rgba(197,138,43,.12);
}
.category-pills::-webkit-scrollbar { display: none; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(74,24,24,.9);
  border: 1px solid rgba(197,138,43,.4);
  color: var(--txt3);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s;
}
.pill.active,
.pill:hover {
  background: rgba(197,138,43,.2);
  color: var(--gold-l);
  border-color: var(--gold);
}
.pill i { font-size: 11px; }

/* ============================================
   SECTIONS
   ============================================ */
.section { padding: 16px 16px 4px; }

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--txt);
  letter-spacing: .3px;
}
.section-link {
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* ============================================
   GAME CARDS
   ============================================ */

/* --- горизонтальный ряд с прокруткой --- */
.games-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 16px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.games-row::-webkit-scrollbar { display: none; }

/* --- сетка (страница slots, casino) --- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

/* --- базовая карточка --- */
.game-card {
  position: relative;
  flex: 0 0 140px;         /* фиксированная ширина в .games-row */
  width: 140px;
  height: 187px;           /* 140 × 4/3 */
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(197,138,43,.3);
  background: var(--bg4);
  cursor: pointer;
  contain: layout;
  transition: border-color .15s;
}

/* в grid — пусть ячейка определяет ширину */
.games-grid .game-card {
  width: 100%;
  flex: none;
  height: auto;
  aspect-ratio: 3 / 4;
}

.game-card:hover { border-color: var(--gold); }
.game-card:hover .game-overlay { opacity: 1; }

/* --- изображение внутри карточки --- */
.game-card-img {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  display: block;
  transition: transform .2s ease;
}
.game-card:hover .game-card-img { will-change: transform; transform: scale(1.04); }

/* Jackpot amount overlay on card */
.game-jackpot-amount {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, rgba(0,0,0,.85) 0%, transparent 100%);
  color: var(--gold-l);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  padding: 14px 6px 7px;
  letter-spacing: .3px;
}

.game-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px;
  text-align: center;
}
.game-card-placeholder i { font-size: 28px; color: var(--gold); }
.game-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--txt2);
  text-transform: uppercase;
  line-height: 1.3;
}
.game-provider { font-size: 10px; color: var(--txt3); }

.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
}

.game-badge {
  position: absolute;
  top: 5px; left: 5px;
  background: var(--green);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 6px;
  text-transform: uppercase;
}
.game-badge.hot    { background: var(--red); }
.game-badge.jackpot { background: var(--purple); }

/* Fade-in animation for game cards (JS-driven) */
.card-hidden  { opacity: 0; transform: translateY(10px); transition: opacity .25s ease, transform .25s ease; will-change: opacity, transform; }
.card-visible { opacity: 1; transform: none; will-change: auto; }

/* ============================================
   BONUS CARDS
   ============================================ */
.bonus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(270px,1fr));
  gap: 14px;
}

.bonus-card {
  background: var(--bg4);
  border: 1px solid rgba(197,138,43,.4);
  border-top: 3px solid var(--gold);
  border-radius: 12px;
  padding: 18px;
  contain: layout;
}

.bonus-icon { font-size: 32px; margin-bottom: 10px; display: block; }
.bonus-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--gold-l);
  margin-bottom: 4px;
}
.bonus-amount {
  font-size: 26px;
  font-weight: 900;
  color: var(--txt);
  margin-bottom: 6px;
}
.bonus-desc {
  font-size: 13px;
  color: var(--txt3);
  margin-bottom: 12px;
  line-height: 1.5;
}
.bonus-terms {
  font-size: 11px;
  color: rgba(217,201,167,.45);
  line-height: 1.4;
}

/* ============================================
   TRUST / WHY
   ============================================ */
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(200px,1fr));
  gap: 14px;
}
.why-card {
  background: var(--bg4);
  border: 1px solid rgba(197,138,43,.3);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  contain: layout;
}
.why-icon { font-size: 36px; margin-bottom: 8px; }
.why-title { font-size: 14px; font-weight: 800; color: var(--gold-l); margin-bottom: 4px; }
.why-desc { font-size: 12px; color: var(--txt3); line-height: 1.5; }

/* ============================================
   DIVIDER
   ============================================ */
.gold-divider {
  height: 1px;
  background: linear-gradient(90deg,transparent,rgba(197,138,43,.4),transparent);
  margin: 6px 16px;
}

/* ============================================
   RESPONSIBLE GAMBLING
   ============================================ */
.resp-banner {
  background: rgba(139,0,0,.12);
  border: 1px solid rgba(210,75,42,.3);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 16px 14px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 12px;
  color: var(--txt3);
  line-height: 1.5;
}
.resp-banner i { color: var(--red); font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.resp-banner a { color: var(--gold); }

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid rgba(197,138,43,.2);
  padding: 24px 16px 16px;
  margin-top: 12px;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(160px,1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.footer-col-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 10px;
}
.footer-links { display: flex; flex-direction: column; gap: 6px; }
.footer-links a { color: var(--txt3); font-size: 12px; }
.footer-links a:hover { color: var(--gold-l); }

.footer-bottom {
  border-top: 1px solid rgba(197,138,43,.15);
  padding-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.footer-logo img { height: 32px; opacity: .9; mix-blend-mode: screen; }
.footer-legal {
  font-size: 11px;
  color: rgba(217,201,167,.4);
  line-height: 1.55;
  max-width: 580px;
}
.footer-badges { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.badge-anj {
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(197,138,43,.35);
  color: var(--txt3);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.badge-18 {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   RESPONSIVE — ≤900px (tablet/mobile)
   ============================================ */
@media (max-width: 900px) {
  :root { --sw: 0px; }

  .sidebar {
    width: 230px;
    transform: translateX(-230px);
    will-change: transform;
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.visible { display: block; }

  .site-header { left: 0; padding-left: 52px; }
  .sidebar-toggle { display: flex; }

  .header-search { max-width: 200px; }
  .btn-login { display: none; }          /* сэкономить место на узком хедере */

  .main-content { width: 100%; } /* на мобиле sidebar = 0, ширина = 100% */
  .hero-banner-cta { bottom: 14px; right: 16px; }
  .btn-hero { font-size: 12px; padding: 10px 20px; }

  .bonus-grid { grid-template-columns: 1fr; }
  .why-grid   { grid-template-columns: repeat(2,1fr); }
}

/* ≤480px — телефон */
@media (max-width: 480px) {
  :root { --hh: 50px; }

  /* hero-banner-img на мобилке: без overrides, показываем как есть */
  .hero-banner-cta { display: none; }   /* на маленьком экране кнопка в trust-bar */

  .trust-bar { gap: 12px; }
  .trust-item:nth-child(n+4) { display: none; } /* показываем только 3 */

  .category-pills { gap: 6px; padding: 8px 12px; }
  .pill { font-size: 11px; padding: 5px 11px; }

  .section { padding: 12px 12px 2px; }
  .section-title { font-size: 15px; }

  .games-row { gap: 8px; padding: 4px 12px 10px; }
  .game-card  { flex: 0 0 130px; width: 130px; height: 173px; }

  .bonus-grid { grid-template-columns: 1fr; }
  .why-grid   { grid-template-columns: 1fr 1fr; }

  .footer-grid { grid-template-columns: 1fr 1fr; }

  /* Мобильная CTA-кнопка под баннером */
  .mobile-cta-bar {
    display: flex !important;
  }
}

/* Скрыта на > 480px */
.mobile-cta-bar {
  display: none;
  padding: 10px 16px;
  background: rgba(0,0,0,.3);
  border-bottom: 1px solid rgba(197,138,43,.2);
}
.mobile-cta-bar .btn-hero { width: 100%; justify-content: center; font-size: 13px; }
