/*
 * Rank / leaderboard sheet — Figma node ~1012-3905 (Cacheta Brasil).
 * Standalone sheet (not Tailwind-purged); loaded from application layout.
 */

.rank-page-root {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px) + 8px);
}

/* Inside DaisyUI modal: dock is behind overlay — no extra bottom gap for the lobby dock */
.rank-page-root--modal {
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.rank-page-root__backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(2, 18, 10, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Modal: dimmed region above the sheet must receive taps to dismiss (see rank-sheet-frame#backdropClose). */
.rank-page-root--modal .rank-page-root__backdrop {
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  display: block;
}

.rank-page-sheet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 359px;
  height: 628px;
  max-height: min(628px, calc(100vh - 120px - env(safe-area-inset-bottom, 0px)));
  margin: 0 auto;
  margin-top: 10px;
  border-radius: 24px 24px 0 0;
  overflow: hidden;
  box-sizing: border-box;
  background: linear-gradient(180deg, #1c5f2c 0%, #2b7d35 50%, #7ee340 100%);
  box-shadow:
    0 -8px 32px rgba(0, 24, 10, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Lobby modal: sheet spans full viewport width; height capped by modal shell */
.rank-page-root--modal .rank-page-sheet {
  max-width: 100%;
  width: 100%;
  height: min(628px, calc(90vh - env(safe-area-inset-bottom, 0px) - 8px));
  max-height: min(628px, calc(90vh - env(safe-area-inset-bottom, 0px) - 8px));
}

.rank-page-sheet__handle {
  flex-shrink: 0;
  width: 42px;
  height: 4px;
  margin: 10px auto 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.rank-page-sheet__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 17px 10px;
}

.rank-page-sheet__header-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 20, 8, 0.35));
}

.rank-page-sheet__title {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  color: #b7f10a;
}

/* Segmented control — Figma: 325×37, rgba white 0.22, inner padding 3px */
.rank-page-tabs {
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  width: 325px;
  max-width: calc(100% - 34px);
  height: 37px;
  margin: 0 auto 12px;
  padding: 3px;
  border-radius: 12px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.22);
}

.rank-page-root--modal .rank-page-tabs,
.rank-page-root--modal .rank-page-table-head,
.rank-page-root--modal .rank-page-row {
  width: calc(100% - 34px);
  max-width: 100%;
}

.rank-page-tabs__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  border: none;
  border-radius: 10px;
  padding: 0 8px;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  color: #ffffff;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

.rank-page-tabs__btn--active {
  font-weight: 700;
  color: #194920;
  background: linear-gradient(180deg, #03f3eb 0%, #b7f10a 100%);
  box-shadow: 0 2px 10px rgba(0, 40, 18, 0.28);
}

.rank-page-tabs__btn:focus-visible {
  outline: 2px solid rgba(3, 243, 235, 0.75);
  outline-offset: 2px;
}

/* Podium — gap 12px, cards 92×125 */
.rank-page-podium {
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  padding: 0 17px 12px;
}

.rank-page-podium-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 92px;
  height: 125px;
  padding: 8px 6px 10px;
  border-radius: 18px;
  box-sizing: border-box;
  overflow: hidden;
  background:
    linear-gradient(165deg, rgba(12, 36, 18, 0.92) 0%, rgba(6, 18, 10, 0.98) 100%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 6px,
      rgba(255, 255, 255, 0.03) 6px,
      rgba(255, 255, 255, 0.03) 7px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 6px,
      rgba(255, 255, 255, 0.03) 6px,
      rgba(255, 255, 255, 0.03) 7px
    );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -2px 8px rgba(0, 0, 0, 0.35);
}

.rank-page-podium-card--second {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -2px 8px rgba(0, 0, 0, 0.35),
    0 0 18px 2px rgba(196, 210, 220, 0.55),
    0 0 28px rgba(180, 200, 215, 0.35);
}

.rank-page-podium-card--first {
  height: 132px;
  transform: translateY(-6px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -2px 10px rgba(0, 0, 0, 0.38),
    0 0 22px 4px rgba(255, 215, 80, 0.65),
    0 0 36px rgba(255, 200, 60, 0.45),
    0 12px 22px rgba(0, 12, 6, 0.55);
}

.rank-page-podium-card--third {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -2px 8px rgba(0, 0, 0, 0.35),
    0 0 18px 2px rgba(205, 130, 70, 0.55),
    0 0 26px rgba(180, 90, 40, 0.35);
}

.rank-page-podium-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  object-fit: cover;
  margin-bottom: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.rank-page-podium-card__place {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  color: #ffffff;
  text-align: center;
}

.rank-page-podium-card__name {
  margin-top: 2px;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
  color: #ffffff;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-page-podium-card__points {
  margin-top: 2px;
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
}

.rank-page-table-head {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(52px, auto) minmax(0, 1fr) 52px 52px;
  column-gap: 8px;
  align-items: center;
  width: 325px;
  max-width: calc(100% - 34px);
  height: 37px;
  margin: 0 auto 8px;
  padding: 0 12px;
  border-radius: 999px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.22);
}

.rank-page-table-head span {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: #ffffff;
  min-width: 0;
}

.rank-page-table-head span:nth-child(1),
.rank-page-table-head span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-page-table-head span:nth-child(3),
.rank-page-table-head span:nth-child(4) {
  text-align: right;
}

.rank-page-list-wrap {
  flex: 1 1 0;
  min-height: 0;
  padding: 0 17px 10px;
  display: flex;
  flex-direction: column;
}

.rank-page-list {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rank-page-row {
  display: grid;
  grid-template-columns: minmax(52px, auto) minmax(0, 1fr) 52px 52px;
  column-gap: 8px;
  align-items: center;
  width: 325px;
  max-width: 100%;
  height: 37px;
  margin: 0 auto;
  padding: 0 10px 0 10px;
  border-radius: 12px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(90deg, rgba(38, 113, 49, 0.95), rgba(111, 197, 77, 0.95));
}

.rank-page-row__pos {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}

.rank-page-row__user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rank-page-row__avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
}

.rank-page-row__name {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-page-row__num {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  text-align: right;
  justify-self: end;
}

.rank-page-row--you {
  border: 1px solid rgba(183, 241, 10, 0.65);
  background: linear-gradient(
    90deg,
    rgba(55, 160, 72, 0.98),
    rgba(140, 220, 95, 0.98)
  );
  box-shadow:
    0 0 16px rgba(183, 241, 10, 0.45),
    0 4px 14px rgba(0, 40, 14, 0.35);
}

.rank-page-row--you .rank-page-row__pos,
.rank-page-row--you .rank-page-row__name,
.rank-page-row--you .rank-page-row__num {
  color: #194920;
  font-weight: 600;
}

/* Lobby bottom-sheet embed: outer shell provides handle + backdrop (see support-page.css). */
.rank-page-root--embedded-bottom-sheet .rank-page-sheet__handle {
  display: none;
}

.lobby-bottom-sheet-host .bottom-sheet__panel[data-active-pane="rank_leaderboard"] .lobby-rank-embed {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lobby-bottom-sheet-host .bottom-sheet__panel[data-active-pane="rank_leaderboard"] .lobby-rank-sheet-turbo-frame {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.lobby-bottom-sheet-host .bottom-sheet__panel[data-active-pane="rank_leaderboard"] .rank-page-root--embedded-bottom-sheet {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: 100%;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.lobby-bottom-sheet-host .bottom-sheet__panel[data-active-pane="rank_leaderboard"] .rank-page-root--embedded-bottom-sheet .rank-page-sheet {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  max-height: min(628px, 100%);
  margin-top: 0;
  border-radius: 0;
  box-shadow: none;
  /* Same top tone as panel; gradient softens below the tabs (no hard seam at header). */
  background: linear-gradient(180deg, #1c5f2c 0%, #1c5f2c 18%, #2b7d35 52%, #7ee340 100%);
}

/* One continuous top color: panel handle strip + rank header + tabs (no dark shell vs lighter card). */
.lobby-bottom-sheet-host .bottom-sheet__panel[data-active-pane="rank_leaderboard"] {
  background: #1c5f2c;
}

.lobby-bottom-sheet-host .bottom-sheet__panel[data-active-pane="rank_leaderboard"] .bottom-sheet__body {
  background: #1c5f2c;
}
