/* =============================================================
   Live ranking slot — 2026-04-21
   In live room exams, the question-navigator button (#overview-button)
   is hidden. This stylesheet repurposes .overview-container as a
   live ranking preview so candidates see their position in real time
   right where the question menu would normally be.
   ============================================================= */

/* Only activate in live rooms. Also show the slot (was display:flex,
   justify-content: flex-end in base runner.css) and expand it. */
body.is-live-room-exam .overview-container {
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  min-width: min(360px, 38vw);
  max-width: 440px;
  padding: 0;
}

body.is-live-room-exam .overview-container.has-live-ranking {
  background: transparent;
}

/* The host panel where we plant the mini-scoreboard */
.live-ranking-slot {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem 1.2rem;
  background: linear-gradient(145deg,
    rgba(12, 25, 43, 0.88),
    rgba(9, 20, 36, 0.94));
  border: 1px solid rgba(198, 163, 84, 0.22);
  border-radius: 1.4rem;
  box-shadow: 0 16px 40px rgba(2, 7, 16, 0.28);
  font-family: "Manrope", "Space Grotesk", system-ui, sans-serif;
  max-height: 22rem;
  overflow: hidden;
}

.live-ranking-slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.live-ranking-slot-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f0c776;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.live-ranking-slot-title::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: #d85d58;
  box-shadow: 0 0 0 4px rgba(216, 93, 88, 0.22);
  animation: live-pulse 1.8s ease-in-out infinite;
}

.live-ranking-slot-meta {
  font-size: 1.05rem;
  font-weight: 600;
  color: rgba(228, 236, 247, 0.72);
}

/* The list — uses classroom scoreboard classes directly so when the
   real scoreboard node is cloned/moved into the slot, it renders
   compact without needing extra markup. */
.live-ranking-slot .live-scoreboard-list,
.live-ranking-slot ol,
.live-ranking-slot ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-y: auto;
  max-height: 15rem;
  scrollbar-width: thin;
}

.live-ranking-slot .live-scoreboard-item,
.live-ranking-slot li {
  display: grid;
  grid-template-columns: 1.8rem 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.6rem;
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 1rem;
  color: #dfe8f4;
  transition: background 0.2s ease;
}

.live-ranking-slot .live-scoreboard-item:hover,
.live-ranking-slot li:hover {
  background: rgba(255, 255, 255, 0.07);
}

.live-ranking-slot .live-scoreboard-item.is-self {
  background: rgba(216, 175, 96, 0.14);
  border-color: rgba(216, 175, 96, 0.45);
  color: #f8f6f1;
  font-weight: 700;
}

.live-ranking-slot .live-scoreboard-item.is-rank-1 { border-left: 3px solid #f0c776; }
.live-ranking-slot .live-scoreboard-item.is-rank-2 { border-left: 3px solid #c5cad4; }
.live-ranking-slot .live-scoreboard-item.is-rank-3 { border-left: 3px solid #d69a6c; }

.live-ranking-slot .live-scoreboard-rank {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: rgba(228, 236, 247, 0.55);
  text-align: center;
}

.live-ranking-slot .live-scoreboard-item.is-rank-1 .live-scoreboard-rank { color: #f0c776; }
.live-ranking-slot .live-scoreboard-item.is-rank-2 .live-scoreboard-rank { color: #c5cad4; }
.live-ranking-slot .live-scoreboard-item.is-rank-3 .live-scoreboard-rank { color: #d69a6c; }

.live-ranking-slot .live-scoreboard-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.live-ranking-slot .live-scoreboard-copy strong {
  font-size: 0.98rem;
  font-weight: 600;
  color: #f0f4fb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 14rem;
}

.live-ranking-slot .live-scoreboard-copy span {
  font-size: 0.8rem;
  color: rgba(228, 236, 247, 0.6);
}

.live-ranking-slot .live-scoreboard-points {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #f0c776;
  text-align: right;
}

/* Empty state */
.live-ranking-slot-empty {
  padding: 1.2rem 0.6rem;
  text-align: center;
  font-size: 0.95rem;
  color: rgba(228, 236, 247, 0.55);
  font-style: italic;
}

@keyframes live-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.25); opacity: 0.55; }
}

/* Collapsed toggle on narrow viewports — fall back to the icon button
   on small screens where real estate is scarce. */
@media (max-width: 900px) {
  body.is-live-room-exam .overview-container {
    max-width: 220px;
    min-width: 180px;
  }
  .live-ranking-slot { max-height: 14rem; padding: 0.7rem 0.8rem; }
  .live-ranking-slot .live-scoreboard-copy span { display: none; }
}

@media (max-width: 640px) {
  body.is-live-room-exam .overview-container {
    display: none;
  }
}
