@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700;800&family=Inter:wght@300;400;500;600&display=swap');

/* ═══════════════════════════════════════════════
   LSCSD DESIGN SYSTEM — Tokens & Variables
   Style: Trust & Authority · Dark OLED
   UI/UX Pro Max — Dimensional Layering
═══════════════════════════════════════════════ */

:root {
  /* ── Backgrounds (4-level elevation) ── */
  --bg:        #060910;
  --bg2:       #0b1121;
  --bg3:       #101828;
  --bg4:       #172033;
  --bg5:       #1e2b44;
  --bg-glass:  rgba(11, 17, 33, 0.72);

  /* ── Gold accent ── */
  --gold:      #c9a84c;
  --gold-lt:   #e8d07a;
  --gold-dk:   #8a6c1a;
  --gold-05:   rgba(201, 168, 76, 0.05);
  --gold-08:   rgba(201, 168, 76, 0.08);
  --gold-12:   rgba(201, 168, 76, 0.12);
  --gold-20:   rgba(201, 168, 76, 0.20);
  --gold-35:   rgba(201, 168, 76, 0.35);
  --gold-50:   rgba(201, 168, 76, 0.50);
  --gold-rgb:  201, 168, 76;

  /* ── Borders ── */
  --border:    rgba(201, 168, 76, 0.10);
  --border2:   rgba(201, 168, 76, 0.22);
  --border3:   rgba(201, 168, 76, 0.42);
  --border-hi: rgba(201, 168, 76, 0.65);

  /* ── Text ── */
  --text:      #e2e8f5;
  --text2:     #8fa5c5;
  --text3:     #44587a;
  --text4:     #2c3d5a;

  /* ── Semantic ── */
  --navy:      #0c1e45;
  --red:       #d95555;
  --red-glow:  rgba(217, 85, 85, 0.15);
  --green:     #45a67e;
  --green-glow:rgba(69, 166, 126, 0.15);
  --blue:      #5896ff;
  --blue-glow: rgba(88, 150, 255, 0.12);

  /* ── Elevation shadows (Dimensional Layering) ── */
  --shadow-1:  0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-2:  0 4px 12px rgba(0,0,0,0.35), 0 2px 4px rgba(0,0,0,0.2);
  --shadow-3:  0 10px 28px rgba(0,0,0,0.45), 0 4px 8px rgba(0,0,0,0.25);
  --shadow-4:  0 20px 48px rgba(0,0,0,0.55), 0 8px 16px rgba(0,0,0,0.3);
  --shadow-gold: 0 0 24px rgba(201,168,76,0.18), 0 4px 16px rgba(0,0,0,0.4);
  --shadow-gold-lg: 0 0 48px rgba(201,168,76,0.25), 0 8px 32px rgba(0,0,0,0.5);

  /* ── Layout ── */
  --nav-h:     64px;
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* ── Animation ── */
  --ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:   cubic-bezier(0.4, 0, 1, 1);
  --dur-fast:  150ms;
  --dur-mid:   250ms;
  --dur-slow:  400ms;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: clip; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* ── Custom scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dk); }

a { color: inherit; text-decoration: none; }

/* ═══════════════════════════════════════════════
   NAV — Glassmorphism elevated
═══════════════════════════════════════════════ */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(6, 9, 16, 0.88);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  z-index: 200;
  display: flex; align-items: center;
  padding: 0 32px; gap: 0;
  box-shadow: 0 1px 0 rgba(201,168,76,0.06), 0 4px 24px rgba(0,0,0,0.4);
  transition: background var(--dur-mid);
}
.site-nav::after {
  content: '';
  position: absolute; bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-20), transparent);
  pointer-events: none;
}

.nav-brand {
  display: flex; align-items: center; gap: 12px;
  margin-right: 36px; flex-shrink: 0;
}

.nav-star { width: 34px; height: 34px; flex-shrink: 0; filter: drop-shadow(0 0 6px var(--gold-35)); }

.nav-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 20px; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text); line-height: 1;
}
.nav-title .accent { color: var(--gold); }
.nav-sub {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text3); margin-top: 1px;
}

.nav-menu { display: flex; align-items: center; flex: 1; }
.nav-links { display: flex; align-items: center; gap: 2px; }

.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 38px;
  height: 38px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 12px 9px;
  outline: none;
  z-index: 210;
  box-shadow: var(--shadow-1);
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
.nav-burger:hover {
  background: var(--bg4);
  border-color: var(--gold-35);
}
.nav-burger:active {
  transform: scale(0.95);
}
.nav-burger span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text);
  border-radius: 2px;
  transition: transform var(--dur-mid) var(--ease-out),
              opacity var(--dur-mid) var(--ease-out),
              background-color var(--dur-mid) var(--ease-out);
}

.nav-links a {
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text2);
  padding: 6px 14px; border-radius: var(--radius-sm);
  transition: color var(--dur-fast), background var(--dur-fast);
  white-space: nowrap; position: relative;
}
.nav-links a:hover { color: var(--text); background: var(--gold-08); }
.nav-links a.active {
  color: var(--gold);
  background: var(--gold-08);
}
.nav-links a.active::after {
  content: '';
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 16px; height: 2px;
  background: var(--gold); border-radius: 2px;
}

.nav-auth { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* ── Discord button ── */
.btn-discord {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, #5865F2, #4752c4);
  color: #fff;
  border: none; border-radius: var(--radius-sm);
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-fast);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.3);
}
.btn-discord:hover {
  background: linear-gradient(135deg, #6875f5, #5865F2);
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.45);
  transform: translateY(-1px);
}
.btn-discord:active { transform: translateY(0); }
.btn-discord svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ── Auth pill ── */
.auth-pill {
  display: none; align-items: center; gap: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 14px 4px 5px;
  cursor: default;
  transition: border-color var(--dur-fast);
}
.auth-pill:hover { border-color: var(--border2); }
.auth-pill img {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg5); object-fit: cover;
  box-shadow: 0 0 0 2px var(--border2);
}
.auth-pill-name { font-size: 13px; font-weight: 500; }
.auth-pill-out {
  background: none; border: none; color: var(--text3);
  font-size: 11px; cursor: pointer; padding: 0 0 0 6px;
  transition: color var(--dur-fast);
}
.auth-pill-out:hover { color: var(--red); }

.demo-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--gold);
  background: var(--gold-08); border: 1px solid var(--border2);
  border-radius: 4px; padding: 2px 7px;
}

/* ═══════════════════════════════════════════════
   PAGE SHELL
═══════════════════════════════════════════════ */
.page { padding-top: var(--nav-h); min-height: 100vh; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.container-sm { max-width: 860px; margin: 0 auto; padding: 0 32px; }

/* ═══════════════════════════════════════════════
   TYPOGRAPHY
═══════════════════════════════════════════════ */
.eyebrow {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.eyebrow::before {
  content: '';
  width: 20px; height: 1px;
  background: var(--gold-50); flex-shrink: 0;
}

.display-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800; letter-spacing: 0.03em;
  text-transform: uppercase; line-height: 1.0;
  color: var(--text);
}

.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 34px; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text); margin-bottom: 8px;
}

.gold-rule {
  width: 44px; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-20));
  border-radius: 2px; margin: 14px 0 28px;
}

/* ═══════════════════════════════════════════════
   CARDS — Dimensional layering + glassmorphism
═══════════════════════════════════════════════ */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-2);
  transition: border-color var(--dur-mid) var(--ease-out),
              transform var(--dur-mid) var(--ease-out),
              box-shadow var(--dur-mid) var(--ease-out);
  position: relative;
}
.card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(201,168,76,0.04) 0%, transparent 60%);
  pointer-events: none; border-radius: inherit;
  opacity: 0; transition: opacity var(--dur-mid);
}
.card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-3), 0 0 0 1px var(--gold-08);
}
.card:hover::before { opacity: 1; }

.card-padded { padding: 24px; }

/* Glass card variant */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color var(--dur-mid) var(--ease-out),
              box-shadow var(--dur-mid) var(--ease-out),
              transform var(--dur-mid) var(--ease-out);
}
.glass-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-gold), inset 0 1px 0 rgba(255,255,255,0.06);
  transform: translateY(-3px);
}

/* ═══════════════════════════════════════════════
   GRID
═══════════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4, .grid-auto { grid-template-columns: 1fr; }
  .container, .container-sm { padding: 0 20px; }
  .site-nav { padding: 0 20px; }
}

/* ═══════════════════════════════════════════════
   BADGES / RANK CHIPS
═══════════════════════════════════════════════ */
.rank-chip {
  display: inline-flex; align-items: center;
  background: var(--gold-08); border: 1px solid rgba(201,168,76,0.2);
  border-radius: 4px; padding: 3px 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--gold); white-space: nowrap;
}
.rank-chip.cmd { background: var(--gold-12); border-color: var(--gold-35); }
.rank-chip.off { background: var(--blue-glow); border-color: rgba(88,150,255,0.25); color: var(--blue); }
.rank-chip.cdt { background: rgba(100,120,160,0.08); border-color: rgba(100,120,160,0.22); color: var(--text2); }

/* ═══════════════════════════════════════════════
   AUTH LOCK
═══════════════════════════════════════════════ */
.auth-protected { position: relative; }
.auth-lock {
  position: absolute; inset: 0;
  background: rgba(6, 9, 16, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: inherit;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
  z-index: 10; text-align: center; padding: 24px;
}
.auth-lock .lock-ico { font-size: 28px; opacity: 0.5; }
.auth-lock p { font-size: 13px; color: var(--text2); max-width: 220px; line-height: 1.5; }

/* ═══════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 80px;
  padding: 32px 0;
  background: var(--bg);
  position: relative;
}
.site-footer::before {
  content: '';
  position: absolute; top: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-20), transparent);
}
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.footer-brand {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--text3);
}
.footer-brand .accent { color: var(--gold); }
.footer-note { font-size: 12px; color: var(--text3); }

/* ═══════════════════════════════════════════════
   BUTTONS — With glow + press feedback
═══════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
  border: none; position: relative; overflow: hidden;
  touch-action: manipulation;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.1);
  opacity: 0;
  transition: opacity var(--dur-fast);
  border-radius: inherit;
}
.btn:active::after { opacity: 1; }
.btn:active { transform: scale(0.97); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, #b8942f 100%);
  color: #0a0800;
  box-shadow: 0 2px 8px rgba(201,168,76,0.3), 0 1px 2px rgba(0,0,0,0.2);
}
.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-lt) 0%, var(--gold) 100%);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border2);
}
.btn-outline:hover {
  border-color: var(--border3); color: var(--text);
  background: var(--gold-08);
  box-shadow: 0 0 12px rgba(201,168,76,0.1);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════
   INPUTS / SEARCH
═══════════════════════════════════════════════ */
.search-wrap {
  position: relative; display: flex; align-items: center;
}
.search-wrap input {
  width: 100%; background: var(--bg2);
  border: 1px solid var(--border2); border-radius: 10px;
  color: var(--text); font-family: inherit; font-size: 15px;
  padding: 12px 16px 12px 46px; outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.search-wrap input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-08), var(--shadow-1);
}
.search-wrap input::placeholder { color: var(--text3); }
.search-wrap .search-icon {
  position: absolute; left: 14px;
  color: var(--text3); pointer-events: none;
  transition: color var(--dur-fast);
}
.search-wrap:focus-within .search-icon { color: var(--gold); }

/* ═══════════════════════════════════════════════
   TABS
═══════════════════════════════════════════════ */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab-btn {
  background: none; border: 1px solid transparent;
  color: var(--text2); font-family: inherit; font-size: 12px;
  font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 7px 18px; border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--dur-fast); touch-action: manipulation;
}
.tab-btn:hover { background: var(--bg3); color: var(--text); }
.tab-btn.active {
  background: var(--gold-08); border-color: var(--border2);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(201,168,76,0.1);
}

/* ═══════════════════════════════════════════════
   DIVIDERS
═══════════════════════════════════════════════ */
.section-sep {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 0;
}

/* ═══════════════════════════════════════════════
   NOTIFICATION BANNER
═══════════════════════════════════════════════ */
.auth-banner {
  background: var(--gold-05); border-bottom: 1px solid var(--border);
  padding: 10px 32px; display: flex; align-items: center;
  justify-content: center; gap: 12px; font-size: 13px; color: var(--text2);
}
.auth-banner strong { color: var(--gold); }
.auth-banner button {
  background: none; border: 1px solid var(--border2);
  color: var(--gold); border-radius: 6px; padding: 3px 12px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background var(--dur-fast), box-shadow var(--dur-fast);
}
.auth-banner button:hover {
  background: var(--gold-12);
  box-shadow: 0 0 12px rgba(201,168,76,0.12);
}

/* ═══════════════════════════════════════════════
   SHIMMER SKELETON (loading states)
═══════════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg4) 50%, var(--bg3) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: 4px;
}

/* ═══════════════════════════════════════════════
   GLOW UTILITIES
═══════════════════════════════════════════════ */
.glow-gold { box-shadow: var(--shadow-gold); }
.glow-gold-lg { box-shadow: var(--shadow-gold-lg); }

.text-gold { color: var(--gold); }
.text-muted { color: var(--text2); }
.text-dim   { color: var(--text3); }

/* ═══════════════════════════════════════════════
   SECTION PADDING UTILITIES
═══════════════════════════════════════════════ */
.section-pad { padding: 80px 0; }
.section-pad-sm { padding: 48px 0; }

/* ═══════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════
   MOBILE NAVIGATION ADAPTATION
   ═══════════════════════════════════════════════ */
@media (max-width: 860px) {
  .site-nav.mobile-open {
    background: var(--bg2) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .nav-burger {
    display: flex;
    margin-left: auto;
  }
  .nav-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    bottom: 0;
    background: var(--bg2);
    border-left: 1px solid var(--border);
    flex-direction: column;
    padding: 96px 24px 32px;
    gap: 32px;
    transform: translateX(100%);
    transition: transform var(--dur-mid) var(--ease-out);
    z-index: 199;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    align-items: stretch;
  }
  .site-nav.mobile-open .nav-menu {
    transform: translateX(0);
  }
  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    flex: none;
  }
  .nav-links a {
    font-size: 14px;
    padding: 12px 16px;
    width: 100%;
  }
  .nav-links a.active::after {
    display: none;
  }
  .nav-auth {
    margin-left: 0;
    margin-top: auto;
    width: 100%;
    justify-content: center;
  }
  .auth-pill {
    width: 100%;
    justify-content: space-between;
    padding: 6px 14px;
  }
  
  .site-nav.mobile-open .nav-burger span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
    background-color: var(--gold);
  }
  .site-nav.mobile-open .nav-burger span:nth-child(2) {
    opacity: 0;
  }
  .site-nav.mobile-open .nav-burger span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
    background-color: var(--gold);
  }
}

/* ═══════════════════════════════════════════════
   AI LEGAL ASSISTANT WIDGET
   ═══════════════════════════════════════════════ */
.ai-widget-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  font-family: 'Inter', system-ui, sans-serif;
}

/* Floating Action Button */
.ai-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, #b8942f 100%);
  border: 1px solid var(--border-hi);
  box-shadow: var(--shadow-gold), 0 4px 15px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #0a0800;
  transition: transform var(--dur-mid) var(--ease-out), box-shadow var(--dur-mid);
  position: relative;
  outline: none;
}
.ai-fab:hover {
  transform: scale(1.08) rotate(5deg);
  box-shadow: var(--shadow-gold-lg);
}
.ai-fab:active {
  transform: scale(0.95);
}

/* Red indicator dot */
.ai-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  background: var(--red);
  border: 2px solid var(--bg);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--red);
  animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(217, 85, 85, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(217, 85, 85, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(217, 85, 85, 0); }
}

/* Chat Window */
.ai-chat-window {
  display: none;
  flex-direction: column;
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 380px;
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-4), 0 0 32px rgba(201, 168, 76, 0.15);
  overflow: hidden;
  animation: slideUp var(--dur-mid) var(--ease-out);
  transform-origin: bottom right;
}
.ai-chat-window.open {
  display: flex;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Chat Header */
.ai-chat-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(180deg, var(--bg3) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.ai-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold-08);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 10px rgba(201, 168, 76, 0.15);
}
.ai-chat-title-group {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.ai-chat-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
  line-height: 1.2;
}
.ai-chat-status {
  font-size: 11px;
  color: var(--green);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}
.ai-chat-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px var(--green);
}
.ai-chat-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 20px;
  cursor: pointer;
  transition: color var(--dur-fast);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}
.ai-chat-close:hover {
  color: var(--red);
}

/* Chat Messages */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(6, 9, 16, 0.4);
}
/* Scrollbar */
.ai-chat-messages::-webkit-scrollbar { width: 3px; }
.ai-chat-messages::-webkit-scrollbar-track { background: transparent; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* Message Bubble */
.ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: fadeIn var(--dur-fast) ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-msg.user {
  align-self: flex-end;
}
.ai-msg.ai {
  align-self: flex-start;
}

.ai-msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}
.ai-msg.user .ai-msg-bubble {
  background: var(--gold-12);
  border: 1px solid rgba(201, 168, 76, 0.25);
  color: var(--text);
  border-bottom-right-radius: 2px;
}
.ai-msg.ai .ai-msg-bubble {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 2px;
}

/* Markdown styling inside AI bubble */
.ai-msg-bubble p {
  margin-bottom: 8px;
}
.ai-msg-bubble p:last-child {
  margin-bottom: 0;
}
.ai-msg-bubble ul, .ai-msg-bubble ol {
  padding-left: 20px;
  margin-bottom: 8px;
}
.ai-msg-bubble ul:last-child, .ai-msg-bubble ol:last-child {
  margin-bottom: 0;
}
.ai-msg-bubble li {
  margin-bottom: 4px;
}
.ai-msg-bubble strong {
  color: var(--gold);
}

.ai-msg-time {
  font-size: 10px;
  color: var(--text3);
  margin-top: 4px;
  padding: 0 4px;
}
.ai-msg.user .ai-msg-time {
  align-self: flex-end;
}
.ai-msg.ai .ai-msg-time {
  align-self: flex-start;
}

/* Typing indicator */
.ai-typing {
  align-self: flex-start;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-bottom-left-radius: 2px;
  padding: 12px 20px;
  display: none;
  align-items: center;
  gap: 4px;
}
.ai-typing span {
  width: 6px;
  height: 6px;
  background-color: var(--text3);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}
.ai-typing span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* Chat Input Area */
.ai-chat-input-area {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  background: var(--bg3);
  border-top: 1px solid var(--border);
  gap: 10px;
}
.ai-chat-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 20px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 8px 16px;
  outline: none;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
  transition: border-color var(--dur-fast);
}
.ai-chat-input:focus {
  border-color: var(--gold);
}
.ai-chat-input::placeholder {
  color: var(--text3);
}
.ai-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold-08);
  border: 1px solid var(--border2);
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--dur-fast);
  outline: none;
}
.ai-chat-send:hover {
  background: var(--gold);
  color: #0a0800;
  box-shadow: 0 0 10px rgba(201, 168, 76, 0.3);
  transform: scale(1.05);
}
.ai-chat-send:active {
  transform: scale(0.95);
}

/* Lock overlay when user is unauthorized */
.ai-chat-lock {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 16, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
  z-index: 5;
}
.ai-chat-lock-icon {
  font-size: 40px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 10px rgba(201, 168, 76, 0.2));
}
.ai-chat-lock-text {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 20px;
}

/* Resize Handles */
.ai-chat-resize-handle {
  position: absolute;
  z-index: 100;
  background: transparent;
}

.ai-chat-resize-handle.tl {
  top: 0;
  left: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
}

.ai-chat-resize-handle.tl::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  border-left: 2px solid rgba(201, 168, 76, 0.4);
  border-top: 2px solid rgba(201, 168, 76, 0.4);
  transition: border-color var(--dur-fast);
}

.ai-chat-resize-handle.tl:hover::before {
  border-left-color: var(--gold);
  border-top-color: var(--gold);
}

.ai-chat-resize-handle.t {
  top: 0;
  left: 16px;
  right: 0;
  height: 6px;
  cursor: ns-resize;
}

.ai-chat-resize-handle.l {
  top: 16px;
  bottom: 0;
  left: 0;
  width: 6px;
  cursor: ew-resize;
}

body.ai-resizing {
  user-select: none !important;
  -webkit-user-select: none !important;
}

@media (max-width: 480px) {
  .ai-chat-window {
    width: calc(100vw - 32px);
    right: 0;
    bottom: 72px;
    height: 480px;
  }
  .ai-chat-resize-handle {
    display: none !important; /* Отключаем ресайз на мобилках */
  }
}

