:root {
  --bg-body: #020617;
  --bg-surface: rgba(15, 23, 42, 0.6);
  --bg-card: rgba(30, 41, 59, 0.5);
  --bg-elevated: #0f172a;
  --bg-hover: rgba(51, 65, 85, 0.5);
  --border-subtle: rgba(132, 204, 22, 0.08);
  --border-glass: rgba(132, 204, 22, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --lime: #31FF87;
  --lime-bright: #6BFFA8;
  --lime-dark: #00CC5E;
  --glow-color: rgba(49, 255, 135, 0.15);
  --scrollbar-track: #0f172a;
  --scrollbar-thumb: #84cc16;
  --nav-shadow: none;
}
[data-theme="light"] {
  --bg-body: #f5f0eb;
  --bg-surface: rgba(255, 252, 248, 0.8);
  --bg-card: rgba(255, 252, 248, 0.6);
  --bg-elevated: #fffcf8;
  --bg-hover: rgba(226, 216, 206, 0.6);
  --border-subtle: rgba(49, 255, 135, 0.12);
  --border-glass: rgba(49, 255, 135, 0.12);
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a5a;
  --text-muted: #6b6b7b;
  --text-dim: #9a9aab;
  --lime: #00CC5E;
  --lime-bright: #31FF87;
  --lime-dark: #00994A;
  --glow-color: rgba(0, 204, 94, 0.08);
}
html { transition: background 0.3s, color 0.3s; }
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--bg-body); color: var(--text-primary); transition: background 0.3s, color 0.3s; min-height: 100vh; overflow-x: hidden; max-width: 100vw; }
.glass { background: var(--bg-surface); backdrop-filter: blur(20px); border: 1px solid var(--border-glass); }
.glass-card { background: var(--bg-card); backdrop-filter: blur(12px); border: 1px solid var(--border-subtle); transition: all 0.3s; }
.gradient-btn { background: linear-gradient(135deg, var(--lime), var(--lime-dark)); transition: all 0.3s ease; color: #fff; cursor: pointer; border: none; font-family: inherit; }
.gradient-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px var(--glow-color); }
.sidebar-link { transition: all 0.2s ease; color: var(--text-muted); text-decoration: none; display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; cursor: pointer; }
.sidebar-link:hover { background: var(--glow-color); color: var(--lime); }
.sidebar-link.active { background: rgba(132, 204, 22, 0.15); color: var(--lime); border-right: 2px solid var(--lime); }
.sidebar-mobile-logout { display: none; }
.sidebar-profile-logout { display: none; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
.theme-btn { transition: all 0.3s; cursor: pointer; }
.theme-btn:hover { background: var(--bg-hover); }
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; vertical-align: middle; line-height: 1; }
.text-sec { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
#scrollTop { position: fixed; bottom: 24px; right: 24px; z-index: 100; opacity: 0; visibility: hidden; transition: all 0.3s; cursor: pointer; }
#scrollTop.show { opacity: 1; visibility: visible; }

.telegram-required-banner {
  position: fixed;
  top: 80px;
  left: 50%;
  width: min(1280px, calc(100vw - 32px));
  transform: translateX(-50%);
  z-index: 45;
  pointer-events: none;
}
.telegram-required-banner__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-color: rgba(250, 204, 21, 0.42);
  background: rgba(48, 35, 12, 0.72);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  pointer-events: auto;
}
[data-theme="light"] .telegram-required-banner__inner {
  background: rgba(255, 251, 235, 0.92);
}
.telegram-required-banner__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(250, 204, 21, 0.16);
  color: #facc15;
  flex-shrink: 0;
}
.telegram-required-banner__content {
  min-width: 0;
}
.telegram-required-banner__title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}
.telegram-required-banner__text {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 3px;
}
.telegram-required-banner__until {
  color: #facc15;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}
.telegram-required-banner__btn {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
body.telegram-required-visible {
  scroll-padding-top: 160px;
}
body.telegram-required-visible main {
  padding-top: 72px;
}

.preloader {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-body);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.preloader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-content { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.preloader-logo { position: relative; width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; }
.preloader-shield { width: 48px; height: 48px; animation: pulseShield 1.5s ease-in-out infinite; }
.preloader-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--lime); border-right-color: var(--lime-dark); animation: spin 1s linear infinite; }
.preloader-ring::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; border: 2px solid transparent; border-bottom-color: rgba(49,255,135,0.3); animation: spin 1.5s linear infinite reverse; }
.preloader-text { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.preloader-title { font-size: 24px; font-weight: 800; background: linear-gradient(135deg, var(--lime-bright), var(--lime)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: -0.5px; }
.preloader-subtitle { font-size: 13px; color: var(--text-muted); font-weight: 400; letter-spacing: 0.3px; }
.preloader-dots span { animation: dotPulse 1.4s ease-in-out infinite; opacity: 0; }
.preloader-dots span:nth-child(1) { animation-delay: 0s; }
.preloader-dots span:nth-child(2) { animation-delay: 0.2s; }
.preloader-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseShield { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: 0.85; } }
@keyframes dotPulse { 0%, 80%, 100% { opacity: 0; } 40% { opacity: 1; } }

.lang-dropdown {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 6px;
  min-width: 180px;
  z-index: 99999;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  animation: langFadeIn 0.12s ease-out;
  overflow: hidden;
}
[data-theme="light"] .lang-dropdown {
  background: rgba(255, 252, 248, 0.95);
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.lang-option:hover {
  background: var(--glow-color);
  color: var(--text-primary);
}
.lang-option.active {
  color: var(--lime);
  font-weight: 600;
}
.lang-option.active .lang-flag {
  filter: brightness(1.2);
}
.lang-flag {
  font-size: 18px;
  line-height: 1;
  width: 24px;
  text-align: center;
}
.lang-name {
  flex: 1;
}
@keyframes langFadeIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1023px) {
  #sidebar {
    z-index: 1300;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    height: 100dvh !important;
    max-height: 100dvh !important;
    width: min(82vw, 320px);
    padding: 76px 12px max(14px, calc(10px + env(safe-area-inset-bottom))) 12px;
    border-radius: 0 18px 18px 0;
    overflow: hidden;
  }
  #sidebar .sidebar-profile,
  #sidebar .sidebar-footer {
    min-width: 0;
    flex-shrink: 0;
  }
  #sidebar .sidebar-nav {
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;
    padding-bottom: 8px;
  }
  #sidebar .sidebar-footer {
    background: var(--bg-surface);
    margin-top: auto;
    padding-top: 10px;
    padding-bottom: 0;
  }
  #sidebar .sidebar-footer {
    display: none;
  }
  #sidebar .sidebar-profile-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: var(--text-secondary);
    background: var(--bg-hover);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
  }
  #sidebar .sidebar-profile-logout:hover {
    color: var(--lime);
    border-color: var(--lime);
  }
  #sidebar .sidebar-profile {
    padding-top: 6px;
    padding-bottom: 10px;
  }
  #sidebar .sidebar-link {
    padding: 0.62rem 0.75rem;
    border-radius: 0.55rem;
  }
  #sidebarOverlay {
    z-index: 1250;
  }
  .telegram-required-banner {
    top: 76px;
    left: 10px;
    right: 10px;
    width: calc(100vw - 20px);
    transform: none;
  }
  .telegram-required-banner__inner {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px 12px;
    padding: 12px;
    border-radius: 14px;
    border-left: 1px solid rgba(250, 204, 21, 0.42);
    border-right: 1px solid rgba(250, 204, 21, 0.42);
  }
  .telegram-required-banner__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  .telegram-required-banner__btn {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 38px;
    font-size: 12px;
  }
  body.telegram-required-visible main {
    padding-top: 168px;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .telegram-required-banner {
    top: 64px;
    left: 24px;
    right: 24px;
    width: auto;
    transform: none;
  }
  body.telegram-required-visible main {
    padding-top: 76px;
  }
}
