:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #f9fbfa;
  --line: #d9e1dd;
  --line-strong: #b9c5c0;
  --text: #15211d;
  --muted: #61706a;
  --accent: #1d7a5c;
  --accent-dark: #155d47;
  --blue: #315f91;
  --gold: #9f7432;
  --danger: #ad3c4a;
  --keeper: #f5ead6;
  --selection: #dff0e8;
  --focus: rgba(29, 122, 92, 0.22);
  --shadow: 0 14px 34px rgba(21, 33, 29, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea {
  border-radius: 6px;
}

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus);
}

textarea {
  min-height: 138px;
  resize: vertical;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 800;
}

h2 {
  font-size: 14px;
  font-weight: 800;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar p {
  margin-top: 4px;
  color: var(--muted);
}

.topbar-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 260px;
}

.topbar-stats span,
.subtle-text {
  color: var(--muted);
  font-size: 13px;
}

.topbar-stats span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 4px 9px;
  border-radius: 999px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(380px, 430px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.setup-pane,
.draft-pane,
.pane-section,
.board-section,
.pool-section,
.roster-section {
  border: 1px solid var(--line);
  background: var(--surface);
}

.setup-pane,
.draft-pane {
  min-width: 0;
  box-shadow: var(--shadow);
}

.setup-pane {
  align-self: start;
}

.draft-pane {
  min-height: calc(100vh - 106px);
}

.pane-section,
.board-section,
.pool-section,
.roster-section {
  border-left: 0;
  border-right: 0;
  border-top: 0;
  padding: 14px;
}

.pane-section:last-child,
.board-section:last-child,
.pool-section:last-child,
.roster-section:last-child {
  border-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.heading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

label,
.wide-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.wide-label {
  margin-top: 10px;
}

.draft-board-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.draft-board-wrap {
  overflow-x: hidden;
  overflow-y: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  background: #eef3f0;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
}

.team-panel-summary {
  margin: -2px 0 10px;
}

.team-keeper-panel,
.team-overview-list,
.team-detail-panel,
.team-roster-value-list {
  display: grid;
  gap: 8px;
}

.team-overview-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.draft-order-field {
  align-content: start;
  gap: 4px;
  text-align: center;
}

.draft-order-field input {
  min-height: 46px;
  padding: 7px;
  text-align: center;
  font-weight: 900;
}

.team-overview-button {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 10px;
  align-items: center;
  min-height: 64px;
  width: 100%;
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
}

.team-overview-button:hover {
  border-color: var(--accent);
  background: #f0f7f4;
  color: var(--text);
}

.team-overview-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.team-overview-title strong {
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.team-overview-title span,
.team-detail-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.team-keeper-chips,
.selected-keeper-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.selected-keeper-strip {
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 8px;
  border-radius: 6px;
}

.keeper-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-height: 26px;
  border: 1px solid #d7c39d;
  background: var(--keeper);
  color: var(--text);
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
}

.keeper-chip b,
.keeper-chip em {
  color: var(--gold);
  font-style: normal;
}

.keeper-chip.empty {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.team-detail-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.team-detail-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  gap: 8px;
}

.team-detail-fields input {
  min-height: 38px;
}

.team-roster-value-list {
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.team-roster-value-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 54px;
  width: 100%;
  border-color: var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
  text-align: left;
}

.team-roster-value-row:hover {
  border-color: var(--accent);
  background: #f0f7f4;
  color: var(--text);
}

.team-roster-value-row.selected {
  border-color: var(--accent);
  background: var(--selection);
  box-shadow: inset 4px 0 0 var(--accent);
}

.team-roster-value-row strong,
.team-roster-value-row span span {
  display: block;
}

.team-roster-value-row strong {
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.team-roster-value-row span span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.team-roster-value-row b {
  display: grid;
  place-items: center;
  min-width: 42px;
  min-height: 28px;
  border-radius: 999px;
  background: var(--muted);
  color: #ffffff;
  font-size: 12px;
}

.team-roster-value-row.elite b {
  background: var(--accent);
}

.team-roster-value-row.good b {
  background: var(--blue);
}

.team-roster-value-row.modest b {
  background: var(--gold);
}

.team-roster-value-row.low b {
  background: #596574;
}

.team-roster-value-row.missing b {
  background: var(--danger);
}

.button-row,
.command-actions,
.filter-row {
  display: flex;
  gap: 8px;
}

.button-row {
  margin-top: 10px;
}

.ghost-button,
.secondary-button {
  background: #ffffff;
  border-color: var(--line-strong);
  color: var(--text);
}

.ghost-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled) {
  background: #eef4f1;
  border-color: var(--accent);
  color: var(--accent-dark);
}

.message-area {
  min-height: 20px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
}

.message-area.success {
  color: var(--accent-dark);
}

.draft-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 4;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.current-pick {
  margin-top: 2px;
  font-size: 17px;
  font-weight: 800;
}

.board-section {
  padding-bottom: 10px;
}

.draft-board {
  min-width: 0;
  table-layout: fixed;
  width: 100%;
}

.draft-board th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: center;
}

.round-header {
  width: 48px;
  text-align: center;
}

.team-header {
  width: calc((100% - 48px) / 12);
  max-width: 1px;
  overflow-wrap: anywhere;
  font-size: 11px;
  line-height: 1.15;
}

.team-header span {
  display: block;
  color: var(--accent-dark);
  font-size: 12px;
}

.board-cell {
  min-width: 0;
  height: 72px;
  background: #ffffff;
  overflow: hidden;
  border-left: 1px solid var(--line);
  padding: 5px 4px;
}

.board-cell.current {
  outline: 4px solid #111827;
  outline-offset: -4px;
}

.board-cell.keeper {
  background: var(--keeper);
}

.board-cell.selection {
  background: var(--selection);
}

.board-cell.pos-qb {
  background: #bddbff;
  border-left: 7px solid #155bc7;
  box-shadow: inset 0 3px 0 #155bc7;
}

.board-cell.pos-rb {
  background: #bdeed0;
  border-left: 7px solid #087f3e;
  box-shadow: inset 0 3px 0 #087f3e;
}

.board-cell.pos-wr {
  background: #ffd0ab;
  border-left: 7px solid #c65c16;
  box-shadow: inset 0 3px 0 #c65c16;
}

.board-cell.pos-te {
  background: #ddc8ff;
  border-left: 7px solid #6942c2;
  box-shadow: inset 0 3px 0 #6942c2;
}

.board-cell.pos-dst {
  background: #d0d7e2;
  border-left: 7px solid #334155;
  box-shadow: inset 0 3px 0 #334155;
}

.board-cell.pos-k {
  background: #ffe28a;
  border-left: 7px solid #b77900;
  box-shadow: inset 0 3px 0 #b77900;
}

.pick-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.pick-name {
  margin-top: 4px;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
}

.pick-meta {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  color: #ffffff;
  background: var(--blue);
}

.pill.keeper-pill {
  background: var(--gold);
}

.pill.recommend-pill {
  background: var(--accent);
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(340px, 1.2fr) minmax(300px, 0.8fr);
  min-height: 430px;
}

.pool-section,
.roster-section {
  border-bottom: 0;
}

.pool-section {
  border-right: 1px solid var(--line);
}

.filter-row {
  align-items: center;
  margin-bottom: 10px;
}

.filter-row input {
  flex: 1;
}

#sortPlayers,
#rosterTeam {
  width: auto;
  min-width: 150px;
}

.position-toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.position-toggle {
  min-height: 36px;
  min-width: 44px;
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--muted);
  padding: 0 9px;
  font-size: 12px;
}

.position-toggle.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.position-toggle:hover:not(:disabled) {
  border-color: var(--accent-dark);
}

.player-list {
  display: grid;
  gap: 6px;
  max-height: 464px;
  overflow: auto;
  padding-right: 4px;
}

.player-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  text-align: left;
  padding: 8px 10px;
}

.player-row:hover,
.player-row.selected {
  border-color: var(--accent);
  background: #f0f7f4;
}

.player-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.player-row span {
  color: var(--muted);
  font-size: 12px;
}

.adp-stack {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.roster-view {
  display: grid;
  gap: 10px;
}

.roster-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.roster-summary span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  border-radius: 6px;
}

.roster-lineup {
  display: grid;
  gap: 8px;
}

.roster-slot {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 56px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--line-strong);
  background: #ffffff;
  padding: 8px 10px;
  border-radius: 6px;
}

.roster-slot.empty {
  background: var(--surface-soft);
  border-left-color: var(--line-strong);
}

.roster-slot.pos-qb {
  background: #eef6ff;
  border-left-color: #155bc7;
}

.roster-slot.pos-rb {
  background: #effbf3;
  border-left-color: #087f3e;
}

.roster-slot.pos-wr {
  background: #fff3ea;
  border-left-color: #c65c16;
}

.roster-slot.pos-te {
  background: #f5efff;
  border-left-color: #6942c2;
}

.roster-slot.pos-dst {
  background: #f2f5f8;
  border-left-color: #334155;
}

.roster-slot.pos-k {
  background: #fff8df;
  border-left-color: #b77900;
}

.roster-slot-label {
  display: grid;
  place-items: center;
  min-height: 32px;
  border-radius: 6px;
  background: var(--text);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.roster-slot-player,
.roster-slot-player strong {
  min-width: 0;
}

.roster-slot-player strong {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.roster-slot-meta,
.roster-slot-empty {
  color: var(--muted);
  font-size: 12px;
}

.roster-slot-empty {
  font-weight: 800;
}

.bench-slot {
  align-items: start;
}

.roster-bench-list {
  display: grid;
  gap: 6px;
}

.roster-bench-player {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 6px 8px;
  border-radius: 6px;
}

.roster-bench-player b {
  display: grid;
  place-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: var(--muted);
  color: #ffffff;
  font-size: 11px;
}

.roster-bench-player.pos-qb b {
  background: #155bc7;
}

.roster-bench-player.pos-rb b {
  background: #087f3e;
}

.roster-bench-player.pos-wr b {
  background: #c65c16;
}

.roster-bench-player.pos-te b {
  background: #6942c2;
}

.roster-bench-player.pos-dst b {
  background: #334155;
}

.roster-bench-player.pos-k b {
  background: #b77900;
}

.roster-bench-player strong,
.roster-bench-player span span {
  display: block;
  overflow-wrap: anywhere;
}

.roster-bench-player span span {
  color: var(--muted);
  font-size: 11px;
}

.roster-list {
  display: grid;
  gap: 6px;
}

.roster-player {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 8px 10px;
  border-radius: 6px;
}

.roster-player strong {
  overflow-wrap: anywhere;
}

.summary-section {
  border: 1px solid var(--line);
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  background: var(--surface);
  padding: 14px;
}

.final-rosters-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.final-roster-table {
  min-width: 1180px;
  table-layout: fixed;
}

.final-roster-table th,
.final-roster-table td {
  width: 92px;
  font-size: 12px;
}

.final-roster-table th:first-child,
.final-roster-table td:first-child {
  width: 150px;
}

.final-team-cell {
  color: var(--text);
  background: #ffffff;
  overflow-wrap: anywhere;
}

.final-team-cell span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  min-height: 24px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
}

.summary-player {
  display: grid;
  gap: 2px;
}

.summary-player + .summary-player {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.summary-player strong {
  overflow-wrap: anywhere;
  line-height: 1.15;
}

.summary-player span {
  color: var(--muted);
  font-size: 11px;
}

.bench-cell {
  width: 220px;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  background: var(--surface-soft);
  color: var(--muted);
  padding: 18px;
  text-align: center;
  border-radius: 6px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .draft-pane {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .topbar,
  .draft-command-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    padding: 14px 12px;
  }

  h1 {
    font-size: 19px;
    line-height: 1.15;
  }

  .topbar-stats,
  .command-actions,
  .button-row {
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
  }

  .command-actions,
  .button-row {
    flex-wrap: wrap;
  }

  .command-actions button,
  .button-row button {
    flex: 1 1 132px;
  }

  .workspace {
    gap: 10px;
    padding: 8px;
  }

  .pane-section,
  .board-section,
  .pool-section,
  .roster-section,
  .summary-section,
  .draft-command-bar {
    padding: 12px;
  }

  .settings-grid,
  .lower-grid,
  .team-overview-row,
  .team-overview-button,
  .team-detail-fields {
    grid-template-columns: 1fr;
  }

  .draft-order-field {
    text-align: left;
  }

  .draft-order-field input {
    text-align: left;
  }

  .pool-section {
    border-right: 0;
  }

  .draft-board-wrap,
  .final-rosters-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .draft-board {
    min-width: 900px;
  }

  .board-cell {
    height: 66px;
  }

  .filter-row {
    align-items: stretch;
    flex-direction: column;
  }

  .position-toggle-row {
    justify-content: flex-start;
  }

  #sortPlayers,
  #rosterTeam {
    width: 100%;
  }

  .player-list,
  .team-roster-value-list {
    max-height: 58vh;
  }

  .team-detail-toolbar,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .heading-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .heading-actions button {
    flex: 1 1 140px;
  }

  .roster-slot {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px;
  }

  .roster-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
