/* Dark by design, not as an option.
   Restraint rules: one interactive accent (mint), position hues only as compact
   pills, and a single thin value bar per row instead of a wall of numbers.
   Every tap target is >=44px -- this gets used one-handed against a pick clock. */

:root {
  --bg: #0a0c10;
  --bg-glow: #10141c;
  --surface: rgba(255, 255, 255, .035);
  --surface-2: rgba(255, 255, 255, .07);
  --line: rgba(255, 255, 255, .08);
  --line-soft: rgba(255, 255, 255, .045);

  --text: #e6e9ef;
  --muted: #7b8496;
  --dim: #4d5563;

  --accent: #5eead4;
  --accent-dim: rgba(94, 234, 212, .14);
  --warn: #fbbf24;
  --danger: #f87171;
  --good: #4ade80;

  --qb: #f87171;
  --rb: #4ade80;
  --wr: #60a5fa;
  --te: #fbbf24;
  --k:  #a78bfa;
  --dst:#22d3ee;

  --row-h: 62px;
  --ease: cubic-bezier(.2, .8, .3, 1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  min-height: 100%;
  background: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 50% -8%, var(--bg-glow) 0%, transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

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

header {
  position: sticky; top: 0; z-index: 20;
  padding: env(safe-area-inset-top) 12px 8px;
  background: rgba(10, 12, 16, .82);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--line-soft);
}

.bar { display: flex; align-items: center; gap: 8px; padding: 8px 0 6px; }

.tabs {
  display: flex; flex: 1; gap: 2px; padding: 3px;
  background: var(--surface); border-radius: 11px;
}

.tab {
  flex: 1; min-height: 34px;
  background: transparent; color: var(--muted);
  border: 0; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; letter-spacing: .1px;
  transition: color .18s var(--ease), background .18s var(--ease);
}
.tab.active { background: var(--surface-2); color: var(--text); }

.icon-btn {
  min-width: 40px; min-height: 40px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); border-radius: 11px;
  font-size: 17px; line-height: 1;
  transition: color .18s var(--ease), border-color .18s var(--ease);
}
.icon-btn:active { color: var(--accent); border-color: var(--accent); }

.search-row { display: flex; gap: 8px; align-items: center; }

#search {
  flex: 1; min-height: 46px;
  padding: 0 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 13px;
  font-size: 16px; /* 16px stops iOS zooming on focus */
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
#search::placeholder { color: var(--dim); }
#search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.chips {
  display: flex; gap: 6px; margin-top: 8px;
  overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto; min-height: 32px; padding: 0 13px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--line); border-radius: 16px;
  font-size: 12.5px; font-weight: 650; letter-spacing: .2px;
  transition: all .18s var(--ease);
}
.chip.active {
  background: var(--accent-dim); color: var(--accent);
  border-color: rgba(94, 234, 212, .4);
}

.status {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  font-size: 11.5px; color: var(--dim); padding: 6px 3px 2px;
  font-variant-numeric: tabular-nums;
}
.status .run { color: var(--warn); font-weight: 600; }
.status-right { display: flex; align-items: center; gap: 10px; }

/* Persistent undo for the last pick — the toast is gone by the time you notice. */
.last-pick {
  min-height: 30px; padding: 0 11px;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); border-radius: 15px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
  transition: all .15s var(--ease);
}
.last-pick:active { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

/* ---------- player list ---------- */

main { padding-bottom: 96px; }

.list { display: flex; flex-direction: column; }

.row {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  min-height: var(--row-h); padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  transition: opacity .25s var(--ease), background .15s var(--ease);
}
.row::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: transparent; transition: background .2s var(--ease);
}
.row:active { background: var(--surface); }
.row.drafted { opacity: .3; }
.row.mine::before { background: var(--accent); }
.row.mine { background: linear-gradient(90deg, var(--accent-dim), transparent 55%); }

.rank {
  flex: 0 0 34px; text-align: center;
  font-size: 12.5px; font-weight: 700; color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* How far you've moved someone off the model's ranking. */
.shift { display: block; font-size: 9px; font-weight: 700; margin-top: 2px; letter-spacing: -.2px; }
.shift.up { color: var(--good); }
.shift.down { color: var(--danger); }

/* ---------- reorder mode ---------- */

#reorder-btn.on {
  background: var(--accent-dim); color: var(--accent);
  border-color: rgba(94, 234, 212, .45);
}

.reorder-hint {
  margin-top: 8px; padding: 8px 11px;
  background: var(--accent-dim); border: 1px solid rgba(94, 234, 212, .25);
  border-radius: 10px; font-size: 11.5px; line-height: 1.4; color: var(--accent);
}
.reorder-hint strong { color: var(--text); }

.reorder-controls { display: flex; flex-direction: column; gap: 3px; flex: 0 0 44px; }
.nudge {
  min-height: 27px;
  background: var(--surface); color: var(--accent);
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 11px; line-height: 1;
  transition: all .12s var(--ease);
}
.nudge:active { background: var(--accent); color: #06120f; border-color: var(--accent); }

.pos {
  flex: 0 0 40px; text-align: center;
  font-size: 10.5px; font-weight: 800; letter-spacing: .4px;
  padding: 4px 0; border-radius: 6px; color: #080b0f;
}
.pos.QB { background: var(--qb); } .pos.RB { background: var(--rb); }
.pos.WR { background: var(--wr); } .pos.TE { background: var(--te); }
.pos.K  { background: var(--k);  } .pos.DST { background: var(--dst); }

.info { flex: 1; min-width: 0; }
.name {
  font-size: 15px; font-weight: 600; letter-spacing: -.1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meta {
  font-size: 11.5px; color: var(--muted); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meta .sep { color: var(--dim); margin: 0 6px; }

/* Team identity in the club's own colors. Colors ship with the board, so this
   works offline -- unlike logos, which are remote URLs on someone else's CDN. */
.team-badge {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 800; letter-spacing: .3px;
  vertical-align: 1px; min-width: 30px; text-align: center;
}
td .team-badge { font-size: 9.5px; }
.meta .flag { color: var(--warn); font-weight: 650; }
.meta .starter { color: var(--good); font-weight: 650; }

/* Thin bar showing this player's value against the best still available --
   the one piece of chrome that earns its space. */
.vbar {
  height: 2px; margin-top: 6px; border-radius: 2px;
  background: var(--surface-2); overflow: hidden;
}
.vbar > i {
  display: block; height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), rgba(94, 234, 212, .35));
  transition: width .3s var(--ease);
}

.take {
  flex: 0 0 44px; min-height: 44px;
  background: var(--surface); color: var(--accent);
  border: 1px solid var(--line); border-radius: 12px;
  font-size: 19px; font-weight: 600; line-height: 1;
  transition: all .15s var(--ease);
}
.take:active { background: var(--accent); color: #06120f; border-color: var(--accent); }

.tier-break {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px 7px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .8px;
  color: var(--dim); text-transform: uppercase;
}
.tier-break::after {
  content: ""; flex: 1; height: 1px; background: var(--line-soft);
}

.empty { padding: 56px 24px; text-align: center; color: var(--dim); font-size: 14px; }

/* ---------- detailed table ---------- */

.sort-row {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px; border-bottom: 1px solid var(--line-soft);
}
.sort-row label { font-size: 12px; color: var(--muted); }
#sort-by {
  flex: 1; min-height: 42px; padding: 0 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
}
.toggle { display: flex; align-items: center; gap: 6px; }
.toggle input { accent-color: var(--accent); width: 17px; height: 17px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td {
  padding: 9px 8px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--line-soft);
  font-variant-numeric: tabular-nums;
}
th {
  position: sticky; top: 0; z-index: 5;
  background: rgba(16, 20, 28, .95);
  backdrop-filter: blur(10px);
  color: var(--dim); font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
}
/* Action column stays pinned so it's reachable however far the table is
   scrolled sideways. */
td.act, th:first-child {
  position: sticky; left: 0; z-index: 2;
  background: var(--bg); text-align: left;
  padding: 5px 7px; white-space: nowrap;
}
th:first-child { z-index: 6; background: rgba(16, 20, 28, .95); }
tr.drafted td.act { background: var(--bg); }

.act-btn {
  min-width: 30px; min-height: 30px; padding: 0;
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--line); border-radius: 7px;
  font-size: 13px; font-weight: 700; line-height: 1;
  transition: all .12s var(--ease);
}
.act-btn + .act-btn { margin-left: 4px; }
.act-btn.mine { color: var(--accent); }
.act-btn.undo { color: var(--accent); }
.act-btn.out:active { background: var(--danger); color: #0b0e13; border-color: var(--danger); }
.act-btn.mine:active,
.act-btn.undo:active { background: var(--accent); color: #06120f; border-color: var(--accent); }

td:nth-child(4), th:nth-child(4) { text-align: left; }
tr.drafted { opacity: .38; }
/* The put-back affordance is now an explicit button in the action column, so
   the old arrow decoration would render a second, dead arrow beside it. */
tr.undoable:active { opacity: .8; background: var(--surface); }

/* ---------- roster ---------- */

.roster { padding: 14px 12px; }
.slot {
  display: flex; align-items: center; gap: 11px;
  min-height: 54px; padding: 9px 12px; margin-bottom: 7px;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 12px;
}
.slot.filled { border-color: rgba(94, 234, 212, .22); }
.slot .label {
  flex: 0 0 50px; font-size: 10.5px; font-weight: 800;
  letter-spacing: .5px; color: var(--dim);
}
.slot.filled .label { color: var(--accent); }
.slot .empty-txt { color: var(--dim); font-size: 13px; }
.needs { margin: 18px 0 10px; font-size: 13px; color: var(--muted); }
.needs strong { color: var(--text); font-weight: 650; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; z-index: 40;
  background: rgba(24, 29, 38, .94);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .55);
  font-size: 14px;
  animation: rise .2s var(--ease);
}
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
#toast-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#undo-btn {
  min-height: 38px; padding: 0 16px;
  background: var(--accent); color: #06120f;
  border: none; border-radius: 10px; font-weight: 700; font-size: 13.5px;
}

/* ---------- dialogs ---------- */

dialog {
  width: min(560px, 92vw); padding: 20px;
  background: #12161e; color: var(--text);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
dialog::backdrop { background: rgba(0, 0, 0, .66); backdrop-filter: blur(3px); }
dialog h2 { margin: 0 0 14px; font-size: 17px; font-weight: 650; letter-spacing: -.2px; }
dialog label { display: block; margin-bottom: 13px; font-size: 12.5px; color: var(--muted); }
dialog input[type=number], dialog input[type=text] {
  display: block; width: 100%; min-height: 44px; margin-top: 6px; padding: 0 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; font-size: 16px;
}
dialog textarea {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical;
}
.hint { font-size: 12.5px; color: var(--muted); margin: 0 0 11px; line-height: 1.45; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.dialog-actions button {
  min-height: 44px; padding: 0 17px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 11px; font-size: 14px; font-weight: 600;
}
.dialog-actions .primary { background: var(--accent); color: #06120f; border-color: var(--accent); }
.dialog-actions .danger { background: transparent; color: var(--danger); border-color: rgba(248, 113, 113, .4); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
