:root {
  --bg-900: #030712;
  --bg-850: #071226;
  --bg-800: #0a1d39;
  --panel: #0d233f;
  --panel-strong: #133055;
  --panel-soft: #0a1a31;
  --ink: #dde9ff;
  --ink-soft: #95accb;
  --border: #2f507d;
  --border-soft: #214167;
  --accent: #4cb2d7;
  --accent-soft: #7fd2ee;
  --gold: #d8b565;
  --gold-soft: #f0d28d;
  --shadow: 0 18px 36px rgba(2, 8, 20, 0.62);
  --radius-lg: 24px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  background: #020815;
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Exo 2", "Segoe UI", sans-serif;
  color: var(--ink);
  background-color: #050d1d;
  background:
    radial-gradient(circle at 12% 12%, rgba(76, 178, 215, 0.24) 0%, transparent 34%),
    radial-gradient(circle at 88% 84%, rgba(216, 181, 101, 0.17) 0%, transparent 30%),
    linear-gradient(152deg, var(--bg-800) 0%, var(--bg-850) 42%, var(--bg-900) 100%);
  background-size: 170% 170%;
  line-height: 1.45;
  overflow-x: hidden;
  position: relative;
  padding-bottom: var(--safe-bottom);
  animation: bg-shift 18s ease-in-out infinite alternate;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -2;
  background:
    radial-gradient(circle at 50% 110%, rgba(18, 57, 101, 0.58) 0%, transparent 56%),
    repeating-linear-gradient(
      145deg,
      rgba(140, 189, 235, 0.03) 0px,
      rgba(140, 189, 235, 0.03) 2px,
      transparent 2px,
      transparent 28px
    );
  animation: grid-drift 22s linear infinite;
}

body::after {
  z-index: -1;
  background: linear-gradient(
    to bottom,
    rgba(4, 10, 23, 0.1) 0%,
    rgba(4, 10, 23, 0.58) 70%,
    rgba(3, 7, 18, 0.82) 100%
  );
}

.bg-glow {
  position: fixed;
  width: 30rem;
  height: 30rem;
  border-radius: 50%;
  z-index: -1;
  filter: blur(44px);
  opacity: 0.3;
  animation: glow-float 14s ease-in-out infinite alternate;
}

.bg-glow-left {
  background: #2f79b9;
  left: -11rem;
  top: -9rem;
}

.bg-glow-right {
  background: #b9862e;
  right: -8rem;
  bottom: -10rem;
  animation-delay: -6s;
}

.container {
  width: min(1180px, 92vw);
  margin: 0 auto;
}

.hero {
  padding: 2.8rem 0 1.5rem;
  animation: hero-fade 0.7s ease;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.34rem 0.8rem;
  border: 1px solid rgba(216, 181, 101, 0.55);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: rgba(216, 181, 101, 0.08);
  color: var(--gold-soft);
}

.language-switch {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  max-width: min(100%, 760px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding-bottom: 0.25rem;
}

.language-switch::-webkit-scrollbar {
  height: 8px;
}

.language-switch::-webkit-scrollbar-track {
  background: rgba(11, 26, 49, 0.66);
  border-radius: 999px;
}

.language-switch::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(89, 145, 209, 0.95), rgba(40, 85, 134, 0.95));
  border-radius: 999px;
  border: 1px solid rgba(7, 19, 38, 0.95);
}

.lang-chip {
  border: 1px solid rgba(75, 110, 155, 0.82);
  border-radius: 999px;
  background: linear-gradient(165deg, rgba(14, 33, 58, 0.95), rgba(8, 20, 38, 0.95));
  color: #bed2ee;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.26rem 0.62rem;
  cursor: pointer;
  white-space: nowrap;
  min-height: 1.95rem;
  scroll-snap-align: start;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.lang-chip:hover {
  color: #f0f7ff;
  transform: translateY(-1px);
  border-color: rgba(216, 181, 101, 0.58);
}

.lang-chip.is-active {
  color: #0c1321;
  border-color: transparent;
  background: linear-gradient(120deg, #f0d28c, #c99f4a);
  box-shadow: 0 10px 20px rgba(195, 145, 52, 0.28);
}

.hero h1 {
  font-family: "Russo One", "Exo 2", sans-serif;
  margin: 1rem 0 0.6rem;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1.14;
  color: #edf4ff;
  letter-spacing: 0.01em;
  text-shadow: 0 8px 22px rgba(15, 38, 76, 0.5);
}

.hero-subtitle {
  margin: 0;
  max-width: 44rem;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2.4vw, 1.18rem);
}

.hero-meta {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  max-width: 420px;
}

.meta-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(170deg, rgba(20, 50, 87, 0.95), rgba(10, 25, 46, 0.95));
  padding: 0.8rem 0.95rem;
  box-shadow: 0 10px 30px rgba(4, 12, 28, 0.55);
}

.meta-title {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}

.meta-card strong {
  font-family: "Russo One", "Exo 2", sans-serif;
  font-size: 1.05rem;
  color: #eff5ff;
}

.view-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.9rem;
  padding: 0.34rem;
  border-radius: 999px;
  border: 1px solid rgba(64, 98, 141, 0.82);
  background: rgba(8, 23, 44, 0.75);
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 28px rgba(2, 8, 21, 0.42);
}

.view-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(75, 110, 155, 0.82);
  border-radius: 999px;
  background: linear-gradient(165deg, rgba(14, 33, 58, 0.95), rgba(8, 20, 38, 0.95));
  color: #bed2ee;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.42rem 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.view-chip:hover {
  color: #f0f7ff;
  transform: translateY(-1px);
  border-color: rgba(216, 181, 101, 0.58);
}

.view-chip.is-active {
  color: #0c1321;
  border-color: transparent;
  background: linear-gradient(120deg, #f0d28c, #c99f4a);
  box-shadow: 0 10px 20px rgba(195, 145, 52, 0.22);
}

.view-chip:disabled,
.view-chip.is-disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  border-color: rgba(75, 110, 155, 0.45);
  background: linear-gradient(165deg, rgba(11, 24, 44, 0.78), rgba(6, 14, 28, 0.78));
  box-shadow: none;
}

.view-chip:disabled:hover,
.view-chip.is-disabled:hover {
  transform: none;
  border-color: rgba(75, 110, 155, 0.45);
}

.leaderboard {
  margin: 1.1rem 0 2.2rem;
}

.leaderboard-head h2 {
  font-family: "Russo One", "Exo 2", sans-serif;
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: 0.01em;
  color: #edf4ff;
  text-shadow: 0 8px 20px rgba(15, 38, 76, 0.5);
}

.leaderboard-subtitle {
  margin: 0.3rem 0 0;
  max-width: 54rem;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.leaderboard-controls {
  margin-top: 0.85rem;
}

.leaderboard-list {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 3.15rem minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.6rem 0.65rem;
  border-radius: 16px;
  border: 1px solid rgba(58, 95, 139, 0.78);
  background:
    linear-gradient(165deg, rgba(20, 49, 84, 0.92), rgba(10, 24, 45, 0.96)),
    linear-gradient(90deg, rgba(216, 181, 101, 0.08), transparent 42%);
  box-shadow: 0 14px 30px rgba(2, 8, 21, 0.52);
  overflow: hidden;
}

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 3.15rem;
  height: 3.15rem;
  border-radius: 16px;
  background: rgba(7, 19, 38, 0.65);
  border: 1px solid rgba(203, 224, 255, 0.18);
  font-family: "Russo One", "Exo 2", sans-serif;
  color: rgba(240, 247, 255, 0.95);
  position: relative;
}

.leaderboard-rank.is-1 {
  background: radial-gradient(circle at 30% 30%, rgba(255, 245, 207, 0.95), rgba(199, 159, 77, 0.55));
  border-color: rgba(240, 210, 140, 0.8);
  color: rgba(14, 21, 35, 0.95);
  box-shadow: 0 12px 26px rgba(195, 145, 52, 0.26);
}

.leaderboard-rank.is-2 {
  background: radial-gradient(circle at 30% 30%, rgba(236, 245, 255, 0.96), rgba(136, 169, 210, 0.48));
  border-color: rgba(185, 212, 246, 0.7);
  color: rgba(12, 17, 26, 0.92);
  box-shadow: 0 12px 26px rgba(94, 132, 178, 0.24);
}

.leaderboard-rank.is-3 {
  background: radial-gradient(circle at 30% 30%, rgba(255, 231, 214, 0.96), rgba(198, 132, 78, 0.52));
  border-color: rgba(238, 183, 144, 0.72);
  color: rgba(12, 17, 26, 0.92);
  box-shadow: 0 12px 26px rgba(171, 104, 56, 0.22);
}

.leaderboard-main {
  min-width: 0;
}

.leaderboard-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  color: #edf4ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-sub {
  margin: 0.2rem 0 0;
  color: rgba(156, 178, 209, 0.95);
  font-size: 0.82rem;
  line-height: 1.2;
}

.leaderboard-rating {
  text-align: right;
  font-family: "Russo One", "Exo 2", sans-serif;
  font-size: 1.05rem;
  color: rgba(240, 247, 255, 0.95);
  white-space: nowrap;
}

.leaderboard-bar {
  grid-column: 1 / -1;
  margin-top: 0.45rem;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(126, 167, 217, 0.22);
  background: rgba(7, 19, 38, 0.55);
  overflow: hidden;
  position: relative;
}

.leaderboard-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--pct, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(76, 178, 215, 0.92), rgba(216, 181, 101, 0.88));
  box-shadow: 0 10px 20px rgba(76, 178, 215, 0.14);
}

.analytics {
  margin: 1.1rem 0 2.2rem;
}

.analytics-head h2 {
  font-family: "Russo One", "Exo 2", sans-serif;
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: 0.01em;
  color: #edf4ff;
  text-shadow: 0 8px 20px rgba(15, 38, 76, 0.5);
}

.analytics-subtitle {
  margin: 0.3rem 0 0;
  max-width: 54rem;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.analytics-modes {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.analytics-meta {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.analytics-panel {
  border: 1px solid rgba(58, 95, 139, 0.9);
  border-radius: var(--radius-md);
  background: linear-gradient(165deg, rgba(20, 49, 84, 0.96), rgba(10, 24, 45, 0.98));
  padding: 0.9rem;
  box-shadow: 0 14px 28px rgba(3, 9, 22, 0.48);
  overflow: hidden;
}

.analytics-panel h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.26;
  color: #eff6ff;
}

.analytics-panel p {
  margin: 0.35rem 0 0;
  color: rgba(168, 193, 224, 0.92);
  font-size: 0.9rem;
}

.analytics-blocks {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.analytics-block {
  border: 1px solid rgba(58, 95, 139, 0.9);
  border-radius: var(--radius-md);
  background:
    linear-gradient(165deg, rgba(20, 49, 84, 0.96), rgba(10, 24, 45, 0.98)),
    linear-gradient(90deg, rgba(216, 181, 101, 0.06), transparent 30%);
  padding: 0.95rem;
  box-shadow: 0 14px 30px rgba(2, 8, 21, 0.55);
}

.analytics-block h3 {
  margin: 0;
  font-family: "Russo One", "Exo 2", sans-serif;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  color: #f1f7ff;
}

.analytics-block .hint {
  margin: 0.35rem 0 0;
  color: rgba(163, 186, 216, 0.92);
  font-size: 0.86rem;
}

.bar-list {
  margin-top: 0.72rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr auto;
  gap: 0.65rem;
  align-items: center;
}

.bar-label {
  font-size: 0.88rem;
  color: rgba(210, 226, 247, 0.92);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(126, 167, 217, 0.22);
  background: rgba(7, 19, 38, 0.7);
  overflow: hidden;
}

.bar-fill {
  position: absolute;
  inset: 0;
  width: var(--pct, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(76, 178, 215, 0.92), rgba(216, 181, 101, 0.88));
  box-shadow: 0 10px 20px rgba(76, 178, 215, 0.14);
}

.bar-value {
  font-family: "Russo One", "Exo 2", sans-serif;
  font-size: 0.86rem;
  color: rgba(240, 247, 255, 0.92);
  white-space: nowrap;
}

.top-list {
  margin-top: 0.72rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.top-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.55rem 0.6rem;
  border-radius: 14px;
  border: 1px solid rgba(58, 95, 139, 0.75);
  background: rgba(7, 19, 38, 0.55);
  cursor: pointer;
  text-align: left;
  width: 100%;
  appearance: none;
}

.top-item img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid rgba(203, 224, 255, 0.35);
}

.top-item strong {
  display: block;
  font-size: 0.92rem;
  line-height: 1.2;
  color: #edf4ff;
  overflow-wrap: anywhere;
}

.top-item small {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.78rem;
  color: rgba(156, 178, 209, 0.95);
}

.top-item .metric {
  text-align: right;
  font-family: "Russo One", "Exo 2", sans-serif;
  font-size: 0.88rem;
  color: rgba(240, 247, 255, 0.94);
}

.top-item .metric-sub {
  margin-top: 0.1rem;
  font-family: "Exo 2", "Segoe UI", sans-serif;
  font-size: 0.74rem;
  color: rgba(170, 196, 229, 0.92);
}

.analytics-note {
  margin-top: 0.75rem;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  border: 1px dashed rgba(126, 167, 217, 0.42);
  background: rgba(6, 16, 33, 0.55);
  color: rgba(176, 198, 228, 0.94);
  font-size: 0.86rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-soft);
  background: linear-gradient(170deg, rgba(13, 33, 58, 0.94), rgba(8, 21, 40, 0.94));
  border-radius: 999px;
  padding: 0.42rem 0.8rem;
  min-height: 2rem;
  font-size: 0.84rem;
  font-weight: 700;
  color: #b6c9e6;
  cursor: pointer;
  transition: 0.22s ease;
}

.chip:hover {
  border-color: rgba(216, 181, 101, 0.5);
  color: #f2f7ff;
  transform: translateY(-1px);
}

.chip.is-active {
  color: #0e1524;
  border-color: transparent;
  background: linear-gradient(125deg, #efd18c, #c79f4d);
  box-shadow: 0 10px 18px rgba(178, 133, 50, 0.26);
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  margin-top: 0.9rem;
  position: sticky;
  top: calc(0.6rem + var(--safe-top));
  z-index: 30;
  padding: 0.6rem;
  border-radius: 18px;
  border: 1px solid rgba(64, 98, 141, 0.82);
  backdrop-filter: blur(10px);
  background: rgba(8, 23, 44, 0.88);
  box-shadow: 0 14px 28px rgba(2, 8, 21, 0.5);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 0.3rem 0.5rem;
  background: linear-gradient(180deg, rgba(13, 36, 65, 0.92), rgba(9, 24, 44, 0.92));
}

.search-icon {
  color: var(--accent-soft);
  font-size: 1.1rem;
  line-height: 1;
}

.search-box input {
  border: 0;
  background: transparent;
  outline: none;
  min-width: 0;
  width: 100%;
  font-size: 0.98rem;
  font-family: inherit;
  color: var(--ink);
}

.search-box input::placeholder {
  color: rgba(173, 194, 221, 0.74);
}

.icon-button {
  border: 1px solid rgba(152, 183, 221, 0.24);
  background: rgba(76, 178, 215, 0.1);
  color: var(--accent-soft);
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 8px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: 0.2s ease;
}

.icon-button:hover {
  color: #e7f4ff;
  border-color: rgba(127, 210, 238, 0.45);
  background: rgba(76, 178, 215, 0.2);
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.1rem;
  color: var(--ink-soft);
  font-size: 0.88rem;
  white-space: nowrap;
}

.sort-wrap select {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(14, 36, 64, 0.96), rgba(10, 24, 45, 0.96));
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
  max-width: 100%;
  padding: 0.4rem 0.55rem;
}

.styles-filter {
  margin-top: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-soft);
  background: linear-gradient(170deg, rgba(13, 33, 58, 0.94), rgba(8, 21, 40, 0.94));
  border-radius: 999px;
  padding: 0.42rem 0.8rem;
  min-height: 2rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: #b6c9e6;
  cursor: pointer;
  transition: 0.22s ease;
}

.filter-chip:hover {
  border-color: rgba(216, 181, 101, 0.5);
  color: #f2f7ff;
  transform: translateY(-1px);
}

.filter-chip.is-active {
  color: #0e1524;
  border-color: transparent;
  background: linear-gradient(125deg, #efd18c, #c79f4d);
  box-shadow: 0 10px 18px rgba(178, 133, 50, 0.3);
}

.results-head {
  margin-top: 0.65rem;
}

#resultsSummary {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.cards-grid {
  margin: 0.9rem 0 2.2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.9rem;
}

.card {
  position: relative;
  display: grid;
  gap: 0.72rem;
  width: 100%;
  min-width: 0;
  text-align: left;
  border: 1px solid rgba(58, 95, 139, 0.9);
  border-radius: var(--radius-md);
  background:
    linear-gradient(165deg, rgba(20, 49, 84, 0.96), rgba(10, 24, 45, 0.98)),
    linear-gradient(90deg, rgba(216, 181, 101, 0.08), transparent 28%);
  padding: 0.8rem;
  box-shadow: 0 10px 20px rgba(3, 9, 22, 0.5);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  opacity: 0;
  transform: translateY(8px);
  animation: card-in 0.45s ease forwards;
  overflow: hidden;
  content-visibility: auto;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(240, 210, 141, 0.14);
  pointer-events: none;
}

.card::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(
    120deg,
    transparent 36%,
    rgba(239, 218, 160, 0.22) 50%,
    transparent 64%
  );
  transform: translateX(-70%) rotate(16deg);
  opacity: 0.3;
  transition: transform 0.5s ease, opacity 0.5s ease;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 34px rgba(3, 11, 24, 0.72);
  border-color: rgba(216, 181, 101, 0.72);
}

.card:hover::after {
  transform: translateX(70%) rotate(16deg);
  opacity: 0.5;
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}

.card-icon-wrap {
  position: relative;
  width: 62px;
  height: 62px;
  flex-shrink: 0;
}

.card-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(203, 224, 255, 0.35);
}

.card-style {
  align-self: flex-start;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #eef6ff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.card[data-style="wound"] .card-style {
  background: #8e3030;
}

.card[data-style="flame"] .card-style {
  background: #b9611f;
}

.card[data-style="ice"] .card-style {
  background: #255f9f;
}

.card[data-style="warrior"] .card-style {
  background: #6d4329;
}

.card[data-style="shield"] .card-style {
  background: #3f7281;
}

.card[data-style="giant"] .card-style {
  background: #49672f;
}

.card[data-style="wizard"] .card-style {
  background: #0f5662;
}

.card[data-style="crit"] .card-style {
  background: #6f3a88;
}

.card[data-style="regeneration"] .card-style {
  background: #146f49;
}

.card.rarity-epic {
  border-color: rgba(176, 126, 255, 0.95);
  background:
    radial-gradient(circle at 87% -14%, rgba(200, 138, 255, 0.34) 0%, transparent 40%),
    radial-gradient(circle at 10% 108%, rgba(154, 109, 255, 0.18) 0%, transparent 46%),
    linear-gradient(165deg, rgba(37, 44, 96, 0.98), rgba(19, 18, 56, 0.99));
  box-shadow:
    0 18px 38px rgba(87, 41, 157, 0.58),
    0 0 22px rgba(196, 142, 255, 0.18),
    0 0 0 1px rgba(169, 121, 242, 0.32) inset;
  animation: card-in 0.45s ease forwards, epic-pulse 3.2s ease-in-out infinite;
}

.card.rarity-epic::before {
  border-color: rgba(218, 186, 255, 0.42);
}

.card.rarity-epic::after {
  inset: -52%;
  background: linear-gradient(
    112deg,
    transparent 30%,
    rgba(210, 162, 255, 0.22) 43%,
    rgba(186, 120, 255, 0.82) 50%,
    rgba(210, 162, 255, 0.22) 57%,
    transparent 70%
  );
  opacity: 0.72;
  transform: translateX(-120%) rotate(16deg);
  animation: epic-shimmer 4.6s linear infinite;
}

.card.rarity-epic:hover::after {
  opacity: 0.92;
}

.card.rarity-epic .card-style {
  background: linear-gradient(120deg, #7e46ca, #a463e9);
  border-color: rgba(237, 214, 255, 0.44);
}

.card.rarity-epic .card-icon {
  border-color: rgba(229, 196, 255, 0.78);
  box-shadow: 0 12px 24px rgba(119, 57, 202, 0.42);
}

.card.rarity-legendary {
  border-color: rgba(245, 205, 127, 0.98);
  background:
    radial-gradient(circle at 84% -16%, rgba(255, 227, 160, 0.34) 0%, transparent 42%),
    radial-gradient(circle at 8% 108%, rgba(255, 180, 72, 0.18) 0%, transparent 46%),
    linear-gradient(160deg, rgba(44, 33, 21, 0.98), rgba(25, 18, 11, 0.99));
  box-shadow:
    0 20px 44px rgba(125, 80, 20, 0.62),
    0 0 28px rgba(250, 211, 132, 0.32),
    0 0 0 1px rgba(252, 220, 152, 0.35) inset;
  animation: card-in 0.45s ease forwards, legendary-pulse 2.8s ease-in-out infinite;
}

.card.rarity-legendary::before {
  border-color: rgba(255, 229, 174, 0.58);
}

.card.rarity-legendary::after {
  inset: -54%;
  background: linear-gradient(
    112deg,
    transparent 30%,
    rgba(255, 238, 186, 0.26) 43%,
    rgba(255, 216, 132, 0.86) 50%,
    rgba(255, 238, 186, 0.26) 57%,
    transparent 70%
  );
  opacity: 0.78;
  transform: translateX(-120%) rotate(16deg);
  transition: opacity 0.25s ease;
  animation: legendary-shimmer 3.9s linear infinite;
}

.card.rarity-legendary:hover::after {
  opacity: 0.95;
}

.card.rarity-legendary .card-style {
  background: linear-gradient(120deg, #c9913b, #f0cc82);
  color: #271a06;
  border-color: rgba(255, 248, 231, 0.52);
}

.card.rarity-legendary .card-icon {
  border-color: rgba(255, 232, 177, 0.9);
  box-shadow: 0 12px 25px rgba(166, 113, 33, 0.48);
}

.card h3 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.32;
  color: #edf4ff;
  overflow-wrap: anywhere;
}

.card p {
  margin: 0;
  color: #9cb2d1;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.card-dialog {
  border: 1px solid rgba(70, 111, 160, 0.82);
  border-radius: var(--radius-lg);
  width: min(780px, 94vw);
  max-height: 92dvh;
  background: linear-gradient(165deg, rgba(15, 37, 65, 0.99), rgba(8, 19, 36, 0.99));
  color: var(--ink);
  box-shadow: 0 28px 62px rgba(1, 5, 14, 0.82);
  padding: 0;
  overflow: hidden;
}

.card-dialog::backdrop {
  background: rgba(3, 8, 18, 0.68);
  backdrop-filter: blur(5px);
}

.dialog-close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  border: 1px solid rgba(126, 167, 217, 0.42);
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: #d8e9ff;
  background: rgba(65, 122, 174, 0.25);
}

.dialog-content {
  padding: 1.1rem 1.15rem 1.2rem;
  max-height: calc(92dvh - 0.6rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dialog-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  align-items: start;
}

.dialog-head img {
  width: 92px;
  height: 92px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(194, 220, 255, 0.44);
}

.dialog-head h3 {
  margin: 0.2rem 0 0.5rem;
  font-family: "Russo One", "Exo 2", sans-serif;
  font-size: 1.25rem;
  line-height: 1.26;
  color: #f1f7ff;
}

.card-style-dialog {
  margin-bottom: 0.15rem;
}

.rarity-chip {
  display: inline-flex;
  margin-top: 0.15rem;
  margin-bottom: 0.3rem;
  padding: 0.16rem 0.52rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.rarity-chip-epic {
  color: #f4e9ff;
  border: 1px solid rgba(203, 162, 255, 0.62);
  background: linear-gradient(120deg, rgba(104, 58, 180, 0.92), rgba(142, 80, 223, 0.92));
}

.rarity-chip-legendary {
  color: #2f1e06;
  border: 1px solid rgba(255, 232, 184, 0.72);
  background: linear-gradient(120deg, rgba(206, 151, 58, 0.95), rgba(244, 207, 126, 0.96));
}

.dialog-text {
  margin-top: 0.9rem;
  color: #b8cae5;
  font-size: 1rem;
}

.empty-state {
  margin: 0.2rem 0 2rem;
  padding: 1.4rem;
  border: 1px dashed rgba(106, 145, 191, 0.6);
  border-radius: var(--radius-md);
  background: rgba(10, 24, 43, 0.72);
  color: #b5c9e6;
  text-align: center;
  grid-column: 1 / -1;
}

.noscript {
  margin: 1rem auto 2rem;
  width: min(1180px, 92vw);
  border: 1px solid rgba(184, 70, 55, 0.55);
  background: rgba(74, 20, 19, 0.66);
  color: #ffd2ca;
  border-radius: 12px;
  padding: 0.8rem 1rem;
}

button,
input,
select,
dialog {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.card:focus-visible,
.dialog-close:focus-visible,
.filter-chip:focus-visible,
.view-chip:focus-visible,
.chip:focus-visible,
.top-item:focus-visible {
  outline: 2px solid rgba(240, 210, 141, 0.92);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 11px;
}

::-webkit-scrollbar-track {
  background: #071326;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(73, 126, 186, 0.95), rgba(33, 70, 114, 0.95));
  border-radius: 999px;
  border: 2px solid #071326;
}

@keyframes hero-fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bg-shift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@keyframes grid-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(0, -24px, 0) scale(1.02);
  }
}

@keyframes glow-float {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(8px, -14px, 0) scale(1.06);
  }
}

@keyframes epic-shimmer {
  0% {
    transform: translateX(-120%) rotate(16deg);
  }
  100% {
    transform: translateX(120%) rotate(16deg);
  }
}

@keyframes epic-pulse {
  0%,
  100% {
    box-shadow:
      0 18px 38px rgba(87, 41, 157, 0.54),
      0 0 18px rgba(196, 142, 255, 0.16),
      0 0 0 1px rgba(169, 121, 242, 0.28) inset;
    border-color: rgba(176, 126, 255, 0.92);
  }
  50% {
    box-shadow:
      0 22px 46px rgba(101, 46, 184, 0.68),
      0 0 30px rgba(211, 157, 255, 0.34),
      0 0 0 1px rgba(206, 155, 255, 0.44) inset;
    border-color: rgba(210, 160, 255, 1);
  }
}

@keyframes legendary-shimmer {
  0% {
    transform: translateX(-120%) rotate(16deg);
  }
  100% {
    transform: translateX(120%) rotate(16deg);
  }
}

@keyframes legendary-pulse {
  0%,
  100% {
    box-shadow:
      0 20px 44px rgba(125, 80, 20, 0.58),
      0 0 18px rgba(250, 211, 132, 0.22),
      0 0 0 1px rgba(252, 220, 152, 0.3) inset;
    border-color: rgba(240, 198, 118, 0.94);
  }
  50% {
    box-shadow:
      0 24px 52px rgba(137, 86, 19, 0.74),
      0 0 30px rgba(255, 220, 142, 0.45),
      0 0 0 1px rgba(255, 228, 170, 0.45) inset;
    border-color: rgba(255, 221, 156, 1);
  }
}

@media (max-width: 860px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .sort-wrap {
    justify-content: space-between;
  }

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

  .analytics-blocks {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .container {
    width: min(1180px, calc(100vw - 0.9rem));
  }

  .hero {
    padding-top: calc(1rem + var(--safe-top));
    padding-bottom: 1.05rem;
  }

  .hero h1 {
    margin-top: 0.74rem;
    margin-bottom: 0.45rem;
    font-size: clamp(1.55rem, 8vw, 2.2rem);
  }

  .hero-subtitle {
    font-size: 0.97rem;
    line-height: 1.4;
  }

  .hero-top {
    align-items: stretch;
  }

  .language-switch {
    width: 100%;
  }

  .hero-meta {
    max-width: none;
    gap: 0.55rem;
  }

  .view-switch {
    width: 100%;
  }

  .view-chip {
    flex: 1 1 0;
  }

  .meta-card {
    padding: 0.68rem 0.75rem;
  }

  .analytics {
    margin-top: 0.8rem;
  }

  .analytics-head h2 {
    font-size: 1.35rem;
  }

  .analytics-subtitle {
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .analytics-meta {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .controls {
    position: static;
    margin-top: 0.55rem;
    padding: 0.5rem;
    border-radius: 14px;
    backdrop-filter: none;
  }

  .search-box {
    padding: 0.34rem 0.46rem;
  }

  .search-box input {
    font-size: 0.95rem;
    min-height: 2.2rem;
  }

  .icon-button {
    width: 2rem;
    height: 2rem;
  }

  .sort-wrap {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.45rem;
    align-items: center;
    padding: 0;
  }

  .sort-wrap select {
    width: 100%;
    min-height: 2.2rem;
  }

  .styles-filter {
    margin-top: 0.72rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 0.24rem;
  }

  .styles-filter .filter-chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .cards-grid {
    margin: 0.72rem 0 1.8rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .analytics-modes {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding-bottom: 0.24rem;
  }

  .analytics-modes .chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .bar-row {
    grid-template-columns: 1fr auto;
    gap: 0.55rem;
  }

  .bar-track {
    grid-column: 1 / -1;
  }

  .top-item {
    grid-template-columns: 36px 1fr auto;
  }

  .top-item img {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }

  .top-item strong {
    font-size: 0.9rem;
  }

  .top-item small {
    font-size: 0.76rem;
  }

  .card {
    gap: 0.46rem;
    padding: 0.55rem;
    border-radius: 14px;
    text-align: center;
  }

  .card-top {
    flex-direction: column;
    align-items: center;
    gap: 0.34rem;
  }

  .card-icon-wrap {
    width: 66px;
    height: 66px;
  }

  .card-style {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.62rem;
    padding: 0.18rem 0.46rem;
  }

  .card h3 {
    font-size: 0.86rem;
    line-height: 1.22;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.44em;
  }

  .card p {
    margin: 0;
    color: rgba(168, 193, 224, 0.92);
    font-size: 0.74rem;
    line-height: 1.26;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .card-dialog {
    width: min(100vw - 0.5rem, 100%);
    max-height: 92dvh;
    border-radius: 18px;
  }

  .dialog-close {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.35rem;
    top: 0.45rem;
    right: 0.45rem;
  }

  .dialog-content {
    padding: 1rem 0.95rem calc(1rem + var(--safe-bottom));
    max-height: calc(92dvh - 0.4rem);
  }

  .dialog-head {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .dialog-head img {
    width: 72px;
    height: 72px;
  }

  .dialog-head h3 {
    font-size: 1.12rem;
  }

  .dialog-text {
    margin-top: 0.72rem;
    font-size: 0.96rem;
  }
}

@media (max-width: 420px) {
  .hero-meta {
    grid-template-columns: 1fr;
  }

  .lang-chip {
    font-size: 0.7rem;
    padding: 0.24rem 0.54rem;
  }

  .controls {
    padding: 0.46rem;
  }

  .sort-wrap {
    grid-template-columns: 1fr;
    gap: 0.28rem;
  }

  .sort-wrap span {
    font-size: 0.8rem;
  }

  .filter-chip {
    font-size: 0.8rem;
    padding: 0.38rem 0.68rem;
  }
}

@media (max-width: 360px) {
  .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (hover: none) and (pointer: coarse) {
  .card:hover {
    transform: none;
  }

  .card:hover::after {
    opacity: 0.45;
  }

  /* Box-shadow pulse animations are expensive on mobile GPUs. Keep shimmer, drop pulsing. */
  .card.rarity-epic,
  .card.rarity-legendary {
    animation: card-in 0.45s ease forwards;
  }

  /* Animated backgrounds can get janky on low-end phones. Keep the look, stop the motion. */
  body {
    animation: none;
  }

  body::before {
    animation: none;
  }

  .bg-glow {
    animation: none;
  }

  /* Shimmer loops also cost; freeze them on touch devices. */
  .card.rarity-epic::after,
  .card.rarity-legendary::after {
    animation: none;
    opacity: 0.58;
    transform: translateX(0) rotate(16deg);
  }
}

@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;
  }
}
