/* RJs Pick'Em web client — a real webpage layout (top nav, full width, hover tabs)
   sharing the app's branding + the same /api. */
:root {
  --blue: #1C5CC7;
  --blue-dk: #12448f;
  --blue-tint: rgba(28, 92, 199, 0.10);
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1c1c1e;
  --secondary: #70757e;
  --sep: #e6e8ee;
  --green: #2fae57;
  --red: #e0392b;
  --orange: #ff9500;
  --radius: 12px;
  --maxw: 1180px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
#root { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { -webkit-user-drag: none; }
.muted { color: var(--secondary); }
.empty { text-align: center; color: var(--secondary); padding: 80px 20px; font-size: 15px; }

/* ---------------- top nav ---------------- */
.topnav { background: linear-gradient(180deg, var(--blue), var(--blue-dk)); color: #fff; position: sticky; top: 0; z-index: 30; box-shadow: 0 1px 6px rgba(0,0,0,.12); }
.nav-inner { max-width: var(--maxw); margin: 0 auto; display: flex; align-items: center; gap: 20px; padding: 0 24px; height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; margin-left: 12px; height: 100%; }
.tabs a { display: flex; align-items: center; padding: 0 16px; height: 100%; font-weight: 600; font-size: 15px; color: rgba(255,255,255,.82); border-bottom: 3px solid transparent; transition: background .15s, color .15s, border-color .15s; }
.tabs a:hover { background: rgba(255,255,255,.12); color: #fff; }
.tabs a.active { color: #fff; border-bottom-color: #fff; }
.nav-league { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-league select { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 6px 10px; font: inherit; font-weight: 600; cursor: pointer; }
.nav-league .bubble { background: rgba(255,255,255,.15); border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 600; }

/* ---------------- container ---------------- */
.container { max-width: var(--maxw); margin: 0 auto; padding: 22px 24px 60px; }
.pagehead { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.pagehead h2 { font-size: 22px; margin: 0; }

/* ---------------- week bar ---------------- */
.weekbar { display: flex; gap: 6px; flex-wrap: wrap; }
.week-pill { width: 40px; height: 34px; border-radius: 8px; border: 1px solid var(--sep); background: var(--card); color: var(--text); font-weight: 700; transition: background .12s; }
.week-pill:hover { background: var(--blue-tint); }
.week-pill.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---------------- toolbar / buttons ---------------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.btn { border: none; border-radius: 9px; padding: 10px 20px; font-size: 15px; font-weight: 700; color: #fff; transition: filter .12s, opacity .12s; }
.btn:hover { filter: brightness(1.05); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.blue { background: var(--blue); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
/* Sticky so the confidence-reassignment warning stays visible while scrolling the grid. */
.notice { position: sticky; top: 68px; z-index: 15; background: #fff4e2; color: #a65b00; padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(255,149,0,.4); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.notice button.x { margin-left: auto; background: none; border: none; color: #a65b00; font-size: 16px; cursor: pointer; }

/* ---------------- games grid ---------------- */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--sep); border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card { position: relative; }
.card:has(details[open]) { z-index: 20; }   /* keep an open confidence menu above other cards */
.game.live { border-color: rgba(255,149,0,.5); box-shadow: 0 0 0 2px rgba(255,149,0,.2); }
.game-top { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: var(--secondary); margin-bottom: 10px; }
.game-top .num { background: var(--bg); border-radius: 999px; padding: 2px 8px; }
.game-top .status.live { color: var(--orange); }
.game-top .kick { margin-left: auto; font-weight: 500; }
.matchup { display: flex; align-items: center; gap: 10px; }
.team { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.team .logobtn { border: 2.5px solid transparent; border-radius: 12px; padding: 6px; background: #f2f4f8; line-height: 0; position: relative; transition: border-color .12s, background .12s; }
.team .logobtn:hover { background: var(--blue-tint); }
.team .logobtn.sel { border-color: var(--blue); background: var(--blue-tint); }
.team .logobtn img { width: 54px; height: 54px; object-fit: contain; }
.team .tag { font-size: 10px; font-weight: 700; color: var(--secondary); }
.team .rank { position: absolute; top: -6px; left: -6px; background: var(--blue); color: #fff; font-size: 10px; font-weight: 800; width: 19px; height: 19px; border-radius: 999px; display: flex; align-items: center; justify-content: center; border: 1px solid #fff; }
.vs { min-width: 48px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.vs small { color: var(--secondary); font-weight: 600; }
.won { color: var(--green); }
.spread { font-size: 12px; color: var(--secondary); margin-top: 10px; }
/* Custom confidence menu (like the iOS Menu): compact button shows the number, the open
   list shows "N · Team" for every value — including this game's own pick. */
.confmenu { margin-left: auto; flex: 0 0 auto; position: relative; }
.confmenu > summary { list-style: none; cursor: pointer; width: 58px; height: 40px;
  display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700;
  border: 1px solid var(--sep); border-radius: 9px; background: var(--card); }
.confmenu > summary::-webkit-details-marker { display: none; }
.confmenu[open] > summary { border-color: var(--blue); }
.conflist { position: absolute; right: 0; top: calc(100% + 4px); z-index: 50; min-width: 190px;
  max-height: 300px; overflow-y: auto; background: var(--card); border: 1px solid var(--sep);
  border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 4px; }
.conflist button { display: block; width: 100%; text-align: left; border: none; background: none;
  padding: 8px 12px; border-radius: 7px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.conflist button:hover { background: var(--blue-tint); }
.detail-link { margin-left: 6px; background: none; border: none; color: var(--secondary); font-size: 20px; }
.detail-link:hover { color: var(--blue); }

/* ---------------- standings table ---------------- */
.stand-wrap { background: var(--card); border: 1px solid var(--sep); border-radius: var(--radius); overflow: hidden; }
.stand-scroll { overflow-x: auto; }
table.stand { border-collapse: collapse; width: 100%; }
table.stand th, table.stand td { padding: 8px 10px; border-bottom: 1px solid var(--sep); text-align: center; }
table.stand th { background: var(--bg); font-size: 11px; color: var(--secondary); position: sticky; top: 0; }
table.stand td.player, table.stand th.player { text-align: left; position: sticky; left: 0; background: var(--card); z-index: 1; white-space: nowrap; font-weight: 600; }
table.stand tr.me td { background: var(--blue-tint); }
table.stand tr.me td.player { background: #e7effb; }
table.stand td .score { font-weight: 800; font-variant-numeric: tabular-nums; }
table.stand td .pot { color: var(--secondary); font-size: 12px; }
.gcell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 8px; background: #f2f4f8; border: 1px solid var(--sep); }
.gcell.win { background: rgba(47,174,87,.16); border-color: rgba(47,174,87,.5); }
.gcell.loss { background: rgba(224,57,43,.14); border-color: rgba(224,57,43,.5); }
.gcell.live { background: rgba(255,149,0,.2); border-color: rgba(255,149,0,.6); }
.gcell.locked { background: #eef0f4; color: var(--secondary); font-size: 14px; }
.gcell img { width: 30px; height: 30px; object-fit: contain; }
.gcell .cconf { position: absolute; bottom: -3px; right: -3px; background: rgba(0,0,0,.66); color: #fff; font-size: 9px; font-weight: 700; width: 15px; height: 15px; border-radius: 999px; display: flex; align-items: center; justify-content: center; }
button.gcell { cursor: pointer; }
button.gcell:hover { outline: 2px solid var(--blue); }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--sep); border-radius: 9px; padding: 2px; }
.seg button { border: none; background: transparent; padding: 7px 14px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--text); }
.seg button.active { background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* ---------------- yearly table ---------------- */
table.yearly { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--sep); border-radius: var(--radius); overflow: hidden; }
table.yearly th, table.yearly td { padding: 11px 14px; border-bottom: 1px solid var(--sep); text-align: left; }
table.yearly th { background: var(--bg); font-size: 12px; color: var(--secondary); }
table.yearly td.total { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
table.yearly tr.me td { background: var(--blue-tint); }

/* ---------------- settings (two column on wide) ---------------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--sep); border-radius: var(--radius); overflow: hidden; }
.panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--secondary); margin: 0; padding: 14px 16px 8px; }
.row { display: flex; align-items: center; padding: 12px 16px; border-top: 1px solid var(--sep); gap: 10px; }
.row .lbl { color: var(--secondary); }
.row .val { margin-left: auto; font-weight: 600; }
.row input, .row select { font: inherit; padding: 9px; border-radius: 8px; border: 1px solid var(--sep); }
.row select { cursor: pointer; }
.linkbtn { background: none; border: none; color: var(--blue); font: inherit; font-weight: 700; padding: 14px 16px; text-align: left; width: 100%; }
.linkbtn:hover { background: var(--blue-tint); }
.danger { color: var(--red); }
.chip { background: var(--bg); border: 1px solid var(--sep); border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 600; }
.chip:hover { background: var(--blue-tint); }

/* ---------------- admin list ---------------- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.admin-item { display: flex; gap: 10px; align-items: flex-start; background: var(--card); border: 1px solid var(--sep); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.admin-item:hover { border-color: var(--blue); }
.admin-item.on { border-color: var(--blue); background: var(--blue-tint); }

/* ---------------- modal ---------------- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--bg); width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; border-radius: 16px; padding: 20px; }
.modal h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--secondary); margin: 16px 2px 6px; }
.distbar { height: 26px; border-radius: 999px; position: relative; overflow: hidden; background: rgba(224,57,43,.8); }
.distbar .green { position: absolute; top: 0; bottom: 0; background: rgba(47,174,87,.85); }
.distbar .pl { position: absolute; left: 8px; top: 5px; color: #fff; font-weight: 700; font-size: 12px; }
.distbar .pr { position: absolute; right: 8px; top: 5px; color: #fff; font-weight: 700; font-size: 12px; }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.85); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: 520px; text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,.3); }

/* ---------------- login ---------------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: linear-gradient(140deg, #0d3820, #05080f); padding: 28px; }
.login .logo { font-size: 60px; }
.login h1 { color: #fff; font-size: 34px; font-weight: 900; margin: 0; }
.login p.sub { color: rgba(255,255,255,.7); margin: 0; }
.login .form { width: 100%; max-width: 380px; background: rgba(255,255,255,.08); backdrop-filter: blur(12px); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.login input { padding: 13px; border-radius: 12px; border: none; background: rgba(255,255,255,.1); color: #fff; font: inherit; }
.login input::placeholder { color: rgba(255,255,255,.5); }
.login .go { background: var(--orange); color: #fff; border: none; border-radius: 12px; padding: 14px; font-weight: 800; font-size: 16px; }
.login .toggle { background: none; border: none; color: rgba(255,255,255,.85); font: inherit; cursor: pointer; }
.login .err { color: #ff6b6b; font-size: 13px; }

/* ---------------- responsive: collapse nav on narrow ---------------- */
@media (max-width: 640px) {
  .nav-inner { padding: 0 12px; gap: 8px; height: 54px; }
  .brand { font-size: 17px; }
  .tabs a { padding: 0 10px; font-size: 14px; }
  .container { padding: 16px 12px 50px; }
  .games-grid { grid-template-columns: 1fr; }
}

/* ---- Prank popup (configurable easter egg) ---- */
.prank-back { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 24px; animation: prankIn .12s ease-out; }
.prank-pop { background: #fff; border-radius: 16px; padding: 26px 24px; max-width: 380px; width: 100%;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); animation: prankPop .18s cubic-bezier(.2,1.3,.5,1); }
.prank-msg { font-size: 19px; font-weight: 700; line-height: 1.35; margin-bottom: 18px; color: #14213d; }
.prank-pop .btn { width: 100%; }
@keyframes prankIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes prankPop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
