:root {
  color-scheme: dark;
  --bg: #070910;
  --panel: #10131e;
  --panel-2: #131725;
  --line: #1c2132;
  --muted: #7f879f;
  --text: #f8f9ff;
  --blue: #59c7ff;
  --purple: #ff8fc4;
  --gold: #ffd84d;
  --green: #40d783;
  --red: #ff526c;
}

* {
  box-sizing: border-box;
}

.is-hidden {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 28% -12%, rgba(89, 199, 255, 0.16), transparent 34rem),
    linear-gradient(180deg, #070910 0%, #090b13 48%, #080a11 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
.topbar-nav-link,
.brand,
.category,
.search-result,
.tier-player,
.player-card,
.search-clear {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid #ff8fc4;
  outline-offset: 3px;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 44px;
}

.app-frame {
  overflow: hidden;
  border: 1px solid #141927;
  background: rgba(12, 15, 24, 0.92);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.topbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: #0b0e17;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 7px;
  color: #848ba0;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.3px;
  transition: color 0.15s, background 0.15s, transform 0.15s ease, box-shadow 0.15s ease;
}

.topbar-nav-link:hover {
  transform: translateY(-1px);
}

.topbar-nav-link:active {
  transform: translateY(1px) scale(0.97);
}
}

.topbar-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.topbar-nav-link[href*="discord"] .discord-icon {
  color: #5865f2;
}

.topbar-nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.topbar-nav-icon-img {
  width: 17px;
  height: 17px;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(255, 216, 77, 0.35));
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #f5f7ff;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 1px;
}

.brand-image {
  width: 42px;
  height: 42px;
  display: block;
  object-fit: contain;
  border-radius: 9px;
  filter: drop-shadow(0 0 10px rgba(255, 143, 196, 0.25));
}

.search-wrap {
  position: relative;
  width: min(360px, 46vw);
}

.search {
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid #222840;
  border-radius: 7px;
  background: #151a2a;
  color: #757d95;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search:focus-within {
  border-color: #3a4260;
  box-shadow: 0 0 0 2px rgba(89, 199, 255, 0.1);
}

.search-icon {
  flex-shrink: 0;
  color: #555d79;
  transition: color 0.2s;
}

.search:focus-within .search-icon {
  color: #59c7ff;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  caret-color: #59c7ff;
}

.search input::placeholder {
  color: #4a5270;
  font-weight: 600;
}

.search-clear {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 5px;
  background: #22283c;
  color: #8e96ac;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s, transform 0.15s ease;
}

.search-clear:hover {
  background: #2c3450;
  color: #fff;
  transform: rotate(90deg);
}

.search-clear:active {
  transform: rotate(90deg) scale(0.88);
}

.search-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  right: 0;
  width: min(420px, 90vw);
  overflow: hidden;
  border: 1px solid #2a324a;
  border-radius: 10px;
  background: #151a2a;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.46), 0 0 0 1px rgba(89, 199, 255, 0.04);
  animation: searchSlideDown 0.15s ease-out;
}

@keyframes searchSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.search-result {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding: 8px 14px;
  background: transparent;
  color: #fff;
  text-align: left;
  transition: background 0.12s, padding-left 0.12s ease, transform 0.12s ease;
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result:hover {
  background: #1c2338;
  padding-left: 18px;
}

.search-result:active {
  transform: scale(0.99);
}

.search-result img {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: contain;
}

.search-result span {
  display: grid;
  gap: 3px;
}

.search-result small,
.search-empty {
  color: #6b7490;
  font-size: 12px;
  font-weight: 700;
}

.search-result strong {
  font-weight: 800;
  font-size: 14px;
}

.search-empty {
  padding: 18px 14px;
}

.category-row {
  display: grid;
  grid-template-columns: repeat(9, minmax(78px, 1fr));
  border-bottom: 1px solid var(--line);
  background: #0e111b;
}

.category {
  position: relative;
  min-height: 76px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: #848ba0;
  font-size: 11px;
  font-weight: 900;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.category.active,
.category:hover {
  color: #fff;
  transform: translateY(-2px);
}

.category:active {
  transform: translateY(0) scale(0.96);
}

.category.active::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, #ff8fc4, #ffc0dc);
}

.category-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.15));
  transition: filter 0.2s, transform 0.2s ease;
}

.category.active .category-img,
.category:hover .category-img {
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
  transform: scale(1.08);
}

.controls {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px 10px;
  background: #0b0e17;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented button,
.stat-pill {
  min-height: 34px;
  border: 1px solid #222840;
  background: #121625;
  color: #aeb5c8;
  border-radius: 7px;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 900;
}

.segmented button.active {
  border-color: #ff8fc4;
  background: rgba(255, 143, 196, 0.14);
  color: #fff;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.leaderboard {
  padding: 18px 40px 34px;
  background: #0b0e17;
}

.table-head,
.player-card {
  display: grid;
  grid-template-columns: 140px minmax(230px, 1fr) 120px minmax(310px, 1.7fr);
  align-items: center;
}

.table-head {
  height: 36px;
  padding: 0 26px;
  color: #555d79;
  background: #10131d;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.8px;
}

.player-list {
  display: grid;
  gap: 8px;
}

.player-card {
  min-height: 72px;
  padding: 0 26px;
  background: #111420;
  border: 1px solid rgba(255, 255, 255, 0.015);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.018);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s ease, box-shadow 0.15s ease;
}

.player-card:hover {
  background: #161b2b;
  border-color: rgba(255, 143, 196, 0.22);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.018);
}

.player-card:active {
  transform: translateY(0) scale(0.995);
}

.rank-cell {
  height: 72px;
  display: flex;
  align-items: center;
}

.rank-plate {
  position: relative;
  width: 156px;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: -26px;
  padding-left: 22px;
  clip-path: polygon(0 0, 100% 0, 82% 100%, 0% 100%);
  background: linear-gradient(135deg, #ffd632, #ffc540 54%, #e3a71d);
}

.rank-plate.silver { background: linear-gradient(135deg, #b0b8c8, #c8d0dc 54%, #8a92a0); }
.rank-plate.bronze { background: linear-gradient(135deg, #ffb25a, #e48438 54%, #a5532c); }
.rank-plate.dark { background: linear-gradient(135deg, #3a4260, #20273b 54%, #161b2a); }
.rank-plate:nth-child(4n) { background: linear-gradient(135deg, #8d75ff, #624ee0 54%, #3c2c9b); }
.rank-plate:nth-child(5n) { background: linear-gradient(135deg, #45d6c2, #209c9c 54%, #176b78); }

.rank-number {
  min-width: 45px;
  color: white;
  font-size: 35px;
  font-weight: 900;
  font-style: italic;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.28);
}

.avatar {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.25));
  margin-top: 14px;
}

.player-name {
  margin-bottom: 4px;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
}

.player-title {
  color: #fbf5d3;
  font-size: 13px;
  font-weight: 900;
}

.player-title span {
  color: #7e879e;
}

.player-title.title-combat-novice { color: #8b93a5; }
.player-title.title-combat-apprentice { color: #65b7e8; }
.player-title.title-combat-warrior { color: #63d2a0; }
.player-title.title-combat-master { color: #c59aff; }
.player-title.title-combat-grandmaster { color: #ffd84d; }
.player-title.title-combat-overlord { color: #ff6b8a; }

.profile-title.title-combat-novice { color: #8b93a5; }
.profile-title.title-combat-apprentice { color: #65b7e8; }
.profile-title.title-combat-warrior { color: #63d2a0; }
.profile-title.title-combat-master { color: #c59aff; }
.profile-title.title-combat-grandmaster { color: #ffd84d; }
.profile-title.title-combat-overlord { color: #ff6b8a; }

.region {
  width: max-content;
  min-width: 37px;
  min-height: 25px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 900;
}

.region.NA { color: #ff7880; background: rgba(255, 82, 108, 0.18); }
.region.EU { color: #88f2ac; background: rgba(64, 215, 131, 0.18); }
.region.AS { color: #c9a7ff; background: rgba(149, 107, 255, 0.18); }
.region.AU { color: #c0c8d8; background: rgba(180, 190, 210, 0.18); }

.tier-stack {
  display: flex;
  align-items: center;
  gap: 9px;
  overflow-x: auto;
  padding: 10px 0;
}

.tier {
  min-width: 31px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: #6b7288;
  font-size: 9px;
  font-weight: 900;
}

.tier-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px currentColor);
}

.tier strong {
  font-size: 12px;
  line-height: 1;
  text-shadow: 0 0 10px currentColor;
}

.tier.has-tier {
  color: var(--tier-color);
}

.empty-state {
  padding: 42px 20px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 14px;
}

.coming-soon {
  grid-column: 1 / -1;
  min-height: 360px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  border: 1px solid #1c2235;
  background: #101421;
  color: #aeb5c8;
  text-align: center;
}

.coming-soon strong {
  color: #ff8fc4;
  font-size: clamp(24px, 5vw, 42px);
  font-weight: 900;
  letter-spacing: 1px;
}

.coming-soon span {
  color: #687086;
  font-size: 13px;
  font-weight: 700;
}

.tier-column {
  min-height: 560px;
  border: 1px solid #1c2235;
  background: #101421;
}.tier-column-head {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid #242a3e;
  font-size: 14px;
  font-weight: 900;
}

.tier-column-head span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #202641;
  color: #78d9ff;
  font-size: 11px;
}

.tier-col-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.2));
}


.tier-column-1 .tier-column-head { color: #778096; }
.tier-column-2 .tier-column-head { color: #949db5; }
.tier-column-3 .tier-column-head { color: #c09cff; }
.tier-column-4 .tier-column-head { color: #6b7288; }
.tier-column-5 .tier-column-head { color: #6b7288; }

.tier-column-list {
  display: grid;
  gap: 7px;
  padding: 10px;
}

.tier-player {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid #1e2538;
  border-radius: 7px;
  background: #151a2a;
  color: #f7f8ff;
  text-align: left;
  padding: 6px 8px;
}

.tier-player {
  transition: border-color 0.15s, background 0.15s, transform 0.15s ease, box-shadow 0.15s ease;
}

.tier-player:hover {
  border-color: #ff8fc4;
  background: #1a2032;
  transform: translateY(-2px);
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.2);
}

.tier-player:active {
  transform: translateY(0) scale(0.98);
}

.tier-player img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.tier-player span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.tier-player em {
  color: #8d96ad;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.tier-empty {
  padding: 16px 8px;
  color: #687086;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.profile-modal {
  width: min(540px, calc(100% - 28px));
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.profile-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
}

.profile-card {
  position: relative;
  overflow: hidden;
  border: 1px solid #2a324a;
  border-radius: 10px;
  background:
    radial-gradient(circle at 18% 0%, rgba(89, 199, 255, 0.18), transparent 16rem),
    linear-gradient(180deg, #171c2c, #101421);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62);
}

.profile-close {
  position: absolute;
  z-index: 2;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 1px solid #2b334b;
  border-radius: 7px;
  background: #20263a;
  color: #dfe5f6;
  font-weight: 900;
  transition: background 0.15s, transform 0.15s ease;
}

.profile-close:hover {
  background: #2c3450;
  transform: rotate(90deg);
}

.profile-close:active {
  transform: rotate(90deg) scale(0.9);
}

.profile-hero {
  display: grid;
  grid-template-columns: 96px 118px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 158px;
  padding: 26px 26px 22px;
}

.profile-rank {
  height: 70px;
  display: grid;
  place-items: center;
  clip-path: polygon(0 0, 100% 0, 82% 100%, 0 100%);
  background: linear-gradient(135deg, #ffd632, #ffc540 54%, #e3a71d);
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.28);
}

.profile-rank.silver {
  background: linear-gradient(135deg, #b0b8c8, #c8d0dc 54%, #8a92a0);
}

.profile-rank.bronze {
  background: linear-gradient(135deg, #ffb25a, #e48438 54%, #a5532c);
}

.profile-rank.dark {
  background: linear-gradient(135deg, #3a4260, #20273b 54%, #161b2a);
}

.profile-hero img {
  width: 118px;
  height: 118px;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.36));
}

.profile-hero h2 {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
}

.profile-hero p {
  margin: 0 0 12px;
  color: #fbf5d3;
  font-size: 14px;
  font-weight: 900;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #242b3f;
  border-bottom: 1px solid #242b3f;
  background: rgba(9, 12, 20, 0.42);
}

.profile-stats div {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 76px;
  border-right: 1px solid #242b3f;
}

.profile-stats div:last-child {
  border-right: 0;
}

.profile-stats strong {
  font-size: 24px;
  font-weight: 900;
}

.profile-stats span {
  color: #7f879f;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-tiers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 18px;
}

.profile-tier-row {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 8px 13px;
}

.profile-tier-row > span {
  color: #cbd2e4;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 980px) {
  .page-shell {
    width: min(100% - 20px, 760px);
  }

  .category-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .tier-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .leaderboard {
    padding: 12px;
  }

  .table-head {
    display: none;
  }

  .player-card {
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 12px;
    min-height: 132px;
    padding: 10px 14px 12px;
  }

  .rank-cell {
    grid-row: span 3;
    height: 104px;
  }

  .rank-plate {
    width: 132px;
    height: 92px;
    margin-left: -14px;
    align-items: center;
  }

  .tier-stack {
    grid-column: 2;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: 100%;
    padding-top: 18px;
  }

  .topbar {
    height: auto;
    align-items: stretch;
    flex-direction: column;
    padding: 14px;
  }

  .topbar-left {
    justify-content: space-between;
  }

  .topbar-nav {
    gap: 2px;
  }

  .topbar-nav-link {
    font-size: 12px;
    padding: 5px 8px;
  }

  .search-wrap {
    width: 100%;
  }

  .search input {
    width: 100%;
  }

  .controls {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .player-card {
    grid-template-columns: 1fr;
  }

  .rank-cell,
  .tier-stack {
    grid-column: 1;
  }

  .tier-grid {
    grid-template-columns: 1fr;
  }

  .profile-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .profile-rank {
    width: 110px;
  }

  .profile-tiers {
    grid-template-columns: 1fr;
  }
}
