@import url("https://fonts.cdnfonts.com/css/geist");

@font-face {
  font-family: "Geist";
  src: url("Geist-VariableFont_wght.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Minecraft";
  src: url("MinecraftRegular-Bmg3 (1).otf") format("opentype");
  font-display: swap;
}

:root {
  --bg: #07090d;
  --panel: #111722;
  --panel-2: #171f2c;
  --text: #f4f7ff;
  --muted: #9da8b8;
  --line: #2f3b4c;
  --green: #43d64e;
  --gold: #f0ae18;
  --cyan: #4dd9e8;
  --red: #ee5252;
  --ink: #030508;
  --radius: 8px;
  --font-body: "Geist", system-ui, sans-serif;
}

.font-minecraft {
  --font-body: "Minecraft", "Geist", system-ui, sans-serif;
}

.font-minecraft,
.font-minecraft * {
  font-weight: 400 !important;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  scrollbar-color: var(--line) var(--bg);
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 3px solid var(--line);
  background: #07090d;
}

.site-header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  width: min(1480px, calc(100vw - 32px));
  min-height: 72px;
  margin: 0 auto;
}

.header-brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.header-logo {
  display: block;
  width: 220px;
  height: auto;
  margin-left: 4px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.site-nav .nav-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.font-toggle {
  min-height: 34px;
  padding: 0 10px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.font-toggle:hover,
.font-toggle:focus-visible,
.font-toggle[aria-pressed="true"] {
  border-color: var(--cyan);
  color: var(--text);
}

.font-toggle:active {
  transform: none;
  box-shadow: none;
}

.site-footer {
  border-top: 3px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.site-footer p {
  margin: 0;
  padding: 20px 16px;
}

.site-footer a {
  color: var(--cyan);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--text);
  text-decoration: underline;
}

.nav-button {
  min-height: 40px;
  padding: 0 15px;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: none;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.nav-button:hover,
.nav-button.is-active {
  border-color: var(--cyan);
  color: var(--text);
}

.nav-button:active {
  transform: none;
  box-shadow: none;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 18px;
  align-items: end;
  padding: 22px;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: #0b0f16;
  box-shadow: 0 8px 0 #000;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 14px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 6vw, 60px);
  line-height: 0.95;
  color: var(--text);
}

.brand-logo {
  display: block;
  width: min(100%, 380px);
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 92px 210px 190px 150px;
  column-gap: 16px;
  row-gap: 12px;
  align-items: end;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field span,
.rank-strip span,
.panel-title span {
  color: var(--muted);
  font-size: 12px;
}

input,
select,
button {
  min-height: 48px;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--cyan);
}

.match-type-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: 4px 10px;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.match-type-field legend {
  color: var(--muted);
  font-size: 12px;
}

.match-type-field label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  white-space: nowrap;
}

.match-type-field input {
  min-height: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--green);
}

button {
  cursor: pointer;
  color: var(--ink);
  background: var(--green);
  border-color: #8cf393;
  box-shadow: 0 5px 0 #1b7022;
}

button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #1b7022;
}

button:disabled {
  cursor: wait;
  background: var(--muted);
  border-color: #c2cad6;
}

.search-panel button {
  border-radius: 0;
  font-weight: 500;
}

.export-actions {
  display: flex;
  justify-content: flex-end;
}

.status-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 14px 0;
}

.export-button {
  min-height: 40px;
  border-radius: var(--radius) !important;
  background: var(--green);
  border-color: #8cf393;
  box-shadow: 0 5px 0 #1b7022;
  color: var(--ink);
  font-weight: 500;
}

.export-button:disabled {
  cursor: not-allowed;
  background: #1a2330;
  border-color: #344657;
  box-shadow: none;
  color: #647386;
  opacity: 0.7;
}

.export-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #1b7022;
}

.stats-export {
  isolation: isolate;
}

.export-watermark {
  display: none;
}

.stats-export.is-exporting {
  position: relative;
  padding-bottom: 36px;
}

.stats-export.is-exporting .export-watermark {
  display: flex;
  align-items: baseline;
  gap: 3px;
  position: absolute;
  right: 6px;
  bottom: 2px;
  color: var(--muted);
  font-family: "Minecraft", "Geist", system-ui, sans-serif;
  font-size: 32px;
  line-height: 1;
  opacity: 0.8;
}

.watermark-dot {
  margin: 0 1px;
}

.status-line {
  margin: 0;
  color: var(--muted);
  min-height: 24px;
}

.analyze-button {
  margin-bottom: 5px;
}

.profile-section,
.panel {
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 6px 0 #000;
}

.profile-section {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(420px, 1.4fr);
  gap: 18px;
  align-items: center;
  padding: 18px;
  margin-bottom: 18px;
}

.identity {
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 0;
}

.skin-head {
  width: 78px;
  height: 78px;
  image-rendering: pixelated;
  background: var(--ink);
  border: 3px solid var(--line);
  border-radius: var(--radius);
}

.name-row {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  flex-wrap: wrap;
}

.name-row h2 {
  margin-bottom: 8px;
  overflow-wrap: anywhere;
  font-size: clamp(24px, 3vw, 40px);
}

.country-flag {
  width: 34px;
  height: 24px;
  object-fit: cover;
  image-rendering: pixelated;
  border: 2px solid var(--line);
  border-radius: 4px;
}

.rank-position {
  color: var(--cyan);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 6px 8px;
  margin-bottom: 8px;
  font-size: 18px;
}

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

.social-links > span {
  color: var(--cyan);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 6px 8px;
  font-size: 12px;
}

.last-played {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.social-copy {
  position: relative;
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 7px;
  color: var(--text);
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 5px 8px;
  font-size: 12px;
}

.social-copy:active {
  transform: none;
  box-shadow: none;
}

.social-copy::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  color: var(--text);
  background: var(--ink);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 5px 7px;
  white-space: nowrap;
}

.social-copy:hover::after,
.social-copy.copied::after {
  opacity: 1;
}

.social-icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--ink);
  background: var(--cyan);
  border-radius: 4px;
  font-size: 11px;
}

.social-icon svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.social-discord .social-icon {
  background: #5865f2;
  color: var(--text);
}

.social-youtube .social-icon {
  background: #ff3333;
  color: var(--text);
}

.social-twitch .social-icon {
  background: #9146ff;
  color: var(--text);
}

.social-discord .social-icon svg {
  transform: translateX(0.5px);
}

.social-youtube .social-icon svg {
  transform: translateX(0.5px);
}

.rank-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.rank-strip > div,
.mini-stat {
  min-width: 0;
  padding: 12px;
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: var(--radius);
}

.rank-strip > .stat-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  background: transparent;
  border: 0;
}

.rank-strip strong {
  display: block;
  margin-top: 8px;
  color: var(--gold);
  font-size: clamp(17px, 2vw, 26px);
  overflow-wrap: anywhere;
}

#eloValue,
#pbValue,
#avgValue,
#winRateValue,
#forfeitRateValue {
  color: var(--text);
}

#eloValue .peak-elo {
  color: var(--gold);
  display: inline-block;
  margin-left: 6px;
  font-size: 26px;
  line-height: 1;
  vertical-align: 0.02em;
}

#recordValue {
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: clamp(20px, 2.1vw, 22px);
}

#recordValue span {
  font-size: inherit;
}

#recordValue .win {
  color: var(--green);
}

#recordValue .loss {
  color: var(--red);
}

#recordValue .draw {
  color: var(--muted);
}

.rank-coal {
  color: #050505 !important;
  text-shadow: 0 0 0 #ffffff;
}

.rank-iron,
.rank-unrated {
  color: var(--text) !important;
}

.rank-gold {
  color: var(--gold) !important;
}

.rank-emerald {
  color: var(--green) !important;
}

.rank-diamond {
  color: var(--cyan) !important;
}

.rank-netherite {
  color: #b14cff !important;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
}

.graphs-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.graphs-row .chart-panel {
  grid-column: auto;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title h3 {
  margin-bottom: 0;
  font-size: 20px;
}

.chart-panel {
  grid-column: span 3;
  height: 360px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.third-panel {
  grid-column: span 2;
}

.wide-panel {
  grid-column: span 3;
}

.chart-panel canvas {
  width: 100% !important;
  height: 100% !important;
  min-height: 0;
}

.table-list,
.history-list {
  display: grid;
  gap: 8px;
}

.scrollable {
  max-height: 440px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-color: var(--line) var(--panel);
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.scrollable::-webkit-scrollbar-track {
  background: var(--panel);
}

.scrollable::-webkit-scrollbar-thumb {
  border-color: var(--panel);
}

.row {
  display: grid;
  gap: 8px;
  align-items: center;
  padding: 10px;
  background: var(--panel-2);
  border: 2px solid var(--line);
  border-radius: var(--radius);
}

.row > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.split-row {
  grid-template-columns: minmax(0, 1.15fr) repeat(3, minmax(0, 0.85fr));
}

.opponent-row {
  grid-template-columns: minmax(150px, 1fr) minmax(76px, 96px) repeat(3, minmax(48px, 72px)) minmax(92px, 116px);
}

.seed-row {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr) minmax(0, 0.6fr) minmax(0, 0.8fr);
}

.bastion-row {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.62fr) minmax(0, 0.8fr) minmax(0, 0.9fr);
}

.match-row {
  grid-template-columns: minmax(160px, 1fr) repeat(4, minmax(80px, 120px));
}

.row.header {
  color: var(--muted);
  background: #0d121b;
  position: sticky;
  top: 0;
  z-index: 1;
}

.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.sort-header::before,
.sort-header::after {
  content: "";
  display: none;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.sort-header.sort-asc::after {
  display: inline-block;
  border-bottom: 6px solid currentColor;
}

.sort-header.sort-desc::after {
  display: inline-block;
  border-top: 6px solid currentColor;
}

.sort-header.sort-none::after {
  display: inline-block;
  border-top: 5px solid currentColor;
  opacity: 0.55;
}

.sort-header:hover,
.sort-header:focus {
  color: var(--text);
  outline: none;
}

.sort-header.active {
  color: var(--cyan);
}

.win {
  color: var(--green);
}

.loss {
  color: var(--red);
}

.draw {
  color: var(--muted);
}

.best-time {
  color: var(--green);
}

.worst-time {
  color: var(--red);
}

.positive-rate {
  color: var(--green);
}

.negative-rate {
  color: var(--red);
}

.neutral-rate {
  color: var(--text);
}

.gold {
  color: var(--gold);
}

.cyan {
  color: var(--cyan);
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  .hero,
  .profile-section,
  .dashboard,
  .search-panel,
  .graphs-row {
    grid-template-columns: 1fr;
  }

  .chart-panel,
  .third-panel,
  .wide-panel {
    grid-column: auto;
  }

  .search-panel {
    width: 100%;
  }

  .export-actions {
    display: block;
  }

  .status-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .export-button {
    width: 100%;
  }

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

  .match-row,
  .opponent-row,
  .seed-row,
  .bastion-row,
  .split-row {
    grid-template-columns: 1fr 1fr;
  }

  .row.header {
    display: none;
  }
}

@media (max-width: 560px) {
  .site-header-inner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: min(100vw - 18px, 1480px);
    min-height: 0;
    padding: 12px 0;
  }

  .header-logo {
    width: 154px;
  }

  .site-nav {
    gap: 6px;
  }

  .nav-button {
    min-height: 34px;
    padding: 0 9px;
    font-size: 13px;
  }

  .app-shell {
    width: min(100vw - 18px, 1480px);
    padding: 12px 0 24px;
  }

  .hero,
  .profile-section,
  .panel {
    padding: 12px;
  }

  .rank-strip {
    grid-template-columns: 1fr;
  }
}
