:root {
  --bg-0: #0a0a0e;
  --bg-1: #11121a;
  --bg-2: #1a1c28;
  --bg-3: #232636;
  --line: #2a2d3e;
  --text: #e8eaf2;
  --text-dim: #9ea2b8;
  --text-faint: #6a6f86;
  --accent: #ff4d5a;
  --accent-2: #b974ff;
  --accent-3: #5b8cff;
  --ok: #4ade80;
  --warn: #f59e0b;
  --err: #ef4444;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(185,116,255,0.10), transparent),
    radial-gradient(900px 500px at -10% 30%, rgba(255,77,90,0.08), transparent),
    var(--bg-0);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* =================== TOPBAR =================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(10, 10, 14, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 32px; }

.logo {
  display: flex; align-items: center; gap: 9px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}
.logo-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.6s ease-in-out infinite;
}
.logo-text { font-size: 15px; color: var(--text); letter-spacing: 0.5px; }
.logo-sub  { font-size: 11px; color: var(--accent); letter-spacing: 1.5px; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.8); }
}

.tabs { display: flex; gap: 6px; }
.tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 12px;
  letter-spacing: 1.2px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { color: var(--text); background: var(--bg-2); }
.tab.active {
  color: var(--text);
  background: var(--bg-2);
  box-shadow: inset 0 -2px 0 var(--accent);
}

#auth-area { display: flex; align-items: center; gap: 10px; }

.topbar-right { display: flex; align-items: center; gap: 14px; }

.lang-switcher {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
}
.lang-btn {
  background: transparent; border: none; padding: 4px;
  border-radius: 5px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, transform 0.1s;
  opacity: 0.55;
}
.lang-btn:hover { opacity: 1; background: var(--bg-3); }
.lang-btn.active { opacity: 1; background: var(--bg-3); box-shadow: inset 0 -2px 0 var(--accent); }
.lang-btn img {
  width: 22px; height: 16px;
  display: block;
  border-radius: 2px;
  object-fit: cover;
}

.auth-username {
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}
.auth-username::before {
  content: '@';
  color: var(--accent-2);
  margin-right: 2px;
}

/* =================== BUTTONS =================== */
.btn {
  border: none;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.15s ease;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 4px 14px rgba(255,77,90,0.25);
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--bg-3); }

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--err);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.btn-sm { padding: 6px 10px; font-size: 11px; }

/* =================== PAGES =================== */
.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 40px 28px 100px;
}

.hero {
  text-align: center;
  margin-bottom: 36px;
}
.hero-title {
  font-size: 32px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  letter-spacing: -0.5px;
}
.hero-sub {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 14px;
}

/* =================== SEARCH CARD =================== */
.search-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 28px;
}
.search-row {
  display: flex; gap: 10px;
}
.search-row input {
  flex: 1;
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 15px;
  padding: 14px 18px;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}
.search-row input:focus { border-color: var(--accent); }
.search-row .btn { padding: 14px 22px; font-size: 13px; }

.deep-toggle {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 12px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: var(--text-dim);
}
.deep-toggle input { display: none; }
.deep-toggle-track {
  position: relative;
  width: 34px; height: 18px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: background 0.18s;
}
.deep-toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: var(--text-faint);
  border-radius: 50%;
  transition: all 0.18s ease;
}
.deep-toggle input:checked + .deep-toggle-track {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: var(--accent);
}
.deep-toggle input:checked + .deep-toggle-track .deep-toggle-thumb {
  left: 18px;
  background: white;
}
.deep-toggle:hover .deep-toggle-label { color: var(--text); }

.translation-box {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--bg-2);
  border-radius: 8px;
  border-left: 3px solid var(--accent-2);
  font-size: 13px;
}
.trans-label { color: var(--text-faint); margin-right: 8px; }
.trans-value { color: var(--accent-2); font-weight: 600; font-family: 'JetBrains Mono', monospace; }

.progress { margin-top: 18px; }
.progress-bar {
  height: 4px; background: var(--bg-2); border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
  transition: width 0.3s ease;
}
.progress-meta {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-size: 12px; color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}

/* =================== SEARCH LAYOUT =================== */
.search-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
}

.activity, .results {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.panel-title {
  font-size: 11px;
  letter-spacing: 1.5px;
  font-weight: 600;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: 14px;
  display: inline-block;
}

.log-list {
  max-height: 65vh; overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.log-item {
  padding: 6px 8px;
  border-radius: 4px;
  border-left: 2px solid transparent;
  margin-bottom: 3px;
  color: var(--text-dim);
  line-height: 1.4;
}
.log-item.searching { border-color: var(--accent-3); }
.log-item.success   { border-color: var(--ok); color: var(--text); }
.log-item.empty     { border-color: var(--text-faint); color: var(--text-faint); }
.log-item.info      { border-color: var(--accent-2); }
.log-item .site     { color: var(--text); font-weight: 600; }
.log-item .count    { color: var(--accent); font-weight: 600; }

.results-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.results-count {
  background: var(--bg-2);
  padding: 4px 10px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}
.results-list { max-height: 65vh; overflow-y: auto; }

.results-toolbar {
  display: flex; gap: 8px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}
.results-toolbar input,
.results-toolbar select {
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.results-toolbar input { flex: 1; min-width: 160px; }
.results-toolbar select { cursor: pointer; min-width: 130px; }
.results-toolbar input:focus,
.results-toolbar select:focus { border-color: var(--accent); }

.result-actions {
  display: inline-flex; gap: 4px;
  margin-left: auto;
}
.result-action-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-faint);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.15s;
}
.result-action-btn:hover { color: var(--accent); border-color: var(--accent); }
.result-action-btn.copied { color: var(--ok); border-color: var(--ok); }

.result-meta-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; color: var(--text-faint);
}

.history-actions {
  display: inline-flex; gap: 6px;
  align-items: center;
}
.history-rerun {
  background: rgba(91, 140, 255, 0.12);
  color: var(--accent-3);
  border: 1px solid rgba(91, 140, 255, 0.25);
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.15s;
}
.history-rerun:hover { background: rgba(91, 140, 255, 0.25); }

.history-export {
  display: inline-flex; gap: 6px;
  margin-bottom: 16px;
}
.history-export .btn-sm { font-family: 'JetBrains Mono', monospace; font-size: 11px; }

/* ============== VOTE WIDGET ============== */
.vote-widget {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px;
  margin-left: 4px;
}
.vote-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  font-size: 12px;
  transition: all 0.15s;
}
.vote-btn:hover { background: var(--bg-3); color: var(--text); }
.vote-btn.up.active   { color: var(--ok);  background: rgba(74, 222, 128, 0.15); }
.vote-btn.down.active { color: var(--err); background: rgba(239, 68, 68, 0.15); }
.vote-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  min-width: 22px;
  text-align: center;
  color: var(--text);
  padding: 0 4px;
}
.vote-score.pos { color: var(--ok); }
.vote-score.neg { color: var(--err); }

.comments-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-faint);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.15s;
}
.comments-btn:hover { color: var(--accent-2); border-color: var(--accent-2); }

/* ============== SUBTABS (community inner tabs) ============== */
.subtabs {
  display: flex; gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.subtab {
  background: transparent;
  border: none;
  color: var(--text-faint);
  padding: 10px 16px;
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.subtab:hover { color: var(--text); }
.subtab.active {
  color: var(--accent-2);
  border-bottom-color: var(--accent-2);
}

/* ============== COMMUNITY FEED ============== */
.feed-item {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 8px;
  transition: all 0.15s;
}
.feed-item:hover { background: var(--bg-2); border-color: var(--accent-3); }
.feed-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
}
.feed-info { flex: 1; min-width: 0; }
.feed-line1 { display: flex; align-items: baseline; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.feed-user {
  color: var(--accent-2);
  font-weight: 600;
  cursor: pointer;
}
.feed-user:hover { text-decoration: underline; }
.feed-action { color: var(--text-faint); font-size: 12px; }
.feed-q {
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg-3);
  padding: 1px 7px;
  border-radius: 4px;
}
.feed-q:hover { color: var(--accent); }
.feed-meta {
  display: flex; gap: 10px; align-items: center;
  font-size: 11px; color: var(--text-faint);
  margin-top: 4px;
  font-family: 'JetBrains Mono', monospace;
}
.feed-meta .count {
  color: var(--accent);
  font-weight: 700;
}

/* ============== TRENDING ============== */
.trending-section { margin-bottom: 28px; }
.trending-row {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 6px;
  transition: all 0.15s;
  cursor: pointer;
}
.trending-row:hover { background: var(--bg-2); border-color: var(--accent-2); }
.trending-rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-faint);
  width: 32px;
}
.trending-row:nth-child(1) .trending-rank { color: var(--accent); }
.trending-row:nth-child(2) .trending-rank { color: var(--accent-2); }
.trending-row:nth-child(3) .trending-rank { color: var(--accent-3); }
.trending-q {
  flex: 1; color: var(--text); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.trending-stats { font-size: 11px; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; }
.trending-stats strong { color: var(--accent); }

/* ============== LEADERBOARD ============== */
.lb-row {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 40px 38px 1fr auto auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 6px;
  transition: all 0.15s;
}
.lb-row:hover { background: var(--bg-2); border-color: var(--accent-2); }
.lb-row.top1 { border-color: var(--accent); box-shadow: 0 0 18px rgba(255, 77, 90, 0.15); }
.lb-row.top2 { border-color: var(--accent-2); }
.lb-row.top3 { border-color: var(--accent-3); }
.lb-rank {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-faint);
}
.lb-row.top1 .lb-rank { color: var(--accent); }
.lb-row.top2 .lb-rank { color: var(--accent-2); }
.lb-row.top3 .lb-rank { color: var(--accent-3); }
.lb-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white;
  font-family: 'JetBrains Mono', monospace;
}
.lb-info { min-width: 0; }
.lb-user {
  color: var(--accent-2); font-weight: 600; cursor: pointer;
  display: block;
}
.lb-user:hover { text-decoration: underline; }
.lb-meta {
  font-size: 11px; color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}
.lb-badges { display: inline-flex; gap: 4px; }
.lb-points {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.badge-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-pill.newbie  { background: rgba(106, 111, 134, 0.2); color: var(--text-dim); }
.badge-pill.hunter  { background: rgba(74, 222, 128, 0.18); color: var(--ok); }
.badge-pill.scout   { background: rgba(91, 140, 255, 0.18); color: var(--accent-3); }
.badge-pill.veteran { background: rgba(185, 116, 255, 0.18); color: var(--accent-2); }
.badge-pill.legend  { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white; box-shadow: 0 0 12px rgba(255,77,90,0.5); }

/* ============== PROFILE PAGE ============== */
.profile-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 18px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.profile-avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 800; color: white;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.profile-name { font-size: 26px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.profile-name::before { content: '@'; color: var(--accent-2); margin-right: 2px; }
.profile-role {
  display: inline-block;
  background: var(--bg-3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  font-family: 'JetBrains Mono', monospace;
  margin-left: 6px;
}
.profile-role.admin { background: rgba(255,77,90,0.18); color: var(--accent); }
.profile-bio {
  color: var(--text-dim);
  margin: 8px 0;
  font-size: 14px;
}
.profile-stats {
  display: flex; gap: 24px;
  margin-top: 14px;
}
.profile-stat-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  font-weight: 600;
}
.profile-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
}
.profile-badges-row {
  margin-top: 14px;
  display: flex; gap: 6px; flex-wrap: wrap;
}

.profile-settings {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
}
.profile-settings h3 {
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 14px;
}
.profile-settings textarea {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 70px;
  margin-bottom: 12px;
}
.profile-settings textarea:focus { border-color: var(--accent); }
.privacy-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

/* ============== COMMENTS MODAL ============== */
.comments-modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 600px; max-width: calc(100vw - 32px);
  max-height: 80vh;
  display: flex; flex-direction: column;
  z-index: 101;
  overflow: hidden;
}
.comments-modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.comments-modal-head h3 { margin: 0; font-size: 14px; color: var(--text); }
.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 22px;
}
.comment-item {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-2);
  margin-bottom: 8px;
}
.comment-head {
  display: flex; gap: 8px; align-items: baseline;
  margin-bottom: 4px;
}
.comment-user { color: var(--accent-2); font-weight: 600; font-size: 13px; cursor: pointer; }
.comment-user:hover { text-decoration: underline; }
.comment-time { font-size: 11px; color: var(--text-faint); font-family: 'JetBrains Mono', monospace; }
.comment-body { color: var(--text); font-size: 13px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; }
.comments-form {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex; gap: 8px;
}
.comments-form input {
  flex: 1;
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  outline: none;
  font-size: 13px;
  font-family: inherit;
}
.comments-form input:focus { border-color: var(--accent); }

/* ============== CLICKED LINK BADGE ============== */
.result-item.clicked {
  background: rgba(91, 140, 255, 0.04);
  border-left: 2px solid var(--accent-3);
  padding-left: 12px;
}
.result-item.clicked .result-title {
  color: var(--accent-3);
}
.clicked-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(91, 140, 255, 0.15);
  color: var(--accent-3);
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}
.clicked-badge::before {
  content: '✓';
  font-size: 11px;
}

/* ============== CLICKS / ACESSOS TAB ============== */
.clicks-search {
  background: var(--bg-1) !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
  padding: 8px 14px !important;
  border-radius: 8px !important;
  font-family: inherit !important;
  font-size: 12px !important;
  min-width: 220px !important;
  outline: none !important;
}
.clicks-search:focus { border-color: var(--accent) !important; }

.clicks-stats {
  display: flex; gap: 18px;
  margin-bottom: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
}
.clicks-stats .ck-stat-num {
  color: var(--accent);
  font-weight: 700;
  margin-right: 4px;
}

.clicks-list {
  display: flex; flex-direction: column; gap: 6px;
}
.click-row {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 14px;
  align-items: center;
  transition: all 0.15s;
}
.click-row:hover {
  background: var(--bg-2);
  border-color: var(--accent-3);
}
.click-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.4;
}
.click-time strong {
  color: var(--text);
  display: block;
  font-weight: 600;
}
.click-info { min-width: 0; }
.click-title {
  color: var(--accent-3);
  font-weight: 500;
  font-size: 14px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}
.click-title:hover { color: var(--accent); text-decoration: underline; }
.click-meta {
  display: flex; flex-wrap: wrap; gap: 8px;
  font-size: 11px;
  color: var(--text-faint);
}
.click-meta .ck-query {
  color: var(--accent-2);
  font-family: 'JetBrains Mono', monospace;
}
.click-meta .ck-query::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 5px;
  vertical-align: -2px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.8 18a7.2 7.2 0 1 1 0-14.4 7.2 7.2 0 0 1 0 14.4Zm5.1-1.1 4.5 4.5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.8 18a7.2 7.2 0 1 1 0-14.4 7.2 7.2 0 0 1 0 14.4Zm5.1-1.1 4.5 4.5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.click-meta .ck-forum {
  color: var(--text-dim);
}
.click-actions {
  display: inline-flex; gap: 4px;
}

@media (max-width: 700px) {
  .click-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .click-time { font-size: 10px; }
}

/* ============== STATS DASHBOARD ============== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.stat-label {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.1;
}
.stat-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.stats-section {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.stats-section h3 {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}

.top-list {
  display: flex; flex-direction: column; gap: 6px;
}
.top-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: var(--bg-2);
  border-radius: 6px;
  transition: background 0.15s;
}
.top-row:hover { background: var(--bg-3); }
.top-rank {
  width: 24px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
}
.top-name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
}
.top-bar {
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  flex: 0 0 80px;
  overflow: hidden;
}
.top-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.activity-chart {
  display: flex; align-items: flex-end; gap: 4px;
  height: 100px;
  padding: 8px 0;
}
.activity-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  position: relative;
  transition: all 0.15s;
  cursor: pointer;
}
.activity-bar:hover { filter: brightness(1.4); }
.activity-bar[data-count="0"] { background: var(--bg-3); }
.activity-bar::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-3);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.activity-bar:hover::after { opacity: 1; }

.result-item {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  margin-bottom: 6px;
  transition: all 0.15s;
}
.result-item:hover {
  background: var(--bg-2);
  border-color: var(--line);
}
.result-title {
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.4;
  display: block;
  margin-bottom: 4px;
}
.result-title:hover { color: var(--accent); }
.result-meta {
  display: flex; gap: 10px; align-items: center;
  font-size: 11px; color: var(--text-faint);
}
.result-source {
  padding: 2px 7px; border-radius: 3px;
  background: var(--bg-3);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
}
.result-source.live   { color: var(--accent-3); }
.result-source.search { color: var(--ok); }
.result-source.deep   { color: var(--accent-2); }
.result-source.google { color: var(--warn); }
.result-source.cache  { color: var(--text-faint); }
.result-forum { color: var(--text-dim); }

.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--text-faint);
}
.empty-icon { font-size: 48px; margin-bottom: 10px; opacity: 0.3; }
.empty-text { color: var(--text-faint); font-size: 14px; }

/* =================== HISTORY =================== */
.page-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 24px;
}
.page-title { font-size: 24px; font-weight: 700; color: var(--text); }
.page-sub { color: var(--text-dim); margin-top: 4px; font-size: 13px; }

.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; transition: all 0.15s;
}
.history-item:hover { background: var(--bg-2); border-color: var(--accent); }
.history-q { color: var(--text); font-weight: 600; font-size: 14px; }
.history-trans { color: var(--accent-2); font-family: 'JetBrains Mono', monospace; font-size: 12px; margin-top: 2px; }
.history-meta { color: var(--text-faint); font-size: 11px; margin-top: 4px; font-family: 'JetBrains Mono', monospace; }
.history-count {
  background: var(--bg-3);
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
}
.history-delete {
  background: transparent;
  color: var(--text-faint);
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 0 8px;
  transition: color 0.15s;
}
.history-delete:hover { color: var(--err); }

.history-detail {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  margin-top: 16px;
}
.history-back {
  display: inline-block; margin-bottom: 16px;
  color: var(--text-dim); cursor: pointer;
}
.history-back:hover { color: var(--text); }

/* =================== FORUMS GRID =================== */
.forums-controls {
  display: flex; align-items: center; gap: 12px;
}
.forums-stats {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-1);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 8px;
}
.forums-stats .stat-on   { color: var(--ok); }
.forums-stats .stat-off  { color: var(--err); }
.forums-stats .stat-deg  { color: var(--warn); }
.forums-stats .stat-num  { font-weight: 700; }

.forums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.forum-card {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  transition: all 0.2s ease;
  overflow: hidden;
}
.forum-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--text-faint);
  opacity: 0.5;
}
.forum-card.online::before    { background: var(--ok);   box-shadow: 0 0 12px var(--ok); }
.forum-card.degraded::before  { background: var(--warn); box-shadow: 0 0 12px var(--warn); }
.forum-card.offline::before   { background: var(--err);  box-shadow: 0 0 12px var(--err); }
.forum-card.loading::before   { background: var(--accent-3); animation: shimmer 1.4s ease-in-out infinite; }

@keyframes shimmer {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

.forum-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.forum-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.forum-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
  margin-right: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.forum-status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.forum-card.online    .forum-status-dot { background: var(--ok);   box-shadow: 0 0 8px var(--ok); animation: pulse 2s ease-in-out infinite; }
.forum-card.degraded  .forum-status-dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.forum-card.offline   .forum-status-dot { background: var(--err);  box-shadow: 0 0 8px var(--err); }
.forum-card.loading   .forum-status-dot { background: var(--accent-3); animation: pulse 0.8s ease-in-out infinite; }

.forum-host {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forum-meta {
  display: flex; justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.forum-status-label {
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 700;
}
.forum-card.online    .forum-status-label { color: var(--ok); }
.forum-card.degraded  .forum-status-label { color: var(--warn); }
.forum-card.offline   .forum-status-label { color: var(--err); }
.forum-card.loading   .forum-status-label { color: var(--accent-3); }

.forum-latency {
  color: var(--text-faint);
}
.forum-latency.fast  { color: var(--ok); }
.forum-latency.slow  { color: var(--warn); }

.forum-charset {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg-3);
  border-radius: 3px;
  font-size: 9px;
  color: var(--accent-2);
  margin-left: 6px;
}

/* =================== MODAL =================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  z-index: 100;
}
.modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 380px; max-width: calc(100vw - 32px);
  z-index: 101;
  overflow: hidden;
}
.modal-tabs {
  display: flex; align-items: center;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.modal-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 14px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-tab:hover { color: var(--text); }
.modal-tab.active {
  color: var(--text);
  background: var(--bg-1);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.modal-close {
  background: transparent; border: none;
  color: var(--text-dim);
  font-size: 24px; padding: 0 16px;
  cursor: pointer;
}
.modal-close:hover { color: var(--err); }

.modal-form { padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.modal-form label {
  font-size: 12px; color: var(--text-dim);
  font-weight: 500;
}
.modal-form .hint { color: var(--text-faint); font-weight: 400; }
.modal-form input {
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  margin-bottom: 6px;
}
.modal-form input:focus { border-color: var(--accent); }
.modal-form .btn { margin-top: 10px; padding: 12px; justify-content: center; }
.form-error {
  color: var(--err);
  font-size: 12px;
  min-height: 18px;
  margin-top: 6px;
  text-align: center;
}

/* =================== FOOTER =================== */
.footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 10px 28px;
  background: rgba(10,10,14,0.85);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--text-faint);
  display: flex; gap: 10px; justify-content: center; align-items: center;
  letter-spacing: 0.5px;
}
.footer b { color: var(--accent-2); font-weight: 600; }
.footer .dot { color: var(--text-faint); opacity: 0.5; }

/* =================== NAV DROPDOWN (More) =================== */
.tab-dropdown { position: relative; display: inline-block; }
.tab-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  display: none;
  z-index: 100;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.tab-dropdown.open .tab-dropdown-menu { display: flex; flex-direction: column; gap: 2px; }
.tab-menu-item {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 8px 12px;
  text-align: left;
  border-radius: 5px;
  font-size: 12px;
  letter-spacing: 1.2px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.tab-menu-item:hover { color: var(--text); background: var(--bg-2); }
.tab-menu-item.active { color: var(--accent); background: var(--bg-2); }

/* =================== USER MENU (avatar dropdown) =================== */
.user-menu { position: relative; }
.user-menu-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.user-menu-trigger:hover { background: var(--bg-3); border-color: var(--accent); }
.user-menu-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  overflow: hidden;
  flex-shrink: 0;
}
.user-menu-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-menu-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-menu-name::before { content: '@'; color: var(--accent-2); margin-right: 2px; }
.user-menu-caret { font-size: 10px; color: var(--text-faint); }

.user-menu-panel {
  position: absolute;
  top: calc(100% + 8px); right: 0;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  min-width: 240px;
  z-index: 200;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.user-menu.open .user-menu-panel { display: block; }
.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.user-menu-item:hover { background: var(--bg-2); }
.user-menu-item.danger { color: var(--err); }
.user-menu-item.danger:hover { background: rgba(239, 68, 68, 0.1); }
.user-menu-divider { height: 1px; background: var(--line); margin: 6px 0; }
.user-menu-header {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.user-menu-header .user-menu-name { font-size: 15px; max-width: 100%; }
.user-menu-header .user-menu-email { font-size: 11px; color: var(--text-faint); margin-top: 4px; word-break: break-all; }

/* =================== SETTINGS PAGE =================== */
.settings-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
}
.settings-nav {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: flex; flex-direction: column; gap: 2px;
  height: fit-content;
  position: sticky; top: 80px;
}
.settings-nav-item {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 10px 14px;
  text-align: left;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.settings-nav-item:hover { background: var(--bg-2); color: var(--text); }
.settings-nav-item.active { background: var(--bg-3); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.settings-nav-item.danger { color: var(--err); margin-top: 10px; border-top: 1px solid var(--line); padding-top: 14px; }

.settings-content {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px;
  min-height: 400px;
}
.settings-section h2 {
  font-size: 18px; font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}
.settings-section .section-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 22px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 18px;
  margin-bottom: 22px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.3px;
}
.form-field label .hint { color: var(--text-faint); font-weight: 400; margin-left: 4px; }
.form-field input,
.form-field textarea,
.form-field select {
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: var(--accent); }
.form-field textarea { min-height: 80px; resize: vertical; }
.form-field input[type="color"] {
  padding: 4px; height: 40px; cursor: pointer; width: 80px;
}

.toggle-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  gap: 14px;
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row-info { flex: 1; }
.toggle-row-title { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.toggle-row-sub { font-size: 12px; color: var(--text-faint); line-height: 1.4; }

.toggle-switch {
  position: relative;
  width: 42px; height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-switch input { display: none; }
.toggle-switch .track {
  position: absolute; inset: 0;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 22px;
  transition: background 0.18s;
}
.toggle-switch .thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--text-faint);
  border-radius: 50%;
  transition: all 0.18s ease;
}
.toggle-switch input:checked + .track {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: var(--accent);
}
.toggle-switch input:checked + .track .thumb { left: 22px; background: white; }

.settings-save-bar {
  display: flex; gap: 10px; align-items: center;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.saved-flash { color: var(--ok); font-size: 12px; opacity: 0; transition: opacity 0.2s; }
.saved-flash.show { opacity: 1; }

/* =================== AVATAR / COVER UPLOAD WIDGETS =================== */
.avatar-edit {
  position: relative;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; font-weight: 800; color: white;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.avatar-edit img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-edit-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.18s;
  cursor: pointer;
  font-size: 11px; color: white; letter-spacing: 0.5px;
  text-align: center;
}
.avatar-edit:hover .avatar-edit-overlay { opacity: 1; }

.cover-edit {
  position: relative;
  width: 100%;
  height: 200px;
  background: var(--bg-2);
  border-radius: 12px;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
  border: 2px dashed var(--line);
  margin-bottom: 14px;
}
.cover-edit.has-image { border-style: solid; }
.cover-edit img { width: 100%; height: 100%; object-fit: cover; }
.cover-edit-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.6));
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity 0.18s;
  cursor: pointer;
  padding-bottom: 14px;
  color: white; font-size: 13px;
}
.cover-edit:hover .cover-edit-overlay { opacity: 1; }
.upload-input { display: none; }

/* =================== PROFILE PAGE REDESIGN =================== */
.profile-cover {
  height: 220px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-3));
  border-radius: 14px 14px 0 0;
  overflow: hidden;
  position: relative;
}
.profile-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.profile-card-v2 {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 18px;
  overflow: visible;
}
.profile-body {
  padding: 0 28px 24px;
  margin-top: -56px;
  display: flex; gap: 22px; align-items: flex-end;
  flex-wrap: wrap;
}
.profile-avatar-v2 {
  width: 132px; height: 132px;
  border-radius: 50%;
  border: 5px solid var(--bg-1);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 50px; font-weight: 800; color: white;
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.profile-avatar-v2 img { width: 100%; height: 100%; object-fit: cover; }
.profile-info-v2 { flex: 1; min-width: 220px; padding-bottom: 6px; }
.profile-display-name {
  font-size: 24px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.profile-username-v2 {
  color: var(--text-faint);
  font-size: 14px;
  font-weight: 500;
  margin-top: 2px;
}
.profile-username-v2::before { content: '@'; color: var(--accent-2); }
.profile-bio-v2 { color: var(--text-dim); margin: 12px 0; font-size: 14px; line-height: 1.5; }
.profile-extra {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12px; color: var(--text-faint);
}
.profile-extra a { color: var(--accent-3); }
.profile-extra a:hover { text-decoration: underline; }
.profile-socials {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 12px;
}
.profile-social-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-dim);
  transition: all 0.15s;
  cursor: pointer;
  text-decoration: none;
}
.profile-social-link:hover { background: var(--bg-3); color: var(--text); border-color: var(--accent); }
.profile-actions-v2 {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 8px;
}

@media (max-width: 700px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .profile-body { padding: 0 18px 18px; margin-top: -40px; }
  .profile-avatar-v2 { width: 90px; height: 90px; font-size: 34px; }
}

/* =================== SOCIAL: TOPBAR ICONS + BADGES =================== */
.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--bg-2); border-color: var(--accent); }
.unread-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--accent);
  color: white;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
  box-shadow: 0 0 8px rgba(255,77,90,0.5);
}

/* =================== NOTIFICATION PANEL =================== */
.notif-panel {
  position: fixed;
  top: 60px; right: 20px;
  width: 340px; max-width: calc(100vw - 32px);
  max-height: 70vh;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.notif-panel.open { display: flex; }
.notif-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px;
  color: var(--text);
}
.notif-list { overflow-y: auto; flex: 1; }
.notif-row {
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--bg-2);
  transition: background 0.12s;
  font-size: 13px;
  color: var(--text);
}
.notif-row:hover { background: var(--bg-2); }
.notif-row.unread { background: rgba(91, 140, 255, 0.06); border-left: 2px solid var(--accent-3); }
.notif-row.unread:hover { background: rgba(91, 140, 255, 0.12); }
.notif-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* =================== FRIENDS DRAWER =================== */
.friends-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 340px; max-width: 90vw;
  background: var(--bg-1);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 20px rgba(0,0,0,0.3);
  z-index: 199;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex; flex-direction: column;
}
.friends-drawer.open { transform: translateX(0); }
.fd-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.fd-head h3 { margin: 0; font-size: 14px; letter-spacing: 1.2px; color: var(--text); text-transform: uppercase; }
.fd-body { overflow-y: auto; flex: 1; padding: 12px; }
.fd-section-title {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  margin: 14px 0 6px;
  padding: 0 4px;
}
.fd-search {
  background: var(--bg-2);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}
.fd-search input {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.fd-search input:focus { border-color: var(--accent); }
.fd-search-results { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.fd-search-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px;
  border-radius: 6px;
}
.fd-search-row:hover { background: var(--bg-3); }
.fd-avatar {
  position: relative;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: white; font-size: 13px;
  flex-shrink: 0;
}
.fd-presence {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-1);
}
.fd-presence.on  { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.fd-presence.off { background: var(--text-faint); }
.fd-name {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fd-name:hover { color: var(--accent); }
.friend-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px;
  background: var(--bg-2);
  border-radius: 8px;
  margin-bottom: 4px;
  transition: background 0.12s;
}
.friend-row:hover { background: var(--bg-3); }
.friend-row.offline { opacity: 0.65; }
.friend-name {
  flex: 1;
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.friend-name:hover { color: var(--accent); }
.friend-actions {
  display: inline-flex; gap: 4px;
  flex-shrink: 0;
}
.friend-actions .btn { padding: 4px 8px; font-size: 11px; position: relative; }
.friend-actions .unread-badge {
  position: static;
  margin-left: 4px;
  min-width: 16px; height: 14px;
  font-size: 9px;
  display: inline-flex;
}

/* =================== DM MODAL =================== */
.dm-modal {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 380px; max-width: calc(100vw - 32px);
  height: 500px; max-height: calc(100vh - 80px);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  z-index: 195;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.dm-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-2);
}
.dm-head h3 { margin: 0; font-size: 13px; color: var(--text); }
.dm-list { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.dm-msg { max-width: 78%; padding: 8px 12px; border-radius: 12px; word-wrap: break-word; }
.dm-msg.mine {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border-bottom-right-radius: 4px;
}
.dm-msg.theirs {
  align-self: flex-start;
  background: var(--bg-3);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.dm-msg-body { font-size: 13px; line-height: 1.4; }
.dm-msg-time {
  font-size: 10px;
  margin-top: 2px;
  opacity: 0.65;
  font-family: 'JetBrains Mono', monospace;
}
.typing-indicator { opacity: 0.6; font-style: italic; }
.dm-form { padding: 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; background: var(--bg-2); }
.dm-form input {
  flex: 1;
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.dm-form input:focus { border-color: var(--accent); }

/* =================== CHAT PAGE (full-tab layout) =================== */
.chat-stats {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-1);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 8px;
}
.chat-stats .stat-num { color: var(--ok); font-weight: 700; margin-right: 4px; }

.chat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  height: calc(100vh - 240px);
  min-height: 420px;
}

.chat-sidebar {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  overflow-y: auto;
}
.chat-online-list {
  margin-top: 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.chat-online-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s;
}
.chat-online-row:hover { background: var(--bg-2); }
.chat-online-row .fd-avatar {
  width: 26px; height: 26px;
  font-size: 12px;
}
.chat-online-row .chat-online-name {
  flex: 1;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-main {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.chat-messages-page {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.chat-msg {
  padding: 6px 10px;
  border-radius: 6px;
  line-height: 1.5;
  word-wrap: break-word;
  font-size: 14px;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.chat-msg:hover { background: var(--bg-2); }
.chat-msg-user {
  color: var(--accent-2);
  font-weight: 600;
  cursor: pointer;
}
.chat-msg-user:hover { text-decoration: underline; }
.chat-msg-body { color: var(--text); }
.chat-msg-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-faint);
  margin-left: auto;
  opacity: 0.75;
}

.chat-form-page {
  display: flex; gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.chat-form-page input {
  flex: 1;
  background: var(--bg-0);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.chat-form-page input:focus { border-color: var(--accent); }
.chat-form-page .btn { padding: 12px 22px; }

.page-chat { display: flex; flex-direction: column; }
.page-chat .page-header { margin-bottom: 18px; }

@media (max-width: 700px) {
  .chat-layout { grid-template-columns: 1fr; height: calc(100vh - 220px); }
  .chat-sidebar { display: none; }
}

/* =================== WALL POSTS (on profile) =================== */
.wall-list { display: flex; flex-direction: column; gap: 8px; }
.wall-post {
  background: var(--bg-2);
  border-radius: 8px;
  padding: 10px 14px;
}
.wall-head {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
}
.wall-author { color: var(--accent-2); font-weight: 600; cursor: pointer; }
.wall-author:hover { text-decoration: underline; }
.wall-time { color: var(--text-faint); font-family: 'JetBrains Mono', monospace; }
.wall-body {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
[data-del-post] { margin-left: auto; }

/* =================== TOAST =================== */
#toast-wrap {
  position: fixed;
  bottom: 60px; left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--accent-2);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  pointer-events: auto;
  transition: opacity 0.4s, transform 0.4s;
}
.toast.fade { opacity: 0; transform: translateY(20px); }

/* =================== RESPONSIVE =================== */
@media (max-width: 900px) {
  .search-layout { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .topbar-left { gap: 16px; }
  .page { padding: 24px 16px 80px; }
  .hero-title { font-size: 24px; }
}

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--line); }

/* =================== JOTAGAME MODERN THEME REFRESH =================== */
:root {
  --bg-0: #06090d;
  --bg-1: #0b1118;
  --bg-2: #101923;
  --bg-3: #172434;
  --line: #263748;
  --line-soft: rgba(117, 219, 238, 0.16);
  --text: #edf7f8;
  --text-dim: #9eb3bd;
  --text-faint: #647984;
  --accent: #24d6f2;
  --accent-2: #ffba55;
  --accent-3: #5f8dff;
  --ok: #39d98a;
  --warn: #f5b544;
  --err: #ff5b6e;
  --panel-glow: 0 18px 70px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255,255,255,0.035);
}

html,
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-0);
}

body {
  background:
    radial-gradient(900px 460px at 50% -120px, rgba(36, 214, 242, 0.12), transparent 64%),
    radial-gradient(720px 420px at 88% 8%, rgba(255, 186, 85, 0.08), transparent 66%),
    linear-gradient(180deg, #06090d 0%, #080b10 44%, #05070b 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(117, 219, 238, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 219, 238, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.72), transparent 72%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 9, 13, 0), rgba(6, 9, 13, .86));
}

.topbar {
  min-height: 66px;
  padding: 12px 26px;
  background: rgba(6, 10, 15, 0.82);
  border-bottom: 1px solid rgba(117, 219, 238, 0.18);
  box-shadow: 0 18px 50px rgba(0,0,0,0.28);
}

.topbar-left {
  gap: 26px;
}

.logo {
  gap: 12px;
  font-family: 'Sora', Inter, sans-serif;
}

.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 20px rgba(36, 214, 242, .46);
  transform: rotate(45deg);
}

.logo-text {
  color: #f6fbfb;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
}

.logo-sub {
  padding: 2px 5px;
  border: 1px solid rgba(255, 186, 85, .38);
  border-radius: 5px;
  color: var(--accent-2);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: .8px;
}

.tabs {
  gap: 4px;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #93a4b0;
  font-size: 11px;
  letter-spacing: .9px;
  background: transparent;
}

.tab::before,
.lf-icon {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.tab::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.8 18a7.2 7.2 0 1 1 0-14.4 7.2 7.2 0 0 1 0 14.4Zm5.1-1.1 4.5 4.5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.tab[data-tab="community"]::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm8-1a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7ZM2 21c.8-4 3.2-6 6-6s5.2 2 6 6M13 19c.8-2.6 2.5-4 4.7-4 2.1 0 3.8 1.4 4.3 4' fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round'/%3E%3C/svg%3E");
}

.tab[data-tab="chat"]::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 5h16v11H9l-5 4V5Z' fill='none' stroke='black' stroke-width='2.2' stroke-linejoin='round'/%3E%3Cpath d='M8 9h8M8 13h5' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.tab[data-tab="history"]::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12a8 8 0 1 0 2.3-5.7L4 8.6V3' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M12 7v5l3 2' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.tab[data-tab="clicks"]::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.5 14.5 14.5 9.5M8.5 9.5 7 11a4 4 0 0 0 5.7 5.7l1-1M15.5 14.5l1.5-1.5A4 4 0 0 0 11.3 7.3l-1 1' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.tab[data-tab="stats"]::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 19V9m7 10V5m7 14v-7' stroke='black' stroke-width='2.8' stroke-linecap='round'/%3E%3C/svg%3E");
}

.tab[data-tab="profile"]::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 12a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9Zm-8 9c1-4.6 4-7 8-7s7 2.4 8 7' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.tab[data-tab="forums"]::before {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 5h7v6H4V5Zm9 0h7v6h-7V5ZM4 13h7v6H4v-6Zm9 0h7v6h-7v-6Z' fill='none' stroke='black' stroke-width='2.1' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.tab:hover {
  color: #eaf8fa;
  background: rgba(36, 214, 242, 0.08);
  border-color: rgba(36, 214, 242, 0.18);
}

.tab.active {
  color: #061116;
  background: linear-gradient(135deg, #7decff, #ffcf86);
  box-shadow: 0 10px 26px rgba(36, 214, 242, 0.14);
}

.tab.active::before {
  background: #061116;
}

.topbar-right {
  gap: 10px;
}

.lang-switcher {
  border-radius: 10px;
  background: rgba(15, 25, 35, .9);
  border-color: rgba(117, 219, 238, .22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}

.lang-btn {
  min-width: 34px;
  min-height: 28px;
  border: 1px solid transparent;
}

.lang-btn.active {
  border-color: rgba(255, 186, 85, .6);
  background: rgba(255, 186, 85, .1);
  box-shadow: none;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(15, 25, 35, .72);
  border-color: rgba(117, 219, 238, .18);
  color: var(--text-dim);
}

.icon-btn:hover {
  color: var(--accent);
  background: rgba(36, 214, 242, .1);
  border-color: rgba(36, 214, 242, .34);
}

.lf-icon-users {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8Zm8-1a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7ZM2 21c.8-4 3.2-6 6-6s5.2 2 6 6M13 19c.8-2.6 2.5-4 4.7-4 2.1 0 3.8 1.4 4.3 4' fill='none' stroke='black' stroke-width='2.1' stroke-linecap='round'/%3E%3C/svg%3E");
}

.lf-icon-bell {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 9a6 6 0 1 0-12 0c0 7-3 7-3 9h18c0-2-3-2-3-9ZM10 21h4' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.lf-icon-search {
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10.8 18a7.2 7.2 0 1 1 0-14.4 7.2 7.2 0 0 1 0 14.4Zm5.1-1.1 4.5 4.5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.page {
  max-width: 1280px;
  padding-top: 44px;
}

.hero {
  margin: 2px auto 30px;
}

.hero-title {
  font-family: 'Sora', Inter, sans-serif;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #f7ffff 0%, #86efff 42%, #ffd28c 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-sub {
  color: #abc3cd;
  font-size: 14px;
}

.search-card,
.activity,
.results,
.history-item,
.history-detail,
.forum-card,
.feed-item,
.trending-row,
.lb-row,
.profile-card,
.profile-settings,
.chat-sidebar,
.chat-main,
.notif-panel,
.friends-drawer,
.modal,
.dm-modal,
.comments-modal {
  border-color: rgba(117, 219, 238, 0.16);
  background:
    linear-gradient(180deg, rgba(16, 25, 35, .92), rgba(9, 15, 22, .96));
  box-shadow: var(--panel-glow);
}

.search-card {
  position: relative;
  padding: 24px;
  border-radius: 18px;
  overflow: hidden;
}

.search-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: .76;
}

.search-row {
  gap: 12px;
}

.search-row input,
.modal-form input,
.profile-settings textarea,
.dm-form input,
.chat-form-page input,
.results-toolbar input,
.results-toolbar select,
.clicks-search,
.fd-search input {
  background: rgba(4, 8, 12, .82);
  border-color: rgba(117, 219, 238, .18);
  border-radius: 12px;
  color: var(--text);
}

.search-row input {
  min-height: 52px;
  padding: 15px 18px;
}

.search-row input:focus,
.modal-form input:focus,
.profile-settings textarea:focus,
.dm-form input:focus,
.chat-form-page input:focus,
.results-toolbar input:focus,
.results-toolbar select:focus,
.fd-search input:focus {
  border-color: rgba(36, 214, 242, .72);
  box-shadow: 0 0 0 3px rgba(36, 214, 242, .1);
}

.btn {
  border-radius: 11px;
  font-weight: 800;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #7a7cff 52%, var(--accent-2));
  color: #061116;
  box-shadow: 0 14px 34px rgba(36, 214, 242, .18);
}

.btn-ghost {
  background: rgba(15, 25, 35, .82);
  border-color: rgba(117, 219, 238, .18);
}

.btn-danger {
  background: rgba(255, 91, 110, .1);
  border-color: rgba(255, 91, 110, .32);
}

.deep-toggle-track {
  background: rgba(23, 36, 52, .95);
  border-color: rgba(117, 219, 238, .22);
}

.deep-toggle input:checked + .deep-toggle-track {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.progress-fill {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.panel-title,
.page-sub,
.empty-text,
.result-meta,
.history-meta,
.forum-host {
  color: var(--text-faint);
}

.page-title {
  font-family: 'Sora', Inter, sans-serif;
  font-size: 26px;
  font-weight: 800;
}

.empty-state {
  padding: 74px 20px;
}

.empty-icon {
  width: 74px;
  height: 74px;
  display: inline-grid;
  place-items: center;
  margin: 0 auto 16px;
  border: 1px solid rgba(117, 219, 238, .18);
  border-radius: 22px;
  background: rgba(15, 25, 35, .68);
  color: var(--accent);
  opacity: 1;
}

.empty-icon .lf-icon {
  width: 34px;
  height: 34px;
}

.result-item,
.click-item,
.wall-post,
.comment-item {
  border-radius: 12px;
  background: rgba(5, 10, 15, .58);
  border-color: rgba(117, 219, 238, .12);
}

.result-item:hover,
.history-item:hover,
.forum-card:hover,
.feed-item:hover,
.trending-row:hover,
.lb-row:hover {
  border-color: rgba(36, 214, 242, .36);
  background: rgba(16, 27, 38, .92);
  transform: translateY(-1px);
}

.result-title:hover,
.feed-user,
.lb-user,
.chat-msg-user,
.wall-author {
  color: var(--accent);
}

.result-source {
  border-radius: 999px;
  background: rgba(36, 214, 242, .08);
}

.results-count,
.history-count,
.forums-stats,
.chat-stats {
  border-radius: 999px;
  color: var(--accent);
  background: rgba(36, 214, 242, .08);
  border: 1px solid rgba(36, 214, 242, .15);
}

.forum-card::before {
  height: 3px;
}

.forum-card.online::before {
  background: linear-gradient(90deg, var(--ok), var(--accent));
}

.forum-card.degraded::before {
  background: linear-gradient(90deg, var(--warn), var(--accent-2));
}

.forum-card.offline::before {
  background: linear-gradient(90deg, var(--err), #ff9aa7);
}

.feed-avatar,
.lb-avatar,
.profile-avatar,
.fd-avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent-3), var(--accent-2));
  color: #061116;
}

.subtabs {
  border-bottom-color: rgba(117, 219, 238, .16);
}

.subtab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.chat-layout {
  gap: 18px;
}

.chat-msg {
  border-radius: 10px;
}

.chat-msg:hover {
  background: rgba(36, 214, 242, .06);
}

.footer {
  background: rgba(6, 10, 15, 0.86);
  border-top-color: rgba(117, 219, 238, 0.16);
}

.footer b {
  color: var(--accent);
}

@media (max-width: 1100px) {
  .tabs {
    overflow-x: auto;
    max-width: calc(100vw - 360px);
    padding-bottom: 2px;
  }
  .tab {
    white-space: nowrap;
  }
}

@media (max-width: 900px) {
  .tabs {
    max-width: 100%;
  }
  .tab::before {
    display: none;
  }
  .topbar-right {
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  .topbar {
    align-items: flex-start;
    padding: 10px 12px;
    gap: 10px;
  }

  .topbar-left {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

  .logo {
    min-height: 36px;
  }

  .tabs {
    order: 3;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    min-height: 34px;
    padding: 8px 10px;
    font-size: 10px;
    letter-spacing: .65px;
    white-space: nowrap;
  }

  .tab::before {
    display: inline-block;
    width: 14px;
    height: 14px;
  }

  .topbar-right {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
  }

  #auth-area {
    gap: 8px;
  }

  .btn-sm {
    padding: 7px 10px;
  }

  .page {
    width: 100%;
    padding: 34px 16px 86px;
  }

  .hero {
    margin-bottom: 26px;
  }

  .hero-title {
    font-size: 32px;
    line-height: 1.1;
    letter-spacing: 0;
  }

  .hero-sub {
    max-width: 100%;
    padding: 0 4px;
    line-height: 1.45;
  }

  .search-card {
    padding: 16px;
    border-radius: 16px;
  }

  .search-row {
    flex-direction: column;
  }

  .search-row input {
    width: 100%;
    min-width: 0;
  }

  .search-row .btn {
    width: 100%;
    justify-content: center;
    white-space: normal;
  }

  .deep-toggle {
    align-items: flex-start;
  }

  .empty-state {
    padding: 50px 10px;
  }

  .footer {
    min-height: auto;
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 10px;
  }
}

@media (max-width: 430px) {
  .hero-title {
    font-size: 30px;
  }

  .logo-text {
    font-size: 15px;
  }

  .lang-btn {
    min-width: 32px;
  }
}

/* =================== COMPLETE MOBILE APP LAYOUT =================== */
@media (max-width: 760px) {
  *,
  *::before,
  *::after {
    min-width: 0;
  }

  #app {
    width: 100%;
    overflow: hidden;
  }

  .topbar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 12px;
    row-gap: 10px;
  }

  .topbar-left {
    display: contents;
  }

  .logo {
    order: 1;
    min-height: 36px;
    gap: 9px;
  }

  .logo-dot {
    width: 11px;
    height: 11px;
  }

  .logo-sub {
    padding: 2px 5px;
    font-size: 8px;
  }

  .topbar-right {
    order: 2;
    width: auto;
    max-width: calc(100% - 138px);
    margin-left: auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .lang-switcher {
    padding: 2px;
    gap: 2px;
    border-radius: 9px;
  }

  .lang-btn {
    width: 31px;
    min-width: 31px;
    height: 28px;
    padding: 3px;
  }

  .lang-btn img {
    width: 21px;
    height: 15px;
  }

  .icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  #auth-area {
    flex: 0 1 auto;
    gap: 6px;
  }

  #auth-area .btn {
    min-height: 34px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 11px;
    letter-spacing: 0;
    white-space: nowrap;
  }

  .auth-username {
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }

  .tabs {
    order: 3;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    gap: 6px;
    overflow: visible;
    padding: 2px 0 0;
  }

  .tab {
    min-height: 52px;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 7px 3px;
    border-radius: 11px;
    font-size: 9px;
    line-height: 1.1;
    letter-spacing: .4px;
    text-align: center;
  }

  .tab::before {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin: 0;
  }

  .page {
    padding: 30px 14px 104px;
  }

  .hero {
    max-width: 100%;
    margin: 4px auto 24px;
  }

  .hero-title {
    max-width: 100%;
    font-size: 30px;
    line-height: 1.08;
    text-wrap: balance;
  }

  .hero-sub,
  .page-sub,
  .empty-text {
    font-size: 13px;
    line-height: 1.45;
  }

  .search-card,
  .activity,
  .results,
  .history-item,
  .history-detail,
  .forum-card,
  .feed-item,
  .trending-row,
  .lb-row,
  .profile-card,
  .profile-settings,
  .stats-section,
  .stat-card,
  .chat-sidebar,
  .chat-main {
    border-radius: 14px;
  }

  .search-card {
    padding: 16px;
    margin-bottom: 22px;
  }

  .search-row {
    flex-direction: column;
    gap: 10px;
  }

  .search-row input {
    min-height: 50px;
    font-size: 14px;
  }

  .search-row .btn,
  .modal-form .btn,
  .profile-settings .btn,
  .comments-form .btn,
  .dm-form .btn,
  .chat-form-page .btn {
    width: 100%;
    justify-content: center;
  }

  .translation-box,
  .progress-meta {
    line-height: 1.45;
  }

  .progress-meta {
    flex-direction: column;
    gap: 4px;
  }

  .search-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .activity,
  .results {
    padding: 15px;
  }

  .log-list,
  .results-list {
    max-height: none;
    overflow: visible;
  }

  .results-header,
  .result-meta,
  .result-meta-row,
  .click-meta,
  .forum-meta,
  .feed-meta {
    flex-wrap: wrap;
  }

  .results-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .results-toolbar input,
  .results-toolbar select,
  .clicks-search {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 42px;
  }

  .result-item {
    padding: 13px;
  }

  .result-title,
  .click-title,
  .forum-name,
  .forum-host,
  .top-name,
  .trending-q {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .result-actions {
    width: 100%;
    margin: 10px 0 0;
    flex-wrap: wrap;
  }

  .result-action-btn,
  .comments-btn,
  .history-rerun,
  .history-delete {
    min-height: 34px;
  }

  .vote-widget {
    margin: 8px 0 0;
  }

  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 18px;
  }

  .page-title {
    font-size: 23px;
    line-height: 1.16;
  }

  .forums-controls,
  .history-export {
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    width: 100%;
  }

  .forums-controls .btn,
  .history-export .btn,
  #history-clear-all,
  #clicks-clear-all,
  #forums-refresh {
    width: 100%;
    justify-content: center;
  }

  .forums-stats,
  .chat-stats,
  .results-count,
  .history-count {
    width: 100%;
    text-align: center;
  }

  .history-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 11px;
    padding: 15px;
  }

  .history-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .history-rerun {
    justify-content: center;
  }

  .history-delete {
    width: 42px;
    border: 1px solid rgba(255, 91, 110, .2);
    border-radius: 10px;
    background: rgba(255, 91, 110, .06);
  }

  .history-detail {
    padding: 16px;
  }

  .forums-grid,
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .forum-card {
    padding: 15px;
  }

  .forum-meta {
    gap: 8px;
  }

  .subtabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    border-bottom: none;
    margin-bottom: 14px;
  }

  .subtab {
    min-height: 40px;
    padding: 8px 6px;
    border: 1px solid rgba(117, 219, 238, .14);
    border-radius: 10px;
    font-size: 10px;
    letter-spacing: .4px;
  }

  .subtab.active {
    background: rgba(36, 214, 242, .08);
    border-color: rgba(36, 214, 242, .4);
  }

  .feed-item {
    align-items: flex-start;
    padding: 13px;
    gap: 11px;
  }

  .feed-avatar,
  .lb-avatar {
    width: 34px;
    height: 34px;
  }

  .feed-line1 {
    line-height: 1.35;
  }

  .trending-row {
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: start;
    gap: 8px 10px;
    padding: 13px;
  }

  .trending-stats {
    grid-column: 2;
  }

  .lb-row {
    grid-template-columns: 30px 34px 1fr;
    gap: 10px;
    padding: 13px;
  }

  .lb-badges,
  .lb-points {
    grid-column: 3;
  }

  .lb-points {
    font-size: 15px;
  }

  .profile-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 22px 16px;
  }

  .profile-avatar {
    width: 82px;
    height: 82px;
    font-size: 30px;
  }

  .profile-name {
    font-size: 23px;
  }

  .profile-stats {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .profile-stat-value {
    font-size: 19px;
  }

  .profile-settings {
    padding: 16px;
  }

  .privacy-row {
    align-items: flex-start;
    line-height: 1.4;
  }

  .clicks-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 12px;
  }

  .click-row {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 14px;
  }

  .click-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 27px;
  }

  .top-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .top-bar {
    flex-basis: 100%;
    order: 5;
  }

  .activity-chart {
    height: 86px;
    gap: 3px;
  }

  .modal {
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    max-height: calc(100dvh - 24px);
    transform: none;
    border-radius: 18px;
  }

  .modal-tabs {
    min-height: 52px;
  }

  .modal-form {
    padding: 18px;
  }

  .modal-form input {
    min-height: 44px;
  }

  .notif-panel {
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    max-height: 72dvh;
    border-radius: 18px;
  }

  .friends-drawer {
    width: 100%;
    max-width: none;
    border-left: none;
  }

  .fd-head {
    padding: 14px 16px;
  }

  .fd-body {
    padding: 10px;
  }

  .friend-row,
  .fd-search-row {
    min-height: 48px;
  }

  .friend-actions {
    gap: 5px;
  }

  .friend-actions .btn {
    min-height: 32px;
  }

  .comments-modal,
  .dm-modal {
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-width: none;
    height: auto;
    max-height: calc(100dvh - 20px);
    transform: none;
    border-radius: 18px;
  }

  .comments-list,
  .dm-list {
    max-height: 52dvh;
  }

  .comments-form,
  .dm-form,
  .chat-form-page {
    flex-direction: column;
    padding: 12px;
  }

  .comments-form input,
  .dm-form input,
  .chat-form-page input {
    min-height: 44px;
  }

  .page-chat {
    min-height: auto;
  }

  .chat-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    gap: 12px;
  }

  .chat-sidebar {
    display: block;
    max-height: 132px;
    padding: 13px;
  }

  .chat-online-list {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .chat-online-list::-webkit-scrollbar {
    display: none;
  }

  .chat-online-row {
    min-width: max-content;
    background: rgba(4, 8, 12, .42);
    border: 1px solid rgba(117, 219, 238, .12);
  }

  .chat-main {
    min-height: 480px;
  }

  .chat-messages-page {
    min-height: 360px;
    padding: 13px;
  }

  .chat-msg {
    align-items: flex-start;
    gap: 5px 8px;
    padding: 8px 9px;
  }

  .chat-msg-time {
    width: 100%;
    margin-left: 0;
  }

  .wall-head {
    flex-wrap: wrap;
  }

  #toast-wrap {
    right: 12px;
    bottom: 76px;
    left: 12px;
    transform: none;
  }

  .toast {
    width: 100%;
    text-align: center;
  }

  .footer {
    position: fixed;
    justify-content: center;
    padding: 9px 12px;
    gap: 5px 8px;
    font-size: 10px;
    line-height: 1.35;
  }
}

@media (max-width: 430px) {
  .topbar-right {
    max-width: calc(100% - 122px);
  }

  .auth-username {
    display: none;
  }

  #auth-area .btn {
    padding: 8px 9px;
    font-size: 10px;
  }

  .tabs {
    gap: 5px;
  }

  .tab {
    min-height: 50px;
    font-size: 8.5px;
  }

  .hero-title {
    font-size: 28px;
  }

  .profile-stats {
    grid-template-columns: 1fr;
  }
}
