/* ============================================================
   Horrortainment Quiz — Leaderboard Styles
   ============================================================ */

.page-leaderboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#htq-leaderboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ------------------------------------------------------------
   Main layout
------------------------------------------------------------ */
.lb-main {
  flex: 1;
  padding: 0 20px 60px;
}

.lb-inner {
  max-width: 800px;
  margin: 0 auto;
  padding-top: 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ------------------------------------------------------------
   Title
------------------------------------------------------------ */
.lb-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lb-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 8vw, 56px);
  color: var(--white);
  letter-spacing: 0.02em;
  line-height: 1;
}

/* ------------------------------------------------------------
   Tabs
------------------------------------------------------------ */
.lb-tabs {
  display: flex;
  gap: 4px;
  background: var(--grey-900);
  border: 1px solid var(--grey-700);
  border-radius: var(--radius-lg);
  padding: 4px;
  width: fit-content;
}

.lb-tab {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--grey-400);
  cursor: pointer;
  transition: all var(--transition);
}

.lb-tab:hover {
  color: var(--white);
}

.lb-tab--active {
  background: var(--grey-700);
  color: var(--white);
}

/* ------------------------------------------------------------
   Controls
------------------------------------------------------------ */
.lb-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lb-quiz-select-wrap {
  width: 100%;
}

.lb-quiz-select {
  width: 100%;
  background: var(--grey-800);
  border: 2px solid var(--grey-600);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--white);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.lb-quiz-select:focus {
  border-color: var(--red);
}

.lb-quiz-select option {
  background: var(--grey-800);
  color: var(--white);
}

/* ------------------------------------------------------------
   Loading
------------------------------------------------------------ */
.lb-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 20px;
}

/* ------------------------------------------------------------
   Table
------------------------------------------------------------ */
.lb-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.lb-table thead tr {
  background: var(--grey-800);
}

.lb-table th {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-400);
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
}

.lb-table th:first-child {
  text-align: center;
  width: 48px;
}

.lb-table tbody tr {
  background: var(--grey-900);
  border-bottom: 1px solid var(--grey-800);
  transition: background var(--transition);
}

.lb-table tbody tr:hover {
  background: var(--grey-800);
}

.lb-table tbody tr:last-child {
  border-bottom: none;
}

.lb-table td {
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--white);
  padding: 14px 16px;
  vertical-align: middle;
}

/* Rank column */
.lb-rank {
  text-align: center;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--grey-400);
  width: 48px;
}

.lb-rank--gold {
  color: var(--gold);
}
.lb-rank--silver {
  color: #c0c0c0;
}
.lb-rank--bronze {
  color: #cd7f32;
}

/* Name */
.lb-name {
  font-weight: 700;
  color: var(--white);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Score */
.lb-score {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--white);
  white-space: nowrap;
}

.lb-score-sep {
  color: var(--grey-600);
  font-size: 16px;
  margin: 0 2px;
}

/* Percentage */
.lb-pct {
  font-family: var(--font-display);
  font-size: 20px;
}

.lb-pct--100 {
  color: var(--gold);
}
.lb-pct--high {
  color: var(--green);
}
.lb-pct--mid {
  color: var(--amber);
}
.lb-pct--low {
  color: var(--red-bright);
}

/* Quiz title (global board) */
.lb-quiz-title {
  font-size: 13px;
  color: var(--grey-400);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Date */
.lb-date {
  font-size: 12px;
  color: var(--grey-600);
  white-space: nowrap;
}

/* Top 3 rows */
.lb-row--1 {
  background: rgba(255, 215, 0, 0.04) !important;
}
.lb-row--2 {
  background: rgba(192, 192, 192, 0.03) !important;
}
.lb-row--3 {
  background: rgba(205, 127, 50, 0.03) !important;
}

.lb-time {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--grey-400);
  white-space: nowrap;
}

/* ------------------------------------------------------------
   Empty state
------------------------------------------------------------ */
.lb-empty {
  padding: 60px 20px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 16px;
  color: var(--grey-400);
  letter-spacing: 0.05em;
}

/* ------------------------------------------------------------
   Desktop
------------------------------------------------------------ */
@media (min-width: 640px) {
  .lb-table th,
  .lb-table td {
    padding: 16px 20px;
  }
}

/* ------------------------------------------------------------
   Highlighted row (player's own score after redirect)
------------------------------------------------------------ */
.lb-row--highlight {
  background: rgba(255, 26, 26, 0.08) !important;
  outline: 2px solid var(--red-bright);
  outline-offset: -2px;
  position: relative;
}

.lb-row--highlight .lb-name {
  color: var(--red-bright);
}

/* ------------------------------------------------------------
   Share block
------------------------------------------------------------ */
.lb-share-block {
  display: none;
  background: var(--grey-900);
  border: 1px solid var(--red);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 30px var(--red-glow);
  overflow: hidden;
}

.lb-share-inner {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.lb-share-score {
  font-family: var(--font-ui);
  font-size: 17px;
  color: var(--white);
  letter-spacing: 0.02em;
}

.lb-share-score strong {
  color: var(--gold);
  font-size: 20px;
}

.lb-share-score em {
  color: var(--grey-200);
  font-style: normal;
}

.lb-share-challenge {
  font-family: var(--font-display);
  font-size: clamp(22px, 5vw, 32px);
  color: var(--red-bright);
  letter-spacing: 0.05em;
  text-shadow: 0 0 20px var(--red-glow);
}

.lb-share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 6px;
}

.lb-share-btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  transition: opacity var(--transition), transform var(--transition);
  white-space: nowrap;
}

.lb-share-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.lb-share-btn--x {
  background: #000;
  color: var(--white);
  border: 1px solid #333;
}

.lb-share-btn--bluesky {
  background: #0085ff;
  color: var(--white);
}

.lb-share-btn--fb {
  background: #1877f2;
  color: var(--white);
}

@media (min-width: 640px) {
  .lb-share-inner {
    padding: 28px 32px;
  }
}
