/* ══════════════════════════════════════════════════
   DSA CODE SHEET — STYLE.CSS
   Font: DM Mono + Clash Display + Satoshi
   Theme: Dark-first, geometric, editorial
══════════════════════════════════════════════════ */

/* ── VARIABLES ── */
:root {
  --bg:       #09090f;
  --bg2:      #0e0e1a;
  --bg3:      #131320;
  --surface:  rgba(255,255,255,0.04);
  --surface2: rgba(255,255,255,0.07);
  --border:   rgba(255,255,255,0.07);
  --border2:  rgba(255,255,255,0.13);
  --text:     #e2e2f0;
  --text2:    #8888aa;
  --text3:    #55556a;
  --accent:   #6c47ff;
  --accent2:  #a78bfa;
  --accent3:  #c4b5fd;
  --green:    #22d3a0;
  --green-bg: rgba(34,211,160,0.1);
  --amber:    #f59e0b;
  --amber-bg: rgba(245,158,11,0.1);
  --red:      #ff5555;
  --red-bg:   rgba(255,85,85,0.1);
  --radius:   12px;
  --radius-lg:18px;
  --radius-sm:8px;
  --font:     'Satoshi', sans-serif;
  --display:  'Clash Display', sans-serif;
  --mono:     'DM Mono', monospace;
  --sidebar-w:240px;
  --shadow:   0 8px 32px rgba(0,0,0,0.5);
  --glow:     0 0 40px rgba(108,71,255,0.18);
}

/* ── LIGHT THEME ── */
body.light-theme {
  --bg:       #f8f9fa;
  --bg2:      #ffffff;
  --bg3:      #f1f3f5;
  --surface:  rgba(0,0,0,0.03);
  --surface2: rgba(0,0,0,0.06);
  --border:   rgba(0,0,0,0.08);
  --border2:  rgba(0,0,0,0.12);
  --text:     #1a1b26;
  --text2:    #4a5568;
  --text3:    #718096;
  --glow:     0 0 40px rgba(108,71,255,0.1);
  --shadow:   0 8px 32px rgba(0,0,0,0.1);
}

body.light-theme .auth-grid {
  background-image:
    linear-gradient(rgba(0,0,0,0.03) 1px,transparent 1px),
    linear-gradient(90deg,rgba(0,0,0,0.03) 1px,transparent 1px);
}
body.light-theme .search-input,
body.light-theme .filter-select {
  border: 1.5px solid rgba(0,0,0,0.1);
  background: rgba(0,0,0,0.04);
}
body.light-theme .filter-select option {
  background: #ffffff;
  color: #1a1b26;
}
body.light-theme .prob-card.prob-locked {
  border-color: rgba(0,0,0,0.06);
  background: rgba(0,0,0,0.02);
}
body.light-theme .prob-card.prob-locked:hover {
  border-color: rgba(245,158,11,0.25);
  box-shadow: 0 0 20px rgba(245,158,11,0.1);
}

/* ── RESET ── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
button { cursor:pointer; font-family: var(--font); border:none; outline:none; }
input  { font-family: var(--font); outline:none; }
a      { color: inherit; }

/* ── SCREENS ── */
.screen { display:none; }
.screen.active { display:flex; }

/* ══════════════════════════════════════════════════
   AUTH SCREEN
══════════════════════════════════════════════════ */
#authScreen {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.auth-bg { position:fixed; inset:0; z-index:0; pointer-events:none; }
.auth-orb {
  position:absolute; border-radius:50%;
  filter: blur(100px); opacity:0.4;
}
.orb-1 { width:600px;height:600px; top:-200px;right:-150px; background:rgba(108,71,255,0.35); }
.orb-2 { width:500px;height:500px; bottom:-150px;left:-100px; background:rgba(34,211,160,0.18); }
.auth-grid {
  position:absolute; inset:0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px,transparent 1px),
    linear-gradient(90deg,rgba(255,255,255,0.02) 1px,transparent 1px);
  background-size: 48px 48px;
}

.auth-container {
  position:relative; z-index:1;
  width:100%; max-width:440px;
  display:flex; flex-direction:column; align-items:center; gap:1.5rem;
}

.auth-brand {
  display:flex; align-items:center; gap:0.65rem;
  font-family: var(--display);
  font-size: 1.6rem; font-weight:700;
  letter-spacing:-0.02em;
}
.brand-icon { color:var(--accent2); font-family:var(--mono); font-size:1.3rem; }
.brand-accent { color:var(--accent2); }

.auth-card {
  width:100%;
  background: var(--bg3);
  border:1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow);
  overflow:hidden;
}

.auth-tabs {
  display:grid; grid-template-columns:1fr 1fr;
  border-bottom:1px solid var(--border);
}
.auth-tab {
  padding:1rem;
  background:transparent;
  color:var(--text2);
  font-size:0.9rem; font-weight:500;
  border:none;
  transition:all 0.25s;
  border-bottom:2px solid transparent;
}
.auth-tab.active {
  color:var(--text);
  border-bottom-color:var(--accent);
  background:rgba(108,71,255,0.06);
}
.auth-tab:hover { color:var(--text); }

.auth-form { display:none; padding:1.75rem; flex-direction:column; gap:1.1rem; }
.auth-form.active { display:flex; }

.form-title { font-family:var(--display); font-size:1.3rem; font-weight:600; letter-spacing:-0.01em; }
.form-sub   { font-size:0.85rem; color:var(--text2); margin-top:-0.5rem; }

.field-group { display:flex; flex-direction:column; gap:0.45rem; }
.field-label { font-size:0.82rem; color:var(--text2); font-weight:500; }
.field-input {
  width:100%;
  padding:0.75rem 1rem;
  background:var(--bg2);
  border:1px solid var(--border2);
  border-radius:var(--radius-sm);
  color:var(--text);
  font-size:0.95rem;
  transition:border-color 0.2s, box-shadow 0.2s;
}
.field-input:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(108,71,255,0.15); }
.field-input::placeholder { color:var(--text3); }

.form-error {
  font-size:0.8rem; color:var(--red);
  min-height:1.1rem;
  background: var(--red-bg);
  border-radius:var(--radius-sm);
  padding:0.4rem 0.75rem;
  display:none;
}
.form-error:not(:empty) { display:block; }

.auth-footer { font-size:0.78rem; color:var(--text3); font-family:var(--mono); }

/* ── PRIMARY BUTTON ── */
.btn-primary {
  width:100%;
  padding:0.85rem 1.5rem;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border:none;
  border-radius:var(--radius-sm);
  color:#fff;
  font-size:0.95rem; font-weight:600;
  font-family:var(--font);
  display:flex; align-items:center; justify-content:center; gap:0.5rem;
  transition:transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.btn-primary:hover { transform:translateY(-2px); box-shadow:0 8px 24px rgba(108,71,255,0.4); }
.btn-primary:active { opacity:0.88; transform:none; }
.btn-arrow { font-family:var(--mono); }

/* ══════════════════════════════════════════════════
   APP SCREEN
══════════════════════════════════════════════════ */
#appScreen {
  min-height: 100vh;
  flex-direction: row;
  align-items: stretch;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right:1px solid var(--border);
  display:flex; flex-direction:column;
  position:sticky; top:0;
  height:100vh;
  flex-shrink:0;
  z-index:50;
  transition:transform 0.3s;
}

.sidebar-brand {
  padding:1.5rem 1.25rem 1rem;
  display:flex; align-items:center; gap:0.6rem;
  font-family:var(--display);
  font-size:1.25rem; font-weight:700;
  border-bottom:1px solid var(--border);
}

.sidebar-nav {
  flex:1;
  padding:1rem 0.75rem;
  display:flex; flex-direction:column; gap:0.35rem;
  overflow-y:auto; overflow-x:hidden;
}

.nav-item {
  display:flex; align-items:center; gap:0.85rem;
  padding:0.75rem 1rem;
  border-radius:var(--radius-sm);
  background:transparent;
  color:var(--text2);
  font-size:0.9rem; font-weight:500;
  text-align:left; width:100%;
  transition:all 0.2s;
  border:1px solid transparent;
}
.nav-item:hover { background:var(--surface2); color:var(--text); }
.nav-item.active { background:rgba(108,71,255,0.12); color:var(--accent3); border-color:rgba(108,71,255,0.2); }
.nav-icon { font-family:var(--mono); font-size:1rem; width:20px; text-align:center; position:relative; }
.unread-dot {
  position: absolute;
  top: -2px;
  right: -8px;
  width: 8px;
  height: 8px;
  background-color: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg2);
}

.sidebar-bottom {
  padding:0.75rem;
  border-top:1px solid var(--border);
  display:flex; flex-direction:column; gap:0.5rem;
}

.premium-badge {
  display:flex; align-items:center; gap:0.5rem;
  padding:0.5rem 1rem;
  background:linear-gradient(135deg,rgba(108,71,255,0.2),rgba(167,139,250,0.15));
  border:1px solid rgba(108,71,255,0.3);
  border-radius:var(--radius-sm);
  color:var(--accent3);
  font-size:0.82rem; font-weight:600; font-family:var(--mono);
}
.premium-star { color:var(--amber); }

.logout-btn { color:var(--text3) !important; }
.logout-btn:hover { color:var(--red) !important; background:var(--red-bg) !important; }

/* ── MOBILE HEADER ── */
.mobile-header {
  display:none;
  position:fixed; top:0; left:0; right:0;
  height:56px; z-index:60;
  background:var(--bg2);
  border-bottom:1px solid var(--border);
  padding:0 1rem;
  align-items:center;
  justify-content:space-between;
}
.hamburger {
  background:none; border:none;
  color:var(--text); font-size:1.25rem;
  padding:0.35rem 0.6rem;
}
.mobile-brand { font-family:var(--display); font-weight:700; font-size:1.15rem; }
.logout-btn-mobile {
  background:none; border:none;
  color:var(--text2); font-size:1.1rem; padding:0.35rem;
}

.sidebar-overlay {
  display:none;
  position:fixed; inset:0; z-index:49;
  background:rgba(0,0,0,0.5);
  backdrop-filter:blur(4px);
}
.sidebar-overlay.active { display:block; }

/* ── MAIN CONTENT ── */
.main-content {
  flex:1; min-width:0;
  padding:2rem 2.5rem;
  overflow-y:auto;
}

/* ── VIEW ── */
.view { display:none; animation:fadeUp 0.4s ease; }
.view.active { display:block; }
@keyframes fadeUp {
  from { opacity:0; transform:translateY(14px); }
  to   { opacity:1; transform:none; }
}

.view-header {
  display:flex; align-items:flex-start; justify-content:space-between;
  margin-bottom:1.75rem; gap:1rem; flex-wrap:wrap;
}
.view-title {
  font-family:var(--display);
  font-size:clamp(1.75rem,3vw,2.4rem);
  font-weight:700;
  letter-spacing:-0.03em;
  background:linear-gradient(135deg,var(--text) 0%,var(--accent2) 100%);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
}
.view-sub { font-size:0.9rem; color:var(--text2); margin-top:0.25rem; }

/* ── UNLOCK BUTTON ── */
.unlock-btn {
  display:inline-flex; align-items:center; gap:0.5rem;
  padding:0.65rem 1.25rem;
  background:linear-gradient(135deg,var(--amber),#f97316);
  border:none; border-radius:var(--radius-sm);
  color:#fff;
  font-size:0.85rem; font-weight:600;
  white-space:nowrap;
  transition:transform 0.2s, box-shadow 0.2s;
  flex-shrink:0;
}
.unlock-btn:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(245,158,11,0.4); }
.unlock-icon { color:var(--amber); filter:brightness(1.4); }

/* ── STATS STRIP ── */
.stats-strip {
  display:flex; gap:1rem;
  margin-bottom:2rem; flex-wrap:wrap;
}
.stat-chip {
  flex:1; min-width:100px;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:1.1rem 1.25rem;
  display:flex; flex-direction:column; align-items:center;
}
.stat-val {
  font-family:var(--mono);
  font-size:1.75rem; font-weight:600;
  color:var(--accent2);
  display:block;
}
.stat-lbl { font-size:0.75rem; color:var(--text2); margin-top:0.2rem; }

/* ── CATEGORY SECTIONS ── */
.cat-section {
  background:var(--bg2);
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  padding:1.5rem;
  margin-bottom:1.5rem;
  animation:fadeUp 0.4s ease backwards;
}

.cat-section-header {
  display:flex; justify-content:space-between; align-items:center;
  margin-bottom:1.5rem; gap:1rem; flex-wrap:wrap;
}
.cat-section-left {
  display:flex; align-items:center; gap:1rem;
}
.cat-section-icon {
  width:48px; height:48px;
  background:linear-gradient(135deg,rgba(108,71,255,0.2),rgba(167,139,250,0.1));
  border:1px solid rgba(108,71,255,0.25);
  border-radius:12px;
  display:flex; align-items:center; justify-content:center;
  font-size:1.4rem; font-family:var(--mono);
  color:var(--accent2); flex-shrink:0;
}
.cat-section-title {
  font-family:var(--display);
  font-size:1.1rem; font-weight:600;
  letter-spacing:-0.01em;
}
.cat-section-desc { font-size:0.82rem; color:var(--text2); margin-top:0.2rem; }

.cat-section-meta { display:flex; flex-direction:column; align-items:flex-end; gap:0.5rem; }
.cat-count { font-family:var(--mono); font-size:0.85rem; color:var(--text2); }
.cat-progress-bar {
  width:130px; height:5px;
  background:var(--surface2); border-radius:3px; overflow:hidden;
}
.cat-progress-fill {
  height:100%;
  background:linear-gradient(90deg,var(--accent),var(--accent2));
  border-radius:3px;
  transition:width 0.8s cubic-bezier(.4,0,.2,1);
}

/* ── PROBLEMS GRID ── */
.problems-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
  gap:0.85rem;
}

/* ── PROBLEM CARD ── */
.prob-card {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  transition:transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  position:relative; overflow:hidden;
}
.prob-card:hover { transform:translateY(-3px); border-color:var(--border2); box-shadow:var(--glow); }
.prob-card.prob-solved {
  border-color:rgba(34,211,160,0.3);
  background:rgba(34,211,160,0.04);
}
.prob-card.prob-locked {
  cursor:pointer;
  border-color:rgba(255,255,255,0.04);
  background:rgba(255,255,255,0.02);
}
.prob-card.prob-locked:hover {
  border-color:rgba(245,158,11,0.25);
  box-shadow:0 0 20px rgba(245,158,11,0.1);
}

.prob-card-inner { padding:1.1rem; display:flex; flex-direction:column; gap:0.7rem; }

.prob-card-top {
  display:flex; justify-content:space-between; align-items:center;
}

/* Custom Checkbox */
.prob-check-wrap { display:flex; align-items:center; cursor:pointer; }
.prob-checkbox { display:none; }
.prob-checkmark {
  width:22px; height:22px;
  border:2px solid var(--border2);
  border-radius:6px;
  display:flex; align-items:center; justify-content:center;
  transition:all 0.2s;
  flex-shrink:0;
}
.prob-check-wrap:hover .prob-checkmark { border-color:var(--green); }
.prob-checkbox:checked + .prob-checkmark {
  background:var(--green); border-color:var(--green);
}
.prob-checkbox:checked + .prob-checkmark::after {
  content:'✓'; color:#000; font-size:13px; font-weight:700;
}
[data-locked] .prob-checkmark { border-color:var(--border); opacity:0.4; cursor:not-allowed; }

.prob-badges { display:flex; gap:0.35rem; }
.badge {
  padding:0.15rem 0.45rem;
  border-radius:4px;
  font-size:0.68rem; font-weight:600; font-family:var(--mono);
}
.diff-easy   { background:var(--green-bg); color:var(--green); }
.diff-medium { background:var(--amber-bg); color:var(--amber); }
.src-gfg     { background:rgba(34,211,160,0.1); color:var(--green); }
.src-leetcode{ background:rgba(245,158,11,0.1); color:var(--amber); }

.prob-title-row {
  display:flex; align-items:flex-start; gap:0.5rem;
  flex: 1;
}
.lock-icon { font-size:0.9rem; flex-shrink:0; }
.prob-title { font-size:0.9rem; font-weight:500; line-height:1.4; }
.prob-solved .prob-title { text-decoration:line-through; color:var(--text2); }
.blurred { filter:blur(4px); user-select:none; opacity:0.5; color:var(--text3); }

.prob-actions {
  display:flex; gap:0.4rem; margin-left:auto; flex-shrink:0;
}
.prob-icon-btn {
  background:none; border:none; font-size:1.1rem; cursor:pointer; opacity:0.4; transition:all 0.2s;
  filter: grayscale(100%);
}
.prob-icon-btn:hover { opacity:1; transform:scale(1.1); filter: grayscale(0%); }
.bookmark-btn.active { opacity:1; filter: grayscale(0%); text-shadow: 0 0 8px rgba(245,158,11,0.5); }

textarea.field-input { resize:vertical; font-family:var(--font); }

.prob-open-btn {
  display:inline-flex; align-items:center;
  padding:0.5rem 0.9rem;
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  border-radius:var(--radius-sm);
  color:#fff;
  font-size:0.8rem; font-weight:500;
  text-decoration:none;
  transition:transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  width:fit-content;
}
.prob-open-btn:hover { transform:scale(1.04); box-shadow:0 4px 14px rgba(108,71,255,0.4); }

.prob-unlock-btn {
  display:inline-flex; align-items:center;
  padding:0.5rem 0.9rem;
  background:rgba(245,158,11,0.12);
  border:1px solid rgba(245,158,11,0.25);
  border-radius:var(--radius-sm);
  color:var(--amber);
  font-size:0.8rem; font-weight:500;
  width:fit-content;
  transition:all 0.2s;
}
.prob-unlock-btn:hover { background:rgba(245,158,11,0.2); }

/* ══════════════════════════════════════════════════
   PROFILE VIEW
══════════════════════════════════════════════════ */
.profile-card {
  background:var(--bg2);
  border:1px solid var(--border2);
  border-radius:var(--radius-lg);
  padding:1.75rem;
  display:flex; align-items:center; gap:1.5rem;
  margin-bottom:1.5rem;
}
.profile-avatar {
  width:72px; height:72px;
  border-radius:50%;
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  display:flex; align-items:center; justify-content:center;
  font-family:var(--display);
  font-size:2rem; font-weight:700; color:#fff;
  flex-shrink:0;
}
.profile-name  { font-family:var(--display); font-size:1.4rem; font-weight:600; letter-spacing:-0.01em; }
.profile-email { font-size:0.88rem; color:var(--text2); margin-top:0.25rem; font-family:var(--mono); }
.profile-badges { margin-top:0.5rem; }
.pbadge {
  display:inline-flex; align-items:center; gap:0.4rem;
  padding:0.25rem 0.75rem;
  background:linear-gradient(135deg,rgba(108,71,255,0.2),rgba(167,139,250,0.15));
  border:1px solid rgba(108,71,255,0.3);
  border-radius:50px;
  color:var(--accent3); font-size:0.78rem; font-weight:600; font-family:var(--mono);
}

.profile-stats-grid {
  display:grid; grid-template-columns:repeat(3,1fr);
  gap:1rem; margin-bottom:2rem;
}
.pstat {
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:1.25rem;
  text-align:center;
}
.pstat-val { display:block; font-family:var(--mono); font-size:2rem; font-weight:700; color:var(--accent2); }
.pstat-lbl { font-size:0.75rem; color:var(--text2); margin-top:0.2rem; }

.section-title {
  font-family:var(--display);
  font-size:1rem; font-weight:600;
  letter-spacing:-0.01em;
  margin-bottom:1rem; color:var(--text2);
  text-transform:uppercase; font-size:0.78rem; letter-spacing:0.08em;
}

.profile-progress-section { margin-bottom:2rem; }

.cprog-row {
  display:flex; justify-content:space-between; align-items:center;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:1rem 1.25rem;
  margin-bottom:0.65rem; gap:1rem;
}
.cprog-label {
  display:flex; align-items:center; gap:0.75rem;
  font-size:0.9rem; font-weight:500;
}
.cprog-icon { font-family:var(--mono); font-size:1.1rem; color:var(--accent2); }
.cprog-right { display:flex; align-items:center; gap:0.85rem; flex-shrink:0; }
.cprog-count { font-family:var(--mono); font-size:0.8rem; color:var(--text2); white-space:nowrap; }
.cprog-track { width:100px; height:5px; background:var(--surface2); border-radius:3px; overflow:hidden; }
.cprog-fill  { height:100%; background:linear-gradient(90deg,var(--accent),var(--accent2)); border-radius:3px; transition:width 0.6s ease; }

.profile-links-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:1.5rem; margin-bottom:2rem;
}
.profile-links-display { margin-top:1rem; }
.lc-stats-card {
  background:var(--bg2); border:1px solid var(--border2);
  border-radius:var(--radius-sm); padding:1rem; margin-bottom:1rem;
}
.lc-stat { font-family:var(--font); font-weight:500; font-size:0.85rem; color:var(--text2); }
.lc-stat span { font-family:var(--mono); font-weight:600; font-size:1.4rem; margin-right:4px; }

.profile-unlock-cta {
  background:linear-gradient(135deg,rgba(108,71,255,0.1),rgba(245,158,11,0.08));
  border:1px solid rgba(108,71,255,0.2);
  border-radius:var(--radius-lg);
  padding:1.5rem 1.75rem;
  display:flex; align-items:center; justify-content:space-between;
  gap:1rem; flex-wrap:wrap;
}
.profile-unlock-cta p { font-size:0.9rem; color:var(--text2); }

/* ══════════════════════════════════════════════════
   LEADERBOARD & CHAT
══════════════════════════════════════════════════ */
/* ── LEADERBOARD ── */
.leaderboard-list { display:flex; flex-direction:column; gap:0.85rem; padding-bottom: 2rem; }
.lb-row {
  display:flex; align-items:center; gap:1.25rem;
  padding:1.2rem 1.25rem; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); transition:all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation:fadeUp 0.5s ease backwards;
  position: relative;
  overflow: hidden;
}
.lb-row:hover { transform:translateY(-3px); box-shadow:var(--glow); border-color:var(--border2); }
.lb-gold { background: linear-gradient(90deg, rgba(255,215,0,0.08), transparent); border-left: 4px solid #ffd700; }
.lb-silver { background: linear-gradient(90deg, rgba(192,192,192,0.08), transparent); border-left: 4px solid #c0c0c0; }
.lb-bronze { background: linear-gradient(90deg, rgba(205,127,50,0.08), transparent); border-left: 4px solid #cd7f32; }
.lb-current-user { border: 2px solid var(--accent); background: rgba(108,71,255,0.05); }

.lb-rank { font-family:var(--mono); font-size:1.4rem; font-weight:700; color:var(--text3); width:45px; text-align:center; flex-shrink:0; }
.lb-gold .lb-rank { font-size: 1.8rem; filter: drop-shadow(0 2px 4px rgba(255,215,0,0.5)); }
.lb-silver .lb-rank { font-size: 1.6rem; }
.lb-bronze .lb-rank { font-size: 1.6rem; }

.lb-avatar-wrap {
  width: 52px; height: 52px; border-radius: 50%; overflow: hidden;
  background: var(--bg3); border: 2px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.lb-avatar { width: 100%; height: 100%; object-fit: cover; }
.lb-gold .lb-avatar-wrap { border-color: #ffd700; box-shadow: 0 0 15px rgba(255,215,0,0.3); }
.lb-silver .lb-avatar-wrap { border-color: #c0c0c0; }
.lb-bronze .lb-avatar-wrap { border-color: #cd7f32; }

.lb-info { flex:1; display:flex; justify-content:space-between; align-items:center; flex-wrap: wrap; gap:1rem; }
.lb-name-group { display:flex; align-items:center; gap:0.75rem; flex-wrap: wrap; }
.lb-name { font-weight:600; font-size:1.1rem; font-family:var(--display); letter-spacing:-0.01em; }

.lb-premium-badge { font-size: 0.75rem; color: var(--amber); background: rgba(245,158,11,0.1); padding: 0.2rem 0.6rem; border-radius: 6px; font-weight: 600; font-family:var(--mono); border: 1px solid rgba(245,158,11,0.2); }
.lb-you-badge { font-size: 0.75rem; color: #fff; background: var(--accent); padding: 0.2rem 0.6rem; border-radius: 6px; font-weight: 600; font-family:var(--mono); box-shadow: 0 0 10px rgba(108,71,255,0.4); }

.lb-score-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; min-width:130px; }
.lb-score { font-family:var(--mono); color:var(--accent2); font-weight:700; font-size:1rem; }
.lb-bar-bg { width: 100%; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.lb-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent3)); border-radius: 3px; }
.lb-gold .lb-bar-fill { background: linear-gradient(90deg, #f59e0b, #ffd700); }
.lb-silver .lb-bar-fill { background: linear-gradient(90deg, #9ca3af, #d1d5db); }
.lb-bronze .lb-bar-fill { background: linear-gradient(90deg, #cd7f32, #fcd34d); }

/* ── CHAT ── */
.chat-container {
  display:flex; flex-direction:column; background:var(--surface);
  border:1px solid var(--border); border-radius:var(--radius-lg);
  height:60vh; max-height:600px; overflow:hidden;
}
.chat-messages {
  flex:1; padding:1.5rem; overflow-y:auto;
  display:flex; flex-direction:column; gap:1rem;
}
.chat-msg { display:flex; flex-direction:column; max-width:80%; }
.msg-me { align-self:flex-end; align-items:flex-end; }
.msg-other { align-self:flex-start; align-items:flex-start; }
.msg-sender { font-size:0.75rem; color:var(--text3); margin-bottom:0.2rem; }
.msg-bubble {
  padding:0.75rem 1rem; border-radius:12px; font-size:0.9rem; line-height:1.4;
}
.msg-me .msg-bubble { background:linear-gradient(135deg,var(--accent),var(--accent2)); color:#fff; border-bottom-right-radius:0; }
.msg-other .msg-bubble { background:var(--bg3); border:1px solid var(--border); border-bottom-left-radius:0; }
.chat-input-area {
  display:flex; gap:0.5rem; padding:1rem; border-top:1px solid var(--border);
  background:var(--bg2);
}
.chat-input-area input {
  flex:1; padding:0.75rem 1rem; border-radius:var(--radius-sm);
  border:1px solid var(--border2); background:transparent; color:var(--text);
}
.light-theme .chat-input-area input {
  background:var(--surface); border-color:var(--border2);
}

/* ══════════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════════ */
.modal-overlay {
  display:none;
  position:fixed; inset:0; z-index:900;
  background:rgba(0,0,0,0.7);
  backdrop-filter:blur(8px);
  align-items:center; justify-content:center;
  padding:1rem;
  animation:fadeIn 0.2s ease;
}
.modal-overlay.active { display:flex; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.modal-card {
  background:var(--bg3);
  border:1px solid var(--border2);
  border-radius:var(--radius-lg);
  padding:2rem 2.25rem;
  width:100%; max-width:420px;
  position:relative;
  box-shadow:var(--shadow);
  animation:slideUp 0.3s ease;
}
@keyframes slideUp { from{transform:translateY(24px);opacity:0} to{transform:none;opacity:1} }

.modal-close {
  position:absolute; top:1rem; right:1rem;
  width:32px; height:32px;
  background:var(--surface2); border:1px solid var(--border);
  border-radius:50%; color:var(--text);
  font-size:1.1rem; display:flex; align-items:center; justify-content:center;
  transition:all 0.2s;
}
.modal-close:hover { background:var(--red-bg); color:var(--red); }

.modal-icon { font-size:2.5rem; margin-bottom:0.75rem; display:block; }
.modal-title {
  font-family:var(--display);
  font-size:1.5rem; font-weight:700;
  letter-spacing:-0.02em; margin-bottom:0.75rem;
}
.modal-desc { font-size:0.9rem; color:var(--text2); line-height:1.65; margin-bottom:1.25rem; }

.modal-features {
  list-style:none;
  margin-bottom:1.5rem;
  display:flex; flex-direction:column; gap:0.5rem;
}
.modal-features li {
  font-size:0.88rem; color:var(--text2);
  padding:0.45rem 0.75rem;
  background:var(--green-bg);
  border-radius:var(--radius-sm);
  color:var(--green);
}

.modal-price {
  font-family:var(--mono);
  font-size:2.25rem; font-weight:600;
  color:var(--accent2); margin-bottom:1.25rem;
}
.modal-price-sub { font-size:0.85rem; color:var(--text2); }

.modal-secure {
  text-align:center;
  font-size:0.78rem; color:var(--text3);
  margin-top:0.85rem; font-family:var(--mono);
}

.lock-modal .modal-desc strong { color:var(--amber); }
.modal-cancel {
  display:block; width:100%; margin-top:0.75rem;
  padding:0.7rem;
  background:transparent; border:1px solid var(--border);
  border-radius:var(--radius-sm);
  color:var(--text2); font-size:0.85rem;
  transition:all 0.2s;
}
.modal-cancel:hover { background:var(--surface2); color:var(--text); }

/* ══════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════ */
.toast-zone {
  position:fixed;
  bottom:1.5rem; right:1.5rem;
  display:flex; flex-direction:column; gap:0.5rem;
  z-index:9999; pointer-events:none;
}
.toast {
  display:flex; align-items:center; gap:0.65rem;
  padding:0.8rem 1.1rem;
  background:var(--bg3);
  border:1px solid var(--border2);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  font-size:0.88rem;
  white-space:nowrap;
  opacity:0; transform:translateX(20px);
  transition:opacity 0.3s, transform 0.3s;
}
.toast.show { opacity:1; transform:none; }
.toast-success { border-left:3px solid var(--green); }
.toast-error   { border-left:3px solid var(--red); }
.toast-info    { border-left:3px solid var(--accent2); }
.toast-dot {
  width:8px; height:8px; border-radius:50%;
  background:var(--green);
  flex-shrink:0;
}
.toast-error .toast-dot   { background:var(--red); }
.toast-info  .toast-dot   { background:var(--accent2); }

/* ══════════════════════════════════════════════════
   SCROLLBAR
══════════════════════════════════════════════════ */
::-webkit-scrollbar { width:5px; height:5px; }
::-webkit-scrollbar-track { background:var(--bg); }
::-webkit-scrollbar-thumb { background:var(--accent); border-radius:3px; }

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar {
    position:fixed; top:0; left:0; bottom:0;
    transform:translateX(-100%);
    z-index:100;
  }
  .sidebar.open { transform:none; }
  .mobile-header { display:flex; }
  .main-content { padding:5rem 1.25rem 2rem; }
  .profile-stats-grid { grid-template-columns:repeat(3,1fr); }
  .problems-grid { grid-template-columns:1fr 1fr; }
}

@media (max-width: 560px) {
  .problems-grid { grid-template-columns:1fr; }
  .profile-stats-grid { grid-template-columns:repeat(3,1fr); }
  .cat-section-header { flex-direction:column; align-items:flex-start; }
  .cat-section-meta { align-items:flex-start; }
  .cat-progress-bar { width:160px; }
  .profile-card { flex-direction:column; align-items:flex-start; }
  .profile-unlock-cta { flex-direction:column; }
  .cprog-track { width:70px; }
  .stats-strip { gap:0.75rem; }
  .stat-chip { padding:0.85rem 1rem; }
  .stat-val { font-size:1.4rem; }
  .modal-card { padding: 1.5rem; }
  .lb-info { flex-direction:column; align-items:flex-start; gap:0.75rem; }
  .lb-score-wrap { align-items: flex-start; width: 100%; min-width: auto; }
  .chat-container { height: 75vh; }
  .chat-msg { max-width: 95%; }
  .lc-stats-card > div:nth-child(2) { flex-direction: column; gap: 0.5rem; }
}
