/* =========================================================================
   StakeTruth — Design System
   Mobile-first: base rules target ~375px; min-width queries layer up.
   ========================================================================= */

:root {
  /* ---- Brand palette: sunset orange + lilac purple + off-white ----------
     Token names below are kept stable from the original design system (so
     every var(--leaf-green) etc. reference across the app updates for free)
     but now hold the new brand hues, per the rebrand: sunset orange is the
     primary/CTA colour, lilac purple is the secondary/VIP accent. Semantic
     status colours (won/lost/confidence tiers) are intentionally kept as
     dedicated green/amber/red tokens below, independent of the brand accent
     — so a "won" badge still reads as unambiguously green regardless of
     what the brand colours are. */
  --off-white:    #faf6f2;
  --cream:        #f3e9e0;
  --leaf-green:   #ff6b35;   /* = sunset orange (primary) */
  --light-green:  #b39ddb;   /* = lilac purple (accent) */
  --deep-green:   #3a2a4d;   /* dark-mode card background (deep plum) */
  --charcoal:     #241b2f;   /* dark-mode page background (purple-tinted) */
  --red-start:    #ff9a56;   /* sunset gradient start — banker/urgent accents */
  --red-end:      #e0501f;   /* sunset gradient end */

  /* Dedicated semantic tokens — not tied to the brand palette */
  --success:       #4caf6d;
  --success-light: #8bc97e;
  --success-dim:   #2f7a49;

  /* Result status colours: won = lemon green, pending = yellow, lost = red */
  --result-won:          #a4d65e;
  --result-won-text:     #3d5c14;
  --result-pending:      #ffd60a;
  --result-pending-text: #6b5200;
  --result-lost:         #e53935;

  --bg:         var(--off-white);
  --bg-2:       var(--cream);
  --card:       #ffffff;
  --card-2:     #f7ece1;
  --border:     rgba(126, 87, 194, 0.16);
  --text:       #2b2138;
  --text-soft:  rgba(43, 33, 56, 0.68);
  --muted:      rgba(43, 33, 56, 0.42);
  --primary:    var(--leaf-green);
  --primary-dim:#e0501f;
  --accent:     var(--light-green);
  --warning:    #d4a017;
  --danger:     #d6455a;
  --info:       #6c63b5;
  --gradient-red:   linear-gradient(135deg, var(--red-start), var(--red-end));      /* sunset — banker/live/urgent */
  --gradient-green: linear-gradient(135deg, var(--light-green), #7e57c2);           /* lilac — VIP/premium */

  --font-head: 'Inter', -apple-system, sans-serif;
  --font-body: 'Open Sans', -apple-system, sans-serif;
  --radius:    8px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 6px 20px rgba(43,33,56,0.10);
  --header-h: 56px;
}

[data-theme="dark"] {
  --bg:         var(--charcoal);
  --bg-2:       #2e2138;
  --card:       var(--deep-green);
  --card-2:     #40304f;
  --border:     rgba(179, 157, 219, 0.18);
  --text:       #f3ecf7;
  --text-soft:  rgba(243, 236, 247, 0.72);
  --muted:      rgba(243, 236, 247, 0.42);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:         var(--charcoal);
    --bg-2:       #2e2138;
    --card:       var(--deep-green);
    --card-2:     #40304f;
    --border:     rgba(179, 157, 219, 0.18);
    --text:       #f3ecf7;
    --text-soft:  rgba(243, 236, 247, 0.72);
    --muted:      rgba(243, 236, 247, 0.42);
  }
}

/* ---- Reset ------------------------------------------------------------ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6 { font-family: var(--font-head); font-weight: 800; line-height: 1.25; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; }
ul, ol { padding-left: 1.25em; }

/* ---- Layout ------------------------------------------------------------ */
.container { width: 100%; max-width: 1320px; margin: 0 auto; padding: 0 12px; }
@media (min-width: 640px) { .container { padding: 0 20px; } }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 480px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 768px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.main-with-aside { display: block; }
.main-with-aside__content { min-width: 0; }
.main-with-aside__aside { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.aside-scroll-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.aside-scroll-row::-webkit-scrollbar { display: none; }
.aside-scroll-row > * { scroll-snap-align: start; flex: 0 0 260px; }

@media (min-width: 1024px) {
  .main-with-aside { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
  .main-with-aside__aside { margin-top: 0; position: sticky; top: calc(var(--header-h) + 16px); }
  .aside-scroll-row { display: block; overflow: visible; }
  .aside-scroll-row > * { flex: initial; margin-bottom: 12px; }
}

section { padding: 28px 0; }
.section-title { font-size: 1.3rem; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.section-title .material-icons-round { color: var(--primary); }

/* ---- Header ------------------------------------------------------------ */
.ticker-wrap {
  background: var(--deep-green);
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  font-size: 13px;
  padding: 6px 0;
}
.ticker-track { display: inline-block; animation: ticker-scroll 40s linear infinite; padding-left: 100%; }
.ticker-track span { margin-right: 40px; opacity: 0.9; }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--header-h);
  gap: 12px;
  padding: 0 14px;
}
@media (min-width: 640px) { .header-inner { padding: 0 20px; } }
.site-logo { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 800; font-size: 1.1rem; justify-self: start; }
.site-logo img { height: 42px; width: auto; }
.site-logo .brand-fallback { display: none; }
.site-logo img:not([src]), .site-logo img[src=""] { display: none; }

.main-nav { display: none; }
@media (min-width: 900px) {
  .main-nav { display: flex; gap: 32px; justify-self: center; }
  .main-nav .nav-link { font-weight: 700; font-size: 1.08rem; padding: 8px 0; border-bottom: 2px solid transparent; }
  .main-nav .nav-link.active, .main-nav .nav-link:hover { border-color: var(--primary); color: var(--primary); }
}

.header-actions { display: flex; align-items: center; gap: 8px; justify-self: end; }
.theme-toggle {
  background: var(--card-2); border: 1px solid var(--border); border-radius: 50%;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
}
.mobile-menu-toggle {
  background: none; border: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
}
@media (min-width: 900px) { .mobile-menu-toggle { display: none; } }

.mobile-drawer {
  position: fixed; inset: 0; z-index: 200;
  visibility: hidden;
  transition: visibility 0.32s;
}
.mobile-drawer.open { visibility: visible; }
.mobile-drawer__overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.5);
  opacity: 0; transition: opacity 0.32s ease;
}
.mobile-drawer.open .mobile-drawer__overlay { opacity: 1; }
.mobile-drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 82%; max-width: 340px;
  background: var(--bg); padding: 20px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: -8px 0 24px rgba(0,0,0,0.2);
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.mobile-drawer.open .mobile-drawer__panel { transform: translateX(0); }
.mobile-drawer__panel a, .mobile-drawer__panel button {
  display: block; width: 100%; text-align: left; padding: 14px 8px; font-size: 1.05rem; font-weight: 600;
  border-radius: var(--radius); min-height: 44px;
}
.mobile-drawer__panel a:hover, .mobile-drawer__panel button:hover { background: var(--card-2); }
.mobile-drawer__close { align-self: flex-end; font-size: 1.5rem; background: none; border: none; width: 44px; height: 44px; }
@media (min-width: 900px) { .mobile-drawer { display: none !important; } }

.avatar-dropdown { position: relative; }
.avatar-btn {
  width: 40px; height: 40px; border-radius: 50%; background: var(--gradient-green); color: #fff; border: none;
  font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.avatar-menu {
  display: none; position: absolute; right: 0; top: 48px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md); min-width: 200px; overflow: hidden; z-index: 50;
}
.avatar-menu.open { display: block; }
.avatar-menu a, .avatar-menu button { display: block; width: 100%; text-align: left; padding: 12px 16px; min-height: 44px; }
.avatar-menu a:hover, .avatar-menu button:hover { background: var(--card-2); }

/* ---- Footer -------------------------------------------------------------- */
.site-footer { background: var(--bg-2); border-top: 1px solid var(--border); padding: 40px 0 20px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 28px; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-brand img { height: 30px; margin-bottom: 10px; }
.footer-grid h4 { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-soft); margin-bottom: 12px; }
.footer-grid a { display: block; padding: 4px 0; color: var(--text-soft); }
.footer-grid a:hover { color: var(--primary); }
.social-links { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.social-links a {
  width: 38px; height: 38px; border-radius: 50%; background: var(--card-2); display: flex;
  align-items: center; justify-content: center; padding: 0;
}
.footer-bottom { border-top: 1px solid var(--border); margin-top: 24px; padding-top: 16px; font-size: 0.85rem; color: var(--muted); text-align: center; }

/* ---- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 20px; border-radius: var(--radius); border: none;
  font-weight: 700; font-size: 0.95rem; transition: transform 0.15s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 0.85rem; }
.btn-lg { min-height: 52px; padding: 14px 28px; font-size: 1.05rem; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { box-shadow: 0 0 0 4px rgba(67,160,71,0.18); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-vip { background: var(--gradient-green); color: #2b1a3d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); }
.btn-block-mobile { width: 100%; }
@media (min-width: 640px) { .btn-block-mobile { width: auto; } }

/* ---- Cards --------------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px; }

.prediction-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; margin-bottom: 14px; position: relative; overflow: hidden;
}
.prediction-card__league { font-size: 0.75rem; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; display: flex; justify-content: space-between; padding-right: 46px; }

/* Autoscore — the Intelligence Engine's confidence score, shown at a glance
   on every card (never rendered when the pick itself is locked, since the
   score is null for gated content). */
.score-badge {
  position: absolute; top: 12px; right: 12px;
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.82rem; font-family: var(--font-head);
  border: 3px solid; background: var(--card); z-index: 1;
}
.score-badge.high { border-color: var(--success); color: var(--success-dim); }
.score-badge.mid { border-color: var(--success-light); color: var(--success-dim); }
.score-badge.low { border-color: var(--warning); color: var(--warning); }
.score-badge.poor { border-color: var(--danger); color: var(--danger); }
.prediction-card__teams { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.prediction-card__team { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; text-align: center; font-weight: 700; font-size: 0.9rem; }
.prediction-card__team img { width: 32px; height: 32px; object-fit: contain; }
.prediction-card__vs { font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.prediction-card__tip { font-size: 1.05rem; font-weight: 800; color: var(--primary-dim); margin-bottom: 6px; }
.prediction-card__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 0.8rem; color: var(--text-soft); margin-bottom: 10px; }
.prediction-card__analysis { font-size: 0.88rem; color: var(--text-soft); margin-bottom: 10px; }
.prediction-card__footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.banker-card { border: 2px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--gradient-red) border-box; }
.vip-card { border: 2px solid transparent; background: linear-gradient(var(--card), var(--card)) padding-box, var(--gradient-green) border-box; }

.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; text-align: center; }
.stat-card .material-icons-round { color: var(--primary); font-size: 1.6rem; }
.stat-card__value { font-size: 1.5rem; font-weight: 800; font-family: var(--font-head); }
.stat-card__label { font-size: 0.78rem; color: var(--text-soft); }

.aside-widget { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.aside-widget h3 { font-size: 1rem; display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.recent-win-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 0.85rem; }
.recent-win-row:last-child { border-bottom: none; }
.recent-win-row__score { font-weight: 800; color: var(--primary-dim); }

.pricing-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 24px; position: relative; }
.pricing-card.featured { border: 2px solid var(--accent); }
.pricing-card__badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #2b1a3d; font-size: 0.7rem; font-weight: 800; padding: 4px 12px; border-radius: 20px; }
.pricing-card__price { font-size: 2rem; font-weight: 800; font-family: var(--font-head); margin: 12px 0; }
.pricing-card ul { list-style: none; padding: 0; margin: 16px 0; }
.pricing-card li { padding: 6px 0; display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.pricing-card li .material-icons-round { color: var(--primary); font-size: 1.1rem; }

.blog-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.blog-card img { width: 100%; height: 160px; object-fit: cover; background: var(--card-2); }
.blog-card__body { padding: 14px; }
.blog-card__category { font-size: 0.7rem; text-transform: uppercase; color: var(--primary); font-weight: 700; }

.stats-chart-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.stats-chart-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }

.locked-card { position: relative; }
.locked-card__content { filter: blur(6px); pointer-events: none; user-select: none; }
.locked-card__overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; background: rgba(247,245,239,0.55); backdrop-filter: blur(2px); border-radius: var(--radius-lg); text-align: center; padding: 16px;
}
[data-theme="dark"] .locked-card__overlay { background: rgba(23,26,21,0.6); }
.locked-card__overlay .material-icons-round { font-size: 2rem; color: var(--primary); }
.locked-card__overlay p { font-size: 0.85rem; font-weight: 700; margin: 0; max-width: 220px; }

/* ---- Badges --------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; }
.badge-won { background: var(--result-won); color: var(--result-won-text); }
.badge-lost { background: var(--result-lost); color: #fff; }
.badge-pending { background: var(--result-pending); color: var(--result-pending-text); }

.result-badge-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 12px; border: none; border-radius: 20px; font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; cursor: pointer; }
.result-badge-btn.won { background: var(--result-won); color: var(--result-won-text); }
.result-badge-btn.pending { background: var(--result-pending); color: var(--result-pending-text); }
.result-badge-btn.lost { background: var(--result-lost); color: #fff; }
.result-badge-btn.void, .result-badge-btn.cancelled { background: var(--border); color: var(--text-soft); }
.badge-vip { background: var(--gradient-green); color: #2b1a3d; }
.badge-banker { background: var(--gradient-red); color: #fff; animation: pulse 2s infinite; }
.badge-live { background: var(--gradient-red); color: #fff; display: inline-flex; align-items: center; gap: 4px; }
.badge-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }

/* ---- Prediction-specific ---------------------------------------------- */
.confidence-bar-track { height: 8px; border-radius: 6px; background: var(--card-2); overflow: hidden; width: 100%; }
.confidence-bar-fill { height: 100%; border-radius: 6px; transition: width 0.4s; }
.confidence-bar-fill.high { background: var(--success); }
.confidence-bar-fill.mid { background: var(--success-light); }
.confidence-bar-fill.low { background: var(--warning); }
.confidence-bar-fill.poor { background: var(--danger); }

.intelligence-score { position: relative; width: 64px; height: 64px; }
.intelligence-score svg { transform: rotate(-90deg); }
.intelligence-score__value { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.95rem; }

.bookie-tag { display: inline-flex; align-items: center; gap: 4px; background: var(--card-2); border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px; font-size: 0.72rem; font-weight: 600; }
.odds-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); display: inline-block; animation: pulse 1.6s infinite; }

.tab-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.tab-row::-webkit-scrollbar { display: none; }
.category-tab {
  scroll-snap-align: start; flex: 0 0 auto; min-height: 40px; padding: 8px 16px; border-radius: 20px;
  background: var(--card-2); border: 1px solid var(--border); font-weight: 700; font-size: 0.85rem; white-space: nowrap;
}
.category-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.vote-poll { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--card-2); }
.vote-poll__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 0.8rem; font-weight: 700; }
.vote-poll__bars { display: flex; flex-direction: column; gap: 8px; }
.vote-poll__row { display: grid; grid-template-columns: 60px 1fr 40px; align-items: center; gap: 8px; font-size: 0.8rem; }
.vote-poll__track { height: 18px; border-radius: 10px; background: var(--card); overflow: hidden; }
.vote-poll__fill { height: 100%; background: var(--gradient-green); border-radius: 10px; transition: width 0.5s; }
.vote-poll__buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.vote-poll__buttons button { min-height: 40px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--card); font-weight: 700; font-size: 0.85rem; }
.vote-poll__buttons button:hover { border-color: var(--primary); color: var(--primary); }

/* ---- Forms --------------------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 6px; }
.form-control {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--card); color: var(--text);
}
.form-control:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
textarea.form-control { min-height: 120px; resize: vertical; }
.form-error { color: var(--danger); font-size: 0.8rem; margin-top: 4px; }
.form-sticky-submit { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--border); margin-top: 16px; }

/* ---- Modal (bottom sheet on mobile, centred from 768px) ----------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 300; display: none; align-items: flex-end; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg); width: 100%; max-height: 90vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 20px; position: relative;
}
.modal::before { content: ''; display: block; width: 40px; height: 4px; background: var(--border); border-radius: 4px; margin: 0 auto 16px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-close { background: none; border: none; font-size: 1.3rem; width: 40px; height: 40px; }
@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
  .modal { max-width: 560px; border-radius: var(--radius-xl); }
  .modal::before { display: none; }
}

/* ---- Watermark — login/registration UI + error toasts ---------------------
   Applied via a negative-z-index ::after so it always sits behind the real
   content (which needs no z-index changes of its own) while still painting
   on top of the element's own solid background. Uses `contain` sizing so the
   full logo shows, faded, without cropping or distorting its aspect ratio. */
.watermark { position: relative; }
.watermark::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('/images/logo.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.07;
  z-index: -1;
  pointer-events: none;
}
[data-theme="dark"] .watermark::after { opacity: 0.12; }

/* ---- Utility -------------------------------------------------------------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: 0; z-index: 400; display: flex; flex-direction: column; gap: 8px; padding: 12px; align-items: stretch; }
@media (min-width: 640px) { .toast-wrap { left: auto; right: 16px; bottom: 16px; align-items: flex-end; } }
.toast { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow-md); font-size: 0.9rem; overflow: hidden; }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }

.skeleton { background: linear-gradient(90deg, var(--card-2) 25%, var(--border) 37%, var(--card-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius); }
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--text-soft); }
.leaderboard-row { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius); }
.leaderboard-row:nth-child(odd) { background: var(--card-2); }
.rank-badge { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 800; flex-shrink: 0; }

.ad-slot { min-height: 1px; margin: 16px 0; text-align: center; overflow: hidden; }
.ad-slot:empty { display: none; margin: 0; }

/* ---- Sticky bottom conversion bar (mobile) -------------------------------- */
.sticky-cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; background: var(--card);
  border-top: 1px solid var(--border); padding: 10px 16px; display: flex; gap: 10px; align-items: center;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
}
.sticky-cta-bar span { flex: 1; font-size: 0.85rem; font-weight: 700; }
@media (min-width: 900px) { .sticky-cta-bar { display: none; } }

/* ---- Article typography --------------------------------------------------- */
.article-content { font-size: 1rem; line-height: 1.75; }
.article-content h1 { font-size: 1.6rem; margin-top: 1.2em; }
.article-content h2 { font-size: 1.35rem; margin-top: 1.2em; }
.article-content h3 { font-size: 1.15rem; margin-top: 1.2em; }
.article-content p { margin-bottom: 1.1em; }
.article-content ul, .article-content ol { margin-bottom: 1.1em; }
.article-content blockquote { border-left: 4px solid var(--primary); padding: 4px 16px; color: var(--text-soft); margin: 1.2em 0; }
.article-content code { background: var(--card-2); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }
.article-content pre { background: var(--card-2); padding: 14px; border-radius: var(--radius); overflow-x: auto; }
.article-content img { border-radius: var(--radius-lg); margin: 1em 0; }
.article-content table { width: 100%; border-collapse: collapse; margin: 1.2em 0; display: block; overflow-x: auto; }
.article-content th, .article-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.article-content hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.article-content a { color: var(--primary-dim); text-decoration: underline; }

/* ---- Animations --------------------------------------------------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---- Misc helpers --------------------------------------------------------- */
.text-center { text-align: center; }
.text-soft { color: var(--text-soft); }
.text-muted { color: var(--muted); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.hidden { display: none !important; }
.hero { padding: 40px 0 20px; text-align: center; }
.hero h1 { font-size: 1.8rem; }
@media (min-width: 768px) { .hero h1 { font-size: 2.4rem; } }
.hero p { color: var(--text-soft); max-width: 560px; margin: 0 auto 20px; }

/* =========================================================================
   Admin panel — reuses the same design tokens; simple sidebar + card layout
   ========================================================================= */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; background: var(--card); border-right: 1px solid var(--border);
  position: fixed; top: 0; bottom: 0; left: 0; padding: 16px; overflow-y: auto; z-index: 50;
  transform: translateX(-100%); transition: transform 0.2s;
}
.admin-sidebar.open { transform: translateX(0); }
@media (min-width: 960px) { .admin-sidebar { transform: translateX(0); } }
.admin-sidebar a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; min-height: 44px; }
.admin-sidebar a.active, .admin-sidebar a:hover { background: var(--card-2); color: var(--primary); }
.admin-main { flex: 1; min-width: 0; }
@media (min-width: 960px) { .admin-main { margin-left: 240px; } }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 40; }
.admin-content { padding: 20px 16px; max-width: 1400px; }
.admin-sidebar-toggle { background: none; border: none; width: 44px; height: 44px; }
@media (min-width: 960px) { .admin-sidebar-toggle { display: none; } }
.admin-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 45; display: none; }
.admin-overlay.open { display: block; }
@media (min-width: 960px) { .admin-overlay { display: none !important; } }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th { text-align: left; padding: 10px; border-bottom: 2px solid var(--border); font-size: 0.75rem; text-transform: uppercase; color: var(--text-soft); white-space: nowrap; }
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-scroll { overflow-x: auto; }
.data-table-cards { display: none; }
@media (max-width: 767px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; padding: 8px; }
  .data-table td { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--border); text-align: right; }
  .data-table td::before { content: attr(data-label); font-weight: 700; text-align: left; color: var(--text-soft); }
  .data-table td:last-child { border-bottom: none; }
}

.bulk-toolbar {
  position: sticky; bottom: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 10px 14px; display: none; align-items: center; gap: 10px; flex-wrap: wrap; box-shadow: var(--shadow-md); margin-top: 12px;
}
.bulk-toolbar.open { display: flex; }

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 768px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
