/* ==========================================================================
   Page-specific components (built on tokens from style.css)
   ========================================================================== */

.page-header {
  padding: 56px 0 32px;
  border-bottom: 1px solid var(--line-soft);
}

.page-header h1 {
  font-size: clamp(28px, 4vw, 40px);
  margin-bottom: 10px;
}

.page-header p {
  color: var(--text-muted);
  max-width: 60ch;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 28px 0;
}

.segmented {
  display: inline-flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 3px;
  gap: 2px;
}

.segmented button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13.5px;
  padding: 8px 16px;
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.segmented button.active {
  background: var(--gold);
  color: #1a1305;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 100px;
  padding: 10px 18px;
  font-size: 14px;
  font-family: var(--font-body);
}

.search-box input:focus {
  outline: none;
  border-color: var(--gold-dim);
}

/* ---------- Leaderboard table shell ---------- */
.table-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.rank-row-head {
  display: grid;
  grid-template-columns: 44px 44px 1fr auto auto;
  gap: 16px;
  padding: 12px 20px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

@media (max-width: 860px) {
  .rank-row-head { grid-template-columns: 32px 36px 1fr auto; }
  .rank-row-head .wl-col { display: none; }
}

.load-more-wrap {
  text-align: center;
  margin-top: 28px;
}

/* ---------- Match history ---------- */
.match-list { display: flex; flex-direction: column; gap: 12px; }

.match-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
}

.match-side {
  display: flex;
  align-items: center;
  gap: 12px;
}

.match-side.right { flex-direction: row-reverse; text-align: right; }

.match-side img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  image-rendering: pixelated;
}

.match-side .name {
  font-weight: 700;
  font-size: 14.5px;
}

.match-elo {
  font-family: var(--font-mono);
  font-size: 12.5px;
  margin-top: 2px;
}

.match-elo.up { color: var(--win); }
.match-elo.down { color: var(--lose); }

.match-center {
  text-align: center;
  min-width: 90px;
}

.match-mode {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold);
  margin-bottom: 4px;
}

.match-vs {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-faint);
}

.match-meta {
  text-align: right;
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  white-space: nowrap;
}

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

@media (max-width: 700px) {
  .match-card {
    grid-template-columns: 1fr;
    gap: 10px;
    text-align: center;
  }
  .match-side, .match-side.right { flex-direction: column; text-align: center; }
  .match-meta { text-align: center; }
}

/* ---------- Shop ---------- */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.shop-card { display: flex; flex-direction: column; overflow: hidden; }

.shop-card-photo {
  aspect-ratio: 16 / 10;
  background: var(--panel-2);
  overflow: hidden;
  position: relative;
}

.shop-card-photo img { width: 100%; height: 100%; object-fit: cover; }

.shop-card-cat {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(8, 9, 12, 0.75);
  backdrop-filter: blur(6px);
  color: var(--gold);
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--line);
}

.shop-card-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.shop-card-body h3 { font-size: 17px; }

.shop-card-body p {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 0;
  flex: 1;
}

.shop-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.shop-price {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 17px;
  color: var(--gold);
}

.shop-price small { color: var(--text-faint); font-size: 11px; font-weight: 500; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 7, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
  max-width: 380px;
  padding: 28px;
  animation: modal-in 0.25s var(--ease);
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h3 { font-size: 19px; margin-bottom: 6px; }
.modal p.hint { font-size: 13px; color: var(--text-muted); margin: 0 0 18px; }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  background: var(--void);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 15px;
}

.field input:focus { outline: none; border-color: var(--gold-dim); }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

.modal-status {
  margin-top: 14px;
  font-size: 13.5px;
  text-align: center;
  min-height: 18px;
}

.modal-status.ok { color: var(--win); }
.modal-status.err { color: var(--lose); }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.modal { position: relative; }

/* ---------- Player profile ---------- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 48px 0 36px;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  image-rendering: pixelated;
  border: 2px solid var(--line);
  background: var(--panel);
}

.profile-name { font-size: clamp(26px, 4vw, 36px); margin-bottom: 8px; }

.profile-elo {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 10px;
}

.profile-elo .num {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  color: var(--gold);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 32px 0;
}

.stat-cell {
  background: var(--panel);
  padding: 20px;
  text-align: center;
}

.stat-cell .num {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
}

.stat-cell .label {
  font-size: 11.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 6px;
}

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

.mode-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.mode-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}

.mode-table tr:last-child td { border-bottom: none; }
.mode-table td.mono { font-family: var(--font-mono); }

.not-found {
  text-align: center;
  padding: 100px 20px;
}

.not-found h2 { font-size: 24px; margin-bottom: 10px; }
.not-found p { color: var(--text-muted); }
