:root {
  color-scheme: light;
  --bg: #eef2f5;
  --surface: #ffffff;
  --soft: #f7f9fb;
  --ink: #111827;
  --muted: #5f6d7c;
  --line: #d4dde5;
  --accent: #1769aa;
  --good: #147a50;
  --warn: #a66300;
  --bad: #b3261e;
  --qb: #d9cdf8;
  --rb: #ccebd8;
  --wr: #cfe3ff;
  --te: #ffd9b8;
  --k: #c7eeee;
  --dst: #f6c7d8;
  --shadow: 0 8px 18px rgba(17, 24, 39, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

.app-shell {
  width: min(100% - 16px, 1900px);
  margin: 0 auto;
  padding: 8px 0 12px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.upper-grid {
  display: grid;
  grid-template-columns: minmax(500px, 1fr) minmax(560px, 640px);
  gap: 8px;
  align-items: stretch;
  min-height: clamp(260px, 27vh, 360px);
  margin-bottom: 8px;
}

.upper-main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(230px, 0.55fr) minmax(260px, 1fr);
  gap: 8px;
  min-height: 0;
  min-width: 0;
}

.auction-card,
.status-card,
.board-panel,
.recent-panel,
.power-rankings-panel,
.debug-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auction-card {
  position: relative;
  display: block;
  min-height: 104px;
  padding: 8px 10px;
}

.auction-top {
  min-height: 92px;
  padding-right: 140px;
}

.auction-card h1,
.panel-bar h2 {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.player-name {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.demand-line {
  margin-top: 5px;
  overflow: hidden;
  color: var(--accent);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 900;
}

.threat-list {
  display: flex;
  gap: 4px;
  margin-top: 5px;
  overflow-x: auto;
  overflow-y: hidden;
}

.threat-pill {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(48px, 1fr) auto;
  grid-template-rows: 12px 12px;
  gap: 1px 4px;
  width: 132px;
  padding: 3px 5px;
  border-radius: 5px;
  background: var(--soft);
  font-size: 10px;
  line-height: 1;
}

.threat-team,
.threat-reason {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.threat-team {
  font-weight: 900;
}

.threat-level {
  justify-self: end;
  font-size: 9px;
  font-weight: 950;
  text-transform: uppercase;
}

.threat-reason {
  grid-column: 1 / 3;
  color: var(--muted);
  font-weight: 750;
}

.threat-high {
  background: #ffe2d2;
  color: #7b2f00;
}

.threat-med {
  background: #fff2c6;
  color: #735100;
}

.threat-low {
  background: #e7edf3;
  color: #425466;
}

.recommendation-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 5px;
}

.rec-metric {
  min-width: 0;
  overflow: hidden;
  padding: 4px 5px;
  border-radius: 5px;
  background: var(--soft);
}

.rec-metric span,
.rec-detail {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.rec-metric strong {
  display: block;
  margin-top: 1px;
  font-size: 14px;
  line-height: 1;
  font-weight: 950;
}

.rec-metric.target {
  background: #dff3e9;
  color: #0d5d3a;
}

.rec-metric.caution {
  background: #fff2c6;
  color: #735100;
}

.rec-metric.hard-stop {
  background: #ffe2d2;
  color: #7b2f00;
}

.rec-detail {
  grid-column: 1 / -1;
  min-width: 0;
  text-transform: none;
}

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

.meta-pill {
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--soft);
  font-size: 11px;
  font-weight: 800;
}

.auction-media {
  position: absolute;
  top: 8px;
  right: 10px;
  display: grid;
  grid-template-columns: 48px 84px;
  gap: 8px;
  align-items: start;
}

.headshot,
.team-logo {
  border-radius: 6px;
  object-fit: contain;
  background: var(--soft);
}

.headshot {
  width: 84px;
  height: 84px;
}

.team-logo {
  width: 48px;
  height: 48px;
  padding: 5px;
}

.status-card {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 78px;
  padding: 8px;
}

.connection {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.status-connected {
  background: var(--good);
}

.status-connecting {
  background: var(--warn);
}

.status-disconnected {
  background: var(--bad);
}

.power-rankings-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 6px;
  min-height: 0;
  padding: 8px;
}

.ghost-refresh {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
  opacity: 0.22;
}

.ghost-refresh:hover,
.ghost-refresh:focus-visible {
  border-color: var(--line);
  background: var(--surface);
  opacity: 1;
}

.ghost-refresh:disabled {
  cursor: wait;
  opacity: 0.55;
}

.power-rankings-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(7, minmax(0, 1fr));
  align-content: stretch;
  gap: 3px 6px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.power-ranking-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
  min-width: 0;
  min-height: 0;
  padding: 3px 5px;
  border-radius: 6px;
  background: var(--soft);
}

.power-ranking-item b {
  color: var(--accent);
  font-size: 11px;
  font-weight: 950;
}

.power-ranking-item div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.power-ranking-item span,
.power-ranking-item small,
.power-ranking-item em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.power-ranking-item span {
  white-space: nowrap;
  font-size: 11px;
  font-weight: 900;
}

.power-ranking-item small {
  display: -webkit-box;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.1;
  font-weight: 700;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.power-ranking-item em {
  max-width: 74px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #dff3e9;
  color: #0d5d3a;
  white-space: nowrap;
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
}

#last-updated,
.view-link,
.panel-bar p,
.pick-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.view-link {
  width: fit-content;
}

.draft-layout {
  display: block;
}

.commentary-panel {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(220px, 0.65fr);
  gap: 10px;
  align-items: stretch;
  margin-bottom: 8px;
  min-height: 92px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.commentary-panel h2 {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.latest-commentary {
  margin-top: 5px;
  max-width: 980px;
  font-size: 21px;
  line-height: 1.18;
  font-weight: 950;
}

.commentary-feed {
  display: flex;
  gap: 5px;
  align-items: stretch;
  min-width: 0;
  max-height: 76px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
}

.commentary-item {
  flex: 0 0 285px;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--soft);
}

.commentary-meta,
.commentary-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.commentary-meta {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.commentary-text {
  margin-top: 2px;
  display: -webkit-box;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 850;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.market-strip,
.team-strength-strip {
  display: flex;
  gap: 5px;
  align-items: center;
  min-height: 30px;
  margin-bottom: 6px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow-x: auto;
  font-size: 11px;
  font-weight: 850;
}

.header-market {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 360px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.header-market .market-pill {
  padding: 2px 6px;
  font-size: 10px;
}

.team-strength-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(18px, 1fr);
  align-items: stretch;
  min-height: 116px;
  margin-bottom: 8px;
  overflow: hidden;
}

.compact-strip {
  min-height: 28px;
  margin: 0;
  border-width: 1px 0 0;
  border-radius: 0;
  box-shadow: none;
}

.team-strength-strip.compact-strip {
  min-height: 116px;
  padding: 5px 6px;
}

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

.market-pill,
.team-strength-pill {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--soft);
  white-space: nowrap;
}

.strength-label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.team-strength-pill {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-width: 0;
  background: #edf6ff;
  color: #174c75;
}

.team-strength-strip .starter-points-pill {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) max-content;
  gap: 5px;
  justify-content: stretch;
  overflow: hidden;
}

.team-strength-pill span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.starter-points-pill .team-strength-name {
  text-align: left;
  text-overflow: clip;
}

.starter-points-pill .team-strength-value {
  justify-self: end;
  text-align: right;
  text-overflow: clip;
}

.team-strength-pill.projected {
  background: #f0ecff;
  color: #4e367c;
}

.team-strength-pill.no-projection {
  background: #e7edf3;
  color: #697789;
}

.team-strength-pill b {
  color: var(--accent);
}

.market-pill.over {
  background: #ffe2d2;
  color: #7b2f00;
}

.market-pill.under {
  background: #dff3e9;
  color: #0d5d3a;
}

.market-pill.neutral {
  background: #e7edf3;
  color: #425466;
}

.panel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.count {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  font-size: 10px;
  font-weight: 850;
}

.dense-board {
  display: grid;
  grid-template-columns: repeat(var(--team-count, 14), minmax(0, 1fr));
  gap: 4px;
  min-height: calc(100vh - 158px);
  padding: 5px;
}

.empty-state {
  display: block;
  min-height: 96px;
  padding: 18px 10px;
  color: var(--muted);
  font-size: 12px;
}

.team-column {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fdfefe;
  overflow: hidden;
}

.team-column.on-clock {
  border-color: var(--accent);
  box-shadow: inset 0 3px 0 var(--accent);
}

.team-header {
  display: grid;
  grid-template-rows: 28px 22px 4px;
  gap: 4px;
  min-height: 64px;
  padding: 5px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.team-header h3 {
  display: -webkit-box;
  min-width: 0;
  height: auto;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.12;
  font-weight: 900;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.money-line {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  min-width: 0;
  margin-top: 0;
  overflow: hidden;
}

.money-line span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 2px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  padding: 2px 3px;
  border-radius: 4px;
  background: var(--soft);
  font-size: 9px;
  font-weight: 800;
}

.money-line b {
  color: var(--muted);
  font-weight: 850;
}

.money-line em {
  min-width: 0;
  overflow: hidden;
  font-style: normal;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-bar {
  height: 4px;
  margin-top: 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ebf1;
}

.budget-bar div {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.slot-stack {
  display: grid;
  align-content: start;
  gap: 3px;
  padding: 3px;
}

.slot {
  display: grid;
  grid-template-rows: repeat(3, 12px);
  gap: 1px;
  min-height: 43px;
  padding: 3px;
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 3px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.08);
}

.slot.open {
  border-style: dashed;
  background: #f4f6f8;
  color: var(--muted);
}

.sticker-row,
.pick-name,
.pick-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-row {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  gap: 3px;
  align-items: center;
  line-height: 1;
}

.sticker-left,
.sticker-right {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-left {
  color: rgba(17, 24, 39, 0.7);
  font-size: 9px;
  font-weight: 950;
}

.sticker-right {
  font-size: 10px;
  font-weight: 950;
}

.sticker-row:nth-child(3) .sticker-right {
  font-size: 9px;
}

.slot.value-value {
  box-shadow: inset 0 -3px 0 rgba(20, 122, 80, 0.55);
}

.slot.value-over {
  box-shadow: inset 0 -3px 0 rgba(179, 38, 30, 0.5);
}

.slot.value-par {
  box-shadow: inset 0 -3px 0 rgba(95, 109, 124, 0.35);
}

.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-D-ST,
.pos-DST,
.pos-DEF {
  background: var(--dst);
}

.recent-picks {
  display: flex;
  gap: 4px;
  min-height: 41px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 5px;
}

.pick-item {
  flex: 0 0 178px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 4px;
  align-items: center;
  min-height: 40px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--soft);
}

.pick-number {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--ink);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.pick-name {
  font-size: 11px;
  font-weight: 900;
}

.value-badge {
  width: fit-content;
  max-width: 100%;
  margin-top: 2px;
  overflow: hidden;
  padding: 2px 5px;
  border-radius: 999px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 900;
}

.value-badge.value {
  background: #dff3e9;
  color: #0d5d3a;
}

.value-badge.over {
  background: #ffe2d2;
  color: #7b2f00;
}

.value-badge.par {
  background: #e7edf3;
  color: #425466;
}

.new-pick {
  animation: newPickPulse 2200ms ease-out;
  background: #fff7cf;
  box-shadow: inset 0 0 0 2px #e2b100;
}

@keyframes newPickPulse {
  0% {
    background: #ffe878;
    box-shadow: inset 0 0 0 2px #e2b100;
  }

  100% {
    background: #fff7cf;
    box-shadow: inset 0 0 0 2px #e2b100;
  }
}

.debug-panel {
  margin-top: 8px;
}

.debug-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  padding: 0 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

#latest-message {
  max-height: 220px;
  margin: 0;
  overflow: auto;
  padding: 10px;
  background: #101820;
  color: #d7e4ef;
  font-size: 11px;
  line-height: 1.45;
}

@media (max-width: 1300px) {
  body {
    min-width: 980px;
  }

  .upper-grid {
    grid-template-columns: minmax(500px, 1fr) minmax(500px, 560px);
  }

  .topbar {
    grid-template-columns: minmax(230px, 0.55fr) minmax(260px, 1fr);
  }

  .team-header h3 {
    font-size: 10px;
  }

  .slot {
    grid-template-columns: 21px minmax(0, 1fr);
  }
}
