/* ===== TotalX sidebar v2 (Jetton-style, flush full-height, mini mode) ===== */
.sidebar_project {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 252px;
  background: #0b0d11;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 0;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  padding: 14px 12px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: 'Manrope', var(--font-main, sans-serif);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar_project::-webkit-scrollbar { width: 4px; }
.sidebar_project::-webkit-scrollbar-track { background: transparent; }
.sidebar_project::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }

/* --- top: burger + Казино/Спорт --- */
.sb-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.sb-burger {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #aab2c0;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.sb-burger:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}
.sb-modes {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.sb-mode {
  flex: 1;
  min-width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  color: #8a93a4;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0 5px;
}
.sb-mode i { font-size: 13px; flex-shrink: 0; }
.sb-mode span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.sb-mode.active {
  background: linear-gradient(135deg, rgba(225, 163, 55, 0.22), rgba(240, 192, 64, 0.1));
  border-color: rgba(225, 163, 55, 0.45);
  color: #f0c040;
}
.sb-mode:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* --- search --- */
.sb-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  margin-bottom: 10px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  color: #8a93a4;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.sb-search i { font-size: 13px; flex-shrink: 0; }
.sb-search span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-search:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #d7dce4;
}

/* --- nav --- */
.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sb-link {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  padding: 0 13px;
  border-radius: 11px;
  color: #aab2c0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
  position: relative;
}
.sb-link i {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
}
.sb-link svg,
.sb-link .icon {
  width: 17px;
  height: 17px;
  fill: currentColor;
  flex-shrink: 0;
}
.sb-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.sb-link.active {
  background: linear-gradient(135deg, rgba(225, 163, 55, 0.2), rgba(240, 192, 64, 0.08));
  color: #f0c040;
  font-weight: 600;
}
.sb-link.active i { color: #f0c040; }

.sb-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #5f6878;
  padding: 16px 13px 8px;
  font-weight: 600;
  flex-shrink: 0;
}

.sb-badge {
  margin-left: auto;
  background: rgba(225, 163, 55, 0.18);
  color: #f0c040;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  font-style: normal;
}

/* --- bottom block --- */
.sb-bottom {
  margin-top: auto;
  padding-top: 14px;
  flex-shrink: 0;
}
.sb-socials {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.sb-socials a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #8a93a4;
  font-size: 15px;
  transition: all 0.2s ease;
}
.sb-socials a:hover {
  color: #fff;
  border-color: rgba(225, 163, 55, 0.4);
  background: rgba(225, 163, 55, 0.12);
  transform: translateY(-1px);
}
.sb-actions {
  display: flex;
  gap: 8px;
}
.sb-lang {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}
.sb-lang:hover {
  border-color: rgba(225, 163, 55, 0.45);
  background: rgba(225, 163, 55, 0.1);
}
.sb-support {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #e1a337, #f0c040);
  border: none;
  color: #14100a;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}
.sb-support i { font-size: 14px; }
.sb-support span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-support:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 18px rgba(225, 163, 55, 0.3);
  color: #14100a;
}

/* ===== MINI MODE ===== */
.sidebar_project[data-mini="1"] {
  width: 78px;
  padding: 14px 9px 12px;
  align-items: stretch;
}
.sidebar_project[data-mini="1"] .sb-top {
  flex-direction: column;
  gap: 8px;
}
.sidebar_project[data-mini="1"] .sb-modes { flex-direction: column; width: 100%; }
.sidebar_project[data-mini="1"] .sb-mode { height: 38px; padding: 0; }
.sidebar_project[data-mini="1"] .sb-mode span { display: none; }
.sidebar_project[data-mini="1"] .sb-search {
  justify-content: center;
  padding: 0;
  width: 40px;
  align-self: center;
}
.sidebar_project[data-mini="1"] .sb-search span { display: none; }
.sidebar_project[data-mini="1"] .sb-link {
  flex-direction: column;
  gap: 3px;
  height: 52px;
  padding: 6px 2px;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.sidebar_project[data-mini="1"] .sb-link i { font-size: 16px; width: auto; }
.sidebar_project[data-mini="1"] .sb-link svg,
.sidebar_project[data-mini="1"] .sb-link .icon { width: 16px; height: 16px; }
.sidebar_project[data-mini="1"] .sb-link span {
  max-width: 100%;
  text-align: center;
  display: block;
}
.sidebar_project[data-mini="1"] .sb-badge {
  position: absolute;
  top: 5px;
  right: 8px;
  margin-left: 0;
  min-width: 15px;
  height: 15px;
  font-size: 9px;
}
.sidebar_project[data-mini="1"] .sb-label { display: none; }
.sidebar_project[data-mini="1"] .sb-socials { display: none; }
.sidebar_project[data-mini="1"] .sb-actions { flex-direction: column; }
.sidebar_project[data-mini="1"] .sb-lang { width: 100%; height: 38px; }
.sidebar_project[data-mini="1"] .sb-support { padding: 0; }
.sidebar_project[data-mini="1"] .sb-support span { display: none; }

/* content shifts when sidebar present (matrix: sidebar full/mini x chat open/collapsed) */
@media (min-width: 1281px) {
  body .container { margin-left: 252px !important; margin-right: 16px !important; max-width: calc(100% - 268px) !important; }
  body.sb-mini .container { margin-left: 78px !important; max-width: calc(100% - 94px) !important; }
  body.sb-mini .tx-ingame-fav { left: 94px; }
  body .site-header .header-inner { max-width: none !important; margin-left: 252px !important; margin-right: 16px !important; }
  body.sb-mini .site-header .header-inner { margin-left: 78px !important; }
}
@media (min-width: 1601px) {
  body .container { margin-right: 316px !important; max-width: calc(100% - 568px) !important; }
  body.tx-chat-collapsed .container { margin-right: 16px !important; max-width: calc(100% - 268px) !important; }
  body.sb-mini .container { margin-left: 78px !important; margin-right: 316px !important; max-width: calc(100% - 394px) !important; }
  body.sb-mini.tx-chat-collapsed .container { margin-right: 16px !important; max-width: calc(100% - 94px) !important; }
  body .site-header .header-inner { max-width: none !important; margin-left: 252px !important; margin-right: 316px !important; }
  body.tx-chat-collapsed .site-header .header-inner { margin-right: 16px !important; }
  body.sb-mini .site-header .header-inner { margin-left: 78px !important; margin-right: 316px !important; }
  body.sb-mini.tx-chat-collapsed .site-header .header-inner { margin-right: 16px !important; }
}

/* --- backdrop (mobile drawer) --- */
.sb-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 1040;
}
.sb-backdrop.tx-show {
  opacity: 1;
  pointer-events: auto;
}
@media (min-width: 1281px) {
  .sb-backdrop { display: none; }
}

/* ===== games modal (search, centered) ===== */
.tx-gm {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.tx-gm[hidden] { display: none; }
.tx-gm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 7, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.tx-gm-panel {
  position: relative;
  width: min(760px, 100%);
  max-height: min(86vh, 860px);
  background: #0e1015;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  padding: 22px 24px 24px;
  overflow-y: auto;
  font-family: 'Manrope', var(--font-main, sans-serif);
  animation: txGmIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes txGmIn {
  from { transform: translateY(24px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.tx-gm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.tx-gm-head h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}
.tx-gm-head h3 i { color: #f0c040; font-size: 18px; }
.tx-gm-close {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #aab2c0;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.tx-gm-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.tx-gm-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.tx-gm-input {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}
.tx-gm-input i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #5f6878;
  font-size: 13px;
  pointer-events: none;
}
.tx-gm-input input {
  width: 100%;
  height: 46px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 0 14px 0 40px;
  color: #fff;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.tx-gm-input input::placeholder { color: #5f6878; }
.tx-gm-input input:focus {
  border-color: rgba(225, 163, 55, 0.5);
  background: rgba(255, 255, 255, 0.07);
}
.tx-gm-provider {
  flex: 0 0 220px;
  width: 220px;
  height: 46px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  color: #d7dce4;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 0 38px 0 16px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23f0c040' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.tx-gm-provider:hover {
  border-color: rgba(225, 163, 55, 0.35);
  background-color: rgba(255, 255, 255, 0.07);
}
.tx-gm-provider:focus {
  border-color: rgba(225, 163, 55, 0.55);
  box-shadow: 0 0 0 3px rgba(225, 163, 55, 0.12);
}
.tx-gm-provider option { background: #14161c; color: #fff; }
.tx-gm-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.tx-gm-tab {
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #8a93a4;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tx-gm-tab:hover { color: #d7dce4; background: rgba(255, 255, 255, 0.07); }
.tx-gm-tab.active {
  background: linear-gradient(135deg, rgba(225, 163, 55, 0.22), rgba(240, 192, 64, 0.1));
  border-color: rgba(225, 163, 55, 0.45);
  color: #f0c040;
}
.tx-gm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.tx-gm-empty {
  display: none;
  text-align: center;
  color: #5f6878;
  padding: 40px 0;
  font-size: 14.5px;
  font-weight: 500;
}
.tx-gm-card { animation: txGmCard 0.25s ease both; }
@keyframes txGmCard {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== favorites: heart on game cards ===== */
.games-grid .game-card { position: relative; }
.game-card-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(7, 8, 10, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #c9ced6;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.game-card-fav i { font-size: 13px; }
.game-card-fav:hover { transform: scale(1.1); color: #f0c040; }
.game-card-fav.on {
  color: #f0c040;
  background: rgba(225, 163, 55, 0.2);
  border-color: rgba(240, 192, 64, 0.55);
}

/* ===== favorites: in-game floating button ===== */
.tx-ingame-fav {
  position: fixed;
  left: 268px;
  bottom: 26px;
  z-index: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  background: rgba(14, 16, 21, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e8e8e8;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.2s ease, color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.tx-ingame-fav:hover { transform: translateY(-2px); }
.tx-ingame-fav.on {
  color: #f0c040;
  border-color: rgba(240, 192, 64, 0.5);
  background: rgba(225, 163, 55, 0.15);
}

/* ===== favorites modal ===== */
.tx-fav-content {
  background: var(--bg-card, #0e1015);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: 18px;
  color: var(--text-primary, #e8e8e8);
}
.tx-fav-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding: 16px 20px;
}
.tx-fav-header .modal-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f0c040;
}
.tx-fav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.tx-fav-empty {
  display: none;
  text-align: center;
  color: var(--text-muted, #6b7280);
  padding: 26px 0;
  font-size: 14px;
}
.tx-fav-hint {
  margin-top: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted, #6b7280);
}
.tx-fav-card .game-card-name { font-size: 13px; }

/* ===== mobile: off-canvas drawer ===== */
@media screen and (max-width: 1280px) {
  .sidebar_project {
    display: flex !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 0;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1100;
    padding-top: 16px;
    padding-bottom: 12px;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.5);
  }
  .sidebar_project.tx-open { transform: translateX(0); }
  .sidebar_project[data-mini="1"] { width: min(300px, 86vw); padding: 16px 12px 12px; }
  .sidebar_project[data-mini="1"] .sb-top { flex-direction: row; }
  .sidebar_project[data-mini="1"] .sb-modes { flex-direction: row; }
  .sidebar_project[data-mini="1"] .sb-mode { height: 36px; }
  .sidebar_project[data-mini="1"] .sb-mode span { display: inline; }
  .sidebar_project[data-mini="1"] .sb-search { width: 100%; justify-content: flex-start; padding: 0 13px; }
  .sidebar_project[data-mini="1"] .sb-search span { display: inline; }
  .sidebar_project[data-mini="1"] .sb-link {
    flex-direction: row;
    gap: 12px;
    height: 44px;
    padding: 0 13px;
    font-size: 14px;
    font-weight: 500;
  }
  .sidebar_project[data-mini="1"] .sb-link span { text-align: left; }
  .sidebar_project[data-mini="1"] .sb-badge {
    position: static;
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
  }
  .sidebar_project[data-mini="1"] .sb-label { display: block; }
  .sidebar_project[data-mini="1"] .sb-socials { display: flex; }
  .sidebar_project[data-mini="1"] .sb-actions { flex-direction: row; }
  .sidebar_project[data-mini="1"] .sb-lang { width: 40px; height: 40px; }
  .sidebar_project[data-mini="1"] .sb-support span { display: inline; }
  .sb-burger { display: none; }
  .sb-link { padding: 11px 12px; font-size: 14px; height: auto; }
  .tx-ingame-fav { left: 16px; bottom: 86px; }
  .tx-gm-panel { width: 100%; border-right: none; }
}
@media screen and (max-width: 768px) {
  .tx-fav-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .tx-gm-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .tx-gm-controls { flex-direction: column; }
  .tx-gm-provider { min-width: 0; flex: 1 1 100%; width: 100%; }
}
