:root {
  --rb-tour-bg: #111417;
  --rb-tour-panel: #171a1e;
  --rb-tour-panel-soft: #24282d;
  --rb-tour-line: #2d3238;
  --rb-tour-text: #f5f5f5;
  --rb-tour-muted: #aeb2b8;
  --rb-tour-red: #ef2349;
}

.resident-tournaments,
.resident-tournaments * { box-sizing: border-box; }

.resident-tournaments {
  width: 100%;
  margin: 0 auto;
  padding: 0 10px 70px;
  background: var(--rb-tour-bg);
  color: var(--rb-tour-text);
  font-family: inherit;
}

.resident-tournaments__subnav {
  display: flex;
  min-height: 48px;
  margin: 0 -10px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--rb-tour-line);
  background: #15181b;
  align-items: stretch;
  justify-content: center;
  scrollbar-width: none;
}

.resident-tournaments__subnav::-webkit-scrollbar,
.resident-tournaments__tabs::-webkit-scrollbar,
.resident-ref-details::-webkit-scrollbar,
.resident-ref-games::-webkit-scrollbar { display: none; }

.resident-tournaments__subnav a {
  position: relative;
  display: inline-flex;
  min-width: 128px;
  padding: 0 20px;
  color: #8e939a;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.resident-tournaments__subnav a:hover,
.resident-tournaments__subnav a.is-active { color: #fff; }

.resident-tournaments__subnav a.is-active::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: 0;
  left: 22px;
  height: 3px;
  background: var(--rb-tour-red);
}

.resident-tournaments__toolbar {
  display: flex;
  min-height: 58px;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.resident-tournaments__tabs {
  display: flex;
  gap: 7px;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  border: 0;
  background: transparent;
  scrollbar-width: none;
}

.resident-tournaments__tabs button {
  min-width: 88px;
  padding: 10px 14px;
  border: 1px solid #34383e;
  border-radius: 4px;
  background: #262a2f;
  color: #e2e3e5;
  font: 800 11px/1 inherit;
  cursor: pointer;
  white-space: nowrap;
}

.resident-tournaments__tabs button:hover,
.resident-tournaments__tabs button:focus-visible {
  border-color: var(--rb-tour-red);
  outline: none;
}

.resident-tournaments__tabs button.is-active {
  border-color: var(--rb-tour-red);
  background: var(--rb-tour-red);
  color: #fff;
}

.resident-tournaments__free-toggle {
  display: inline-flex;
  gap: 9px;
  color: var(--rb-tour-muted);
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.resident-tournaments__free-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.resident-tournaments__free-toggle span {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #62676d;
  transition: background .18s ease;
}

.resident-tournaments__free-toggle span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e8e8e8;
  transition: transform .18s ease;
}

.resident-tournaments__free-toggle input:checked + span { background: var(--rb-tour-red); }
.resident-tournaments__free-toggle input:checked + span::after { transform: translateX(16px); }

.resident-tournaments__content {
  display: grid;
  gap: 40px;
}

.resident-tournaments__loading,
.resident-tournaments__empty {
  margin: 0;
  padding: 46px 20px;
  border: 1px solid var(--rb-tour-line);
  border-radius: 6px;
  background: var(--rb-tour-panel);
  color: var(--rb-tour-muted);
  text-align: center;
}

.resident-tournaments__empty strong,
.resident-tournaments__empty span { display: block; }
.resident-tournaments__empty span { margin-top: 7px; }

.resident-ref-card {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: 238px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #24292f;
  border-radius: 6px;
  background: var(--rb-tour-panel);
  color: var(--rb-tour-text);
}

.resident-ref-card__side {
  display: grid;
  min-height: 415px;
  grid-template-rows: 158px 1fr;
  background: #2a2e33;
}

.resident-ref-image {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.resident-ref-image::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 36px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .68));
  pointer-events: none;
}

.resident-ref-image > span {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  padding: 5px 8px;
  border-radius: 2px;
  background: var(--rb-tour-red);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
}

.resident-ref-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resident-ref-prize {
  position: relative;
  display: flex;
  min-height: 257px;
  padding: 15px 18px 17px;
  align-items: center;
  flex-direction: column;
  background: #2a2e33;
  text-align: center;
}

.resident-ref-prize::before,
.resident-ref-prize::after {
  content: "";
  position: absolute;
  top: -16px;
  width: 9px;
  height: 31px;
  border-radius: 7px;
  background: linear-gradient(#d3d5d8, #555b62);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .55);
}

.resident-ref-prize::before { left: 48px; }
.resident-ref-prize::after { right: 48px; }

.resident-ref-prize small {
  color: #b6b9bd;
  font-size: 10px;
}

.resident-ref-prize > strong {
  margin: 7px 0 9px;
  color: #fff;
  font-size: clamp(22px, 2.2vw, 29px);
  font-weight: 500;
  line-height: 1.05;
  white-space: nowrap;
}

.resident-ref-prize em {
  color: var(--rb-tour-red);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
}

.resident-ref-countdown {
  display: grid;
  width: 100%;
  margin: 5px 0 12px;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
}

.resident-ref-countdown b {
  display: grid;
  gap: 3px;
  color: #fff;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
}

.resident-ref-countdown b small {
  color: #b8bbc0;
  font-size: 7px;
  font-weight: 800;
}

.resident-ref-prize a {
  display: flex;
  width: 100%;
  min-height: 36px;
  margin-top: auto;
  border-radius: 3px;
  background: var(--rb-tour-red);
  color: #fff;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
}

.resident-ref-prize a:hover,
.resident-ref-prize a:focus-visible {
  background: #ff3b5d;
  outline: none;
}

.resident-ref-card__main {
  display: grid;
  min-width: 0;
  padding: 0 14px 12px;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.resident-ref-card__main > header {
  position: relative;
  min-height: 146px;
  padding: 17px 0 24px;
}

.resident-ref-card h2 {
  margin: 0 0 11px;
  color: #fff;
  font-size: 15px;
  line-height: 1.2;
  text-transform: uppercase;
}

.resident-ref-card__main > header p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #b8bbc0;
  font-size: 11px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.resident-ref-card.is-expanded .resident-ref-card__main > header p { display: block; }

.resident-ref-more {
  position: absolute;
  right: 0;
  bottom: 5px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font: 800 10px/1 inherit;
  cursor: pointer;
}

.resident-ref-details {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.resident-ref-detail {
  min-width: 0;
  min-height: 90px;
  padding: 9px;
  border: 1px solid #31363c;
  border-radius: 4px;
  background: var(--rb-tour-panel-soft);
}

.resident-ref-detail h3 {
  margin: 0 0 9px;
  color: #fff;
  font-size: 9px;
  text-align: center;
}

.resident-ref-detail > div {
  display: flex;
  gap: 6px;
}

.resident-ref-detail span {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 4px;
}

.resident-ref-detail small,
.resident-ref-detail strong {
  overflow-wrap: anywhere;
  font-size: 8px;
  line-height: 1.25;
}

.resident-ref-detail small { color: #9da1a7; }
.resident-ref-detail strong { color: #e1e2e4; }

.resident-ref-games {
  display: grid;
  min-width: 0;
  margin-top: 9px;
  grid-auto-columns: minmax(130px, 1fr);
  grid-auto-flow: column;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.resident-ref-game {
  position: relative;
  height: 132px;
  overflow: hidden;
  margin: 0;
  border: 1px solid #2b3036;
  border-radius: 5px;
  background: #202328;
}

.resident-ref-game img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.resident-ref-game figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 18px 7px 6px;
  overflow: hidden;
  background: linear-gradient(transparent, rgba(0, 0, 0, .9));
  color: #fff;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resident-ref-game--more::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(17, 20, 23, .58);
  backdrop-filter: blur(7px);
}

.resident-ref-game--more strong {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  color: #fff;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

@media (max-width: 920px) {
  .resident-ref-card { grid-template-columns: 220px minmax(0, 1fr); }
  .resident-ref-details { grid-template-columns: repeat(5, 150px); }
}

@media (max-width: 767px) {
  .resident-tournaments { padding: 0 6px 105px; }

  .resident-tournaments__subnav {
    min-height: 40px;
    margin: 0 -6px 7px;
    justify-content: flex-start;
  }

  .resident-tournaments__subnav a {
    min-width: 104px;
    padding: 0 12px;
    font-size: 10px;
  }

  .resident-tournaments__toolbar {
    display: grid;
    min-height: 0;
    gap: 5px;
    padding-bottom: 10px;
  }

  .resident-tournaments__tabs {
    width: 100%;
    gap: 5px;
  }

  .resident-tournaments__tabs button {
    min-width: auto;
    padding: 8px 10px;
    font-size: 9px;
  }

  .resident-tournaments__free-toggle {
    width: 100%;
    justify-content: flex-end;
    font-size: 8px;
  }

  .resident-tournaments__free-toggle span {
    width: 31px;
    height: 17px;
  }

  .resident-tournaments__free-toggle span::after {
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
  }

  .resident-tournaments__free-toggle input:checked + span::after { transform: translateX(14px); }
  .resident-tournaments__content { gap: 20px; }

  .resident-ref-card {
    display: block;
    border-radius: 5px;
  }

  .resident-ref-card__side {
    display: grid;
    min-height: 170px;
    grid-template-columns: 46% 54%;
    grid-template-rows: 170px;
  }

  .resident-ref-prize {
    min-height: 170px;
    padding: 13px 11px 11px;
  }

  .resident-ref-prize::before,
  .resident-ref-prize::after { display: none; }

  .resident-ref-prize > strong {
    margin: 5px 0;
    font-size: 20px;
  }

  .resident-ref-countdown { margin: 4px 0 8px; }
  .resident-ref-countdown b { font-size: 16px; }

  .resident-ref-prize a {
    min-height: 30px;
    font-size: 9px;
  }

  .resident-ref-card__main {
    display: block;
    padding: 0 9px 10px;
  }

  .resident-ref-card__main > header {
    min-height: 116px;
    padding: 12px 0 22px;
  }

  .resident-ref-card h2 {
    margin-bottom: 7px;
    font-size: 12px;
  }

  .resident-ref-card__main > header p {
    font-size: 9.5px;
    line-height: 1.45;
    -webkit-line-clamp: 4;
  }

  .resident-ref-more { font-size: 8px; }

  .resident-ref-details {
    grid-template-columns: repeat(5, 142px);
    gap: 6px;
    padding-bottom: 2px;
    scroll-snap-type: x proximity;
  }

  .resident-ref-detail {
    min-height: 82px;
    scroll-snap-align: start;
  }

  .resident-ref-games {
    grid-auto-columns: 137px;
    scroll-snap-type: x proximity;
  }

  .resident-ref-game {
    height: 96px;
    scroll-snap-align: start;
  }
}

@media (max-width: 360px) {
  .resident-ref-card__side { grid-template-columns: 44% 56%; }
  .resident-ref-prize > strong { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .resident-tournaments__free-toggle span,
  .resident-tournaments__free-toggle span::after { transition: none; }
}
