* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f1923;
  color: #e0e0e0;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #1a2a3a, #0f1923);
  border-bottom: 2px solid #2a4a6a;
  padding: 24px;
  text-align: center;
}

header h1 {
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.85rem;
  color: #8899aa;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Controls */
.controls {
  margin-bottom: 16px;
}

#search {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid #2a4a6a;
  border-radius: 8px;
  background: #1a2a3a;
  color: #fff;
  outline: none;
  margin-bottom: 10px;
}

#search:focus {
  border-color: #4a8abf;
}

#search::placeholder {
  color: #667788;
}

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

.filters select {
  padding: 8px 12px;
  font-size: 0.9rem;
  border: 1px solid #2a4a6a;
  border-radius: 6px;
  background: #1a2a3a;
  color: #e0e0e0;
  outline: none;
  cursor: pointer;
  flex: 1;
  min-width: 120px;
}

.filters select:focus {
  border-color: #4a8abf;
}

.result-count {
  font-size: 0.85rem;
  color: #8899aa;
  margin-bottom: 12px;
}

/* Player List */
.player-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.player-card {
  background: #1a2a3a;
  border: 1px solid #2a4a6a;
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.player-card:hover {
  transform: translateY(-2px);
  border-color: #4a8abf;
}

.player-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.player-card .player-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.player-card .player-meta {
  font-size: 0.8rem;
  color: #8899aa;
}

.player-card .overall {
  font-size: 1.4rem;
  font-weight: 800;
}

.player-card .stats-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}

.player-card .stat-item {
  text-align: center;
  font-size: 0.75rem;
}

.player-card .stat-item .stat-label {
  color: #667788;
  display: block;
}

.player-card .stat-item .stat-value {
  color: #ccc;
  font-weight: 600;
  font-size: 0.9rem;
}

/* Grade colors */
.grade-normal { color: #999; }
.grade-bronze { color: #cd7f32; }
.grade-silver { color: #c0c0c0; }
.grade-gold { color: #ffd700; }
.grade-diamond { color: #b9f2ff; }
.grade-signature { color: #ff6b9d; }

.grade-badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

.grade-badge.grade-normal { background: #33333380; }
.grade-badge.grade-bronze { background: #cd7f3230; }
.grade-badge.grade-silver { background: #c0c0c030; }
.grade-badge.grade-gold { background: #ffd70030; }
.grade-badge.grade-diamond { background: #b9f2ff30; }
.grade-badge.grade-signature { background: #ff6b9d30; }

/* Position badge */
.position-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: #2a4a6a;
  color: #aabbcc;
  font-weight: 600;
}

/* Loading */
.loading {
  text-align: center;
  padding: 60px;
  color: #667788;
  font-size: 1.1rem;
}

.loading.hidden {
  display: none;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.modal-content {
  position: relative;
  background: #1a2a3a;
  border: 1px solid #2a4a6a;
  border-radius: 12px;
  padding: 28px;
  max-width: 550px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #8899aa;
  font-size: 1.6rem;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

.detail-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #2a4a6a;
}

.detail-header .name {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.detail-header .info {
  font-size: 0.85rem;
  color: #8899aa;
  margin-top: 4px;
}

.detail-overall {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}

.detail-overall .ovr-number {
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
}

.detail-overall .ovr-label {
  font-size: 0.8rem;
  color: #667788;
}

/* Stat bars */
.stat-section {
  margin-bottom: 20px;
}

.stat-section h3 {
  font-size: 0.9rem;
  color: #8899aa;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.stat-bar-label {
  width: 70px;
  font-size: 0.8rem;
  color: #aabbcc;
  flex-shrink: 0;
}

.stat-bar-track {
  flex: 1;
  height: 8px;
  background: #0f1923;
  border-radius: 4px;
  overflow: hidden;
  margin: 0 8px;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.stat-bar-value {
  width: 32px;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
  flex-shrink: 0;
}

/* Season stats table */
.season-stats {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 8px;
}

.season-stats th {
  background: #0f1923;
  color: #8899aa;
  padding: 6px 8px;
  text-align: center;
  font-weight: 600;
}

.season-stats td {
  padding: 6px 8px;
  text-align: center;
  border-top: 1px solid #2a4a6a30;
}

/* Footer */
footer {
  text-align: center;
  padding: 24px;
  margin-top: 40px;
  border-top: 1px solid #2a4a6a;
  font-size: 0.8rem;
  color: #556677;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #0f1923;
}

::-webkit-scrollbar-thumb {
  background: #2a4a6a;
  border-radius: 3px;
}

@media (max-width: 600px) {
  header h1 {
    font-size: 1.3rem;
  }

  .player-list {
    grid-template-columns: 1fr;
  }

  .filters {
    flex-direction: column;
  }

  .filters select {
    min-width: unset;
  }
}
