:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #191d21;
  --panel-2: #20262b;
  --border: #30373f;
  --text: #f4f6f8;
  --muted: #98a3ad;
  --amber: #f6b84a;
  --green: #2fc57b;
  --red: #ff5f56;
  --orange: #ff9e3d;
  --cyan: #48c7df;
  --blue: #4f8cff;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button,
.button-link {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #242a30;
  color: var(--text);
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

button:hover,
.button-link:hover {
  border-color: #4a5560;
  background: #2a3239;
}

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

.primary {
  background: #0f8f58;
  border-color: #1dbb77;
}

.primary:hover {
  background: #10a565;
}

.danger,
.danger-link {
  border-color: rgba(255, 95, 86, 0.55);
  color: #ffd0cd;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #11161b;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(72, 199, 223, 0.16);
}

.top-strip {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(17, 19, 21, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.claim-center {
  min-width: min(460px, 48vw);
  display: grid;
  justify-items: center;
  gap: 3px;
}

.claim-kicker {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.claimed-pill {
  max-width: min(460px, 48vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.05;
}

.claim-link-center {
  color: #c4f6fc;
  text-decoration: none;
}

.claim-link-center:hover {
  color: var(--text);
}

.test-pill,
.count-pill,
.connection-pill {
  border-radius: 999px;
  border: 1px solid rgba(246, 184, 74, 0.55);
  background: rgba(246, 184, 74, 0.12);
  color: #ffd891;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 6px 8px;
  letter-spacing: 0;
  white-space: nowrap;
}

.connection-pill {
  border-color: rgba(72, 199, 223, 0.5);
  background: rgba(72, 199, 223, 0.11);
  color: #a8eef8;
}

.connection-pill.offline {
  border-color: rgba(255, 95, 86, 0.5);
  background: rgba(255, 95, 86, 0.11);
  color: #ffc2be;
}

.top-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.top-link {
  color: #c4f6fc;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.top-link:hover {
  color: var(--text);
}

main {
  padding: 14px;
}

.board-grid,
.admin-grid {
  display: grid;
  gap: 14px;
}

.board-grid {
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.2fr) minmax(280px, 0.8fr);
  align-items: start;
}

.auction-column {
  display: grid;
  gap: 14px;
}

.admin-grid {
  max-width: 1280px;
  margin: 0 auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.single-column {
  max-width: 520px;
  margin: 32px auto;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-header,
.auction-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.panel-header.compact {
  padding-bottom: 10px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 48px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.eyebrow,
.metric-label,
.field-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.muted {
  color: var(--muted);
}

.filters {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.filters select {
  width: auto;
  min-width: 92px;
}

.list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.scroll-list {
  max-height: calc(100vh - 204px);
  overflow: auto;
}

.player-row,
.bid-row,
.team-row,
.drafted-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #273039;
  border-radius: 8px;
  background: #15191d;
}

.player-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.row-main {
  min-width: 0;
}

.row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  min-width: 0;
}

/*
 * Player/team names use .primary-title so badges and logos can sit on the same
 * line without becoming the overflow target.
 */
.primary-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.position-chip {
  border-radius: 5px;
  padding: 3px 6px;
  background: #25313a;
  color: #dce8ef;
  font-size: 12px;
  font-weight: 800;
}

.position-chip {
  min-width: 30px;
  text-align: center;
}

.position-QB {
  background: rgba(255, 95, 86, 0.16);
  color: #ffc2be;
  border: 1px solid rgba(255, 95, 86, 0.5);
}

.position-RB {
  background: rgba(47, 197, 123, 0.16);
  color: #b9edce;
  border: 1px solid rgba(47, 197, 123, 0.5);
}

.position-WR {
  background: rgba(79, 140, 255, 0.16);
  color: #c7dcff;
  border: 1px solid rgba(79, 140, 255, 0.5);
}

.position-TE {
  background: rgba(246, 184, 74, 0.17);
  color: #ffe1a4;
  border: 1px solid rgba(246, 184, 74, 0.52);
}

.nfl-team {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: max-content;
  border: 1px solid rgba(152, 163, 173, 0.22);
  border-radius: 999px;
  background: rgba(17, 22, 27, 0.72);
  color: #dce8ef;
  padding: 2px 7px 2px 4px;
  font-size: 11px;
  font-weight: 900;
}

.team-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: contain;
  background: transparent;
  border: 0;
}

.team-icon-fallback {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #20262b;
  color: #dce8ef;
  font-size: 8px;
  font-weight: 900;
}

.metric-chip {
  border-radius: 5px;
  padding: 3px 7px;
  font-weight: 800;
}

.points-chip {
  color: #b9edce;
  background: rgba(47, 197, 123, 0.1);
}

.adp-chip {
  color: #ffe1a4;
  background: rgba(246, 184, 74, 0.12);
}

.auction-panel {
  overflow: hidden;
}

.auction-panel.auction-paused {
  border-color: rgba(246, 184, 74, 0.72);
  box-shadow: 0 0 0 1px rgba(246, 184, 74, 0.2), var(--shadow);
}

.auction-head {
  align-items: center;
}

.auction-player-layout {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.auction-headshot-shell {
  flex: 0 0 auto;
  width: 94px;
  height: 94px;
  border: 1px solid rgba(152, 163, 173, 0.28);
  border-radius: 8px;
  background: #11161b;
  overflow: hidden;
}

.auction-headshot-shell.hidden {
  display: none;
}

.auction-headshot {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
}

#auction-subtitle {
  margin-top: 8px;
}

.timer {
  flex: 0 0 auto;
  min-width: 108px;
  min-height: 96px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #11161b;
  color: var(--cyan);
  font-size: 42px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.timer-warning {
  color: #ffdb9f;
  border-color: rgba(255, 158, 61, 0.55);
  background: rgba(255, 158, 61, 0.11);
}

.timer-danger {
  color: #ffc2be;
  border-color: rgba(255, 95, 86, 0.65);
  background: rgba(255, 95, 86, 0.13);
}

.timer-expired {
  color: #ffc2be;
  border-color: rgba(255, 95, 86, 0.65);
  background: rgba(255, 95, 86, 0.13);
}

.timer-idle {
  color: var(--muted);
}

.timer-paused {
  color: #ffd891;
  border-color: rgba(246, 184, 74, 0.72);
  background: rgba(246, 184, 74, 0.13);
}

.pause-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 14px;
  border-top: 1px solid rgba(246, 184, 74, 0.42);
  border-bottom: 1px solid rgba(246, 184, 74, 0.42);
  background: rgba(246, 184, 74, 0.15);
  color: #ffd891;
  font-size: 14px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pause-banner.hidden {
  display: none;
}

.auction-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
}

.auction-metrics > div {
  padding: 14px;
  background: var(--panel);
}

.auction-metrics strong {
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}

.bid-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px;
}

.bid-form label span,
.claim-form label span,
.admin-form label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stepper {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 6px;
}

.money-input {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #11161b;
  overflow: hidden;
}

.money-input:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(72, 199, 223, 0.16);
}

.money-input span {
  padding-left: 12px;
  color: var(--muted);
  font-weight: 900;
}

.money-input input {
  min-height: 40px;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding-left: 5px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.segmented button.active {
  border-color: var(--cyan);
  background: rgba(72, 199, 223, 0.16);
  color: #c4f6fc;
}

.bid-value-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  grid-column: 1 / -1;
  min-height: 50px;
  padding: 10px 12px;
  border: 1px solid rgba(47, 197, 123, 0.45);
  border-radius: 8px;
  background: rgba(47, 197, 123, 0.1);
}

.bid-value-box span {
  color: #b9edce;
  font-size: 13px;
  font-weight: 800;
}

.bid-value-box strong {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.bid-button {
  grid-column: 1 / -1;
  min-height: 54px;
  font-size: 18px;
  font-weight: 900;
}

.admin-strip,
.admin-actions,
.board-admin-actions,
.claim-actions,
.export-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
}

.board-admin-panel {
  border-color: rgba(246, 184, 74, 0.42);
}

.board-admin-actions {
  padding-bottom: 8px;
}

.board-admin-actions button {
  min-height: 36px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
}

.board-admin-current {
  color: var(--muted);
  font-size: 12px;
}

.admin-strip {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #15191d;
}

.admin-strip input {
  width: 160px;
}

.compact-list {
  gap: 7px;
}

.team-row,
.drafted-row,
.bid-row {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.leading-bid-inline,
.bid-chip-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.leading-person {
  margin-right: 2px;
}

.bid-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.salary-bid-chip {
  border: 1px solid rgba(72, 199, 223, 0.4);
  background: rgba(72, 199, 223, 0.12);
  color: #a8eef8;
}

.heat-bid-chip {
  border: 1px solid hsla(var(--heat-hue), 62%, 55%, 0.48);
  background: hsla(var(--heat-hue), 62%, 42%, 0.15);
  color: hsl(var(--heat-hue), 80%, 78%);
}

.team-row {
  border-color: rgba(48, 55, 63, 0.88);
}

.team-row.nominating {
  border-color: rgba(246, 184, 74, 0.7);
  background: rgba(246, 184, 74, 0.08);
}

.team-row.next-nominator {
  border-color: rgba(72, 199, 223, 0.42);
}

.team-row.nomination-ineligible {
  opacity: 0.72;
}

.team-title {
  gap: 7px;
}

.nomination-slot {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(152, 163, 173, 0.28);
  border-radius: 999px;
  color: #dce8ef;
  background: #20262b;
  font-size: 11px;
  font-weight: 900;
}

.team-name-inline {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.turn-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(246, 184, 74, 0.55);
  border-radius: 999px;
  background: rgba(246, 184, 74, 0.14);
  color: #ffd891;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.turn-badge.next {
  border-color: rgba(72, 199, 223, 0.5);
  background: rgba(72, 199, 223, 0.12);
  color: #a8eef8;
}

.turn-badge.blocked {
  border-color: rgba(255, 95, 86, 0.46);
  background: rgba(255, 95, 86, 0.12);
  color: #ffc2be;
}

.badge-row {
  gap: 6px;
}

.heat-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid hsla(var(--heat-hue), 62%, 55%, 0.45);
  border-radius: 999px;
  background: hsla(var(--heat-hue), 62%, 42%, 0.13);
  color: hsl(var(--heat-hue), 80%, 78%);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.heat-badge span {
  color: rgba(244, 246, 248, 0.68);
  font-weight: 800;
}

.heat-badge strong {
  color: inherit;
}

.team-connected {
  color: var(--green);
}

.divider {
  height: 1px;
  margin: 4px 12px;
  background: var(--border);
}

.claim-form,
.admin-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.admin-form {
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
}

.admin-auth-bar {
  grid-template-columns: minmax(160px, 1fr) auto;
}

.admin-form.stacked {
  grid-template-columns: 1fr;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
}

.checkbox-row span {
  margin: 0;
}

.admin-current {
  padding: 0 14px 14px;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #222930;
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.bottom-tabs {
  display: none;
}

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

  .side-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .side-panel > .panel-header:first-child,
  .side-panel > .divider {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: 68px;
  }

  .top-strip {
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .claim-center {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    width: 100%;
    padding-top: 2px;
  }

  .claimed-pill {
    max-width: 100%;
    font-size: 17px;
  }

  .top-meta {
    max-width: 58vw;
  }

  main {
    padding: 10px;
  }

  .board-grid,
  .auction-column,
  .admin-grid {
    gap: 10px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .player-panel,
  .auction-column,
  .history-panel,
  .side-panel {
    display: none;
  }

  body[data-active-tab="Bid"] .auction-column {
    display: grid;
  }

  body[data-active-tab="Bid"] .history-panel,
  body[data-active-tab="Players"] .player-panel,
  body[data-active-tab="Teams"] .side-panel,
  body[data-active-tab="Drafted"] .side-panel {
    display: block;
  }

  body[data-active-tab="Drafted"] .side-panel > .panel-header:first-child,
  body[data-active-tab="Drafted"] .side-panel > #teams-list,
  body[data-active-tab="Drafted"] .side-panel > .divider {
    display: none;
  }

  body[data-active-tab="Teams"] .side-panel > .panel-header.compact,
  body[data-active-tab="Teams"] .side-panel > #drafted-list {
    display: none;
  }

  .auction-head {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .auction-player-layout {
    gap: 10px;
  }

  .auction-headshot-shell {
    width: 70px;
    height: 70px;
  }

  h1 {
    font-size: 30px;
  }

  .timer {
    min-width: 88px;
    min-height: 82px;
    font-size: 34px;
  }

  .auction-metrics {
    grid-template-columns: 1fr;
  }

  .bid-form,
  .filters,
  .admin-form,
  .export-grid {
    grid-template-columns: 1fr;
  }

  .scroll-list {
    max-height: none;
  }

  .bottom-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    padding: 8px;
    border-top: 1px solid var(--border);
    background: rgba(17, 19, 21, 0.96);
    backdrop-filter: blur(12px);
  }

  .bottom-tabs button {
    min-height: 44px;
    padding: 0 6px;
    font-size: 13px;
  }

  .bottom-tabs button.active {
    border-color: var(--cyan);
    color: #c4f6fc;
  }
}
