:root {
  --ink: #1a2233;
  --paper: #f7f5ef;
  --card: #ffffff;
  --line: #e2ddd0;
  --accent: #37003c;
  --accent-bright: #963cff;
  --green: #1e7a3d;
  --gold: #c9971f;
  --muted: #7a7568;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

.topbar {
  display: flex;
  /* nowrap so auth-widget (login/signup or the profile icon) never gets
     pulled down onto a wrapped tabs line -- it stays pinned top-right no
     matter how many lines .topbar-left wraps to. */
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 10px 24px;
  padding: 14px 24px;
  background: var(--ink);
  color: white;
}
.topbar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 24px;
  flex: 1 1 auto;
  min-width: 0;
}
.topbar-left h1 { font-size: 18px; margin: 0; letter-spacing: 0.02em; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tab-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.tab-btn.active { background: white; color: var(--ink); border-color: white; }

.sync-btn {
  background: var(--green);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.sync-btn:disabled { opacity: 0.6; cursor: default; }

.auth-widget { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; flex-shrink: 0; }
.auth-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.auth-btn:hover { background: rgba(255,255,255,0.12); }

.account-menu-wrap { position: relative; }
.icon-avatar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  cursor: pointer;
}
.icon-avatar-btn:hover, .icon-avatar-btn[aria-expanded="true"] {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.7);
}

.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  max-width: calc(100vw - 28px);
  background: white;
  color: var(--ink);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  padding: 6px;
  z-index: 60;
}
.account-menu-name {
  padding: 8px 10px 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  word-break: break-word;
}
.account-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 10px;
  min-height: 40px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.account-menu-item:hover { background: #f2f0e8; }
.account-menu-item-danger { color: var(--accent); }

.rules {
  max-width: 900px;
  margin: 14px auto 0;
  padding: 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.contest-info {
  max-width: 900px;
  margin: 6px auto 0;
  padding: 0 24px;
  color: var(--muted);
  font-size: 12px;
}

.lock-banner {
  max-width: 900px;
  margin: 10px auto 0;
  padding: 10px 24px;
  background: #fdecea;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  border-top: 1px solid #f3c8c3;
  border-bottom: 1px solid #f3c8c3;
}

.tab-panel { padding: 20px 24px 60px; max-width: 1100px; margin: 0 auto; }
.hidden { display: none !important; }

.build-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 320px;
  gap: 28px;
  align-items: start;
}

.field-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.3;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0,0,0,0.15);
  container-type: inline-size;
}
.field-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.slots { position: absolute; inset: 0; }

.slot {
  position: absolute;
  width: 84px;
  height: 128px;
  width: clamp(44px, 15cqw, 84px);
  height: clamp(78px, 24cqw, 128px);
  transform: translate(-50%, -50%);
  border-radius: 10px;
  border: 2px dashed rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.28);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-size: clamp(8px, 2.8cqw, 12px);
  font-weight: 600;
  padding: 4px;
  padding: clamp(2px, 1cqw, 4px);
  backdrop-filter: blur(1px);
  /* No overflow:hidden here -- .slot-card (same size, below) does its own
     clipping for the name/team text, which leaves .slot itself free to host
     .pos-label positioned just below its bottom edge without clipping it. */
}
.slot::before { content: attr(data-pos); }
.slot:hover { background: rgba(0,0,0,0.4); }

.slot.filled {
  border-style: solid;
  border-color: #ffb020;
  background: rgba(0,0,0,0.55);
  padding: 6px;
  padding: clamp(3px, 1.2cqw, 6px);
  /* Height hugs the actual content (photo + however many lines the name
     wraps to + team) instead of reserving fixed room for a worst-case
     3-line name -- most players don't need that much space, so the fixed
     height left a lot of empty box below shorter names. Width stays fixed
     (inherited from .slot) so the pitch grid still lines up neatly. */
  height: auto;
}
.slot.filled::before { content: none; }
.slot:disabled { cursor: default; }
/* A pick that needs attention (injured/traded) -- always shown, independent
   of lock state, so it stands out on the pitch at a glance instead of only
   being findable via the small INJ/TRD badge text. */
.slot.filled.flagged { border-color: #dc2626; }
.slot.replaceable {
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.35);
}

.slot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  min-width: 0; /* flex items default to min-width:auto, which ignores this width:100% and lets long names push past it */
  overflow: hidden;
}
.slot-card img {
  width: 42px;
  height: 42px;
  width: clamp(20px, 7.5cqw, 42px);
  height: clamp(20px, 7.5cqw, 42px);
  border-radius: 50%;
  object-fit: cover;
  background: #ddd;
  border: 2px solid white;
  flex-shrink: 0;
}
.slot-card .name {
  font-size: 10px;
  font-size: clamp(6.5px, 1.9cqw, 10px);
  line-height: 1.15;
  text-align: center;
  width: 100%;
  /* Wrap onto a 2nd line rather than truncate -- the box (.slot, above) is
     sized with enough headroom for this instead of a single tight line. */
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}
.slot-card .team {
  font-size: 9px;
  font-size: clamp(6px, 1.6cqw, 9px);
  opacity: 0.85;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pos-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 2px;
  line-height: 1;
  font-size: 8px;
  font-size: clamp(5px, 1.4cqw, 8px);
  font-weight: 800;
  background: #ffb020;
  color: #3a2600;
  padding: 1px 5px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none; /* purely informational -- clicks still go to .slot beneath */
}

/* Red, not the same gold as .pos-label -- this means "needs attention"
   (injured/traded), not just "here's the position". */
.flag-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 1px 4px;
  border-radius: 4px;
  background: #dc2626;
  color: white;
}

/* Positions the INJ/TRD .flag-badge just above the box -- the mirror image
   of .pos-label below it -- instead of inside the card competing with the
   name/team for room. Only used for the pitch slot; the picker/pick-list
   .flag-badge usages stay inline text. */
.slot-flag {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 2px;
  line-height: 1;
  pointer-events: none; /* purely informational -- clicks still go to .slot beneath */
}
.slot-flag .flag-badge {
  font-size: 7px;
  font-size: clamp(5px, 1.3cqw, 7px);
}

/* "x" to blank out a filled, unlocked slot -- sibling of .slot-card so it
   sits above it (same trick as .pos-label/.slot-flag, both positioned
   relative to .slot itself). Neutral by default and red only on hover --
   red is already reserved for "needs attention" (.flag-badge/.flagged/
   .replaceable), so an always-red badge here would read as another
   injury/traded flag instead of a plain remove action. */
.slot-clear {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 13px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  z-index: 2;
}
.slot-clear:hover { background: #dc2626; }

.sidebar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-label input {
  font-size: 16px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 400;
  color: var(--ink);
}
.muted { color: var(--muted); font-weight: 400; }

.pick-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.pick-group-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin: 4px 0 -4px; }
.pick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f2f0e8;
  cursor: pointer;
}
.pick-row:hover { background: #e9e5d8; }
.pick-row.locked { cursor: default; }
.pick-row.locked:hover { background: #f2f0e8; }
.pick-row.replaceable { cursor: pointer; background: #fff3d6; }
.pick-row.replaceable:hover { background: #ffe9b8; }
.pick-row .pos { width: 34px; font-weight: 700; color: var(--muted); }
.pick-row .who { flex: 1; }
.pick-row.empty .who { color: var(--muted); font-style: italic; }
.pick-row .pick-clear {
  padding: 0 4px;
  font-weight: 700;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
}
.pick-row .pick-clear:hover { color: #dc2626; }

.primary-btn, .secondary-btn {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  border: none;
}
.primary-btn { background: var(--accent); color: white; }
.primary-btn:disabled { background: #cbb8ce; cursor: default; }
.secondary-btn { background: transparent; border: 1px solid var(--line); color: var(--ink); }

.msg { font-size: 13px; min-height: 18px; }
.msg.error { color: #b91c1c; }
.msg.success { color: var(--green); }

.link-btn {
  background: none;
  border: none;
  padding: 4px 2px;
  margin: -4px -2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.link-btn:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.link-btn.danger { color: #b91c1c; }

.editing-banner {
  margin: 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: #fdf3d9;
  color: #7a5b00;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.my-lineups { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.my-lineups h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.my-lineups-list { display: flex; flex-direction: column; gap: 6px; }
.my-lineup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: #f2f0e8;
}
.my-lineup-label { font-size: 13px; font-weight: 600; }
.my-lineup-sub { font-size: 11px; color: var(--muted); }
.my-lineup-actions { display: flex; gap: 12px; flex-shrink: 0; }

.auth-gate {
  max-width: 420px;
  margin: 60px auto;
  padding: 28px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-gate p { margin: 0; color: var(--muted); font-size: 14px; }

.auth-card { width: min(360px, 92vw); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-switch { text-align: center; font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.auth-divider { border: none; border-top: 1px solid var(--line); margin: 2px 0; width: 100%; }

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal-card {
  background: white;
  width: min(560px, 92vw);
  max-height: 80vh;
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-head h2 { font-size: 16px; margin: 0; }
.icon-btn {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  padding: 8px;
  margin: -8px;
  cursor: pointer;
  color: var(--muted);
}

.search-box {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  flex-shrink: 0;
}

.picker-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
}
.picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  min-height: 44px;
  flex-shrink: 0;
  border-radius: 8px;
  cursor: pointer;
}
.picker-row:hover { background: #f2f0e8; }
.picker-row img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #eee; flex-shrink: 0; }
.picker-row .info { flex: 1; }
.picker-row .info .n { font-size: 14px; font-weight: 600; }
.picker-row .info .t { font-size: 12px; color: var(--muted); }
.picker-row .info .stats { display: flex; flex-direction: column; gap: 1px; margin-top: 3px; }
.picker-row .info .stat-line { font-size: 11px; color: var(--ink); }
.picker-row .info .stat-line b { color: var(--accent); font-weight: 700; }
.picker-row .info .stat-tag { color: var(--muted); font-style: italic; }
.picker-row .taken { font-size: 11px; color: var(--accent); }
.picker-row.disabled { opacity: 0.45; cursor: not-allowed; }
.picker-empty { color: var(--muted); font-size: 13px; padding: 10px 4px; }

/* Standings */
.standings-table-wrap { overflow-x: auto; }

.standings-cards { display: none; flex-direction: column; gap: 10px; }
.standings-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}
.standings-card.winner { background: #fdf3d9; border-color: var(--gold); }

.standings-card-top { display: flex; align-items: center; gap: 10px; }
.standings-card-field { flex-shrink: 0; }
.standings-card-info { flex: 1; min-width: 0; }
.standings-card-patron { font-size: 14px; font-weight: 700; overflow-wrap: break-word; }
.standings-card-lineup-name { font-size: 12px; color: var(--muted); overflow-wrap: break-word; margin-top: 1px; }
.standings-card-progress { font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.winner-tag {
  flex-shrink: 0;
  align-self: flex-start;
  text-transform: uppercase;
}

.standings-card-positions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  /* .cell-player below enlarges its own click target with padding offset by
     an equal negative margin, so it doesn't affect surrounding layout size
     -- but that expanded hit area still pokes out 6px below its row's own
     box, which this padding-bottom gives room to contain. Without it, that
     6px is scrollable overflow: previously an unwanted vertical scrollbar
     (overflow-x: auto implicitly makes overflow-y auto too), now that
     overflow-y is pinned to hidden below, the chip images get clipped
     instead unless there's room to hold them. */
  padding-bottom: 6px;
  border-top: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
}
.pos-chip-group {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.pos-chip-label { font-size: 10px; font-weight: 700; color: var(--muted); }
.pos-chip-players { display: flex; gap: 4px; }
.pos-chip-empty {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f2f0e8;
  color: var(--muted);
  font-size: 14px;
}
table.standings {
  border-collapse: collapse;
  width: 100%;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
}
table.standings th, table.standings td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: center;
  font-size: 13px;
}
.position-group-cell { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; max-width: 140px; }
.progress-cell { font-weight: 700; white-space: nowrap; }
.progress-cell .complete-date { display: block; margin-top: 2px; font-size: 10px; font-weight: 400; color: var(--muted); }
table.standings th { background: #eeece3; font-size: 12px; color: var(--muted); }
table.standings td.patron-cell { text-align: left; font-weight: 600; }
table.standings td.lineup-name-cell { text-align: left; color: var(--muted); }
table.standings td.email-cell { text-align: left; color: var(--muted); }
table.standings td.email-cell .link-btn { margin-left: 8px; }
.inline-edit-form { display: flex; align-items: center; gap: 8px; }
.inline-edit-input {
  font-size: 16px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  flex: 1;
  min-width: 160px;
}
table.standings tr.winner { background: #fdf3d9; }
table.standings tr.winner td.patron-cell::after {
  content: "WINNER";
  margin-left: 8px;
  font-size: 10px;
  background: var(--gold);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: middle;
}

.cell-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  padding: 6px 4px;
  margin: -6px -4px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.cell-player img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: #eee; }
.cell-player.hit img { outline: 3px solid var(--green); }
.cell-player.miss img { outline: 3px solid var(--line); opacity: 0.7; }
/* Wins over .hit/.miss above (same selector weight, declared later) --
   injured/traded is the thing a patron most needs to notice at a glance. */
.cell-player.flagged img { outline: 3px solid #dc2626; opacity: 1; }
.cell-player .hit-date { font-size: 9px; color: var(--muted); }
/* Anonymized chips (see anonChip in app.js) are a <span>, not a <button> --
   nothing to click through to without a player id, so no pointer cursor or
   hover highlight. */
button.cell-player:hover img { outline-color: var(--gold); }
span.cell-player { cursor: default; }

.standings-empty { color: var(--muted); padding: 30px; text-align: center; }

.standings-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  margin: 0 0 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.standings-nav .link-btn { font-size: 13px; white-space: nowrap; }
.standings-nav-current { font-size: 13px; font-weight: 700; color: var(--ink); text-align: center; }

.standings-total {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.standings-banner {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fdf3d9;
  color: #7a5b00;
  font-size: 13px;
  font-weight: 600;
}

.mine-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent);
  color: white;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  vertical-align: middle;
}

.verify-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.verify-tag-yes { background: #e3f3e6; color: var(--green); }
.verify-tag-no { background: #fdecea; color: var(--accent); }

/* Mini lineup field thumbnail (standings "Field" column) */
td.field-cell { padding: 6px; }
.mini-field {
  position: relative;
  width: 64px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.mini-field svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mini-field-markers { position: absolute; inset: 0; }
.mini-marker {
  position: absolute;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}
.mini-marker::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
}
.mini-marker.hit::after { background: #2f6fed; }
/* Wins over .hit above (same selector weight, declared later) -- same
   red used for the flagged outline elsewhere (pitch box, standings chip). */
.mini-marker.flagged::after { background: #dc2626; }
.mini-marker.empty {
  cursor: default;
}
.mini-marker.empty::after {
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.7);
  box-shadow: none;
}
.mini-marker:hover::after { box-shadow: 0 0 0 2px var(--gold); }

/* Player card modal (standings/picker -> click a player -> stat + PL link) */
.modal-card.player-card { width: min(380px, 92vw); }
.modal-card.standings-chart-modal-card { width: min(720px, 94vw); }
.player-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.player-card-head img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: #eee;
  border: 2px solid var(--line);
}
.player-card-team { font-size: 13px; color: var(--muted); font-weight: 600; }
.player-card-pos { font-size: 11px; color: var(--muted); margin-top: 2px; }
.player-card-injury {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  background: #dc2626;
  color: white;
}

.player-card-stats { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.stat-block {
  padding: 8px 10px;
  border-radius: 8px;
  background: #f2f0e8;
}
.stat-block-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin-bottom: 3px; }
.stat-block-line { font-size: 13px; color: var(--ink); }
.stat-block-line b { color: var(--accent); font-weight: 700; }

.fixture-list { display: flex; flex-direction: column; gap: 4px; }
.fixture-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink); }
.fixture-date { color: var(--muted); flex-shrink: 0; }
.fixture-opponent { font-weight: 600; text-align: right; }

.pl-link-btn {
  display: block;
  text-align: center;
  margin-top: 4px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Standings-over-time chart (rendered inside #standingsChartModal) */
.chart-card { display: block; }

.standings-summary-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }
.standings-summary-row .standings-total { margin: 0; }

.chart-svg-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }

.chart-line { stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line-other { opacity: 0.35; }
.chart-line-you { stroke-width: 3; }
.chart-endlabel { font-size: 11px; fill: var(--ink); font-weight: 600; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis-label { font-size: 9px; fill: var(--muted); }
.chart-crosshair { stroke: var(--muted); stroke-width: 1; pointer-events: none; }
#chartHoverArea { cursor: crosshair; }

.chart-tooltip {
  position: absolute;
  min-width: 140px;
  background: var(--ink);
  color: white;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}
.chart-tooltip-date { font-weight: 700; margin-bottom: 4px; font-size: 11px; opacity: 0.85; }
.chart-tooltip-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.chart-tooltip-row b { margin-left: auto; font-weight: 700; }
.chart-tooltip-key { width: 10px; height: 2px; border-radius: 1px; flex-shrink: 0; background: currentColor; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 12px; }
.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 3px 2px;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
}
.chart-legend-item.chart-legend-static { cursor: default; color: var(--muted); }
.chart-legend-item.chart-legend-dim { color: var(--muted); opacity: 0.5; }
.chart-legend-swatch { width: 14px; height: 2px; border-radius: 1px; flex-shrink: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .topbar {
    padding: 10px 14px;
    gap: 8px 14px;
  }
  .topbar-left h1 {
    width: 100%;   /* force its own row so tabs wrap cleanly below, within topbar-left */
    font-size: 16px;
  }

  .rules, .contest-info, .lock-banner { padding-left: 14px; padding-right: 14px; }

  .tab-panel { padding: 14px 12px 40px; }

  .build-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .sidebar { padding: 14px; }

  .pick-row, .my-lineup-row { min-height: 44px; }

  .standings-table-wrap { display: none; }
  .standings-cards { display: flex; }
  .mini-field { width: 48px; height: 60px; }

  .modal-card { padding: 14px; }

  .chart-card { padding: 10px; }
  .chart-endlabel { font-size: 9px; }
  .chart-legend-item { font-size: 11px; }
  .chart-tooltip { min-width: 120px; font-size: 11px; max-width: calc(100vw - 60px); }
}
