/* ========================================================================== */
/*  Survivor Pool — styles                                                    */
/* ========================================================================== */

:root {
  --bg: #0b0e13;
  --bg-raised: #141920;
  --bg-raised-2: #1b212a;
  --border: #262d38;
  --border-strong: #343d4b;

  --text: #eef2f7;
  --text-dim: #9aa5b4;
  --text-faint: #6b7684;

  --accent: #3d7dfa;
  --accent-dim: #2c5cbb;
  --win: #2ecc71;
  --loss: #ff5a5f;
  --tie: #f0b429;
  --live: #ff3b30;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .25);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
}

body { padding-bottom: env(safe-area-inset-bottom); }

a { color: var(--accent); }

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  width: 100%;
}

input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* --------------------------------- layout -------------------------------- */

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px 72px;
}

.boot {
  display: grid;
  place-items: center;
  min-height: 70vh;
}

.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------- header -------------------------------- */

header.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 14, 19, .86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.top-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.01em;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand .ball { font-size: 19px; }

.week-chip {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg-raised-2);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.who {
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 10px;
}

.linkbtn {
  color: var(--text-dim);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.linkbtn:hover { color: var(--text); }

/* ---------------------------------- cards -------------------------------- */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 18px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.card .sub {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--text-faint);
}

.center-card {
  max-width: 420px;
  margin: 64px auto 0;
}

/* --------------------------------- buttons ------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 620;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  transition: background .15s, transform .06s;
}
.btn:hover { background: #4b88ff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.wide { width: 100%; }
.btn.ghost { background: var(--bg-raised-2); color: var(--text); border: 1px solid var(--border-strong); }
.btn.ghost:hover { background: #232a34; }
.btn.small { padding: 7px 13px; font-size: 13px; }
.btn.danger { background: #7a2226; }
.btn.danger:hover { background: #93292e; }

/* ---------------------------------- status ------------------------------- */

.status-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.stat {
  flex: 1 1 130px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  font-weight: 600;
}
.stat .value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-top: 3px;
}
.stat .value.alive { color: var(--win); }
.stat .value.out { color: var(--loss); }

.banner {
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-top: 18px;
  font-size: 14.5px;
  border: 1px solid;
  display: flex;
  align-items: center;
  gap: 10px;
}
.banner.ok { background: rgba(46, 204, 113, .09); border-color: rgba(46, 204, 113, .3); color: #86e5b0; }
.banner.warn { background: rgba(240, 180, 41, .09); border-color: rgba(240, 180, 41, .3); color: #f2cf7a; }
.banner.bad { background: rgba(255, 90, 95, .09); border-color: rgba(255, 90, 95, .3); color: #ff9ea1; }
.banner.info { background: rgba(61, 125, 250, .09); border-color: rgba(61, 125, 250, .3); color: #9dbcff; }
.banner .grow { flex: 1; }
.banner.payment { align-items: center; flex-wrap: wrap; }
.banner.payment .btn { flex: none; text-decoration: none; white-space: nowrap; }
.money-cell .value.pending { color: var(--tie); }

/* --------------------------------- games --------------------------------- */

.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.game {
  background: var(--bg-raised-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  font-size: 11.5px;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,.16);
}

.game-head .live {
  color: var(--live);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--live);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.team-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  transition: background .12s;
  border-left: 3px solid transparent;
}
.team-row + .team-row { border-top: 1px solid var(--border); }
.team-row.pickable:hover { background: rgba(61, 125, 250, .1); }
.team-row.picked { background: rgba(61, 125, 250, .16); border-left-color: var(--accent); }
.team-row.used { opacity: .34; cursor: not-allowed; }
.team-row.locked-out { cursor: default; }
.team-row.winner .tname { color: var(--win); }
.team-row.loser { opacity: .55; }

.team-row img {
  width: 26px; height: 26px;
  object-fit: contain;
  flex: none;
}

.tname { font-weight: 600; font-size: 14.5px; }
.trec { font-size: 11.5px; color: var(--text-faint); margin-left: 6px; }
.tscore {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tbadge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.team-row.dimmed { opacity: .4; }

/* ------------------------------- action bar ------------------------------ */

.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  background: rgba(11, 14, 19, .93);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border-strong);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  animation: slideUp .18s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } }

.action-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.action-text { margin-right: auto; display: flex; flex-direction: column; line-height: 1.35; }
.action-text strong { font-size: 16px; letter-spacing: -.01em; }
.action-text .muted { font-size: 12.5px; }

/* -------------------------------- standings ------------------------------ */

.table-scroll { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }

table.standings {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  white-space: nowrap;
}

table.standings th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-faint);
  font-weight: 650;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border);
}
table.standings th.wk { text-align: center; padding-left: 4px; padding-right: 4px; }

table.standings td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
table.standings tr:last-child td { border-bottom: none; }
table.standings tr.you { background: rgba(61, 125, 250, .08); }
table.standings tr.dead .pname { color: var(--text-faint); text-decoration: line-through; }

.pname { font-weight: 600; }
.pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 7px;
  vertical-align: 1px;
}
.pill.you { background: var(--accent-dim); color: #fff; }
.pill.alive { background: rgba(46, 204, 113, .16); color: var(--win); }
.pill.out { background: rgba(255, 90, 95, .14); color: var(--loss); }
.pill.unpaid { background: rgba(240, 180, 41, .16); color: var(--tie); }
.pill.warn { background: rgba(240, 180, 41, .2); color: var(--tie); }

table.standings th.rank, table.standings td.rank {
  text-align: center;
  width: 34px;
  padding-left: 0;
  padding-right: 0;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12.5px;
}
table.standings th.wins, table.standings td.wins {
  text-align: center;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding-left: 6px;
  padding-right: 14px;
  border-right: 1px solid var(--border);
}
table.standings th.wins { font-size: 11px; font-family: var(--font); }

td.wk {
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}
.cell {
  display: inline-block;
  min-width: 42px;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--bg-raised-2);
  color: var(--text-dim);
}
.cell.win { background: rgba(46, 204, 113, .16); color: var(--win); }
.cell.loss { background: rgba(255, 90, 95, .14); color: var(--loss); }
.cell.tie { background: rgba(240, 180, 41, .16); color: var(--tie); }
.cell.missed { background: rgba(255, 90, 95, .1); color: var(--loss); }
.cell.hidden { color: var(--text-faint); letter-spacing: .1em; }
.cell.empty { background: transparent; color: var(--border-strong); }
.cell.double { box-shadow: inset 0 0 0 1px currentColor; font-size: 11px; }

/* ---------------------------------- money -------------------------------- */

.money-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.money-cell {
  background: var(--bg-raised-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
}
.money-cell .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  font-weight: 600;
}
.money-cell .value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.money-cell.pot .value { color: var(--win); font-size: 26px; }
.money-cell .sublabel {
  font-size: 11.5px; color: var(--text-faint); margin-top: 3px;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------- admin -------------------------------- */

.admin { border-color: var(--border-strong); }
.admin h2 { color: var(--tie); }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 5px;
}
.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--text-dim);
}
.checkline input { width: auto; }

.admin-rows { display: flex; flex-direction: column; gap: 8px; }
.admin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg-raised-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 14px;
}
.admin-row .grow { flex: 1; min-width: 140px; }
.admin-row .email { color: var(--text-faint); font-size: 12px; }

/* ---------------------------------- misc --------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--bg-raised-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 100;
  max-width: min(92vw, 460px);
  animation: rise .18s ease-out;
}
.toast.bad { border-color: rgba(255, 90, 95, .5); color: #ffb3b5; }
.toast.good { border-color: rgba(46, 204, 113, .45); color: #97e9bb; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

.hint {
  margin: 8px 0 14px;
  font-size: 12.5px;
  color: var(--text-faint);
  min-height: 1.2em;
}
.hint.bad { color: var(--loss); }

.muted { color: var(--text-faint); font-size: 13.5px; }
.rowsplit { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt { margin-top: 14px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-faint); margin-top: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

@media (max-width: 640px) {
  .card { padding: 16px; }
  .table-scroll { margin: 0 -16px; padding: 0 16px; }
  .brand { font-size: 15px; }
}

/* --------------------------------- rules modal ---------------------------- */

.card-foot { text-align: center; margin-top: 18px; }
.dot-sep { color: var(--text-faint); margin: 0 6px; }

body.modal-open { overflow: hidden; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 6, 10, .72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modal-in .16s ease-out;
}

@keyframes modal-in { from { opacity: 0 } to { opacity: 1 } }

.modal-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 560px;
  max-height: min(86vh, 780px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 { margin: 2px 0 0; font-size: 20px; font-weight: 650; }

.modal-kicker {
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.modal-x {
  color: var(--text-faint);
  font-size: 26px;
  line-height: 1;
  padding: 0 4px;
  margin: -2px -4px 0 0;
}
.modal-x:hover { color: var(--text); }

.modal-body {
  overflow-y: auto;
  padding: 4px 22px 8px;
  -webkit-overflow-scrolling: touch;
}

.rules-sec { padding: 16px 0; border-bottom: 1px solid var(--border); }
.rules-sec:last-child { border-bottom: 0; }

.rules-sec h4 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 650;
}

.rules-sec ul { margin: 0; padding-left: 18px; }

.rules-sec li {
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 1.55;
  margin-bottom: 7px;
}
.rules-sec li:last-child { margin-bottom: 0; }
.rules-sec strong { color: var(--text); font-weight: 600; }
.rules-sec a { color: var(--accent); }

.modal-foot {
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
}

@media (max-width: 560px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal-card { max-width: none; max-height: 92vh; border-radius: 16px 16px 0 0; }
}
