/* Previous results modal — leaderboards (brand blues + scrollable list) */

.lb-prev-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(20px, env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.lb-prev-modal[hidden] {
  display: none !important;
}

.lb-prev-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 15, 65, 0.78);
  backdrop-filter: blur(8px);
}

.lb-prev-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 72rem);
  margin-top: clamp(48px, 10vh, 96px);
  margin-bottom: max(16px, env(safe-area-inset-bottom));
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.lb-prev-modal__inner {
  position: relative;
  width: 100%;
  max-height: min(88vh, 860px);
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* Space for half the floating logo below the top rim + title */
  padding: calc(2.5rem + 50px) 1.35rem 1.35rem;
  border-radius: 15px;
  overflow: visible;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(
    165deg,
    var(--red-color-bg-3, #071E6D) 0%,
    #051654 42%,
    #041660 100%
  );
  box-shadow: 0 0 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 207, 255, 0.12) inset;
  color: var(--on-surface-readable, #ffffff);
}

@media (min-width: 640px) {
  .lb-prev-modal__inner {
    padding: calc(2.75rem + 50px) 2rem 1.5rem;
  }
}

.lb-prev-modal__x {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(5, 21, 84, 0.85);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.lb-prev-modal__x:hover {
  background: var(--red-color-bg-2, #00CFFF);
  border-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* Floating circular logo — vertical center sits on the inner top edge of the card */
.lb-prev-modal__logo.modal-logo {
  position: absolute;
  left: 50%;
  /* Center of circle on the top border line of the card (≈ half the 2px border) */
  top: -1px;
  z-index: 1;
  width: 100px;
  height: 100px;
  margin: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  background: linear-gradient(
    160deg,
    #0c2a8a 0%,
    var(--red-color-bg-3, #071E6D) 45%,
    #041660 100%
  );
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
  /* Inset so the full mark fits inside the ring without touching the border */
  padding: 10px;
}

.lb-prev-modal__logo.modal-logo img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: center;
  border: none;
  box-shadow: none;
  display: block;
}

.lb-prev-modal__title-wrap {
  text-align: center;
  flex-shrink: 0;
}

.lb-prev-modal__title {
  margin: 0;
  font-family: var(--secondary-font, "Gabarito", "Space Grotesk", system-ui, sans-serif);
  font-size: clamp(1.25rem, 3.8vw, 1.75rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
}

.lb-prev-modal__tabs.lb-previous-tab {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 1.1rem 0 0;
  flex-shrink: 0;
}

.lb-prev-tab-btn {
  flex: 0 1 auto;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #051654;
  color: var(--on-surface-readable, #ffffff);
  font-family: var(--secondary-font, "Gabarito", "Space Grotesk", system-ui, sans-serif);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.lb-prev-tab-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
  background: #061a5c;
}

.lb-prev-tab-btn.active {
  color: #fff;
  background: linear-gradient(
    135deg,
    var(--red-color-bg-2, #00CFFF) 0%,
    var(--red-color-bg-1, #155EEF) 100%
  );
  border-color: rgba(0, 207, 255, 0.45);
  box-shadow: 0 6px 24px rgba(21, 94, 239, 0.35);
}

.lb-prev-modal__table-wrap.leaderboard-table {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: 1rem;
}

.lb-prev-modal__table-wrap .relative {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.lb-prev-modal__alert.coming-alert {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--on-surface-readable, #ffffff) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.lb-prev-modal__coming {
  text-align: center;
  padding: 2.5rem 1rem;
}

.lb-prev-modal__coming-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--primary-color, #155EEF);
}

.lb-prev-modal__coming-text {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.65);
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
}

.lb-prev-modal__status {
  flex-shrink: 0;
}

.lb-prev-modal__status--err {
  color: #b4dcff;
}

/* Scrollable grid — modal stays compact; only this region scrolls */
.lb-prev-modal__scroll {
  flex: 1;
  min-height: 0;
  max-height: min(46vh, 420px);
  overflow-x: hidden;
  overflow-y: auto;
  margin-top: 0.35rem;
  padding-right: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: rgba(21, 94, 239, 0.55) rgba(0, 0, 0, 0.2);
  scrollbar-width: thin;
}

.lb-prev-modal__scroll::-webkit-scrollbar {
  width: 8px;
}

.lb-prev-modal__scroll::-webkit-scrollbar-thumb {
  background: rgba(21, 94, 239, 0.45);
  border-radius: 8px;
}

.lb-prev-modal__scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
}

.lb-prev-modal__more-hint {
  margin: 0.75rem 0 0.25rem;
  padding: 0.5rem;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}

.date-listings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 11px;
}

@media (min-width: 640px) {
  .date-listings {
    grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
    gap: 13px;
  }
}

.date-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 10px 14px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  background: var(--bgColorBack, rgba(255, 255, 255, 0.06)) !important;
  border: 2px solid rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
  font-family: var(--secondary-font, "Gabarito", "Space Grotesk", system-ui, sans-serif);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.date-item:hover {
  transform: translateY(-2px);
  border-color: rgba(21, 94, 239, 0.55) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.date-item:focus-visible {
  outline: 2px solid var(--primary-color, #155EEF);
  outline-offset: 2px;
}

.date-item .top {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 2px;
}

.date-item .top .left span {
  color: var(--primary-color, #3d8bff);
  font-size: 12px;
}

.date-item .top .right {
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
}

.date-item .avatar {
  margin: 4px 0 8px;
}

.date-item .avatar img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.12);
}

.date-item .date-info p {
  margin: 0;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.45);
}

.date-item .date-info h2 {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  word-break: break-word;
}

/* Winner block: full card width so long names can shrink to one line (JS + ellipsis fallback) */
.lb-prev-modal .date-item .date-info {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0 4px;
  box-sizing: border-box;
}

/* Winner line — prominent masked name (Clash / CSBattle archive cards) */
.lb-prev-modal .date-item .date-info p {
  font-size: clamp(0.65rem, 2vw, 0.75rem);
  letter-spacing: 0.14em;
}

.lb-prev-modal .date-item .date-info h2.lb-prev-winner-name {
  margin-top: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.15;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
  overflow: hidden;
  word-break: normal;
  overflow-wrap: normal;
}

.date-item .prize-pool {
  margin-top: 10px;
  width: 100%;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.date-item .prize-pool p {
  margin: 0;
  font-size: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

.date-item .prize-pool p.date-item-pool-label {
  text-transform: none;
  letter-spacing: 0.04em;
  font-size: 9px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
}

.date-item-pool-value-wrap {
  margin-top: 6px;
}

.date-item-pool-value {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  line-height: 1.2;
}

.date-item-pool-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.date-item-pool-site-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.date-item-pool-site-img--coin {
  width: 24px;
  height: 24px;
}

.date-item-pool-amount {
  font-size: 14px;
  font-weight: 900;
  color: #b8f5c8;
  letter-spacing: 0.02em;
}

.date-item-pool-suffix {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.55);
}

.date-item-pool-brand {
  margin: 4px 0 0;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

.date-item .prize-pool h1 {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 900;
  color: #b8f5c8;
  line-height: 1.2;
}
