:root {
  --bg: #070910;
  --bg-soft: #0c1018;
  --panel: #0f141e;
  --card: #141a25;
  --card-hover: #18202d;
  --border: #222b3b;
  --border-strong: #2d3950;
  --text: #e9eef7;
  --muted: #8792a6;
  --accent: #f5a524;
  --accent-soft: rgba(245, 165, 36, 0.14);
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-color: #2a3446 transparent;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

.ambient {
  position: fixed;
  inset: -30% -10% auto -10%;
  height: 60vh;
  background:
    radial-gradient(60% 60% at 20% 0%, rgba(245, 165, 36, 0.12), transparent 70%),
    radial-gradient(50% 50% at 80% 0%, rgba(99, 102, 241, 0.14), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Topbar ------------------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 4vw, 40px);
  background: rgba(7, 9, 16, 0.82);
  border-bottom: 1px solid rgba(34, 43, 59, 0.7);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 22px;
  background: linear-gradient(150deg, #1d2637, #111722);
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.updated {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #1a2230, #131a26);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    transform 0.15s ease,
    background 0.15s ease;
}

.btn:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.ghost {
  background: transparent;
}

/* Kit tabs ---------------------------------------------------------------- */

.tabs {
  position: sticky;
  top: 76px;
  z-index: 15;
  display: flex;
  gap: 4px;
  padding: 10px clamp(16px, 4vw, 40px) 0;
  overflow-x: auto;
  background: linear-gradient(180deg, rgba(7, 9, 16, 0.94), rgba(7, 9, 16, 0.72));
  backdrop-filter: blur(10px);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px 16px;
  border: 0;
  border-radius: 10px 10px 0 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.tab .tab-icon {
  font-size: 15px;
  filter: saturate(0.9);
}

.tab .tab-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: #1a2231;
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
}

.tab[aria-selected="true"] {
  color: var(--text);
  background: linear-gradient(180deg, rgba(245, 165, 36, 0.1), rgba(245, 165, 36, 0));
}

.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(245, 165, 36, 0.55);
}

/* Layout ------------------------------------------------------------------ */

.layout {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  width: 100%;
  padding: 22px clamp(16px, 4vw, 40px) 40px;
  max-width: 1800px;
  margin: 0 auto;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(360px, 100%);
  padding: 9px 14px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  transition: border-color 0.15s ease;
}

.search:focus-within {
  border-color: var(--accent);
}

.search svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.search input::placeholder {
  color: #667085;
}

.toolbar-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

/* Board ------------------------------------------------------------------- */

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(215px, 1fr);
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: start;
  scrollbar-color: #2a3446 transparent;
}

.tier-column {
  --tier-color: #8892a6;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  padding: 0 0 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(15, 20, 30, 0.6), rgba(15, 20, 30, 0.18));
  border: 1px solid rgba(34, 43, 59, 0.55);
}

.tier-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 10px;
  border-bottom: 2px solid var(--tier-color);
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--tier-color) 14%, transparent), transparent);
}

.tier-name {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tier-color);
}

.tier-count {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(7, 9, 16, 0.5);
}

.tier-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 4px 8px 0;
  margin: 0;
  list-style: none;
}

.player {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #161d29, #121824);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.player:hover {
  border-color: color-mix(in srgb, var(--tier-color) 65%, var(--border));
  background: linear-gradient(180deg, #1a2331, #141b27);
  transform: translateY(-1px);
}

.player:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.player.hidden {
  display: none;
}

.skin {
  position: relative;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #0b0f17;
}

.skin img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  display: block;
}

.player-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.player-name {
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank {
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(7, 9, 16, 0.65);
  border: 1px solid var(--border);
}

.tier-empty {
  margin: 4px 8px;
  padding: 16px 10px;
  text-align: center;
  font-size: 12px;
  color: #5d687c;
  border: 1px dashed #253044;
  border-radius: 10px;
}

.skeleton {
  grid-column: 1 / -1;
  padding: 60px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.board-message {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.board-message strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  margin-bottom: 4px;
}

/* Recent ------------------------------------------------------------------ */

.recent {
  margin-top: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(15, 20, 30, 0.5);
  overflow: hidden;
}

.recent-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.recent-head h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.recent-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-top: 1px solid rgba(34, 43, 59, 0.55);
}

.recent-item:first-child {
  border-top: 0;
}

.recent-item .skin {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.recent-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.recent-name {
  font-size: 13px;
  font-weight: 600;
}

.recent-meta {
  font-size: 11px;
  color: var(--muted);
}

.tier-chip {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--tier-color, #8892a6) 50%, var(--border));
  background: color-mix(in srgb, var(--tier-color, #8892a6) 12%, transparent);
  color: var(--tier-color, var(--text));
}

.recent-time {
  flex: none;
  font-size: 11px;
  color: var(--muted);
  min-width: 92px;
  text-align: right;
}

/* Footer ------------------------------------------------------------------ */

.footer {
  flex: 0 0 auto;
  margin-top: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 24px 16px 34px;
  color: #5f6b80;
  font-size: 12px;
  border-top: 1px solid rgba(34, 43, 59, 0.5);
}

.dot {
  color: #333e52;
}

/* Dialog ------------------------------------------------------------------ */

.dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: linear-gradient(180deg, #121826, #0d121b);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(3, 5, 9, 0.72);
  backdrop-filter: blur(4px);
}

.dialog-close-form {
  margin: 0;
  position: absolute;
  top: 12px;
  right: 12px;
}

.dialog-close {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(7, 9, 16, 0.6);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.dialog-close:hover {
  color: var(--text);
  border-color: var(--accent);
}

.dialog-body {
  padding: 22px;
}

.dialog-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.dialog-hero .skin {
  width: 56px;
  height: 56px;
  border-radius: 12px;
}

.dialog-hero h2 {
  margin: 0;
  font-size: 19px;
}

.dialog-hero p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.detail-rows {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--border);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 13px;
  background: #10151f;
  font-size: 13px;
}

.detail-row dt {
  color: var(--muted);
}

.detail-row dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.detail-kits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 13px;
  background: #10151f;
}

.detail-kit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.detail-kit b {
  color: var(--text);
}

/* Toast ------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #1a2230;
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 50;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 720px) {
  .brand-sub {
    display: none;
  }

  .updated {
    display: none;
  }

  .board {
    grid-auto-columns: minmax(190px, 1fr);
    gap: 12px;
  }

  .recent-time {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
