/* ============================================================
   The World Game — Layout V2
   Dark dashboard theme | Mobile-first | Bottom nav on mobile
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700;800&family=Barlow+Condensed:wght@600;700;800&family=DM+Sans:wght@400;500;600&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg-base:       #080c14;
  --bg-surface:    #0f1520;
  --bg-card:       #141c2e;
  --bg-card-hover: #1a2438;
  --bg-sidebar:    #0a0f1a;
  --bg-topbar:     #0d1422;
  --border:        rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.12);

  --accent:        #10d97a;    /* emerald — subtle football nod */
  --accent-dim:    rgba(16,217,122,0.12);
  --accent-glow:   rgba(16,217,122,0.25);
  --accent-alt:    #f59e0b;   /* amber for highlights */

  --text-primary:  #f0f4f8;
  --text-secondary:#8492a6;
  --text-muted:    #4a5568;
  --text-link:     #10d97a;
  --text-linkr:    #f56565;

  --sidebar-w:     220px;
  --topbar-h:      58px;
  --right-w:       260px;
  --bottomnav-h:   60px;

  --radius:        10px;
  --radius-sm:     6px;
  --shadow:        0 4px 24px rgba(0,0,0,0.4);
  --shadow-card:   0 2px 12px rgba(0,0,0,0.3);

  --font-head:     'Barlow Condensed', sans-serif;
  --font-body:     'DM Sans', sans-serif;
  --font-ui:       'Barlow', sans-serif;
}

/* ── Reset for v2 body ──────────────────────────────────────── */
body.wf-v2 {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

body.wf-v2 * { box-sizing: border-box; }

/* ── Shell layout ───────────────────────────────────────────── */
.wf2-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar (desktop) ──────────────────────────────────────── */
.wf2-sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* NO scroll on flex container - scroll happens on inner div */
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

/* Inner scroll container - this is what actually scrolls on iOS */
.wf2-sidebar-scroll {
  flex: 1;
  min-height: 0;     /* CRITICAL: flex children default to min-height:auto, preventing scroll */
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.wf2-sidebar-logo {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.wf2-logo-figure {
  width: auto;
  height: 38px;
  /* Black silhouette → white on dark bg */
  filter: invert(1);
  opacity: 0.85;
  flex-shrink: 0;
}

.wf2-sidebar-logo-text {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  line-height: 1.1;
  text-transform: uppercase;
}

.wf2-sidebar-logo-text span {
  color: var(--accent);
}

/* User card in sidebar */
.wf2-user-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.wf2-user-card-name {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.wf2-user-card-sub {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.wf2-user-card-sub img {
  vertical-align: middle;
}

/* Nav sections */
.wf2-nav {
  flex: 1;
  padding: 10px 0;
}

.wf2-nav-section {
  padding: 6px 0;
}

.wf2-nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 18px 6px;
}

.wf2-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-family: var(--font-ui);
  font-weight: 500;
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.wf2-nav a:hover,
.wf2-nav a.active {
  color: var(--text-primary);
  background: var(--accent-dim);
}

.wf2-nav a.active {
  color: var(--accent);
}

.wf2-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.wf2-nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
  opacity: 0.7;
}

.wf2-nav a:hover .wf2-nav-icon,
.wf2-nav a.active .wf2-nav-icon {
  opacity: 1;
}

.wf2-nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  line-height: 1.6;
}

.wf2-nav-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 16px;
}

/* Sidebar footer */
.wf2-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

.wf2-sidebar-footer a {
  color: var(--text-muted);
  text-decoration: none;
  display: block;
  padding: 3px 0;
  transition: color 0.15s;
}

.wf2-sidebar-footer a:hover { color: var(--text-secondary); }

/* ── Main area ──────────────────────────────────────────────── */
.wf2-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  margin-right: var(--right-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.wf2-topbar {
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.wf2-topbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  font-size: 20px;
  line-height: 1;
}

.wf2-topbar-breadcrumb {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.wf2-topbar-breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}

.wf2-topbar-breadcrumb a:hover { color: var(--text-primary); }

.wf2-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.wf2-topbar-bell {
  position: relative;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
}

.wf2-topbar-bell:hover { background: var(--bg-card); color: var(--text-primary); }

.wf2-topbar-bell-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 7px;
  height: 7px;
  background: #ef4444;
  border-radius: 50%;
  border: 1.5px solid var(--bg-topbar);
}

.wf2-topbar-lang {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wf2-topbar-notification {
  flex: 1;
}

/* ── Content area ───────────────────────────────────────────── */
.wf2-content {
  flex: 1;
  padding: 20px;
  padding-bottom: 20px;
  width: 100%;
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Right panel ────────────────────────────────────────────── */
.wf2-rightpanel {
  width: var(--right-w);
  min-height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  position: fixed;
  top: 0;
  right: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
}

.wf2-rightpanel-inner {
  padding: 12px 14px;
  flex: 1;
  overflow-x: hidden;
}

/* ── Card component ─────────────────────────────────────────── */
.wf2-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.wf2-card-header {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wf2-card-body {
  padding: 12px 14px;
}

/* ── Overlay (mobile sidebar) ───────────────────────────────── */
.wf2-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 290; /* blocks background touches; sidebar at 300 receives touches */
  /* Prevent any touch events reaching the page behind */
  touch-action: none;
}
.wf2-overlay.open {
  display: block;
}

/* ── Bottom nav (mobile) ────────────────────────────────────── */
.wf2-bottomnav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottomnav-h);
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border);
  z-index: 300;
  backdrop-filter: blur(12px);
}

.wf2-bottomnav-inner {
  display: flex;
  height: 100%;
}

.wf2-bottomnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-family: var(--font-ui);
  font-weight: 500;
  padding: 6px 4px;
  transition: color 0.15s, background 0.15s;
  position: relative;
  border: none;
  background: none;
  cursor: pointer;
}

.wf2-bottomnav-item.active {
  color: var(--accent);
}

.wf2-bottomnav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}

.wf2-bottomnav-icon {
  font-size: 20px;
  line-height: 1;
}

.wf2-bottomnav-badge {
  position: absolute;
  top: 6px;
  right: 50%;
  margin-right: -22px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 99px;
  line-height: 1.5;
}

/* ── Re-skin existing content classes for dark theme ────────── */
body.wf-v2 a,
body.wf-v2 .link     { color: var(--accent); text-decoration: none; }
body.wf-v2 .linkb    { color: #60a5fa; text-decoration: none; }
body.wf-v2 .linkr    { color: #f87171; text-decoration: none; }
body.wf-v2 .linkgr   { color: var(--accent); text-decoration: none; }
body.wf-v2 .linkw    { color: var(--text-primary); text-decoration: none; }
body.wf-v2 .ulink    { color: #60a5fa; text-decoration: underline; }
body.wf-v2 .ulinkw   { color: var(--text-primary); text-decoration: underline; }

body.wf-v2 .menu     { color: var(--text-secondary); text-decoration: none; }

body.wf-v2 .text10  { font-size: 10px; color: var(--text-secondary); }
body.wf-v2 .text12  { font-size: 12px; }
body.wf-v2 .text14  { font-size: 14px; font-weight: 600; }
body.wf-v2 .atext10 { font-size: 10px; color: var(--text-muted); }

body.wf-v2 .rtext10 { font-size: 10px; color: #f87171; }
body.wf-v2 .rtext12 { font-size: 12px; color: #f87171; }
body.wf-v2 .rtext14 { font-size: 14px; color: #f87171; font-weight: 600; }
body.wf-v2 .grtext10 { font-size: 10px; color: var(--accent); }
body.wf-v2 .grtext12 { font-size: 12px; color: var(--accent); }
body.wf-v2 .grtext14 { font-size: 14px; color: var(--accent); font-weight: 600; }
body.wf-v2 .dgtext10 { font-size: 10px; color: var(--text-muted); }
body.wf-v2 .wtext10  { font-size: 10px; color: var(--text-primary); }

body.wf-v2 h1, body.wf-v2 h1 a { font-family: var(--font-head); font-size: 22px; font-weight: 700; color: var(--text-primary); margin: 0; }
body.wf-v2 h2, body.wf-v2 h2 a { font-family: var(--font-head); font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 0; }
body.wf-v2 h3 { font-family: var(--font-ui); font-size: 14px; font-weight: 600; color: var(--text-primary); margin: 0; }
body.wf-v2 h4 { font-family: var(--font-head); font-size: 20px; font-weight: 800; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.03em; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
body.wf-v2 h5 { font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--text-secondary); margin: 0; }
body.wf-v2 h6 { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin: 0; }
body.wf-v2 h7 { display: block; font-size: 13px; color: var(--text-primary); margin: 4px 0; }

body.wf-v2 table { border-collapse: collapse; width: 100%; }
body.wf-v2 td, body.wf-v2 th { padding: 5px 8px; font-size: 12px; color: var(--text-primary); }

/* Notification/alert boxes */
body.wf-v2 .red-box     { background: rgba(239,68,68,0.15);    border: 1px solid rgba(239,68,68,0.35);    color: #fca5a5; padding: 10px 14px; border-radius: var(--radius-sm); margin: 8px 0; font-size: 13px; }
body.wf-v2 .yellow-box  { background: rgba(245,158,11,0.15);   border: 1px solid rgba(245,158,11,0.35);   color: #fcd34d; padding: 10px 14px; border-radius: var(--radius-sm); margin: 8px 0; font-size: 13px; }
body.wf-v2 .green-box   { background: rgba(16,217,122,0.12);   border: 1px solid rgba(16,217,122,0.3);    color: #6ee7b7; padding: 10px 14px; border-radius: var(--radius-sm); margin: 8px 0; font-size: 13px; }

/* Inputs & buttons */
body.wf-v2 input.textfield,
body.wf-v2 input.textfield2,
body.wf-v2 input.textfield-penalties,
body.wf-v2 input[type="text"],
body.wf-v2 input[type="number"],
body.wf-v2 select.textfield,
body.wf-v2 textarea.textfield {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text-primary) !important;
  border-radius: 4px;
  padding: 2px 4px;
}

body.wf-v2 input.textfield:focus,
body.wf-v2 select.textfield:focus,
body.wf-v2 textarea.textfield:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

body.wf-v2 input.button,
body.wf-v2 button.button,
body.wf-v2 input[type=submit].button {
  background: var(--accent);
  color: #04150b;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-size: 13px;
  font-family: var(--font-ui);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.02em;
}

body.wf-v2 input.button:hover,
body.wf-v2 button.button:hover,
body.wf-v2 input[type=submit].button:hover {
  background: #0fcc72;
  transform: translateY(-1px);
}

/* Right-sidebar box */
body.wf-v2 .right-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}

body.wf-v2 .right-box h1 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Login box */
body.wf-v2 .login-box {
  padding: 4px 0;
}

/* Notification area */
body.wf-v2 #notification_area {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  margin: 4px 0;
  box-shadow: 0 0 16px var(--accent-glow);
}

/* Central content wrapper */
body.wf-v2 .central-box {
  background: transparent;
  min-height: 200px;
}

/* Breadcrumb in central */
body.wf-v2 .bread-crumb-style {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* ── Override all hardcoded bgcolor attributes ──────────────── */
/* Tables with hardcoded bgcolor (group standings, KO rounds) */
body.wf-v2 table[bgcolor],
body.wf-v2 tr[bgcolor],
body.wf-v2 td[bgcolor] {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

/* The bright green KO round table (bgcolor=#99FF99) */
body.wf-v2 table[bgcolor="#99FF99"],
body.wf-v2 table[bgcolor="#99ff99"] {
  background-color: rgba(16,217,122,0.08) !important;
  border: 1px solid rgba(16,217,122,0.2) !important;
  border-radius: var(--radius) !important;
}

/* Header rows (slightly lighter) */
body.wf-v2 tr[bgcolor="#DCDCDC"],
body.wf-v2 tr[bgcolor="#dcdcdc"],
body.wf-v2 td[bgcolor="#DCDCDC"],
body.wf-v2 td[bgcolor="#dcdcdc"] {
  background-color: rgba(255,255,255,0.06) !important;
}

/* Winning rows (green tinted) */
body.wf-v2 tr[bgcolor="#CCDDCC"],
body.wf-v2 tr[bgcolor="#ccddcc"],
body.wf-v2 tr[bgcolor="#DDEEDD"],
body.wf-v2 tr[bgcolor="#ddeedd"] {
  background-color: rgba(16,217,122,0.1) !important;
}

/* Normal zebra rows */
body.wf-v2 tr[bgcolor="#ECECEC"],
body.wf-v2 tr[bgcolor="#ececec"] {
  background-color: rgba(255,255,255,0.03) !important;
}
body.wf-v2 tr[bgcolor="#E0E0E0"],
body.wf-v2 tr[bgcolor="#e0e0e0"] {
  background-color: rgba(255,255,255,0.02) !important;
}

/* Ensure all td text is readable */
body.wf-v2 td, body.wf-v2 th {
  color: var(--text-primary);
}

/* Score input boxes - need visible background */
body.wf-v2 input.textfield[style*="width:20px"],
body.wf-v2 input.textfield[style*="width: 20px"],
body.wf-v2 input.textfield-penalties {
  background: var(--bg-base) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text-primary) !important;
  text-align: center !important;
  border-radius: 4px !important;
}

/* Group stage score inputs */
body.wf-v2 input[id^="pred_g"],
body.wf-v2 input[id^="pred_p"],
body.wf-v2 input[id^="g1_"],
body.wf-v2 input[id^="g2_"] {
  background: var(--bg-base) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text-primary) !important;
  text-align: center !important;
}

/* Black text that bleeds through on legacy elements */
body.wf-v2 b, body.wf-v2 strong, body.wf-v2 span, body.wf-v2 p,
body.wf-v2 center, body.wf-v2 small, body.wf-v2 i, body.wf-v2 em {
  color: inherit;
}

/* Legacy font tags */
body.wf-v2 font { color: var(--text-primary) !important; }

/* Any inline color:black or color:#000 */
body.wf-v2 [style*="color:#000"],
body.wf-v2 [style*="color: #000"],
body.wf-v2 [style*="color:black"],
body.wf-v2 [style*="color: black"] {
  color: var(--text-primary) !important;
}

/* Zebra fallback */
body.wf-v2 tr:nth-child(even) td { background: rgba(255,255,255,0.015); }

/* Cinza divider */
body.wf-v2 img[src*="cinza"] {
  filter: brightness(0) invert(1);
  opacity: 0.08;
}

/* Inline images / flags */
body.wf-v2 img[src*="country-flags"] { border-radius: 2px; }

/* Switch layout banner */
.wf2-layout-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 99px;
  transition: all 0.15s;
  white-space: nowrap;
}

.wf2-layout-switch:hover {
  color: var(--text-secondary);
  border-color: var(--border-strong);
  background: var(--bg-card);
}

/* Sidebar toggle button (mobile) */
.wf2-sidebar-close {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
}

/* ── Responsive ─────────────────────────────────────────────── */

/* Tablet: hide right panel inside main, show below */
/* ── Top-of-sidebar toggle (mobile only, defined before media queries) ── */
.wf2-sidebar-top-toggle {
  display: none; /* hidden on desktop; media query below shows it on mobile */
  width: 100%;
  background: var(--accent-dim);
  border: none;
  border-bottom: 3px solid var(--accent);
  color: var(--accent);
  padding: 22px 0;
  cursor: pointer;
  font-size: 32px;
  text-align: center;
  transition: color 0.15s, background 0.15s;
  letter-spacing: 0.05em;
  min-height: 70px;
}

.wf2-sidebar-top-toggle:hover {
  color: var(--accent);
  background: rgba(16,217,122,0.2);
}

/* Desktop sidebar edge toggle (defined here so mobile can hide it) */
.wf2-sidebar-toggle {
  position: fixed;
  top: 50%;
  left: var(--sidebar-w);
  transform: translateY(-50%) translateX(-1px);
  z-index: 201;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-left: none;
  color: var(--accent);
  cursor: pointer;
  padding: 28px 14px;
  border-radius: 0 12px 12px 0;
  font-size: 24px;
  line-height: 1;
  transition: left 0.28s cubic-bezier(0.4,0,0.2,1), background 0.15s, color 0.15s;
  box-shadow: 4px 0 16px rgba(0,0,0,0.4);
}

.wf2-sidebar-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}



/* ── Prediction standings row colors ─────────────────────────── */
/* Override legacy light-grey row backgrounds to dark theme */
body.wf-v2 tr[bgcolor="#CCCCCC"],
body.wf-v2 tr[bgcolor="#cccccc"],
body.wf-v2 tr[bgcolor="#DCDCDC"],
body.wf-v2 tr[bgcolor="#dcdcdc"],
body.wf-v2 tr[bgcolor="#ECECEC"],
body.wf-v2 tr[bgcolor="#ececec"],
body.wf-v2 tr[bgcolor="#E0E0E0"],
body.wf-v2 tr[bgcolor="#e0e0e0"],
body.wf-v2 tr[bgcolor="#CCCDCC"],
body.wf-v2 tr[bgcolor="#DCDCDC"],
body.wf-v2 tr[bgcolor="#E8E8E8"],
body.wf-v2 tr[bgcolor="#F0F0F0"],
body.wf-v2 tr[bgcolor="#FFFFFF"],
body.wf-v2 tr[bgcolor="#ffffff"],
body.wf-v2 td[bgcolor="#CCCCCC"],
body.wf-v2 td[bgcolor="#ECECEC"],
body.wf-v2 td[bgcolor="#E0E0E0"],
body.wf-v2 td[bgcolor="#DCDCDC"] {
  background-color: var(--bg-card) !important;
}

/* Ensure text inside these rows is visible */
body.wf-v2 tr[bgcolor="#CCCCCC"] td,
body.wf-v2 tr[bgcolor="#DCDCDC"] td,
body.wf-v2 tr[bgcolor="#ECECEC"] td,
body.wf-v2 tr[bgcolor="#E0E0E0"] td,
body.wf-v2 tr[bgcolor="#FFFFFF"] td,
body.wf-v2 tr[bgcolor="#ffffff"] td {
  color: var(--text-primary) !important;
  background-color: var(--bg-card) !important;
}

/* Also fix td with inline bgcolor */
body.wf-v2 td[bgcolor] {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
}


/* Force all table cell text visible in v2 - legacy color classes */
body.wf-v2 .text10, body.wf-v2 .text12, body.wf-v2 .text14,
body.wf-v2 .grtext10, body.wf-v2 .grtext12 {
  color: var(--text-primary) !important;
}

/* Input scores: explicit light text on dark bg, all variants */
body.wf-v2 input[id^="pred_"],
body.wf-v2 input[id^="sc1_"],
body.wf-v2 input[id^="sc2_"],
body.wf-v2 input[style*="width:20px"],
body.wf-v2 input[style*="width: 20px"],
body.wf-v2 input[style*="width:22px"] {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-strong) !important;
}

/* Desktop: hide mobile-only elements */
.wf2-mobile-only { display: none !important; }
.wf2-desktop-only { display: flex; }
.wf2-mobile-footer { display: none; }

@media (max-width: 1200px) {
  .wf2-rightpanel {
    position: relative;
    width: 100%;
    min-height: auto;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .wf2-main {
    margin-right: 0;
    flex-direction: column;
  }
  .wf2-shell {
    flex-direction: column;
  }
  .wf2-main {
    margin-left: var(--sidebar-w);
    margin-right: 0;
  }
/* footer margin cleared - now position:fixed */
  /* Sidebar toggle: only shown on desktop (handled by 900px block) */
}

/* Mobile: hide sidebar, show bottom nav */
@media (max-width: 900px) {
  :root {
    --sidebar-w: 0px;
    --mf-h: auto; /* mobile footer height - dynamic based on rows */
  }

  /* HIDE sidebar entirely on mobile */
  .wf2-sidebar,
  .wf2-sidebar-toggle,
  .wf2-topbar-hamburger {
    display: none !important;
  }

  /* Show mobile-only elements */
  .wf2-mobile-only { display: flex !important; }
  .wf2-desktop-only { display: none !important; }

  /* Main: full width */
  .wf2-main {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Right panel: hidden */
  .wf2-rightpanel,
  .wf2-rightpanel-toggle { display: none !important; }

  /* Content padding - room for mobile footer */
  .wf2-content {
    padding: 10px;
    padding-bottom: 120px; /* space for mobile footer rows */
  }

  /* Tables scrollable */
  body.wf-v2 .wf2-content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Mobile footer */
  .wf2-mobile-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-strong);
  }

  .wf2-mf-row {
    display: flex;
    align-items: center;
    justify-content: space-around;
    border-bottom: 1px solid var(--border);
  }

  .wf2-mf-row1 { padding: 6px 0; }
  .wf2-mf-row2 { padding: 4px 0; background: rgba(255,50,50,0.05); }
  .wf2-mf-row3 {
    padding: 3px 8px;
    justify-content: center;
    font-size: 9px;
    color: var(--text-muted);
    border-bottom: none;
  }

  .wf2-mf-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    position: relative;
    text-align: center;
  }

  .wf2-mf-item:active { background: var(--bg-card-hover); }
  .wf2-mf-admin { color: var(--accent); }
  .wf2-mf-friends { font-size: 18px; }

  #wf2-wall-badge {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    padding: 0;
    min-width: 0;
    font-size: 0;
  }
  .wf2-mf-badge {
    position: absolute;
    top: 0; right: 0;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    border-radius: 8px;
    padding: 0 4px;
    min-width: 14px;
    text-align: center;
  }

  /* Mobile hamburger dropdown link style */
  .wf2-mmenu-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
  }
  .wf2-mmenu-item:active { background: var(--bg-card-hover); }

  /* Mobile logo in topbar */
  .wf2-mobile-logo {
    text-decoration: none;
    align-items: center;
  }

  /* Bigger tap targets */
  body.wf-v2 input.button,
  body.wf-v2 button.button,
  body.wf-v2 input[type=submit].button {
    padding: 10px 20px;
    font-size: 14px;
  }
}



/* ── Footer ──────────────────────────────────────────────────── */
/* Footer moved into sidebar for v2 - no fixed footer bar */
.wf2-footer { display: none !important; }

.wf2-sidebar-footer-credit {
  padding: 10px 8px 8px;
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
  border-top: 1px solid var(--border);
  margin-top: auto;
  word-break: break-word;
}

.wf2-sidebar-footer-credit a {
  color: var(--text-muted);
  text-decoration: none;
}

.wf2-footer-layout {
  padding: 4px 20px 12px;
  border-top: 1px solid var(--border);
}

.wf2-footer-layout a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 99px;
  transition: all 0.15s;
}

.wf2-footer-layout a:hover {
  color: var(--text-secondary);
  border-color: var(--border-strong);
  background: var(--bg-card);
}

.wf2-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

/* ── Subtle football texture on bg ──────────────────────────── */
body.wf-v2::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(16,217,122,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(245,158,11,0.03) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

body.wf-v2 .wf2-shell { position: relative; z-index: 1; }

/* ── Scrollbar styling ──────────────────────────────────────── */
body.wf-v2 ::-webkit-scrollbar { width: 5px; height: 5px; }
body.wf-v2 ::-webkit-scrollbar-track { background: transparent; }
body.wf-v2 ::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
body.wf-v2 ::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Additional dark mode patches ───────────────────────────── */

/* Select dropdowns */
body.wf-v2 select {
  background: var(--bg-base) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm);
}

/* Inline white/light backgrounds on tables */
body.wf-v2 table {
  background: transparent !important;
}

/* Match score row background override */
body.wf-v2 tr[bgcolor] td {
  color: var(--text-primary) !important;
}

/* Penalty input placeholder */
body.wf-v2 input::placeholder {
  color: var(--text-muted) !important;
  opacity: 1;
}

/* Links inside dark tables */
body.wf-v2 td a, body.wf-v2 td a:visited {
  color: var(--accent);
}

body.wf-v2 td a.linkr { color: #f87171; }
body.wf-v2 td a.linkb { color: #60a5fa; }

/* The KO round rc variable row colors (green win rows in ko_prediction_display) */
/* $rc comes from $_winc0 (#CCDDCC) and $_winc1 (#DDEEDD) */
body.wf-v2 tr[bgcolor="#CCDDCC"] td,
body.wf-v2 tr[bgcolor="#DDEEDD"] td {
  color: var(--text-primary) !important;
}

/* Number inputs */
body.wf-v2 input[type=number] {
  background: var(--bg-base) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm);
}

/* Checkbox */
body.wf-v2 input[type=checkbox] {
  accent-color: var(--accent);
}

/* Textarea */
body.wf-v2 textarea {
  background: var(--bg-base) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text-primary) !important;
}

/* The wf2-nav logout link */
body.wf-v2 .wf2-nav-logout {
  color: #f87171 !important;
}
body.wf-v2 .wf2-nav-logout:hover {
  background: rgba(248,113,113,0.1) !important;
  color: #fca5a5 !important;
}

/* ── Sidebar toggle ──────────────────────────────────────────── */
/* sidebar-toggle defined above */

/* When sidebar is collapsed */
body.wf2-collapsed .wf2-sidebar {
  transform: translateX(-100%);
}

body.wf2-collapsed .wf2-sidebar-toggle {
  left: 0;
  border-left: 1px solid var(--border-strong);
  border-radius: 0 6px 6px 0;
}

body.wf2-collapsed .wf2-main {
  margin-left: 0;
}

/* footer margin cleared - now position:fixed */

body.wf2-collapsed .wf2-sidebar-toggle-icon::before { content: '\203A'; }
.wf2-sidebar-toggle-icon::before { content: '\2039'; }

/* ── Ad: hide in sidebar on desktop, show in mobile bottom area ─ */
.wf2-sidebar-ad {
  display: none; /* hidden on desktop */
}

.wf2-mobile-ad {
  display: none; /* shown only on mobile, handled below */
}
/* top-toggle: defined above, before media queries */

/* ── Back-to-top button (v2): floating, bigger ───────────────── */
body.wf-v2 #back_to_top {
  position: fixed;
  bottom: 60px; /* above error widget */
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  text-decoration: none;
  opacity: 0.6;
  z-index: 500;
  transition: opacity 0.15s, background 0.15s, color 0.15s, transform 0.15s;
  box-shadow: var(--shadow-card);
}

body.wf-v2 #back_to_top:hover {
  opacity: 1;
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
}

@media (max-width: 900px) {
  body.wf-v2 #back_to_top {
    bottom: calc(var(--bottomnav-h) + 60px);
    width: 48px;
    height: 48px;
    font-size: 22px;
  }
}



/* Guest login form: hide in collapsed mobile sidebar */
@media (max-width: 900px) {
  body.wf-v2 .wf2-sidebar:not(.mobile-expanded) .wf2-guest-login {
    display: none;
  }
  /* Hide right panel entirely on mobile - those boxes waste space */
  .wf2-rightpanel {
    display: none !important;
  }
}



/* Error report widget: sit above fixed footer in v2 */
body.wf-v2 #wf-err-tab {
  bottom: 8px !important;
}
body.wf-v2 #wf-err-panel {
  bottom: 8px !important;
}

/* Online friends: hide in icon-strip mode (mobile narrow sidebar) */


/* ── Notifications in v2 topbar ─────────────────────────────── */
.wf2-topbar-notif-area {
  position: relative;
}

#wf2-notif-popup {
  display: none;
  position: fixed;
  top: var(--topbar-h);
  right: 60px;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 500;
  font-size: 13px;
}

#wf2-notif-popup.open {
  display: block;
}

.wf2-notif-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wf2-notif-body {
  padding: 8px 0;
}

.wf2-notif-body .green-box,
.wf2-notif-body .red-box,
.wf2-notif-body .yellow-box {
  margin: 4px 10px;
  border-radius: var(--radius-sm);
}

/* Bell badge */
.wf2-notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid var(--bg-topbar);
}

/* Prevent input autofocus on mobile - avoids keyboard popping up on page load */
@media (max-width: 900px) {
  body.wf-v2 .wf2-sidebar input:focus,
  body.wf-v2 .wf2-guest-login input:focus {
    outline: none;
  }
  /* Blur any auto-focused sidebar inputs on mobile on load (handled via JS in footer) */
}

/* Online friends — suppress ALL legacy spacing */
.wf2-online-friends {
  padding: 6px 12px 4px;
  font-size: 11px;
  border-top: 1px solid var(--border);
  line-height: 1.3;
}
/* Nuke every legacy spacer element */
.wf2-online-friends br {
  display: none !important;
}
/* Only hide spacer/divider images, keep status icons (online.png, idle.png) */
.wf2-online-friends img[src*="trans.gif"],
.wf2-online-friends img[src*="cinza.gif"] {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}
/* p.text10 wraps each group of users - make it block with zero margin */
.wf2-online-friends p,
.wf2-online-friends .text10 {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.3;
}
/* Each user link */
.wf2-online-friends a {
  display: block;
  color: var(--accent);
  text-decoration: none;
  font-size: 11px;
  line-height: 1.7;
  margin: 0;
  padding: 0;
}
/* Labels like "Users online:" "Friends online:" */
.wf2-online-friends b {
  display: block;
  color: var(--text-secondary);
  font-size: 10px;
  margin: 0 0 1px 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Right panel banner: inside the fixed right panel */
.wf2-rightpanel-banner {
  padding: 10px;
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--border);
}

/* Hide banner when panel goes inline (tablet) */
@media (max-width: 1200px) {
  .wf2-rightpanel-banner {
    display: none !important;
  }
}

/* ── Right panel toggle tab ──────────────────────────────────── */
.wf2-rightpanel-toggle {
  position: fixed;
  top: 50%;
  right: var(--right-w);
  transform: translateY(-50%) translateX(1px);
  z-index: 201;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-right: none;
  color: var(--accent);
  cursor: pointer;
  padding: 28px 14px;
  border-radius: 12px 0 0 12px;
  font-size: 24px;
  line-height: 1;
  transition: right 0.28s cubic-bezier(0.4,0,0.2,1), background 0.15s;
  box-shadow: -4px 0 16px rgba(0,0,0,0.4);
}
.wf2-rightpanel-toggle:hover {
  background: var(--bg-card-hover);
}
body.wf2-right-collapsed .wf2-rightpanel-toggle {
  right: 0;
}
body.wf2-right-collapsed .wf2-rightpanel {
  transform: translateX(100%);
}
body.wf2-right-collapsed .wf2-main {
  margin-right: 0;
}
/* Hidden on tablet/mobile (right panel hidden anyway) */
@media (max-width: 1200px) {
  .wf2-rightpanel-toggle {
    display: none !important;
  }
}


/* Mobile wall at top of party page */
.wf2-mobile-wall-top {
  display: none; /* hidden on desktop - wall is in right panel */
}
@media (max-width: 900px) {
  .wf2-mobile-wall-top {
    display: block;
    margin-bottom: 12px;
  }
}

/* Mobile wall at bottom of sidebar - only shown on mobile */
.wf2-sidebar-mobile-wall {
  display: none;
}
@media (max-width: 900px) {
  .wf2-sidebar-mobile-wall {
    display: block;
    border-top: 1px solid var(--border);
    padding: 8px 12px;
    font-size: 11px;
  }
  /* Also remove the mobile-wall-top CSS since we removed it from party-info */
  .wf2-mobile-wall-top {
    display: none !important;
  }
}
