:root {
  --bg: #f4f5f8;          /* page background (light gray) */
  --surface: #ffffff;     /* cards */
  --surface-2: #f7f9fc;   /* subtle inset */
  --text: #11223f;        /* dark navy headings/text */
  --text-secondary: #71809a;
  --accent: #1f83ff;      /* Poki-style bright blue */
  --accent-dark: #0a6ae0;
  --accent-soft: #e8f2ff;
  --gold: #ffb400;
  --silver: #aab4c2;
  --bronze: #d08a4f;
  --teal: #15c5c0;
  --purple: #9b6cff;
  --line: #eceef3;
  --shadow: 0 6px 24px rgba(17, 34, 63, 0.06);
  --shadow-hover: 0 12px 30px rgba(17, 34, 63, 0.10);
}

/* ---- Dark theme ---- */
[data-bs-theme="dark"] {
  --bg: #0f141b;
  --surface: #1a212b;
  --surface-2: #232c38;
  --text: #e6ebf2;
  --text-secondary: #93a1b3;
  --accent-soft: #16263e;
  --line: #2b3441;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.45);
}
[data-bs-theme="dark"] .wc-navbar,
[data-bs-theme="dark"] .bottom-nav { background: var(--surface); }
[data-bs-theme="dark"] .wc-card { background: var(--surface); }

* { font-family: "Nunito", system-ui, -apple-system, sans-serif; }

/* Arabic uses the Cairo font and right-to-left layout.
   Exclude Font Awesome icons (any element with a fa- class) so the icon
   font isn't overridden. */
[dir="rtl"] *:not([class*="fa-"]):not(.fa) {
  font-family: "Cairo", "Nunito", system-ui, sans-serif;
}
.lang-toggle { cursor: pointer; }
.dropdown-item.active { background-color: var(--accent); }

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6, .fw-bold { color: var(--text); letter-spacing: -0.01em; }

.text-accent { color: var(--accent) !important; }
.bg-accent { background: var(--accent) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-gold { color: var(--gold); }
.text-silver { color: var(--silver); }
.text-bronze { color: var(--bronze); }

/* ---- Navbar ---- */
.wc-navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 12px rgba(17, 34, 63, 0.04);
}
.wc-navbar .navbar-brand { font-size: 1.3rem; font-weight: 800; color: var(--text); letter-spacing: -0.02em; padding-top: 0; padding-bottom: 0; }
.brand-logo { height: 46px; width: auto; display: block; }
.login-logo-img { width: 200px; max-width: 70%; height: auto; }
.wc-navbar .nav-link { color: #41506b; font-weight: 700; border-radius: 10px; padding: 0.45rem 0.85rem; }
.wc-navbar .nav-link:hover { color: var(--accent); background: var(--accent-soft); }
.wc-navbar .nav-link.text-danger:hover { background: #ffeef0; }
.wc-userchip {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #d4e6ff;
  font-weight: 800;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
}

/* ---- Buttons ---- */
.btn-accent {
  background: var(--accent);
  border: none;
  color: #fff;
  font-weight: 800;
  border-radius: 12px;
  transition: transform 0.08s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 6px 16px rgba(31, 131, 255, 0.28);
}
.btn-accent:hover { background: var(--accent-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(31, 131, 255, 0.36); }
.btn-accent:active { transform: translateY(0); }
.btn-outline-secondary, .btn-outline-danger { border-radius: 12px; font-weight: 700; }

/* ---- Cards / panels ---- */
.wc-card {
  background: var(--surface);
  border: 1px solid var(--line) !important;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.card-body { color: var(--text); }

/* ---- Login hero ---- */
.login-hero {
  flex: 1; min-height: calc(100vh - 80px); padding: 2rem 0;
  position: relative; overflow: hidden;
  background:
    radial-gradient(700px 380px at 85% -5%, rgba(31, 131, 255, 0.10), transparent 60%),
    radial-gradient(620px 360px at -5% 8%, rgba(21, 197, 192, 0.10), transparent 55%);
}
/* Faint Font Awesome sports/trophy pattern behind the whole site */
.fa-pattern {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; user-select: none;
  display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: space-evenly;
  gap: 30px; padding: 22px; overflow: hidden;
  color: var(--accent); opacity: 0.05; font-size: 1.6rem; line-height: 1;
}
[data-bs-theme="dark"] .fa-pattern { opacity: 0.07; }
.login-logo {
  width: 78px; height: 78px; border-radius: 22px;
  display: grid; place-items: center;
  font-size: 2rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), #54a8ff);
  box-shadow: 0 12px 26px rgba(31, 131, 255, 0.35);
}

/* ---- Forms ---- */
.form-control, .input-group-text {
  background: var(--surface);
  border: 1px solid #dfe4ec;
  color: var(--text);
  border-radius: 12px;
}
.input-group .input-group-text { border-radius: 12px 0 0 12px; }
.input-group .form-control { border-radius: 0 12px 12px 0; }
.form-control::placeholder { color: #aab3c2; }
.form-control:focus {
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem var(--accent-soft);
  color: var(--text);
}
.input-group-text { color: var(--text-secondary); }
.score-input { width: 58px; font-size: 1.15rem; font-weight: 800; border-radius: 12px !important; text-align: center; }
.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-input { -moz-appearance: textfield; }

/* ---- Landing / home page ---- */
.home-hero {
  background:
    radial-gradient(700px 380px at 80% -10%, rgba(31, 131, 255, 0.12), transparent 60%),
    radial-gradient(620px 360px at -5% 10%, rgba(21, 197, 192, 0.12), transparent 55%);
  border-bottom: 1px solid var(--line);
}
.home-logo { width: 240px; max-width: 80%; height: auto; }
.step-num {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 900; font-size: 1.2rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), #54a8ff);
}
.feature-icon {
  flex: 0 0 auto;
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  font-size: 1.15rem; color: var(--accent);
  background: var(--accent-soft);
}

/* ---- Toast notifications ---- */
.toast-box {
  position: fixed;
  bottom: 84px; left: 50%;
  transform: translateX(-50%);
  z-index: 1080;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast-msg {
  background: var(--text); color: #fff;
  padding: 0.6rem 1.1rem; border-radius: 12px;
  font-weight: 800; font-size: 0.9rem;
  box-shadow: var(--shadow-hover);
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 90vw;
}
.toast-msg.show { opacity: 1; transform: translateY(0); }
.toast-ok { background: #19c37d; }
.toast-err { background: #e0394e; }
.btn-saved { background: #19c37d !important; box-shadow: none !important; }

/* ---- How it works card ---- */
.how-card { background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.how-card .row > div { display: flex; align-items: flex-start; }
.how-card .row > div i { margin-top: 2px; }

/* ---- Day filter ---- */
.day-filter {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.2rem 0.1rem;
  scroll-padding: 0 50%;            /* helps centering snap */
  -ms-overflow-style: none;         /* hide scrollbar (IE/Edge) */
  scrollbar-width: none;            /* hide scrollbar (Firefox) */
}
.day-filter::-webkit-scrollbar { display: none; } /* hide scrollbar (Chrome/Safari) */
.day-chip {
  flex: 0 0 auto;
  min-width: 92px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 0.5rem 0.9rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.day-chip:hover { border-color: #cfe0f5; transform: translateY(-1px); }
.day-chip .day-chip-main { display: block; font-weight: 800; color: var(--text); font-size: 0.95rem; }
.day-chip .day-chip-sub { display: block; font-size: 0.72rem; color: var(--text-secondary); font-weight: 700; }
.day-chip.active {
  background: var(--accent);
  border-color: var(--accent);
}
.day-chip.active .day-chip-main,
.day-chip.active .day-chip-sub { color: #fff; }

/* ---- Match cards ---- */
.match-card { transition: transform 0.12s ease, box-shadow 0.2s ease; }
.match-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.match-open { border-color: #cfe5ff !important; }
.match-completed { border-color: #ffe6ad !important; }

.team-flag {
  width: 48px; height: 48px; margin: 0 auto;
  display: grid; place-items: center;
  border-radius: 14px;
  color: var(--accent);
  font-size: 1.1rem;
  overflow: hidden;
}
.flag-img { width: 44px; height: 30px; object-fit: cover; border-radius: 6px; }
.flag-mini { width: 22px; height: 15px; object-fit: cover; border-radius: 3px; vertical-align: -2px; margin-right: 3px; }
.vs { min-width: 72px; }
.final-score { font-size: 1.45rem; font-weight: 900; color: var(--text); white-space: nowrap; }

/* ---- Badges (pills) ---- */
.wc-badge { font-weight: 800; padding: 0.4rem 0.7rem; border-radius: 999px; font-size: 0.78rem; }
.badge-open { background: var(--accent-soft); color: var(--accent-dark); }
.badge-locked { background: #eef1f5; color: var(--text-secondary); }
.badge-done { background: #fff3d6; color: #b07d00; }
.badge-live { background: #ffe7e7; color: #e03131; }

/* live score + pulsing dot */
.live-score { font-size: 1.45rem; font-weight: 900; color: #e03131; white-space: nowrap; }
.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #e03131;
  margin-right: 5px;
  vertical-align: 1px;
  animation: live-pulse 1.2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 49, 49, 0.5); opacity: 1; }
  50% { box-shadow: 0 0 0 5px rgba(224, 49, 49, 0); opacity: 0.6; }
}

/* ---- Legend dots ---- */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; }
.dot-open { background: var(--accent); }
.dot-locked { background: var(--silver); }
.dot-done { background: var(--gold); }

/* ---- Tables (leaderboard / admin / profile) ---- */
.table { --bs-table-bg: transparent; color: var(--text); }
.table thead th {
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}
.table td, .table th { border-color: var(--line); }
.table-hover > tbody > tr:hover > * { background: var(--surface-2); }
.row-me { background: var(--accent-soft) !important; }
.row-me td { color: var(--accent-dark); }
.search-box { max-width: 280px; }

/* ---- Standings / groups ---- */
.standings-table th {
  color: var(--text-secondary);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 800;
  border-bottom: 1px solid var(--line);
}
.standings-table td, .standings-table th { border-color: var(--line); padding: 0.5rem 0.3rem; }
/* Long country names (2nd column) wrap instead of overflowing the box */
.standings-table th:nth-child(2), .standings-table td:nth-child(2) {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.2;
  min-width: 90px;
}
.standings-table th:not(:nth-child(2)), .standings-table td:not(:nth-child(2)) {
  white-space: nowrap;
}
.standings-table .flag-mini {
  vertical-align: middle;
  margin-inline-end: 4px;   /* correct side in both LTR and RTL */
  margin-right: 0;
}
.standings-table tr.qualify { background: rgba(0, 200, 120, 0.10); }
.standings-table tr.qualify td:first-child { box-shadow: inset 3px 0 0 #19c37d; }
.standings-table tr.playoff { background: rgba(255, 180, 0, 0.10); }
.standings-table tr.playoff td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.legend-box { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 4px; vertical-align: -1px; }
.legend-box.qualify { background: #19c37d; }
.legend-box.playoff { background: var(--gold); }

/* ---- Profile / stats ---- */
.profile-avatar {
  width: 66px; height: 66px; border-radius: 20px;
  display: grid; place-items: center;
  font-size: 1.6rem; color: #fff;
  background: linear-gradient(135deg, var(--accent), #54a8ff);
  box-shadow: 0 10px 22px rgba(31, 131, 255, 0.3);
  overflow: hidden;
  flex: 0 0 auto;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.stat-card { transition: transform 0.12s ease, box-shadow 0.2s ease; }
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.stat-icon {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  margin-bottom: 0.75rem; font-size: 1.05rem;
}
/* vary the stat icon colors like the reference */
.stat-card:nth-child(1) .stat-icon { background: #fff3d6; color: var(--gold); }
.stat-card:nth-child(2) .stat-icon { background: var(--accent-soft); color: var(--accent); }
.stat-card:nth-child(3) .stat-icon { background: #e4faf9; color: var(--teal); }
.stat-card:nth-child(4) .stat-icon { background: #f0e9ff; color: var(--purple); }
.stat-value { font-size: 2rem; font-weight: 900; line-height: 1; }
.stat-label { color: var(--text-secondary); font-size: 0.85rem; margin-top: 0.25rem; font-weight: 700; }

/* ---- Champion banner ---- */
.champion-banner {
  background:
    radial-gradient(420px 200px at 100% 0%, rgba(255, 201, 77, 0.14), transparent 60%),
    linear-gradient(180deg, var(--surface-2), var(--surface));
}
.form-select {
  background-color: var(--surface);
  border: 1px solid #dfe4ec;
  color: var(--text);
  border-radius: 12px;
  font-weight: 600;
}
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem var(--accent-soft);
}

/* ---- Champion picker ---- */
.champion-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0.9rem 0.5rem;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
  text-align: center;
}
.champion-option:hover { border-color: #cfe0f5; transform: translateY(-2px); }
.champion-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 6px 16px rgba(31, 131, 255, 0.18);
}
.champion-option.disabled { cursor: default; opacity: 0.7; }
.champion-option.disabled:hover { transform: none; border-color: var(--line); }
.champion-flag {
  width: 54px; height: 38px;
  display: grid; place-items: center;
  overflow: hidden; border-radius: 7px;
  color: var(--accent); font-size: 1.2rem;
}
.champion-flag img { width: 54px; height: 38px; object-fit: cover; }
.champion-name { font-weight: 800; font-size: 0.9rem; color: var(--text); }
.champion-tick {
  position: absolute; top: 8px; right: 8px;
  color: var(--accent); opacity: 0;
  transition: opacity 0.15s ease;
}
.champion-option.selected .champion-tick { opacity: 1; }

/* ---- Bottom app nav (mobile) ---- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(17, 34, 63, 0.08);
  padding: 0.35rem 0.25rem;
  padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
  z-index: 1040;
}
.bottom-nav-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 800;
  font-size: 0.6rem;
  padding: 0.35rem 0.1rem;
  border-radius: 12px;
  transition: color 0.15s ease, background 0.15s ease;
}
.bottom-nav-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bottom-nav-item i { font-size: 1.15rem; }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item:active { background: var(--accent-soft); }

/* keep page content clear of the fixed bottom bar on small screens */
@media (max-width: 991.98px) {
  body { padding-bottom: 70px; }
}

/* ---- Footer ---- */
.wc-footer { border-top: 1px solid var(--line); background: var(--surface); }
.wc-footer .text-secondary { color: var(--text-secondary) !important; }

/* ---- Community (Reddit-style voting) ---- */
.nav-badge { position: absolute; top: 1px; right: 4px; font-size: 0.6rem; padding: 0.18em 0.42em; line-height: 1; min-width: 1.1em; }
.min-w-0 { min-width: 0; }
.vote-col { width: 38px; flex: 0 0 38px; }
.vote-btn { border: none; background: none; color: var(--text-secondary); cursor: pointer; font-size: 1.35rem; line-height: 1; padding: 0; }
.vote-btn:hover { color: var(--accent); }
.vote-btn.up.active { color: #ff6a3d; }
.vote-btn.down.active { color: #6a85ff; }
.vote-score { font-size: 0.95rem; }
.ach-badge { display: inline-flex; align-items: center; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-secondary); border-radius: 14px; padding: 4px 10px; font-size: 0.8rem; font-weight: 700; opacity: 0.55; }
.ach-badge.earned { opacity: 1; background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ach-badge.earned i { color: var(--gold); }
.reaction-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.reaction-btn { border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 2px 9px; font-size: 0.95rem; cursor: pointer; line-height: 1.4; }
.reaction-btn.active { border-color: var(--accent); background: var(--accent-soft); }
.reaction-btn .rc { font-size: 0.72rem; font-weight: 700; margin-inline-start: 3px; color: var(--text-secondary); }
.post-new { border-left: 4px solid #ff5a4d !important; }
.post-newc { border-left: 4px solid #3d7bff !important; }
.comment-new { background: rgba(61, 123, 255, 0.08); border-radius: 8px; }

/* ---- Rank medals (top 3) ---- */
.medal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  font-weight: 900; font-size: 1rem; line-height: 1;
  position: relative; border: 2px solid rgba(255, 255, 255, 0.65);
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.22), 0 2px 5px rgba(0, 0, 0, 0.18);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}
.medal::before {            /* glossy shine */
  content: ""; position: absolute; top: 4px; left: 7px;
  width: 11px; height: 7px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.6); filter: blur(1px);
}
.medal-gold   { background: radial-gradient(circle at 35% 28%, #ffe680, #f3b01c 72%); color: #7a5200; }
.medal-silver { background: radial-gradient(circle at 35% 28%, #ffffff, #b4bdca 72%); color: #555f6e; }
.medal-bronze { background: radial-gradient(circle at 35% 28%, #f4c79a, #c5763a 72%); color: #67381a; }

/* ---- Knockout bracket TREE (desktop ≥ lg) ---- */
.kt { display: flex; align-items: stretch; width: 100%; }
.kt-half { display: flex; flex: 1 1 0; min-width: 0; }
.kt-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: space-around; }
.kt-center { flex: 0 0 188px; justify-content: center; gap: 18px; padding: 0 8px; }
.kt-m { flex: 1 1 0; display: flex; align-items: center; justify-content: center; position: relative; }

/* Final — gold showcase card */
.kt-final { border-radius: 16px; padding: 12px 12px 10px; text-align: center;
  background: linear-gradient(160deg, #fff6da 0%, #ffe9a8 55%, #f6cf6a 100%);
  border: 1px solid #e6c468; box-shadow: 0 8px 22px rgba(193,150,30,0.28); position: relative; z-index: 2; }
.kt-final-ttl { font-weight: 900; letter-spacing: .14em; font-size: .72rem; color: #7a5200; margin-bottom: 8px; }
.kt-final-ttl .fa-trophy { color: #e0a800; }
.kt-champ { margin-top: 8px; font-weight: 800; font-size: .82rem; color: #7a5200;
  border-top: 1px dashed #e0bd5e; padding-top: 6px; }
.kt-champ .fa-crown { color: #e0a800; }

/* 3rd-place play-off — small card under the final */
.kt-third { border-radius: 12px; padding: 8px 10px; text-align: center;
  background: var(--surface-2); border: 1px solid var(--line); box-shadow: var(--shadow); }
.kt-third-ttl { font-weight: 700; font-size: .62rem; letter-spacing: .06em; text-transform: uppercase;
  color: #8a8a8a; margin-bottom: 6px; }

/* shared finalist / third rows */
.kt-fr { display: flex; align-items: center; gap: 7px; padding: 3px 4px; border-radius: 8px; font-size: .82rem; }
.kt-fr .nm { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kt-fr .sc { font-weight: 800; min-width: 16px; }
.kt-fr.win { font-weight: 800; }
.kt-fr.win .nm { color: #1f7a4d; }
.kt-fr .kt-rk { font-size: .58rem; font-weight: 800; color: #fff; background: #b8862b;
  border-radius: 5px; padding: 1px 4px; min-width: 22px; text-align: center; }
.kt-fr .ko-flag.kt-noflag { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 50%; }
[dir="rtl"] .kt-fr .nm { text-align: right; }
.kt-cell { display: flex; flex-direction: column; gap: 5px; background: var(--bg); padding: 3px; border-radius: 10px; z-index: 1; }
.kt-dot { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.18); background: var(--surface-2); display: grid; place-items: center; }
.kt-dot img { width: 100%; height: 100%; object-fit: cover; }
.kt-dot.tbd { border: 2px dashed var(--line); background: var(--surface-2); }
.kt-dot.win { outline: 2px solid #2bb673; outline-offset: 1px; }
/* connector lines — left half */
.kt-left .kt-col:not(:last-child) .kt-m { border-right: 2px solid var(--line); }
.kt-left .kt-col:not(:last-child) .kt-m:nth-child(odd) { border-bottom: 2px solid var(--line); }
.kt-left .kt-col:not(:last-child) .kt-m:nth-child(even) { border-top: 2px solid var(--line); }
.kt-left .kt-col:not(:first-child) .kt-m::before { content: ""; position: absolute; right: 100%; top: 50%; width: 50%; border-top: 2px solid var(--line); }
/* connector lines — right half (columns ordered SF→R32 left-to-right) */
.kt-right .kt-col:not(:first-child) .kt-m { border-left: 2px solid var(--line); }
.kt-right .kt-col:not(:first-child) .kt-m:nth-child(odd) { border-bottom: 2px solid var(--line); }
.kt-right .kt-col:not(:first-child) .kt-m:nth-child(even) { border-top: 2px solid var(--line); }
.kt-right .kt-col:not(:last-child) .kt-m::after { content: ""; position: absolute; left: 100%; top: 50%; width: 50%; border-top: 2px solid var(--line); }

/* ---- Knockout bracket (responsive round-by-round) ---- */
.ko-round { margin-bottom: 1.75rem; }
.ko-round-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.ko-round-head h6 { white-space: nowrap; }
.ko-round-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.ko-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ko-match { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.ko-num { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.05em; color: var(--text-secondary); background: var(--surface-2); padding: 4px 11px; text-transform: uppercase; }
.ko-team { display: flex; align-items: center; gap: 8px; padding: 9px 11px; font-weight: 600; font-size: 0.9rem; }
.ko-team + .ko-team { border-top: 1px solid var(--line); }
.ko-team .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ko-team .sc { font-weight: 800; color: var(--accent); min-width: 18px; text-align: center; }
.ko-flag { width: 22px; height: 16px; object-fit: cover; border-radius: 3px; flex: 0 0 auto; }
.ko-team.win { background: rgba(43, 182, 115, 0.10); }
.ko-team.win .nm { font-weight: 800; color: var(--text); }
.ko-team.win .nm::after { content: " ✓"; color: #2bb673; }

/* ---- Podium card: faint Font Awesome trophy/medal pattern ---- */
.podium-card { position: relative; overflow: hidden; }
.podium-card > .card-body { position: relative; z-index: 1; }
.podium-pattern {
  position: absolute; inset: 0; z-index: 0; pointer-events: none; user-select: none;
  display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: space-evenly;
  gap: 22px; padding: 16px; overflow: hidden;
  color: var(--text-secondary); opacity: 0.08; font-size: 1.4rem; line-height: 1;
}
[data-bs-theme="dark"] .podium-pattern { opacity: 0.11; }

/* ---- Top-3 podium (horizontal) ---- */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 12px; margin-bottom: 1.75rem; }
.podium-place { width: 33%; max-width: 150px; text-align: center; }
.podium-ava-wrap { position: relative; display: inline-block; }
.podium-avatar {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  border: 3px solid #fff; box-shadow: var(--shadow); background: var(--surface-2);
}
.podium-1 .podium-avatar { width: 76px; height: 76px; }
.podium-medal {
  position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 26px; font-size: 0.78rem; border-width: 2px;
}
.podium-name { font-weight: 700; font-size: 0.85rem; margin-top: 0.7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-points { font-size: 0.8rem; color: var(--accent); font-weight: 800; }
.podium-bar { margin-top: 0.5rem; border-radius: 12px 12px 0 0; color: #fff; font-weight: 900; font-size: 1.15rem; padding-top: 0.4rem; text-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.podium-1 .podium-bar { height: 80px; background: linear-gradient(#ffd84d, #f3b01c); }
.podium-2 .podium-bar { height: 58px; background: linear-gradient(#dbe1e8, #b4bdca); }
.podium-3 .podium-bar { height: 42px; background: linear-gradient(#ecbf95, #c5763a); }
/* Shared spot: several tied players split one pedestal (50/50, 33/33/33, …) */
.podium-members { display: flex; justify-content: center; align-items: flex-end; gap: 6px; flex-wrap: wrap; }
.podium-member { flex: 1 1 0; min-width: 40px; max-width: 86px; text-align: center; }
.podium-members .podium-avatar { width: 44px; height: 44px; }
.podium-1 .podium-members .podium-avatar { width: 54px; height: 54px; }
.podium-member .podium-medal { width: 20px; height: 20px; font-size: 0.62rem; bottom: -6px; }
.podium-member .podium-name { font-size: 0.72rem; margin-top: 0.45rem; }

/* ---- Stat tiles (user profile modal) ---- */
.stat-tile { background: var(--surface-2); border: 1px solid var(--line); }

/* ---- Admin action tiles (open modals) ---- */
.admin-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 18px 10px; min-height: 96px;
  border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: .9rem; text-align: center; line-height: 1.2;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.admin-tile i { font-size: 1.5rem; color: var(--accent); }
.admin-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

/* ---- Emoji editor (admin announcements / polls) ---- */
.emoji-toolbar {
  display: flex; flex-wrap: wrap; gap: 2px;
  border: 1px solid var(--line); border-bottom: none;
  border-radius: 12px 12px 0 0;
  background: var(--surface-2); padding: 4px;
}
.emoji-btn {
  border: none; background: transparent; cursor: pointer;
  font-size: 1.15rem; line-height: 1; padding: 4px 6px; border-radius: 8px;
}
.emoji-btn:hover { background: var(--accent-soft); }
.emoji-input { border-radius: 0 0 12px 12px !important; }
/* Preserve the admin's line breaks when shown to users */
.pre-line { white-space: pre-line; }

/* ---- Privacy: blur the user's own predictions ---- */
.preds-hidden .user-pred {
  filter: blur(7px);
  user-select: none;
  transition: filter 0.15s ease;
}

/* ---- Mini avatar (rows) ---- */
.avatar-mini {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: -8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

/* ---- Flag picker ---- */
.flag-pick {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.flag-pick:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.flag-pick img { width: 100%; height: 36px; object-fit: cover; border-radius: 6px; display: block; }

/* ---- PIN input ---- */
.pin-input {
  text-align: center;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.6rem;
  padding: 0.6rem;
  border-radius: 14px;
}

/* ---- Get-the-app banner ---- */
.app-banner {
  background: var(--accent-soft);
  border: 1px solid #d4e6ff;
  border-radius: 14px;
  padding: 0.6rem 0.9rem;
  font-weight: 800;
  color: var(--accent-dark);
}
.app-banner .fa-android { color: #3ddc84; }

/* ---- Alerts ---- */
.alert-success { background: #e9f9ee; border: 1px solid #c7eed4; color: #1c7a3e; border-radius: 12px; }
.alert-danger { background: #fdecee; border: 1px solid #f8ccd2; color: #c0344a; border-radius: 12px; }

/* ---- Phone: smaller text + tighter fit, no horizontal scroll ---- */
@media (max-width: 575.98px) {
  html { font-size: 13.5px; }            /* scales all rem-based sizes down */
  body { overflow-x: hidden; }
  .container { padding-left: 12px; padding-right: 12px; }
  .card-body { padding: 0.9rem; }
  .table td, .table th { padding: 0.4rem 0.3rem; }
  .standings-table td, .standings-table th { padding: 0.35rem 0.2rem; }
  h2.fw-bold { font-size: 1.35rem; }
}
