:root {
  --bg: #0f1420;
  --panel: #1a2233;
  --panel-border: #2b3650;
  --text: #eef1f8;
  --muted: #93a0bd;
  --accent: #ffb020;
  --accent-2: #4f8cff;
  --danger: #ff5d5d;
  --success: #35d07f;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1, h2, h3 {
  margin: 0 0 0.5em;
}

.hidden {
  display: none !important;
}

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

/* ---------- Big Board ----------
   Designed to fit a TV/projector viewport with zero page-level scroll —
   the outer page is pinned to 100vh, and each panel scrolls internally
   instead of pushing the page taller as rosters/history fill up. This is
   relaxed back to normal scrolling below 1000px, since a phone viewer
   following along remotely should get a normal scrolling page, not a
   cramped one-screen layout. */

html {
  height: 100%;
}

.board-body {
  height: 100vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex: none;
}

.board-header h1 {
  font-size: 1.5rem;
}

.status-banner {
  color: var(--danger);
  font-weight: 600;
}

.board-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1.2fr 0.8fr;
  gap: 16px;
}

.rotating-panel {
  grid-column: 1 / -1;
}

@media (max-width: 1000px) {
  html {
    height: auto;
  }
  .board-body {
    height: auto;
    overflow: visible;
  }
  .board-main {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
  .rotating-panel {
    grid-column: 1;
  }
  .on-clock-panel, .upcoming-panel, .feed-panel, .rotating-panel {
    display: block !important;
  }
  .roster-list, .upcoming-list, .pick-feed, .rotating-content {
    flex: none !important;
    overflow: visible !important;
    max-height: none !important;
  }
}

.on-clock-panel, .upcoming-panel, .feed-panel, .rotating-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.on-clock-panel > h2, .upcoming-panel > h2, .feed-panel > h2, .on-clock-panel > h3 {
  font-size: 1rem;
  margin: 0 0 8px;
}

.on-clock-panel > h2, .on-clock-panel > h3, .on-clock-panel > .on-clock-card,
.upcoming-panel > h2,
.feed-panel > h2 {
  flex: none;
}

.on-clock-card {
  background: linear-gradient(135deg, #2a3352, #1c2338);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
  flex: none;
}

.clock-round {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.clock-team {
  font-size: 1.4rem;
  font-weight: 800;
}

.needs-row {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.needs-chip {
  background: rgba(255, 176, 32, 0.15);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  padding: 1px 8px;
  font-weight: 700;
  font-size: 0.68rem;
}

.draft-complete {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--success);
}

.roster-list, .upcoming-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.roster-list li, .upcoming-list li {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* Compact text in the three always-visible panels — fits more, and these are
   read at a glance rather than needing to be the biggest thing on screen.
   Scoped to these specific panels so it doesn't shrink Best Available
   (also .upcoming-list) or the admin Pick Log (also .pick-feed). */
.on-clock-panel .roster-list li,
.upcoming-panel .upcoming-list li,
.feed-panel .feed-item {
  font-size: 0.85rem;
  padding: 8px 10px;
}

.on-clock-panel .roster-list .player-pos,
.feed-panel .feed-round {
  font-size: 0.7rem;
}

.feed-panel .analyst-take {
  font-size: 0.8rem;
}

.roster-list li.stolen {
  border-color: var(--accent);
}

.player-name {
  font-weight: 600;
}

.player-pos {
  color: var(--muted);
  font-size: 0.85rem;
}

.steal-tag {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.pick-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* ---- Rotating panel: Best Available / Draft Board / Rosters ---- */

.rotating-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex: none;
}

.rotating-panel-header h2 {
  margin: 0;
}

.nav-dots {
  display: flex;
  gap: 8px;
}

.nav-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.nav-dot.active {
  background: var(--accent);
  border-color: var(--accent);
}

.rotating-content {
  transition: opacity 0.2s ease;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.rotating-content.fade-out {
  opacity: 0;
}

.draft-board-scroll {
  overflow-x: auto;
}

.draft-board-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.8rem;
}

.draft-board-table th, .draft-board-table td {
  border: 1px solid var(--panel-border);
  padding: 6px 8px;
  text-align: left;
  white-space: nowrap;
}

.draft-board-table thead th {
  background: var(--bg);
  color: var(--accent);
  position: sticky;
  top: 0;
}

.draft-board-table tbody th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 700;
}

.draft-board-table td.pending-cell {
  background: transparent;
}

.draft-board-table td.na-cell {
  color: var(--muted);
  text-align: center;
}

.draft-board-table td.steal-cell {
  background: rgba(255, 176, 32, 0.1);
}

.draft-board-table .db-player {
  display: block;
  font-weight: 600;
}

.draft-board-table .db-pos {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}

.rosters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  align-content: start;
}

.roster-card {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 12px;
}

.roster-card h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--accent-2);
}

.roster-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.roster-card li {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.8rem;
}

.roster-card li.stolen .player-name {
  color: var(--accent);
}

.feed-item {
  background: var(--bg);
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--accent-2);
  border-radius: 8px;
  padding: 10px 14px;
}

.feed-item.feed-steal {
  border-left-color: var(--accent);
}

.analyst-take {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--panel-border);
  font-style: italic;
  color: var(--accent);
  font-size: 0.9rem;
}

.feed-round {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

/* ---------- Admin ---------- */

.admin-body {
  background: #f4f6fb;
  color: #1a2233;
  padding: 24px;
}

.admin-body .muted {
  color: #6b7690;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.login-card, .panel, .clock-summary {
  background: #fff;
  border: 1px solid #dde3ef;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  max-width: 480px;
}

.admin-main .panel {
  max-width: 640px;
}

.clock-summary {
  max-width: 640px;
}

.admin-body .clock-team {
  color: #1a2233;
  font-size: 1.3rem;
}

.admin-body .clock-round {
  color: #b5790a;
}

.admin-body .needs-chip {
  background: rgba(181, 121, 10, 0.1);
  border-color: #b5790a;
  color: #b5790a;
}

form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

input, select, button, textarea {
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #ccd3e0;
}

input, select {
  flex: 1;
  min-width: 140px;
}

textarea {
  width: 100%;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
  margin: 6px 0 10px;
}

.btn {
  cursor: pointer;
  border: none;
  font-weight: 600;
  color: #fff;
}

.btn-primary { background: var(--accent-2); }
.btn-secondary { background: #5b6785; }
.btn-warning { background: var(--accent); color: #2a1e00; }
.btn-danger { background: var(--danger); }

.error-text {
  color: var(--danger);
  font-size: 0.9rem;
  margin-top: 6px;
  min-height: 1.2em;
}

.autocomplete-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.autocomplete-wrap input {
  width: 100%;
}

.suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ccd3e0;
  border-radius: 8px;
  margin-top: 4px;
  z-index: 10;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.suggestion-item:hover {
  background: #eef2fb;
}

.admin-main .pick-feed {
  max-height: 40vh;
}

.admin-main .feed-item {
  background: #f8f9fc;
  border-color: #dde3ef;
}

.admin-main .analyst-take {
  color: #b5790a;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.toggle-row input[type="checkbox"] {
  flex: none;
  width: auto;
}

/* ---- League Setup ---- */

.roster-req-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
}

.roster-req-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: #4b5675;
  font-weight: 600;
}

.roster-req-grid input {
  width: 100%;
}

#teams-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 12px;
}

.team-card {
  border: 1px solid #dde3ef;
  border-radius: 8px;
  padding: 14px;
  background: #f8f9fc;
}

.team-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #4f8cff;
}

.team-card input[type="text"] {
  width: 100%;
  margin-bottom: 8px;
}

.keeper-count-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.keeper-count-row label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.keepers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.keeper-row {
  display: flex;
  gap: 6px;
}

.keeper-row .autocomplete-wrap {
  flex: 2;
  min-width: 0;
}

.keeper-row .keeper-position {
  flex: 1;
  min-width: 60px;
}

.conditional-row {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.conditional-row select {
  width: 100%;
}

.pre-trade-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.season-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #eef1f8;
}

.season-row:last-child {
  border-bottom: none;
}

.active-tag {
  background: rgba(53, 208, 127, 0.15);
  color: #1b8f56;
  border: 1px solid var(--success);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 700;
  font-size: 0.75rem;
}
