/* =============================================================================
   TOURNAMENTS PAGE — Pixel-Perfect CSS from Tournaments.pen
   =============================================================================
   Generated from Pencil.dev MCP batch_get with resolveVariables.
   All fonts → var(--font-family). Colors → CSS variables from tokens.css.
   ============================================================================= */

/* ── 1. Container + Layout ─────────────────────────────────────── */

.spa-tournaments {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden !important;
  height: 100%;
}

.spa-tournaments .tournament-content-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 12px 6px 0;
  gap: 14px;
  overflow: hidden;
  min-height: 0;
}

/* Between scroll area gets sized by _fitListHeights() like all .scrollable-content */
.between-scroll-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tournament-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

/* Tab wrapper divs (created by DOM caching logic) inherit parent gap */
.tournament-content > [data-tab] {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.tournament-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tournament-section-title {
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tournament-section-title svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.tournament-section-subtitle {
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--color-text-tertiary);
}

/* ── 2. Tab Bar ────────────────────────────────────────────────── */

.tournament-tabs {
  display: flex;
  width: 100%;
  border-radius: var(--radius-m);
  overflow: hidden;
  height: 46px;
  position: relative;
  padding: 4px;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
    linear-gradient(to bottom left, var(--border-gradient-start), var(--border-gradient-end)) border-box;
  box-sizing: border-box;
  flex-shrink: 0;
}

.tournament-tabs::before {
  content: '';
  position: absolute;
  height: calc(100% - 8px);
  width: calc(50% - 4px);
  left: 4px;
  top: 4px;
  background-color: var(--color-selected-border);
  border-radius: var(--radius-s);
  transition: transform 0.3s ease;
  z-index: 0;
  box-sizing: border-box;
  box-shadow: var(--shadow-sm);
}

/* NOTE: weekly-selected kept for future re-enable */
.tournament-tabs.weekly-selected::before {
  transform: translateX(calc(100% + 2px));
}

.tournament-tabs.history-selected::before {
  transform: translateX(calc(100% + 2px));
}

.tournament-tabs .tab {
  flex: 1;
  text-align: center;
  padding: 0;
  font-family: var(--font-family);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  cursor: pointer;
  z-index: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
  position: relative;
  border-radius: var(--radius-s);
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  -webkit-tap-highlight-color: transparent;
}

.tournament-tabs .tab.active {
  color: #fff;
  font-weight: 600;
}

/* ── 3. Header Row ─────────────────────────────────────────────── */

.tournament-header-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tournament-title {
  font-family: var(--font-family);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
}

.privacy-toggle {
  border-radius: 12px;
  padding: 6px;
  display: flex;
  gap: 4px;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
    linear-gradient(to bottom left, var(--border-gradient-start), var(--border-gradient-end)) border-box;
}

.privacy-toggle .pv-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  background: transparent;
  color: var(--color-text-tertiary);
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.privacy-toggle .pv-btn.active {
  background: var(--color-selected-border);
  color: #fff;
}

/* ── 4. Timer Row (simple inline) ──────────────────────────────── */

.timer-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timer-left,
.timer-right {
  display: flex;
  gap: 6px;
  align-items: center;
}

.timer-row .t-icon {
  width: 14px;
  height: 14px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.timer-row .t-text {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* ── 5. Podium (Top-3, absolute positioned) ────────────────────── */

/* ── Podium: rectangular cards layout ── */
/* Order in DOM: [2nd] [1st] [3rd] — displayed via flex with align-items: flex-end */

.podium-area {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
  margin-bottom: 18px;
  flex-shrink: 0;
}

.podium-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  border-radius: var(--radius-m);
  border: 1px solid transparent;
  background:
    linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
    linear-gradient(to bottom left, var(--border-gradient-start), var(--border-gradient-end)) border-box;
  box-sizing: border-box;
  flex: 1;
  min-width: 0;
}

/* NFT ribbon — same size as PlayPage probable wins (default from labels.css) */

/* 1st place — tallest */
.podium-card-1 {
  padding-top: 14px;
  padding-bottom: 12px;
}

/* 2nd and 3rd — shorter */
.podium-card-2,
.podium-card-3 {
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Gift animation/thumbnail area */
.podium-gift {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.podium-card-1 .podium-gift {
  width: 80px;
  height: 80px;
}

.podium-card-2 .podium-gift,
.podium-card-3 .podium-gift {
  width: 64px;
  height: 64px;
}

/* Price tag inside podium card — reuses .gift-price from style.css */
.podium-card .gift-price {
  margin: 0 auto;
  padding: 2px 8px;
  font-size: 10px;
}

.podium-card .gift-price-value {
  font-size: 10px;
}

/* User row: small avatar + name */
.podium-user {
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
}

.podium-user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.podium-user-avatar img,
.podium-user-avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.podium-name {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

a.podium-name {
  color: var(--color-selected-border);
}

/* Score with trophy icon */
.podium-score {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-tertiary);
}

.podium-score svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

.podium-pos {
  font-weight: 600;
  color: inherit;
  margin-left: 2px;
}

/* Points — .pen: cp1 x=118 y=147, cp2 x=13 y=136, cp3 x=238 y=136 */
.spot-pts {
  position: absolute;
  text-align: center;
  font-family: var(--font-family);
  font-size: 9px;
  font-weight: 400;
  color: var(--color-text-tertiary);
}

.spot-pts-1 {
  width: 100px;
  top: 163px;
  left: 50%;
  transform: translateX(-50%);
}

.spot-pts-2 {
  width: 84px;
  top: 146px;
  left: 26px;
}

.spot-pts-3 {
  width: 84px;
  top: 146px;
  right: 26px;
}

/* ── 6. Prize Row (4-10 place) ─────────────────────────────────── */

.prize-section {
  display: none;  /* Prizes now shown inline in leaderboard rows */
  flex-direction: column;
  width: 100%;
  padding: 6px 0 8px;
  gap: 6px;
  align-items: center;
}

.prize-section .prize-label {
  font-family: var(--font-family);
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  letter-spacing: 0.5px;
}

.prize-row-cards {
  width: 100%;
  display: flex;
  gap: 6px;
  justify-content: center;
}

.prize-mini-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  position: relative;
  flex: 1;
  min-width: 0;
  height: 68px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 4px;
}

.prize-mini-card .prize-img {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  padding: 2px;
}

.prize-mini-card .prize-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.prize-mini-card .prize-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  z-index: 1;
}

.prize-mini-card .prize-badge-num {
  font-family: var(--font-family);
  font-size: 8px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-align: center;
}

.prize-mini-card .prize-val {
  font-family: var(--font-family);
  font-size: 7px;
  font-weight: 400;
  color: var(--color-text-secondary);
  text-align: center;
  width: 40px;
  margin-top: 2px;
}

/* ── 7. Leaderboard Section ────────────────────────────────────── */

.lb-section {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 10px;
}

.lb-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.lb-header-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
  margin-left: auto;
}

.lb-header-title {
  font-family: var(--font-family);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.lb-header-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-selected-border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lb-card {
  display: flex;
  flex-direction: column;
}

/* Override .scrollable-content padding-bottom inside tournament lists —
   the bottom nav clearance is handled by the page layout, not inside
   bordered card/list containers. */
.spa-tournaments .scrollable-content {
  padding-bottom: 4px;
}

/* ── Row: single-line, transaction-history style ── */
.lb-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  position: relative;
}

/* Separator line starting from name (like transaction history) */
.lb-row + .lb-row::after {
  content: '';
  position: absolute;
  top: 0;
  left: 46px;  /* avatar 36px + gap 10px */
  right: 0;
  height: 0.5px;
  background-color: var(--color-border);
}

.lb-row.user-highlight {
  background: rgba(5, 150, 254, 0.08);
  border: 1px solid rgba(5, 150, 254, 0.30);
  border-radius: 10px;
  padding: 10px 8px;
}

/* No separator line next to highlighted row */
.lb-row.user-highlight::after,
.lb-row.user-highlight + .lb-row::after {
  display: none;
}

/* ── Avatar ── */
.row-avatar {
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.row-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Name ── */
.row-name {
  flex: 1;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.lb-profile-link {
  color: var(--color-selected-border);
  text-decoration: none;
  flex: 1;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* ── Prize column: thumbnail + crystal price ── */
.row-prize {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.row-prize-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: contain;
}

/* ── Score: value + trophy icon ── */
.row-score {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
  white-space: nowrap;
}

.row-score svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* ── Position badge: #1, #2, or medal emoji ── */
.lb-pos {
  min-width: 28px;
  text-align: right;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}

.you-tag {
  font-family: var(--font-family);
  font-size: 10px;
  font-weight: 600;
  color: var(--color-selected-border);
  margin-left: 4px;
  flex-shrink: 0;
}

/* ── 8. User Position Bar ──────────────────────────────────────── */

/* User position bar — same layout as .lb-row but with gradient border */
.tournament-user-bar {
  width: 100%;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--color-surface-secondary), var(--color-surface-secondary)) padding-box,
    linear-gradient(to bottom left, var(--border-gradient-start), var(--border-gradient-end)) border-box;
}

.user-position-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.user-position-name {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 9. Boost Button ───────────────────────────────────────────── */

.boost-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #0596FE 0%, #0470C8 100%);
  color: #fff;
  border: none;
  border-radius: 16px;
  height: 32px;
  padding: 0 12px;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.boost-btn .boost-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: #FF3B30;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}

/* ── 10. Mission Card (bottom sheet) ───────────────────────────── */

.missions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mission-card {
  width: 100%;
  background: var(--color-surface-raised, #27272A);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-sizing: border-box;
}

.mission-card.claimed {
  opacity: 0.45;
}

.mission-emoji {
  font-size: 28px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.mission-middle {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.mission-title {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
}

.mission-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.progress-bar {
  position: relative;
  flex: 1;
  height: 6px;
  background: #3F3F46;
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--color-selected-border);
  border-radius: 3px;
  transition: width 0.3s ease-out;
}

.progress-count {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}

.mission-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

.mission-reward {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-selected-border);
}

.mission-label {
  font-family: var(--font-family);
  font-size: 10px;
  font-weight: 400;
  color: var(--color-text-tertiary);
}

.mission-right.claimed {
  flex-direction: row;
  align-items: center;
  gap: 4px;
}

.mission-checkmark {
  font-size: 14px;
  color: #52525B;
}

.mission-claimed-text {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 500;
  color: #52525B;
}

.mission-claim-btn {
  background: var(--color-selected-border);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.missions-footer {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 400;
  color: #8A8B8E;
  text-align: center;
  padding: 8px 0 4px;
}

/* ── 11. Sub-view Header (back button) ─────────────────────────── */

.tournament-header {
  width: 100%;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.back-button {
  width: 36px;
  height: 36px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.back-button svg {
  width: 20px;
  height: 20px;
  color: var(--color-text);
}

.header-title {
  font-family: var(--font-family);
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── 12. History Card ──────────────────────────────────────────── */

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-card {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* Type icon badge (sun / calendar) */
.hc-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hc-icon svg {
  width: 18px;
  height: 18px;
}

.history-card-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.history-card-title {
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-card-date {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-tertiary);
}

.history-card-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.history-card-chevron {
  color: var(--color-text-tertiary);
  display: flex;
  align-items: center;
}

.history-card-chevron svg {
  width: 18px;
  height: 18px;
}

/* Winner #1 in history card */
.hc-winner {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 110px;
  flex-shrink: 0;
}

.hc-winner-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  align-items: flex-start;
  min-width: 0;
}

.hc-winner-name {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hc-winner-score {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-tertiary);
}

.hc-winner-score svg {
  width: 12px;
  height: 12px;
}

/* ── 13. Winner Row (history detail) ───────────────────────────── */

.winner-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
}

.winner-row.gold {
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.30);
}

.winner-row.silver {
  background: rgba(192, 192, 192, 0.08);
  border: 1px solid rgba(192, 192, 192, 0.30);
}

.winner-row.bronze {
  background: rgba(205, 127, 50, 0.08);
  border: 1px solid rgba(205, 127, 50, 0.30);
}

.winner-medal {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.winner-name {
  flex: 1;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.winner-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.winner-score {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.winner-prize {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-tertiary);
}

/* ── 14. Surprise Grid ─────────────────────────────────────────── */

.surprise-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.surprise-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.surprise-name {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-align: center;
}

.surprise-prize {
  font-family: var(--font-family);
  font-size: 10px;
  font-weight: 500;
  color: var(--color-text-tertiary);
}

.surprise-drop-section {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, transparent 100%);
  border: 1px solid rgba(124, 58, 237, 0.30);
  border-radius: 12px;
  padding: 16px;
}

/* ── 15. Prize Cards (sub-view) ────────────────────────────────── */

.prize-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.prize-card {
  background: linear-gradient(135deg, var(--prize-color-10) 0%, transparent 100%);
  border: 1px solid var(--prize-color-30);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.prize-card.gold { --prize-color-10: rgba(255, 215, 0, 0.10); --prize-color-30: rgba(255, 215, 0, 0.30); }
.prize-card.silver { --prize-color-10: rgba(192, 192, 192, 0.10); --prize-color-30: rgba(192, 192, 192, 0.30); }
.prize-card.bronze { --prize-color-10: rgba(205, 127, 50, 0.10); --prize-color-30: rgba(205, 127, 50, 0.30); }
.prize-card.accent { --prize-color-10: rgba(5, 150, 254, 0.10); --prize-color-30: rgba(5, 150, 254, 0.30); }

.prize-medal { font-size: 28px; }
.prize-position { font-family: var(--font-family); font-size: 13px; font-weight: 600; }
.prize-reward { font-family: var(--font-family); font-size: 18px; font-weight: 700; }

.prize-row {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.prize-range { flex: 1; font-family: var(--font-family); font-size: 14px; font-weight: 600; color: var(--color-text); }
.prize-amount { font-family: var(--font-family); font-size: 14px; font-weight: 600; color: var(--color-selected-border); }

/* ── 16. All-Time User Card ────────────────────────────────────── */

.alltime-user-card {
  width: 100%;
  background: linear-gradient(135deg, var(--color-selected-border) 0%, var(--color-surface) 100%);
  border: 1px solid rgba(5, 150, 254, 0.40);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-sizing: border-box;
}

.alltime-user-rank { font-family: var(--font-family); font-size: 28px; font-weight: 800; color: var(--color-text); }
.alltime-user-name { font-family: var(--font-family); font-size: 16px; font-weight: 600; color: var(--color-text); }
.alltime-user-score { font-family: var(--font-family); font-size: 14px; font-weight: 500; color: var(--color-text-secondary); }

.separator-dots {
  text-align: center;
  font-size: 16px;
  letter-spacing: 8px;
  color: var(--color-text-tertiary);
  padding: 8px 0;
}

/* ── 17. Action Button + Divider ───────────────────────────────── */

.tournament-action-btn {
  width: 100%;
  height: 48px;
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0 16px;
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tournament-action-btn:active { opacity: 0.8; }

.tournament-divider {
  width: 100%;
  height: 1px;
  background: var(--color-border);
  margin: 4px 0;
}

/* ── 18. Between Tournaments ───────────────────────────────────── */

.between-tournaments {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 6px 0;
  flex-shrink: 0;
}

.between-emoji { font-size: 36px; flex-shrink: 0; }

.between-tournaments > * {
  flex-shrink: 0;
  width: 100%;
}

.between-tournaments > .between-emoji,
.between-tournaments > .between-title,
.between-tournaments > .between-subtitle {
  width: auto;
}

.between-title {
  font-family: var(--font-family);
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
}

.between-subtitle {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-align: center;
}

.between-timer {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.between-countdown {
  width: 100%;
  text-align: center;
  padding: 4px 0;
}

.countdown-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.countdown-digits {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
}

.countdown-value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
  line-height: 1.1;
}

.countdown-unit-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  margin-top: 2px;
}

.countdown-sep {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-tertiary);
  margin-top: -10px;
}

.surprise-winners-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px 8px;
  padding: 0 8px;
}

.surprise-winners-scroll {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  gap: 12px;
  padding: 4px 0 8px;
  scrollbar-width: none;
}
.surprise-winners-scroll::-webkit-scrollbar { display: none; }

/* Marquee (auto-scrolling ticker) for surprise winners */
.surprise-marquee {
  overflow: hidden;
  width: 100%;
  -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
  mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}
.surprise-marquee-track {
  display: flex;
  animation: surprise-scroll 25s linear infinite;
  width: max-content;
  will-change: transform;
}
.surprise-marquee-half {
  display: flex;
  gap: 16px;
  padding-right: 16px;
}
/* translateX(-50%) = exactly one half width, seamless loop */
@keyframes surprise-scroll {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

.surprise-winner-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.surprise-winner-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
}

.surprise-winner-pos {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.surprise-winner-prize {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 2px;
}

.between-winners-scroll {
  max-height: 176px;
  overflow-y: auto;
}

/* Fixed-height scrollable list for between-tournaments winners (not _fitListHeights managed) */
.between-winners-list {
  max-height: 270px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ── 19. Privacy Section (moved into header row) ───────────────── */

.privacy-desc {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-tertiary);
  text-align: center;
  padding: 0 20px;
}

/* ── Lobby ──────────────────────────────────────────────── */
.lobby-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 16px 8px;
  gap: 12px;
  text-align: center;
}

.lobby-icon {
  font-size: 64px;
  line-height: 1;
}

.lobby-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  margin-top: -4px;
}

.lobby-subtitle {
  font-size: 13px;
  color: var(--color-text-secondary);
  max-width: 280px;
  line-height: 1.4;
  margin-top: -4px;
}

.lobby-counter {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.lobby-counter-current {
  font-size: 48px;
  font-weight: 700;
  color: var(--color-selected-border);
}

.lobby-counter-separator {
  font-size: 24px;
  font-weight: 400;
  color: var(--color-text-tertiary);
}

.lobby-counter-total {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-tertiary);
}

.lobby-progress-track {
  width: 100%;
  max-width: 280px;
  height: 8px;
  background: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.lobby-progress-fill {
  height: 100%;
  background: var(--color-selected-border);
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

/* User score — inline single row */
.lobby-user-score {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-s);
}

.lobby-user-score-label {
  font-size: 12px;
  color: var(--color-text-tertiary);
}

.lobby-user-score-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 4px;
}
.lobby-user-score-value svg {
  width: 14px;
  height: 14px;
  color: inherit;
}

/* Prizes section */
.lobby-prizes-section {
  width: 100%;
}

/* Floating gift cloud — square, full width, adaptive */
.lobby-cloud {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.lobby-cloud-gift {
  position: absolute;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
  opacity: 0;
}



.lobby-cloud-gift img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.lobby-cloud-crystal {
  position: absolute;
  opacity: 0;
  filter: drop-shadow(0 1px 6px rgba(5, 150, 254, 0.4));
  display: flex;
  align-items: center;
  justify-content: center;
}

.lobby-cloud-crystal .crystal-icon {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

@keyframes lobby-gift-appear {
  0%   { opacity: 0; transform: scale(0.3); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes lobby-float-a {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33%  { transform: translate(3px, -6px) rotate(2deg); }
  66%  { transform: translate(-2px, 4px) rotate(-1deg); }
}

@keyframes lobby-float-b {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(-4px, 5px) rotate(-2deg); }
  75%  { transform: translate(5px, -3px) rotate(3deg); }
}

@keyframes lobby-float-c {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50%  { transform: translate(2px, -8px) rotate(1.5deg); }
}

/* ── Sub-view wrapper (historyDetail, alltime, etc.) ───────────── */

.tournament-subview-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

/* ── 20. History Detail — Layout + Info Card + Winners List ─────── */

.hd-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0 0 16px;
  flex: 1;
  min-height: 0;
}

.hd-info-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--color-surface), var(--color-surface)) padding-box,
    linear-gradient(to bottom left, var(--border-gradient-start), var(--border-gradient-end)) border-box;
  box-sizing: border-box;
  gap: 16px;
}

.hd-info-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hd-info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.hd-info-row svg {
  width: 14px;
  height: 14px;
  color: inherit;
  flex-shrink: 0;
}

.hd-info-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.hd-info-label {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.hd-info-pos {
  font-family: var(--font-family);
  font-size: 28px;
  font-weight: 800;
  color: var(--color-selected-border);
  line-height: 1.1;
}

.hd-info-score {
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* Fixed-height scrollable list for history detail winners (~5 rows visible) */
.hd-winners-list {
  max-height: 270px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Surprise winner name in marquee cells */
.surprise-winner-name {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 64px;
  text-align: center;
}

/* Medal icon in all-time buttons/headers — inherits text color */
.alltime-medal-icon {
  display: inline-flex;
  align-items: center;
  color: inherit;
}

.alltime-medal-icon svg {
  width: 18px;
  height: 18px;
}

/* ── 21. All-Time Podium ───────────────────────────────────────── */

.at-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 0 0 16px;
  flex: 1;
  min-height: 0;
}

.at-podium {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 16px 12px 0;
}

.at-spot {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.at-crown {
  color: #FFD700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: -2px;
}

.at-crown svg {
  width: 16px;
  height: 16px;
}

/* Avatar wrapper with position badge */
.at-avatar-wrap {
  position: relative;
  border-radius: 50%;
  flex-shrink: 0;
}

.at-avatar-wrap img,
.at-avatar-wrap svg {
  border-radius: 50%;
}

.at-avatar-gold { box-shadow: 0 0 0 2px #FFD700; border-radius: 50%; }
.at-avatar-silver { box-shadow: 0 0 0 2px #A8A8A8; border-radius: 50%; }
.at-avatar-bronze { box-shadow: 0 0 0 2px #CD7F32; border-radius: 50%; }

.at-pos-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family);
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  padding: 0 4px;
  box-sizing: border-box;
}

.at-badge-gold { background: #FFD700; color: #000; }
.at-badge-silver { background: #888; }
.at-badge-bronze { background: #CD7F32; }

.at-name {
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.at-score {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-family);
  font-size: 9px;
  font-weight: 500;
  color: var(--color-text-tertiary);
}

.at-score svg {
  width: 10px;
  height: 10px;
}

/* Podium bars */
.at-bar {
  width: 100%;
  border-radius: 6px 6px 0 0;
}

.at-bar-gold {
  background: linear-gradient(180deg, #FFD700 0%, #CC7700 100%);
}

.at-bar-silver {
  background: linear-gradient(180deg, #C0C0C0 0%, #606060 100%);
}

.at-bar-bronze {
  background: linear-gradient(180deg, #CD7F32 0%, #7B3A10 100%);
}

/* ── end of tournaments.css ───────────────────────────────────── */