/* ─── Variables ─────────────────────────────────────────────────── */
:root {
  --bg:          #0f1923;
  --surface:     #1a2535;
  --surface-2:   #20304a;
  --border:      #2a3f5a;
  --accent:      #ff4655;
  --text:        #e2e8f0;
  --muted:       #7a92aa;
  --win:         #22c55e;
  --loss:        #ef4444;
  --elo:         #60a5fa;
  --gold:        #f59e0b;
  --silver:      #94a3b8;
  --bronze:      #c2823a;
  --radius:      8px;
}

/* ─── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ─── Nav ───────────────────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0 2rem;
  height: 56px;
  background: rgba(15,25,35,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo span { color: var(--accent); }

.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s;
}
.nav-link:hover { color: var(--text); }

/* ─── Hero ──────────────────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: 5rem 2rem 4rem;
  border-bottom: 1px solid var(--border);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 60%, rgba(255,70,85,.10) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(96,165,250,.07) 0%, transparent 50%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5rem;
}

.hero-title {
  font-size: 3.25rem;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.05;
  margin-bottom: .75rem;
}
.hero-title span { color: var(--accent); }

.hero-sub {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
}

.hero-stat-val {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
}

.hero-stat-lbl {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-top: .15rem;
}

.discord-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  padding: .85rem 1.75rem;
  background: #5865F2;
  color: #fff;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  transition: background .15s, transform .12s, box-shadow .15s;
  box-shadow: 0 4px 20px rgba(88,101,242,.35);
  white-space: nowrap;
}
.discord-btn:hover {
  background: #4752C4;
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(88,101,242,.50);
}
.discord-btn svg { width: 24px; height: 24px; }

@media (max-width: 768px) {
  .hero { padding: 3rem 1.25rem 2.5rem; }
  .hero-inner { flex-direction: column; align-items: flex-start; }
  .hero-title { font-size: 2.25rem; }
  .discord-btn { align-self: flex-start; }
}

/* ─── Main ──────────────────────────────────────────────────────── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

/* ─── Table card ────────────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

thead th {
  padding: .6rem 1rem;
  text-align: left;
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-top: 1px solid var(--border);
  transition: background .12s;
}
tbody tr:hover { background: var(--surface-2); }

td {
  padding: .75rem 1rem;
  font-size: .875rem;
  vertical-align: middle;
}

/* rank column */
.rank-cell {
  width: 48px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
}
.rank-1 { color: var(--gold); }
.rank-2 { color: var(--silver); }
.rank-3 { color: var(--bronze); }

/* player column */
.player-cell { display: flex; align-items: center; gap: .75rem; }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
  flex-shrink: 0;
}

.player-name { font-weight: 600; color: var(--text); }
.player-riot { font-size: .75rem; color: var(--muted); }

/* elo */
.elo-value  { font-weight: 700; font-size: 1rem; color: var(--elo); }

.win-value  { font-weight: 600; color: var(--win); }
.loss-value { font-weight: 600; color: var(--loss); }
.wr-value   { font-weight: 600; }
.kd-value   { font-weight: 500; }
.muted      { color: var(--muted); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem !important;
}

/* ─── Profile header ────────────────────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  margin-bottom: 1.25rem;
}

.avatar-wrapper {
  position: relative;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid var(--border);
  object-fit: cover;
}

.agent-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--surface-2);
  object-fit: contain;
  padding: 3px;
}

.profile-info h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -.03em;
}

.riot-id {
  font-size: .875rem;
  color: var(--muted);
  margin: .15rem 0 .35rem;
}

.agent-label {
  font-size: .8rem;
  color: var(--muted);
  margin-top: .2rem;
}


.profile-elo { margin-left: auto; text-align: right; flex-shrink: 0; }
.elo-number  { font-size: 2.75rem; font-weight: 800; letter-spacing: -.04em; }
.elo-label   { font-size: .8rem; color: var(--muted); }

@media (max-width: 560px) {
  .profile-header {
    flex-wrap: wrap;
    padding: 1.25rem;
    gap: 1rem;
  }
  .profile-info { min-width: 0; flex: 1; }
  .profile-info h1 { font-size: 1.3rem; }
  .profile-elo {
    margin-left: 0;
    text-align: left;
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: .75rem;
    display: flex;
    align-items: baseline;
    gap: .5rem;
  }
  .elo-number { font-size: 2rem; }
  .elo-label  { font-size: .85rem; }
}

/* ─── Stats grid ────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .75rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 500px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.03em;
}

.stat-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-top: .25rem;
}

/* ─── Section title ─────────────────────────────────────────────── */
.section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .75rem;
}

/* ─── Agent stats grid ───────────────────────────────────────────── */
.agent-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .75rem;
  margin-bottom: .5rem;
}
.agent-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem .75rem;
  text-align: center;
  transition: background .12s;
}
.agent-stat-card:hover { background: var(--surface-2); }
.agent-stat-icon { width: 48px; height: 48px; object-fit: contain; margin-bottom: .5rem; }
.agent-stat-name { font-weight: 700; font-size: .8rem; margin-bottom: .4rem; }
.agent-stat-row  { font-size: .78rem; line-height: 1.6; }
.asv { font-weight: 600; }
.asl { color: var(--muted); font-size: .72rem; }

/* ─── Match history ─────────────────────────────────────────────── */
.match-list { display: flex; flex-direction: column; gap: .4rem; }

.match-row {
  display: grid;
  grid-template-columns: 44px 36px 1fr 90px 90px 90px 90px;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  transition: background .12s;
}
.match-row:hover { background: var(--surface-2); }

.match-agent-icon { width: 32px; height: 32px; object-fit: contain; border-radius: 4px; }
.match-agent-icon-placeholder { width: 32px; height: 32px; }

@media (max-width: 700px) {
  .match-row { grid-template-columns: 44px 32px 1fr 70px 70px; }
  .match-row > *:nth-child(5),
  .match-row > *:nth-child(6) { display: none; }
}

.match-result {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  font-weight: 700;
  font-size: .9rem;
}
.match-result.win  { background: rgba(34,197,94,.15);  color: var(--win);  border: 1px solid rgba(34,197,94,.3); }
.match-result.loss { background: rgba(239,68,68,.15); color: var(--loss); border: 1px solid rgba(239,68,68,.3); }

.match-map     { font-weight: 600; font-size: .9rem; }
.match-sub     { font-size: .75rem; color: var(--muted); margin-top: .1rem; }

.match-stat-val { font-weight: 600; font-size: .9rem; }
.match-stat-lbl { font-size: .7rem; color: var(--muted); margin-top: .1rem; }

.match-elo      { font-weight: 700; font-size: .9rem; text-align: right; }
.match-elo.pos  { color: var(--win); }
.match-elo.neg  { color: var(--loss); }

/* ─── Page header with season tag ──────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-header .page-title { margin-bottom: 0; }

.season-tag {
  display: inline-block;
  padding: .25rem .75rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: rgba(96,165,250,.12);
  color: #60a5fa;
  border: 1px solid rgba(96,165,250,.3);
}
.season-tag.ended {
  background: rgba(122,146,170,.1);
  color: var(--muted);
  border-color: var(--border);
}

/* ─── Search bar ────────────────────────────────────────────────── */
.search-form { margin-bottom: 1.25rem; }

.search-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s;
}
.search-wrap:focus-within { border-color: var(--accent); }

.search-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-left: 14px;
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: .65rem .75rem;
  font-family: inherit;
  font-size: .875rem;
  color: var(--text);
  min-width: 0;
}
.search-input::placeholder { color: var(--muted); }

.search-btn {
  flex-shrink: 0;
  padding: .65rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}
.search-btn:hover { opacity: .85; }

.search-error {
  margin-top: .5rem;
  font-size: .8rem;
  color: var(--loss);
}

.season-meta-bar {
  display: flex;
  gap: .5rem;
  color: var(--muted);
  font-size: .875rem;
  margin-bottom: 1rem;
}

/* ─── Pagination ────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.25rem;
}

.page-btn {
  padding: .5rem 1.25rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, border-color .15s;
}
.page-btn:hover { background: var(--surface-2); border-color: rgba(96,165,250,.4); }
.page-btn.disabled { color: var(--muted); cursor: default; }
.page-btn.disabled:hover { background: var(--surface); border-color: var(--border); }

.page-info {
  font-size: .875rem;
  color: var(--muted);
}

/* ─── Back link ─────────────────────────────────────────────────── */
.back-link {
  margin-bottom: 1rem;
}
.back-link a {
  color: var(--muted);
  text-decoration: none;
  font-size: .875rem;
  transition: color .15s;
}
.back-link a:hover { color: var(--text); }

/* ─── Season list ───────────────────────────────────────────────── */
.season-list { display: flex; flex-direction: column; gap: .5rem; }

.season-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: background .12s, border-color .12s;
}
.season-card:hover {
  background: var(--surface-2);
  border-color: rgba(96,165,250,.3);
}

.season-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 120px;
}

.season-card-meta {
  display: flex;
  gap: .5rem;
  font-size: .875rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.season-card-arrow {
  margin-left: auto;
  color: var(--muted);
  font-size: 1.1rem;
}

/* ─── Season history on player profile ──────────────────────────── */
.season-history-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.5rem; }

.season-history-row {
  display: grid;
  grid-template-columns: 120px 50px 100px 1fr 80px 120px;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  text-decoration: none;
  color: var(--text);
  transition: background .12s;
}
.season-history-row:hover { background: var(--surface-2); }

.sh-name { font-weight: 700; }
.sh-rank { font-weight: 700; color: var(--elo); }
.sh-elo  { font-weight: 600; color: var(--elo); }
.sh-record { display: flex; gap: .4rem; align-items: center; }
.sh-date { font-size: .8rem; text-align: right; }

@media (max-width: 700px) {
  .season-history-row { grid-template-columns: 1fr 50px 90px; }
  .sh-record, .sh-kd, .sh-date { display: none; }
}

/* ─── Match page ────────────────────────────────────────────────── */
.match-page-header {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}
.match-page-header::before {
  content: '';
  position: absolute;
  inset: -10%;
  background-image: var(--map-bg);
  background-size: cover;
  background-position: center;
  filter: blur(6px);
  opacity: 0.35;
  z-index: 0;
}
.mph-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2.5rem 0 2rem;
}
.mph-map {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: .4rem;
}
.mph-score {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: .04em;
  margin-bottom: .4rem;
}
.mph-score-win  { color: var(--win); }
.mph-score-sep  { color: var(--text); }
.mph-score-loss { color: var(--loss); }
.mph-meta { font-size: .85rem; color: var(--muted); }

.scoreboard { display: flex; flex-direction: column; gap: 1.5rem; }

.sb-team {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.sb-team-win  { border-left: 3px solid var(--win); }
.sb-team-loss { border-left: 3px solid var(--loss); }

.sb-team-header {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.sb-team-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .6rem;
}
.sb-team-label  { font-weight: 700; font-size: .9rem; }
.sb-team-result { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.sb-team-win  .sb-team-result { color: var(--win); }
.sb-team-loss .sb-team-result { color: var(--loss); }
.sb-team-score {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.sb-team-identity {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.sb-avg-elo {
  font-size: .75rem;
  color: var(--muted);
}
.sb-avg-elo strong { color: var(--elo); }

.sb-cols {
  display: grid;
  grid-template-columns: 1fr 70px 70px 45px 45px 45px 55px 55px 60px 70px;
  gap: .5rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 0;
}
.sb-col-player { padding-left: 40px; }
.sb-cols span:not(.sb-col-player) { text-align: center; }

.sb-row {
  display: grid;
  grid-template-columns: 1fr 70px 70px 45px 45px 45px 55px 55px 60px 70px;
  gap: .5rem;
  align-items: center;
  padding: .55rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  transition: background .1s;
}
.sb-row:last-child { border-bottom: none; }
.sb-row:hover { background: var(--surface-2); }

.sb-player {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}
.sb-agent {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--surface-2);
}
.sb-agent-ph {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  background: var(--surface-2);
  flex-shrink: 0;
}
.sb-name {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-name:hover { color: var(--accent); }
.sb-tag { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.sb-mvp {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  padding: .1rem .35rem;
  border-radius: 3px;
  background: rgba(245,158,11,.18);
  color: #f59e0b;
  vertical-align: middle;
  margin-left: .2rem;
}

.sb-elo    { color: var(--elo); font-weight: 600; text-align: center; }
.sb-acs    { text-align: center; font-weight: 600; }
.sb-acs-top { color: #f59e0b; }
.sb-kills   { text-align: center; color: var(--win); font-weight: 600; }
.sb-deaths  { text-align: center; color: var(--loss); font-weight: 600; }
.sb-assists { text-align: center; color: var(--text); }
.sb-kd      { text-align: center; color: var(--muted); }
.sb-elochange { text-align: center; font-weight: 700; }
.sb-elochange.pos { color: var(--win); }
.sb-elochange.neg { color: var(--loss); }

.sb-hs  { text-align: center; color: #a78bfa; font-weight: 600; }
.sb-dd  { text-align: center; font-weight: 600; }
.dd-pos { color: var(--win); }
.dd-neg { color: var(--loss); }

@media (max-width: 700px) {
  .sb-cols, .sb-row { grid-template-columns: 1fr 55px 55px 55px; }
  .sb-col-elo, .sb-elo,
  .sb-col-k,   .sb-kills,
  .sb-col-d,   .sb-deaths,
  .sb-col-a,   .sb-assists,
  .sb-col-hs,  .sb-hs,
  .sb-col-dd,  .sb-dd  { display: none; }
  .sb-col-player { padding-left: 36px; }
}

/* ─── Social links (profil) ─────────────────────────────────────── */
.profile-social {
  display: flex;
  gap: .45rem;
  margin-top: .6rem;
  flex-wrap: wrap;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .28rem .65rem;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
  line-height: 1;
}
.social-btn:hover { opacity: .75; }

.social-x {
  background: rgba(255,255,255,.07);
  color: var(--text);
  border: 1px solid var(--border);
}

.social-vlr {
  background: rgba(255,70,85,.1);
  color: #ff4655;
  border: 1px solid rgba(255,70,85,.3);
}
.social-vlr-logo {
  width: 14px;
  height: 14px;
  object-fit: contain;
}

/* ─── LFT & team (profil) ───────────────────────────────────────── */
.lft-line {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .35rem 0 .1rem;
}

.lft-badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.lft-yes {
  background: rgba(34,197,94,.15);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,.35);
}
.lft-no {
  background: rgba(239,68,68,.1);
  color: #ef4444;
  border: 1px solid rgba(239,68,68,.3);
}

.team-name {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .01em;
}
.team-name::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1em;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.team-logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 3px;
}

/* ─── Footer ────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  font-size: .8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
