/* =========================================================
   Desktop draft room — ESPN-style layout
   ========================================================= */

body.draft-room-active .app-main {
  padding: 0 !important;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

body.draft-room-active .app-main-col {
  min-height: 0;
  overflow: hidden;
}

.dr-room {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
  min-height: 0;
  background: #0e1116;
  color: #e8eaed;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ----- Top bar ----- */
.dr-top {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.65rem 1rem;
  background: linear-gradient(180deg, #1a2332 0%, #121820 100%);
  border-bottom: 1px solid #2a3544;
}

.dr-top-left {
  min-width: 0;
}
.dr-league {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b9bb4;
}
.dr-title {
  font-size: 1.05rem;
  font-weight: 750;
  color: #fff;
  margin-top: 0.1rem;
}

.dr-clock-wrap {
  text-align: center;
  padding: 0.35rem 1.5rem;
  border-radius: 12px;
  background: #0b0f14;
  border: 1px solid #2a3544;
  min-width: 11rem;
}
.dr-clock-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b9bb4;
}
.dr-clock {
  font-size: 2.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: #fff;
  line-height: 1.1;
}
.dr-clock.is-low { color: #fbbf24; }
.dr-clock.is-critical {
  color: #f87171;
  animation: dr-pulse 0.9s ease infinite;
}
@keyframes dr-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.dr-on-clock {
  margin-top: 0.15rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fbbf24; /* yellow — on the clock */
}

.dr-top-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.dr-btn {
  border: 1px solid #3a4658;
  background: #1c2533;
  color: #e8eaed;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  min-height: 34px;
}
.dr-btn:hover { background: #243041; border-color: #4b5a70; }
.dr-btn.primary {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #fff;
}
.dr-btn.primary:hover { filter: brightness(1.08); }
.dr-btn.danger {
  background: #3f1515;
  border-color: #7f1d1d;
  color: #fecaca;
}
.dr-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Recent picks ticker */
.dr-ticker {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: #0b0f14;
  border-bottom: 1px solid #1e2733;
  overflow: hidden;
}
.dr-ticker-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7c93;
  flex-shrink: 0;
}
.dr-ticker-track {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}
.dr-ticker-track::-webkit-scrollbar { display: none; }
.dr-chip {
  flex-shrink: 0;
  font-size: 0.72rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: #1a2332;
  border: 1px solid #2a3544;
  color: #cbd5e1;
  white-space: nowrap;
}
.dr-chip strong { color: #fff; }
.dr-chip .pos {
  font-weight: 800;
  font-size: 0.62rem;
  margin-right: 0.25rem;
}

/* ----- Body layout -----
   List (default): Players | stage | Board (compact) | My team
   Blocks:         Players | Board (expands into stage) | My team */
.dr-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns:
    minmax(280px, 340px)   /* players */
    minmax(0, 1fr)         /* open stage (list only) */
    minmax(280px, 340px)   /* draft board — compact list */
    minmax(220px, 280px);  /* my team */
  gap: 0;
  transition: grid-template-columns 0.2s ease;
}

/* Blocks: absorb the stage — board grows to fill the middle */
.dr-body.is-board-blocks {
  grid-template-columns:
    minmax(280px, 340px)   /* players */
    minmax(0, 1fr)         /* expanded draft board */
    minmax(220px, 280px);  /* my team */
}
.dr-body.is-board-blocks .dr-stage {
  display: none;
}
.dr-body.is-board-blocks .dr-board-panel {
  max-width: none;
  width: auto;
  box-shadow: none;
  border-right: 1px solid #1e2733;
}
/* Roomier cells when the board is expanded */
.dr-body.is-board-blocks .dr-cell {
  width: 5.1rem;
  min-width: 5.1rem;
  height: 2.75rem;
  font-size: 0.6rem;
  padding: 0.18rem 0.25rem;
}
.dr-body.is-board-blocks .dr-cell-name {
  max-width: 4.7rem;
  font-size: 0.62rem;
}
.dr-body.is-board-blocks .dr-board-table th {
  max-width: 5.1rem;
  font-size: 0.6rem;
  padding: 0.35rem 0.25rem;
}
.dr-body.is-board-blocks .dr-board-table {
  border-spacing: 3px;
  padding: 0.4rem;
}

.dr-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid #1e2733;
  background: #121820;
}
.dr-panel:last-child { border-right: none; }

.dr-players-panel {
  border-right: 1px solid #1e2733;
}

/* Open middle — keeps board+roster as a right-hand pair in list mode */
.dr-stage {
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% 40%, rgba(26, 115, 232, 0.06), transparent 70%),
    #0b0f14;
  border-right: 1px solid #1e2733;
}

.dr-board-panel {
  min-width: 0;
  max-width: 340px;
  border-right: 1px solid #1e2733;
  background: #121820;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18);
  transition: max-width 0.2s ease, box-shadow 0.2s ease;
}

.dr-roster-panel {
  min-width: 0;
}

.dr-panel-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: #161e2a;
  border-bottom: 1px solid #1e2733;
  font-size: 0.78rem;
  font-weight: 750;
  color: #e2e8f0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dr-panel-head-left {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 0;
  flex-wrap: wrap;
}
.dr-panel-head-stack {
  flex-wrap: wrap;
  row-gap: 0.35rem;
}
.dr-board-panel .dr-panel-head {
  padding: 0.45rem 0.55rem;
}
.dr-board-panel .dr-view-tabs {
  margin-left: auto;
}
.dr-panel-head span.meta {
  font-weight: 600;
  font-size: 0.7rem;
  color: #8b9bb4;
  text-transform: none;
  letter-spacing: 0;
}

/* Board view tabs (Blocks / List) */
.dr-view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem;
  border-radius: 8px;
  background: #0b0f14;
  border: 1px solid #2a3544;
  flex-shrink: 0;
  text-transform: none;
  letter-spacing: 0;
}
.dr-view-tab {
  border: none;
  background: transparent;
  color: #8b9bb4;
  font-size: 0.72rem;
  font-weight: 750;
  font-family: inherit;
  padding: 0.32rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  min-height: 28px;
  line-height: 1;
}
.dr-view-tab:hover {
  color: #e2e8f0;
  background: #1a2332;
}
.dr-view-tab.is-active {
  background: #1a73e8;
  color: #fff;
}
.dr-view-tab:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
}

.dr-panel-tools {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid #1e2733;
  background: #0f141c;
}
.dr-search-wrap {
  flex: 1 1 100%;
  min-width: 0;
  position: relative;
  display: flex;
  align-items: center;
}
.dr-search {
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  border: 1px solid #2a3544;
  background: #0b0f14;
  color: #e8eaed;
  border-radius: 8px;
  padding: 0.45rem 2rem 0.45rem 0.6rem;
  font-size: 0.82rem;
  font-family: inherit;
}
.dr-search:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.25);
}
.dr-search::placeholder {
  color: #6b7c93;
}
/* Hide native IE/Edge clear so we use our own */
.dr-search::-ms-clear { display: none; }
.dr-search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.dr-search-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.4rem;
  height: 1.4rem;
  border: none;
  border-radius: 4px;
  background: #2a3544;
  color: #e2e8f0;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.dr-search-clear:hover {
  background: #3a4658;
  color: #fff;
}
.dr-search-clear[hidden] {
  display: none !important;
}
.dr-search-empty {
  padding: 1rem 0.85rem;
  color: #8b9bb4;
  font-size: 0.8rem;
  line-height: 1.45;
}
.dr-search-empty strong {
  color: #e2e8f0;
}
.dr-pos-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.dr-pos {
  border: 1px solid #2a3544;
  background: #1a2332;
  color: #94a3b8;
  border-radius: 6px;
  padding: 0.28rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  min-height: 28px;
}
.dr-pos:hover { color: #fff; border-color: #4b5a70; }
.dr-pos.is-active {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #fff;
}

/* Player list */
.dr-player-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}
.dr-player {
  display: grid;
  grid-template-columns: 2.4rem 1fr auto auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid #1a222e;
  cursor: pointer;
  transition: background 0.1s ease;
}
.dr-player:hover {
  background: #1a2535;
}
.dr-player.is-selected {
  background: #1e3a5f;
  box-shadow: inset 3px 0 0 #1a73e8;
}
.dr-player.is-drafted {
  opacity: 0.35;
  pointer-events: none;
}
.dr-adp {
  font-size: 0.75rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #8b9bb4;
  text-align: center;
}
.dr-player-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dr-player-sub {
  font-size: 0.68rem;
  color: #8b9bb4;
  margin-top: 0.05rem;
}
.dr-pos-badge {
  font-size: 0.62rem;
  font-weight: 900;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.dr-pos-badge.QB { background: #7c3aed; color: #fff; }
.dr-pos-badge.RB { background: #059669; color: #fff; }
.dr-pos-badge.WR { background: #2563eb; color: #fff; }
.dr-pos-badge.TE { background: #d97706; color: #fff; }
.dr-pos-badge.DST { background: #64748b; color: #fff; }
.dr-pos-badge.K { background: #db2777; color: #fff; }
.dr-player-draft-btn {
  border: none;
  background: #1a73e8;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s ease;
}
.dr-player:hover .dr-player-draft-btn,
.dr-player.is-selected .dr-player-draft-btn {
  opacity: 1;
}
.dr-player-draft-btn:hover { filter: brightness(1.1); }

/* Draft board grid — compact */
.dr-board-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
  background: #0b0f14;
}
.dr-board-table {
  border-collapse: separate;
  border-spacing: 2px;
  min-width: max-content;
  padding: 0.25rem;
}
.dr-board-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #161e2a;
  color: #94a3b8;
  font-size: 0.55rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.25rem 0.2rem;
  text-align: center;
  max-width: 4.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid #2a3544;
}
.dr-board-table th.is-on-clock {
  color: #fbbf24;
  background: #2a2410;
  box-shadow: inset 0 -2px 0 #fbbf24;
}
.dr-board-table .dr-round {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #121820;
  color: #6b7c93;
  font-size: 0.58rem;
  font-weight: 800;
  text-align: center;
  width: 1.5rem;
  padding: 0.15rem;
}
.dr-cell {
  width: 4.4rem;
  min-width: 4.4rem;
  height: 2.35rem;
  vertical-align: top;
  background: #151c27;
  border: 1px solid #243041;
  border-radius: 3px;
  padding: 0.12rem 0.2rem;
  font-size: 0.55rem;
  line-height: 1.15;
}
.dr-cell.is-empty {
  background: #10161f;
  border-style: dashed;
  border-color: #1e2733;
}
.dr-cell.is-current {
  border-color: #fbbf24;
  box-shadow: 0 0 0 1px #fbbf24, 0 0 10px rgba(251, 191, 36, 0.4);
  background: #2a2410;
  animation: dr-on-clock-glow 1.4s ease infinite;
}
@keyframes dr-on-clock-glow {
  0%, 100% { box-shadow: 0 0 0 1px #fbbf24, 0 0 8px rgba(251, 191, 36, 0.35); }
  50% { box-shadow: 0 0 0 1px #fde68a, 0 0 14px rgba(251, 191, 36, 0.55); }
}
.dr-cell-pick {
  color: #6b7c93;
  font-weight: 700;
  font-size: 0.5rem;
}
.dr-cell-name {
  color: #f1f5f9;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 4rem;
}
.dr-cell-meta {
  color: #8b9bb4;
  font-size: 0.5rem;
}

/* Regular pick list — dense rows, fits board side-panel */
.dr-pick-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0.1rem 0.25rem 0.4rem;
  min-width: 0;
  width: 100%;
  max-width: none;
}
.dr-pick-row {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 0.95fr) minmax(0, 1.2fr) 2.2rem;
  gap: 0.28rem;
  align-items: center;
  padding: 0.16rem 0.28rem;
  border-bottom: 1px solid #1a222e;
  border-radius: 2px;
  font-size: 0.68rem;
  line-height: 1.2;
  background: transparent;
  min-height: 0;
}
.dr-pick-row:hover {
  background: #151c27;
}
.dr-pick-row.is-empty {
  opacity: 0.65;
}
.dr-pick-row.is-current {
  background: #2a2410;
  box-shadow: inset 3px 0 0 #fbbf24;
  border-color: #5c4d12;
  animation: dr-on-clock-row 1.4s ease infinite;
}
@keyframes dr-on-clock-row {
  0%, 100% { background: #2a2410; }
  50% { background: #3a3214; }
}
.dr-pick-row.is-made {
  opacity: 1;
}
.dr-pick-slot {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #8b9bb4;
  font-size: 0.64rem;
}
.dr-pick-row.is-current .dr-pick-slot {
  color: #fbbf24;
}
.dr-pick-row.is-current .dr-pick-team {
  color: #fde68a;
}
.dr-pick-team {
  font-weight: 650;
  color: #e2e8f0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
}
.dr-pick-player {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.28rem;
  overflow: hidden;
}
.dr-pick-player .dr-pos-badge {
  font-size: 0.52rem;
  padding: 0.08rem 0.22rem;
  flex-shrink: 0;
}
.dr-pick-player-name {
  font-weight: 650;
  color: #f1f5f9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.68rem;
}
.dr-pick-player-meta {
  color: #6b7c93;
  font-size: 0.6rem;
  flex-shrink: 0;
}
.dr-pick-player.is-waiting {
  color: #4b5563;
  font-weight: 500;
  font-size: 0.66rem;
}
.dr-pick-overall {
  text-align: right;
  color: #6b7c93;
  font-size: 0.6rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.dr-pick-list-head {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 0.95fr) minmax(0, 1.2fr) 2.2rem;
  gap: 0.28rem;
  padding: 0.18rem 0.28rem 0.2rem;
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7c93;
  border-bottom: 1px solid #243041;
  position: sticky;
  top: 0;
  background: #0b0f14;
  z-index: 1;
}
/* Narrow board panel: hide player column if tight — keep team + pick */
.dr-board-panel .dr-pick-player-meta {
  display: none;
}

/* Roster side panel */
.dr-roster {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.5rem 0.65rem 1rem;
}
.dr-roster-team {
  font-size: 0.9rem;
  font-weight: 750;
  color: #fff;
  margin-bottom: 0.65rem;
}
.dr-slot {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 0.4rem;
  align-items: center;
  padding: 0.35rem 0.4rem;
  margin-bottom: 0.3rem;
  border-radius: 6px;
  background: #151c27;
  border: 1px solid #243041;
  font-size: 0.75rem;
}
.dr-slot-pos {
  font-weight: 900;
  font-size: 0.65rem;
  color: #94a3b8;
}
.dr-slot-player {
  color: #e2e8f0;
  font-weight: 650;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dr-slot.is-empty .dr-slot-player {
  color: #4b5563;
  font-weight: 500;
}

.dr-footer-note {
  flex-shrink: 0;
  padding: 0.35rem 0.75rem;
  font-size: 0.68rem;
  color: #6b7c93;
  background: #0b0f14;
  border-top: 1px solid #1e2733;
}

/* Light theme soft override when site is light (draft room stays dark for ESPN feel) */
html[data-theme="light"] body.draft-room-active .app-main {
  background: #0e1116;
}

@media (max-width: 1280px) {
  /* Drop open stage; keep Players | Board | My team */
  .dr-body,
  .dr-body.is-board-blocks {
    grid-template-columns:
      minmax(240px, 1fr)
      minmax(240px, 1fr)
      minmax(200px, 260px);
  }
  .dr-stage { display: none; }
  .dr-board-panel { max-width: none; box-shadow: none; }
  /* Blocks still gets a bit more room than list when possible */
  .dr-body.is-board-blocks {
    grid-template-columns:
      minmax(220px, 0.9fr)
      minmax(0, 1.4fr)
      minmax(200px, 250px);
  }
}
@media (max-width: 980px) {
  .dr-body,
  .dr-body.is-board-blocks {
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
  }
  .dr-panel.dr-roster-panel {
    display: none;
  }
  .dr-stage { display: none; }
  .dr-board-panel { max-width: none; box-shadow: none; }
}
@media (max-width: 800px) {
  .dr-body,
  .dr-body.is-board-blocks {
    grid-template-columns: 1fr;
    grid-template-rows: 45% 55%;
  }
  .dr-stage { display: none; }
  .dr-board-panel { max-width: none; box-shadow: none; }
  .dr-top {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 0.5rem;
  }
  .dr-top-right { justify-content: center; }
  .dr-clock { font-size: 1.85rem; }
}
