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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #121212;
  color: #e0e0e0;
  min-height: 100vh;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 15px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  font-size: 2.2rem;
  color: #fff;
  margin: 10px 0 15px;
  letter-spacing: 2px;
}

.period-selector {
  margin-bottom: 10px;
}

.period-inputs {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.period-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.period-field label {
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.period-field input,
.period-field select {
  padding: 8px 12px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #1a1a1a;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
}

.period-field input:focus,
.period-field select:focus {
  border-color: #e94560;
}

.period-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  background: #e94560;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.period-btn:hover {
  background: #c93450;
}

.event-period {
  color: #888;
  font-size: 0.9rem;
}

/* Section title */
.section-title {
  text-align: center;
  color: #aaa;
  font-size: 0.85rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 25px;
  font-weight: 400;
}

/* Clan Cards Grid */
.clan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.clan-card {
  background: #1a1a1a;
  border-radius: 10px;
  overflow: hidden;
}

.clan-header {
  padding: 20px 25px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-bottom: 1px solid #2a2a2a;
}

.clan-logo {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  background: #333;
}

.clan-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  flex: 1;
}

.clan-stats {
  display: flex;
  gap: 20px;
}

.clan-stat {
  text-align: center;
}

.clan-stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}

.clan-stat-label {
  font-size: 0.7rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Player Table */
.player-table {
  width: 100%;
  border-collapse: collapse;
}

.player-table thead th {
  padding: 10px 15px;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  font-weight: 600;
  border-bottom: 1px solid #2a2a2a;
}

.player-table thead th:first-child {
  width: 50px;
  text-align: center;
}

.player-table thead th:nth-child(3),
.player-table thead th:nth-child(4) {
  text-align: center;
  width: 80px;
}

.player-table tbody tr {
  border-bottom: 1px solid #1f1f1f;
  transition: background 0.15s;
}

.player-table tbody tr:hover {
  background: #222;
}

.player-table tbody td {
  padding: 9px 15px;
  font-size: 0.9rem;
}

.player-table tbody td:first-child {
  text-align: center;
  font-weight: 700;
  color: #555;
  font-size: 0.85rem;
}

.player-table tbody td:nth-child(3),
.player-table tbody td:nth-child(4) {
  text-align: center;
  font-weight: 600;
}

.player-table tbody td:nth-child(3) {
  color: #4ecdc4;
}

.player-table tbody td:nth-child(4) {
  color: #e94560;
}

.player-nick {
  color: #fff;
  font-weight: 500;
}

/* Rank medals */
.rank-1 { color: #ffd700 !important; font-size: 1rem !important; }
.rank-2 { color: #c0c0c0 !important; font-size: 1rem !important; }
.rank-3 { color: #cd7f32 !important; font-size: 1rem !important; }

/* No kills indicator */
.no-kills {
  color: #444;
}

/* Loading & empty states */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: #555;
  font-size: 0.95rem;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #e94560;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.no-data {
  text-align: center;
  padding: 60px 20px;
  color: #444;
  font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 900px) {
  .clan-grid {
    grid-template-columns: 1fr;
  }
}

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

  .clan-header {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .clan-stats {
    justify-content: center;
  }

  .player-table thead th,
  .player-table tbody td {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
}

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

::-webkit-scrollbar-track {
  background: #1a1a1a;
}

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


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

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
}

.modal-content {
  position: relative;
  background: #1a1a1a;
  border-radius: 12px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content.x1-modal-content {
  overflow-y: auto;
  max-height: 85vh;
}

.x1-autocomplete {
  position: relative;
}

.x1-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #222;
  border: 1px solid #333;
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: 100;
  display: none;
  max-height: 180px;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: #666;
  font-size: 1.4rem;
  cursor: pointer;
  transition: color 0.2s;
}

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

.player-detail-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #2a2a2a;
}

.player-detail-header h2 {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.player-detail-header .clan-tag {
  color: #888;
  font-size: 0.85rem;
}

.player-detail-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
}

.player-detail-stat {
  text-align: center;
}

.player-detail-stat .value {
  font-size: 1.6rem;
  font-weight: 700;
}

.player-detail-stat .value.kills { color: #4ecdc4; }
.player-detail-stat .value.deaths { color: #e94560; }
.player-detail-stat .value.kd { color: #fff; }

.player-detail-stat .label {
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Kill/Death log */
.log-section {
  margin-top: 20px;
}

.log-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid #2a2a2a;
}

.log-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid #1f1f1f;
  font-size: 0.85rem;
}

.log-entry .target {
  color: #ccc;
}

.log-entry .target b {
  color: #fff;
  font-weight: 600;
}

.log-entry .date {
  color: #555;
  font-size: 0.75rem;
  white-space: nowrap;
  margin-left: 10px;
}

.log-kill .icon { color: #4ecdc4; }
.log-death .icon { color: #e94560; }


/* Latest kills */
.latest-kills {
  margin-bottom: 25px;
  background: #1a1a1a;
  border-radius: 8px;
  padding: 15px 20px;
}

.latest-kills-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 10px;
}

.latest-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #222;
  font-size: 0.82rem;
}

.latest-entry:last-child {
  border-bottom: none;
}

.latest-entry .icon {
  font-size: 0.9rem;
}

.latest-entry .desc {
  flex: 1;
  color: #aaa;
}

.latest-entry .desc b {
  color: #fff;
}

.latest-entry .time {
  color: #555;
  font-size: 0.75rem;
  white-space: nowrap;
}


/* Sound toggle button */
.sound-btn {
  padding: 8px 16px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #1a1a1a;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.sound-btn.muted {
  color: #555;
  border-color: #222;
}


/* X1 Button */
.x1-btn {
  background: #333;
  border: 1px solid #555;
}

.x1-btn:hover {
  background: #444;
}

/* X1 Modal */
.x1-header {
  text-align: center;
  margin-bottom: 20px;
}

.x1-header h2 {
  color: #fff;
  font-size: 1.4rem;
}

.x1-search {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.x1-field {
  flex: 1;
}

.x1-field label {
  display: block;
  font-size: 0.7rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.x1-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #222;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
}

.x1-field input:focus {
  border-color: #e94560;
}

.x1-vs {
  font-size: 1.2rem;
  font-weight: 700;
  color: #e94560;
  padding-bottom: 8px;
}

/* X1 Result */
.x1-result-box {
  margin-top: 25px;
  text-align: center;
}

.x1-scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}

.x1-player {
  text-align: center;
  flex: 1;
}

.x1-player .nick {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 3px;
}

.x1-player .clan {
  font-size: 0.75rem;
  color: #666;
}

.x1-player .score {
  font-size: 2.5rem;
  font-weight: 700;
  margin-top: 10px;
}

.x1-player.winner .score {
  color: #4ecdc4;
}

.x1-player.loser .score {
  color: #e94560;
}

.x1-player.draw .score {
  color: #888;
}

.x1-divider {
  font-size: 1.5rem;
  color: #444;
  font-weight: 700;
}

.x1-history {
  margin-top: 20px;
  text-align: left;
}

.x1-history h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid #2a2a2a;
}

.x1-kill-entry {
  padding: 5px 0;
  font-size: 0.82rem;
  color: #aaa;
  border-bottom: 1px solid #1f1f1f;
  display: flex;
  justify-content: space-between;
}

.x1-kill-entry .killer {
  color: #4ecdc4;
  font-weight: 600;
}


/* X1 Stats Table */
.x1-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #666;
  margin-bottom: 12px;
  margin-top: 20px;
  text-align: center;
}

.x1-stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}

.x1-stats-table th {
  padding: 8px 12px;
  font-size: 0.85rem;
  color: #fff;
  border-bottom: 1px solid #2a2a2a;
  text-align: center;
}

.x1-stats-table th:first-child {
  text-align: left;
}

.x1-stats-table td {
  padding: 10px 12px;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: #aaa;
  border-bottom: 1px solid #1f1f1f;
}

.x1-stat-label {
  text-align: left !important;
  font-weight: 400 !important;
  color: #888 !important;
  font-size: 0.85rem !important;
}

.x1-stat-better {
  color: #4ecdc4 !important;
}

.x1-stat-worse {
  color: #e94560 !important;
}


/* X1 Autocomplete */
.x1-suggestions.active {
  display: block;
}

.x1-suggestion-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #ccc;
  border-bottom: 1px solid #2a2a2a;
}

.x1-suggestion-item:hover {
  background: #333;
  color: #fff;
}

.x1-suggestion-item .sg-clan {
  color: #666;
  font-size: 0.75rem;
  margin-left: 8px;
}
