:root {
  /* NVIDIA green — solid fills/buttons */
  --nv-green: #76b900;
  --nv-green-bright: #8fd400;
  --nv-green-dim: #5c8f00;
  --accent: #5a8a00;        /* darker green for green TEXT on light bg (readable) */

  /* Light theme surfaces */
  --bg: #eef1ea;            /* page background */
  --bg-2: #ffffff;          /* cards / panels */
  --bg-3: #e6ebdf;          /* chips, hover, inputs */
  --line: #dde2d4;
  --line-2: #c6cdba;

  /* Text */
  --text: #1a2118;          /* near-black: ~14:1 on white */
  --muted: #5b6456;         /* secondary: ~5:1 on white */
  --muted-2: #828b79;       /* tiny meta only */

  --danger: #cf3a3a;
  --gold: #e6a700;
  --silver: #94a0ad;
  --bronze: #bf7430;

  --radius: 14px;
  --shadow: 0 14px 34px -18px rgba(28, 40, 16, 0.45);
  --maxw: 1080px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 520px at 85% -8%, #e7f1d5 0%, transparent 55%),
    radial-gradient(800px 420px at -5% 0%, #eef3e7 0%, transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.accent { color: var(--accent); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 12px clamp(14px, 4vw, 36px);
  background: rgba(248, 250, 245, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.brand-mark { font-size: 22px; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: .3px; color: var(--text); }
.tabs { display: flex; gap: 4px; margin-left: 6px; }
.tab {
  background: transparent; border: none; color: var(--muted);
  font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 9px; cursor: pointer;
  transition: .15s;
}
.tab:hover { color: var(--text); background: var(--bg-3); }
.tab.active { color: var(--nv-green-dim); background: rgba(118,185,0,.14); }
.auth-area { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-pill {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 6px 5px 14px; font-size: 13px; font-weight: 600; color: var(--text);
}
.user-pill .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--nv-green), var(--nv-green-dim));
  color: #07120a; display: grid; place-items: center; font-weight: 800; font-size: 12px;
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 700; border-radius: 10px; padding: 10px 18px;
  cursor: pointer; border: 1px solid transparent; transition: .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--nv-green); color: #07120a; }
.btn-primary:hover { background: var(--nv-green-bright); box-shadow: 0 6px 20px -8px rgba(118,185,0,.8); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--nv-green-dim); color: var(--nv-green-dim); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 15.5px; }

/* ---------- Layout ---------- */
main { max-width: var(--maxw); margin: 0 auto; padding: clamp(16px, 3vw, 28px) clamp(14px, 4vw, 28px) 80px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.view-head h2 { font-size: 24px; margin: 0; display: flex; align-items: center; gap: 10px; }

/* ---------- Hero banner (dark stadium, light text over it) ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 18px;
  min-height: clamp(290px, 36vw, 360px);
  display: flex; align-items: center;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  margin-bottom: 8px;
}
.hero-visual { position: absolute; inset: 0; z-index: 0; line-height: 0; }
.hero-svg { width: 100%; height: 100%; display: block; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(5,8,4,.82) 0%, rgba(5,8,4,.55) 45%, rgba(5,8,4,.15) 100%);
}
.hero-text { position: relative; z-index: 2; padding: clamp(22px, 4vw, 46px); max-width: 660px; color: #fff; }
.hero-badge {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .6px;
  color: #cdf06a; background: rgba(118,185,0,.18); border: 1px solid rgba(143,212,0,.4);
  padding: 6px 12px; border-radius: 999px; margin-bottom: 16px;
}
.hero h1 { font-size: clamp(28px, 4.2vw, 44px); line-height: 1.08; margin: 0 0 14px; font-weight: 850; letter-spacing: -.5px; color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,.4); }
.hero h1 .accent { color: var(--nv-green-bright); }
.hero-sub { color: rgba(255,255,255,.85); font-size: 16.5px; max-width: 540px; margin: 0 0 22px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,.45); background: rgba(255,255,255,.06); }
.hero .btn-ghost:hover { border-color: #fff; background: rgba(255,255,255,.14); color: #fff; }
.hero-stats { display: flex; gap: 28px; margin-top: 24px; }
.hero-stats .stat { display: flex; flex-direction: column; }
.hero-stats .stat-num { font-size: 26px; font-weight: 850; color: var(--nv-green-bright); line-height: 1; }
.hero-stats .stat-lbl { font-size: 11.5px; color: rgba(255,255,255,.72); text-transform: uppercase; letter-spacing: .6px; margin-top: 4px; }
.cft { transform-box: fill-box; transform-origin: center; opacity: 0; animation-name: fall; animation-timing-function: linear; animation-iteration-count: infinite; }
@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  8% { opacity: .95; }
  100% { transform: translateY(460px) rotate(var(--r, 360deg)); opacity: .9; }
}
@media (prefers-reduced-motion: reduce) { .cft { animation: none; opacity: 0; } .ai-orb { animation: none; } }

/* ---------- AI card ---------- */
.ai-card {
  margin: 22px 0; padding: 22px 24px; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(118,185,0,.12), rgba(118,185,0,.03));
  border: 1px solid rgba(118,185,0,.3); position: relative; overflow: hidden;
}
.ai-card::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(118,185,0,.16), transparent 70%);
}
.ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ai-head h2 { margin: 0; font-size: 17px; color: var(--text); }
.ai-orb {
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--nv-green-bright), var(--nv-green-dim));
  box-shadow: 0 0 12px rgba(118,185,0,.7); animation: pulse 2.4s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.ai-refresh {
  margin-left: auto; background: transparent; border: 1px solid var(--line-2); color: var(--muted);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 15px; transition: .15s;
}
.ai-refresh:hover { color: var(--nv-green-dim); border-color: var(--nv-green-dim); transform: rotate(90deg); }
.ai-body { font-size: 15.5px; line-height: 1.6; margin: 0; color: var(--text); }
.ai-foot { margin-top: 10px; font-size: 11.5px; color: var(--muted-2); }
.ai-body.loading { color: var(--muted); }

/* ---------- Home grid ---------- */
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 8px; }
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; transition: .18s; box-shadow: 0 4px 16px -12px rgba(28,40,16,.3); }
.panel:hover { border-color: var(--line-2); transform: translateY(-2px); }
.panel h3 { margin: 0 0 14px; font-size: 15px; color: var(--text); }
.mini-list { display: flex; flex-direction: column; gap: 10px; }
.mini-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.mini-row .mr-main { flex: 1; min-width: 0; }
.mini-row .mr-teams { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; color: var(--text); }
.mini-row .mr-sub { color: var(--muted); font-size: 12px; font-weight: 400; }
.mini-row .mr-rank { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 12px; background: var(--bg-3); color: var(--muted); }
.mini-row .mr-rank.gold { background: var(--gold); color: #2a1d00; }
.mini-row .mr-rank.silver { background: var(--silver); color: #1a1d22; }
.mini-row .mr-rank.bronze { background: var(--bronze); color: #2a1500; }
.mini-row .mr-pts { font-weight: 800; color: var(--accent); }
.rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: 14px; color: var(--muted); }
.rules b { color: var(--text); }

/* ---------- Flags ---------- */
.flag-img {
  width: 30px; height: 20px; border-radius: 4px; object-fit: cover;
  vertical-align: middle; box-shadow: 0 1px 3px rgba(0,0,0,.25); border: 1px solid rgba(0,0,0,.1);
}
.mini-row .flag-img { width: 22px; height: 15px; }
.flag-emoji { font-size: 18px; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s;
}
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.active { background: var(--nv-green); color: #07120a; border-color: var(--nv-green); }

/* ---------- Match cards ---------- */
.match-list { display: flex; flex-direction: column; gap: 22px; }
.day-group h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.match-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.match {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; transition: .18s; position: relative;
  box-shadow: 0 4px 16px -13px rgba(28,40,16,.3);
}
.match.open:hover { border-color: rgba(118,185,0,.5); transform: translateY(-2px); box-shadow: 0 10px 26px -16px rgba(118,185,0,.6); }
.match.finished { background: #f6f8f2; }
.match.saved { animation: savedflash .9s ease; }
@keyframes savedflash { 0% { box-shadow: 0 0 0 0 rgba(118,185,0,.45); } 100% { box-shadow: 0 0 0 12px rgba(118,185,0,0); } }
.match-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted-2); }
.match-tag { color: var(--nv-green-dim); font-weight: 700; }
.match-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.team { display: flex; align-items: center; gap: 8px; min-width: 0; }
.team.away { justify-content: flex-end; }
.team .tname { font-weight: 700; font-size: 14px; line-height: 1.15; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.score-box { display: flex; align-items: center; gap: 6px; }
.score-input {
  width: 42px; height: 40px; text-align: center; font-size: 18px; font-weight: 800;
  background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 9px; color: var(--text);
  -moz-appearance: textfield;
}
.score-input::-webkit-outer-spin-button, .score-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-input:focus { outline: none; border-color: var(--nv-green); box-shadow: 0 0 0 3px rgba(118,185,0,.22); background: #fff; }
.score-input:disabled { opacity: .65; }
.score-sep { color: var(--muted-2); font-weight: 800; }
.final-score { font-size: 22px; font-weight: 850; color: var(--text); }
.match-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
.match-status { font-size: 12px; color: var(--muted); }
.badge { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.badge.live-lock { background: rgba(207,58,58,.12); color: var(--danger); }
.badge.points { background: rgba(118,185,0,.18); color: var(--accent); }
.badge.points.zero { background: var(--bg-3); color: var(--muted); }
.save-pred { opacity: .55; pointer-events: none; transition: .15s; }
.match.dirty .save-pred { opacity: 1; pointer-events: auto; }
.your-pred { font-size: 12px; color: var(--muted); }
.your-pred b { color: var(--text); }

/* ---------- Podium ---------- */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 6px 0 24px; flex-wrap: wrap; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 130px; }
.pod-avatar {
  position: relative; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 850; font-size: 18px; color: #07120a;
  background: linear-gradient(135deg, var(--nv-green-bright), var(--nv-green-dim));
}
.pod-medal { position: absolute; bottom: -6px; right: -6px; font-size: 20px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.pod-name { font-weight: 700; font-size: 13.5px; max-width: 120px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.pod-pts { font-weight: 850; color: var(--accent); font-size: 14px; }
.pod-stand {
  margin-top: 4px; width: 100%; display: grid; place-items: center; font-weight: 850; font-size: 22px; color: #2a1d00;
  border-radius: 10px 10px 0 0;
}
.pod-gold .pod-stand { height: 80px; background: linear-gradient(180deg, #ffd24a, #d49b15); }
.pod-silver .pod-stand { height: 58px; background: linear-gradient(180deg, #cdd6e0, #8b95a1); }
.pod-bronze .pod-stand { height: 44px; background: linear-gradient(180deg, #e2954a, #a9692e); }
.pod-gold .pod-avatar { background: linear-gradient(135deg, #ffe27a, #e0a800); box-shadow: 0 6px 20px -8px rgba(224,168,0,.7); }
.lb-trophy { display: inline-flex; }
.ico-trophy { width: 26px; height: 26px; }

/* ---------- Leaderboard ---------- */
.board-wrap { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 4px 16px -12px rgba(28,40,16,.3); }
.board { width: 100%; border-collapse: collapse; font-size: 14px; }
.board th, .board td { padding: 12px 16px; text-align: left; }
.board th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); border-bottom: 1px solid var(--line); }
.board th.num, .board td.num { text-align: right; }
.board tbody tr { border-bottom: 1px solid var(--line); transition: .12s; }
.board tbody tr:last-child { border-bottom: none; }
.board tbody tr:hover { background: var(--bg-3); }
.board tbody tr.me { background: rgba(118,185,0,.12); }
.board .rank { font-weight: 800; color: var(--muted); font-size: 15px; }
.board .rank.top { font-size: 17px; }
.board .pts { font-weight: 850; color: var(--accent); }
.board .pname { font-weight: 700; color: var(--text); }
.pname-avatar {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--bg-3); border: 1px solid var(--line-2); color: var(--muted); font-size: 10.5px; font-weight: 800;
  margin-right: 9px; vertical-align: middle;
}

/* ---------- Auth modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20,28,16,.45); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--bg-2); border: 1px solid var(--line); border-radius: 18px; width: 100%; max-width: 380px; padding: 26px; position: relative; box-shadow: 0 30px 60px -20px rgba(20,30,12,.5); }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; }
.modal-brand { font-weight: 800; font-size: 18px; text-align: center; margin-bottom: 16px; color: var(--text); }
.modal-tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.modal-tab { flex: 1; background: var(--bg-3); border: 1px solid var(--line); color: var(--muted); padding: 10px; border-radius: 10px; font-weight: 700; cursor: pointer; }
.modal-tab.active { background: rgba(118,185,0,.14); border-color: var(--nv-green); color: var(--nv-green-dim); }
.auth-form { display: flex; flex-direction: column; gap: 13px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.auth-form input { font: inherit; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-3); color: var(--text); }
.auth-form input:focus { outline: none; border-color: var(--nv-green); box-shadow: 0 0 0 3px rgba(118,185,0,.18); background: #fff; }
.auth-form .btn { margin-top: 4px; }
.form-hint { font-size: 12px; color: var(--muted); margin: 0; }
.form-hint b { color: var(--text); }
.form-error { font-size: 13px; color: var(--danger); margin: 0; min-height: 0; }
.form-error:empty { display: none; }

/* ---------- Toast (dark pill for pop on light bg) ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #1f271b; border: 1px solid #2f3a28; color: #fff;
  padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 600;
  box-shadow: 0 16px 36px -14px rgba(20,30,12,.5); opacity: 0; transition: .25s; z-index: 60; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: var(--nv-green); }
.toast.err { border-color: var(--danger); }

/* ---------- Confetti burst (DOM, celebration) ---------- */
.confetti-burst { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti-burst i {
  position: absolute; top: -16px; width: 9px; height: 14px; border-radius: 2px;
  animation-name: burst; animation-timing-function: cubic-bezier(.3,.7,.5,1); animation-fill-mode: forwards;
}
@keyframes burst { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(105vh) rotate(720deg); opacity: .85; } }

/* ---------- Footer + empty ---------- */
.footer { max-width: var(--maxw); margin: 0 auto; padding: 20px clamp(14px,4vw,28px) 40px; display: flex; justify-content: space-between; gap: 12px; color: var(--muted-2); font-size: 12.5px; flex-wrap: wrap; }
.footer a, .footer button.linkish { color: var(--muted); background: none; border: none; cursor: pointer; font: inherit; text-decoration: underline; }
.empty { color: var(--muted); font-size: 14px; padding: 26px 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ico-ball { width: 56px; height: 56px; opacity: .85; }

@media (max-width: 560px) {
  .tabs { display: none; }
  .hero h1 { font-size: 28px; }
  .match-cards { grid-template-columns: 1fr; }
  .hero-stats { gap: 18px; }
}
