/* ===== RESET & TOKENS ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:      #0d0d11;
  --bg2:     #161620;
  --bg3:     #1c1c2a;
  --card:    #1a1a28;
  --border:  rgba(255, 255, 255, .06);
  --green:   #4ade80;
  --green2:  #22c55e;
  --red:     #e74c3c;
  --text:    #eeeeee;
  --text2:   #999999;
  --text3:   #666666;
  --radius:  10px;
  --hdr-h:   56px;
  --mnav-h:  58px;
  --ease:    .22s ease;
}

html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; font-size: 14px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--hdr-h);
  padding-bottom: var(--mnav-h);
}

a { text-decoration: none; color: inherit; }
button { border: none; outline: none; cursor: pointer; font-family: inherit; }
img { display: block; max-width: 100%; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

/* ===== HEADER ===== */
.xn-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(13, 13, 17, .92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: var(--hdr-h);
}

.xn-header-inner {
  display: flex; align-items: center; gap: 12px;
  height: 100%; padding: 0 16px;
  max-width: 1400px; margin: 0 auto;
}

.xn-logo {
  font-size: 1.35rem; font-weight: 800; letter-spacing: -.5px;
  white-space: nowrap; flex-shrink: 0;
  color: var(--text);
}
.xn-logo-accent { color: var(--green); }

.xn-search {
  flex: 1; max-width: 480px; display: none;
  position: relative;
}
.xn-search input {
  width: 100%; height: 38px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 0 44px 0 14px;
  color: var(--text); font-size: .88rem; outline: none;
  transition: var(--ease);
}
.xn-search input:focus { border-color: var(--green); }
.xn-search input::placeholder { color: var(--text3); }
.xn-search-btn {
  position: absolute; right: 0; top: 0;
  width: 40px; height: 38px;
  background: var(--green); color: #000;
  border-radius: 0 8px 8px 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; transition: var(--ease);
}
.xn-search-btn:hover { background: var(--green2); }

.xn-btn-login {
  display: none; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text); font-size: .85rem; font-weight: 500;
  white-space: nowrap; transition: var(--ease);
}
.xn-btn-login:hover { background: rgba(255,255,255,.05); }

.xn-mobile-search-toggle {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.06); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; margin-left: auto; transition: var(--ease);
}
.xn-mobile-search-toggle:hover { background: rgba(255,255,255,.12); }

.xn-mobile-search {
  display: none; padding: 8px 16px 10px;
  position: relative; gap: 0;
}
.xn-mobile-search.active { display: flex; }
.xn-mobile-search input {
  flex: 1; height: 38px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 8px 0 0 8px;
  padding: 0 14px; color: var(--text); font-size: .88rem; outline: none;
}
.xn-mobile-search input::placeholder { color: var(--text3); }
.xn-mobile-search .xn-search-btn {
  position: relative; border-radius: 0 8px 8px 0; width: 44px; height: 38px;
}

/* ===== CATEGORY BAR ===== */
.xn-cat-bar {
  position: sticky; top: var(--hdr-h); z-index: 90;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.xn-cat-scroll {
  display: flex; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px; gap: 8px;
  max-width: 1400px; margin: 0 auto;
}
.xn-cat-scroll::-webkit-scrollbar { display: none; }
.xn-cat {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 8px; flex-shrink: 0;
  font-size: .82rem; font-weight: 500; color: var(--text2);
  border: 1px solid var(--border); background: transparent;
  white-space: nowrap; transition: var(--ease);
}
.xn-cat:hover { color: var(--text); background: rgba(255,255,255,.04); }
.xn-cat.active {
  color: var(--green);
  border-color: rgba(74,222,128,.3);
  background: rgba(74,222,128,.06);
}
.xn-cat i { font-size: .75rem; }

/* ===== MAIN LAYOUT ===== */
.xn-main {
  max-width: 1400px; margin: 0 auto;
  padding: 20px 16px 40px;
}

/* ===== RAGEBAIT HERO SECTION ===== */
.xn-rage-section {
  background: linear-gradient(180deg, rgba(74,222,128,.07) 0%, transparent 100%);
  border: 1px solid rgba(74,222,128,.16);
  border-radius: var(--radius);
  padding: 20px; margin-bottom: 24px;
}

.xn-rage-section-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  margin-bottom: 16px; padding-bottom: 14px;
  border-bottom: 1px solid rgba(74,222,128,.12);
}
.xn-rage-hl {
  font-size: 1.15rem; font-weight: 800; color: var(--green);
  letter-spacing: .3px; display: flex; align-items: center; gap: 8px; margin: 0;
}
.xn-rage-hl-sub { font-size: .8rem; color: var(--text3); font-weight: 400; margin-top: 2px; }

.xn-rage-body {
  display: grid; grid-template-columns: 1fr; gap: 16px;
}
@media (min-width: 768px) {
  .xn-rage-body { grid-template-columns: 1fr 1fr; }
}

.xn-rage-taunt {
  background: rgba(0,0,0,.28);
  border-left: 3px solid var(--green);
  border-radius: 0 6px 6px 0;
  padding: 14px 16px;
  font-size: .84rem; color: var(--text2); line-height: 1.9;
}
.xn-rage-taunt strong { color: var(--green); }
.xn-rage-taunt .qmh { color: var(--red); font-weight: 700; }

/* ===== SORT BAR ===== */
.xn-sort-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px; margin-bottom: 20px;
  background: var(--bg2); border-radius: var(--radius);
  font-size: .85rem; color: var(--text2);
}
.xn-sort-bar i { color: var(--green); font-size: .8rem; }
.xn-sort-select {
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 12px; font-size: .82rem; font-family: inherit;
  outline: none; cursor: pointer;
}

/* ===== SECTION TITLE ===== */
.xn-section-title {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.xn-section-title i { color: var(--green); font-size: 1.1rem; }
.xn-section-title h1 { font-size: 1.2rem; font-weight: 700; }

/* ===== VIDEO GRID ===== */
.xn-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.xn-card {
  display: block; border-radius: var(--radius); overflow: hidden;
  transition: transform var(--ease), box-shadow var(--ease);
  cursor: pointer;
}
.xn-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.35); }

/* Card thumbnail */
.xn-thumb {
  position: relative; width: 100%; aspect-ratio: 16/9;
  overflow: hidden; border-radius: var(--radius);
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
}
.xn-thumb-img {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s ease, opacity .3s;
  opacity: 0;
}
.xn-thumb-img.loaded { opacity: 1; }
.xn-card:hover .xn-thumb-img { transform: scale(1.06); }

.xn-thumb-placeholder {
  position: absolute; inset: 0; z-index: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; color: rgba(255,255,255,.12);
}

/* Ragebait card highlight */
.xn-card-rage .xn-thumb { border: 2px solid rgba(74,222,128,.25); }
.xn-card-rage:hover .xn-thumb { border-color: var(--green); }

/* Card info */
.xn-card-info { padding: 10px 4px 4px; }
.xn-card-title {
  font-size: .87rem; font-weight: 500; color: var(--text);
  line-height: 1.45; margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.xn-card:hover .xn-card-title { color: var(--green); }
.xn-card-rage .xn-card-title { color: #86efac; }

.xn-card-stats {
  display: flex; align-items: center; gap: 14px;
  font-size: .76rem; color: var(--text3);
}
.xn-card-stats i { margin-right: 3px; }
.xn-stat-heart i { color: var(--red); }

/* ===== RAGEBAIT BANNER ===== */
.xn-rage-banner {
  background: linear-gradient(135deg, rgba(74,222,128,.08), rgba(74,222,128,.02));
  border: 1px solid rgba(74,222,128,.2);
  border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 14px;
}
.xn-rage-banner-icon { font-size: 1.8rem; flex-shrink: 0; }
.xn-rage-banner-text { font-size: .88rem; color: var(--text2); line-height: 1.7; }
.xn-rage-banner-text strong { color: var(--green); }
.xn-rage-banner-text .red { color: var(--red); }

/* ===== SCOREBOARD WIDGET ===== */
.xn-scoreboard {
  background: var(--bg2); border-radius: var(--radius);
  padding: 20px; margin-bottom: 24px;
}
.xn-scoreboard h3 {
  font-size: .9rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px; color: var(--text2);
}
.xn-scoreboard h3 i { color: var(--green); }
.xn-score-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.xn-score-name { font-size: 1rem; font-weight: 900; letter-spacing: 1px; }
.xn-score-win .xn-score-name { color: var(--green); }
.xn-score-lose .xn-score-name { color: #555; text-decoration: line-through; }
.xn-score-badge { font-size: .78rem; }
.xn-score-win .xn-score-badge { color: #f59e0b; }
.xn-score-lose .xn-score-badge { color: #555; }
.xn-score-divider { text-align: center; font-size: 1.2rem; font-weight: 900; color: #333; letter-spacing: 4px; padding: 4px 0; }

.xn-compare-table {
  width: 100%; border-collapse: collapse;
  font-size: .75rem; margin-top: 12px;
}
.xn-compare-table thead th {
  background: var(--bg3); color: var(--text3); padding: 6px 8px;
  text-align: left; border-bottom: 1px solid var(--border);
  font-size: .7rem; text-transform: uppercase;
}
.xn-compare-table tbody td {
  padding: 5px 8px; border-bottom: 1px solid rgba(255,255,255,.04); color: var(--text2);
}
.xn-compare-table tbody tr:last-child td { border-bottom: none; }
.cell-win { color: #4ade80 !important; }
.cell-lose { color: #e74c3c !important; }

/* ===== PAGINATION ===== */
.xn-pagination {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 6px; margin-top: 28px; padding: 16px 0;
}
.xn-page-btn {
  min-width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .88rem; font-weight: 500;
  background: var(--bg2); color: var(--text2);
  border: 1px solid var(--border);
  cursor: pointer; transition: var(--ease);
  font-family: inherit;
}
.xn-page-btn:hover:not(.active):not(.disabled) {
  background: rgba(255,255,255,.06); color: var(--text);
  border-color: rgba(255,255,255,.12);
}
.xn-page-btn.active { background: var(--green); color: #000; border-color: var(--green); font-weight: 700; }
.xn-page-btn.disabled { opacity: .3; cursor: default; }
.xn-page-dots { color: var(--text3); font-size: .85rem; padding: 0 4px; }

/* ===== MOBILE BOTTOM NAV ===== */
.xn-mnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: rgba(13,13,17,.94);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around;
  height: var(--mnav-h);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.xn-mnav-item {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px;
  padding: 6px 12px; font-size: .6rem; font-weight: 500;
  color: var(--text3); transition: var(--ease);
}
.xn-mnav-item i { font-size: 1.15rem; }
.xn-mnav-item.active { color: var(--green); }

/* ===== RESPONSIVE ===== */
@media (min-width: 480px) {
  .xn-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

@media (min-width: 768px) {
  .xn-header-inner { padding: 0 24px; }
  .xn-search { display: block; }
  .xn-btn-login { display: flex; }
  .xn-mobile-search-toggle { display: none; }
  .xn-mnav { display: none; }
  body { padding-bottom: 0; }
  .xn-main { padding: 24px 24px 40px; }
  .xn-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}

@media (min-width: 1024px) {
  .xn-header-inner { padding: 0 32px; }
  .xn-main { padding: 24px 32px 40px; }
  .xn-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
}

@media (min-width: 1280px) {
  .xn-grid { grid-template-columns: repeat(5, 1fr); gap: 20px; }
}

@media (hover: none) {
  .xn-card:active { transform: scale(.97); }
}
