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

:root {
  --bg-dark: #0a0e14;
  --bg-panel: #111820;
  --bg-card: #1a2230;
  --bg-hover: #243040;
  --border: #2a3545;
  --text-primary: #e0e6ed;
  --text-secondary: #7a8a9e;
  --text-muted: #4a5568;
  --ally-color: #1a8cff;
  --ally-bg: #0d1f3c;
  --ally-border: #1a5fb4;
  --enemy-color: #ff4444;
  --enemy-bg: #3c0d0d;
  --enemy-border: #b41a1a;
  --gold: #c8aa6e;
  --gold-dim: #785a28;
  --accent: #0acbe6;
  --green: #2ecc71;
  --orange: #f39c12;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
}

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

/* Header */
header {
  text-align: center;
  padding: 30px 0 20px;
}

header h1 {
  font-size: 2.2rem;
  background: linear-gradient(135deg, var(--gold), #f0d68a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 1px;
}

.subtitle {
  color: var(--text-secondary);
  margin-top: 8px;
  font-size: 1rem;
}

/* Role Filter */
.role-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.role-label {
  color: var(--text-secondary);
  font-weight: 600;
  margin-right: 8px;
}

.role-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.role-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.role-btn.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
}

/* Teams Container */
.teams-container {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 20px;
  margin-top: 20px;
}

@media (max-width: 1024px) {
  .teams-container {
    grid-template-columns: 1fr;
  }
  .recommendations-panel {
    order: -1;
  }
}

/* Team Panels */
.team-panel {
  background: var(--bg-panel);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border);
}

.team-title {
  font-size: 1.1rem;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  text-align: center;
}

.ally-title {
  color: var(--ally-color);
  border-bottom-color: var(--ally-border);
}

.enemy-title {
  color: var(--enemy-color);
  border-bottom-color: var(--enemy-border);
}

/* Pick Slots */
.pick-slots {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pick-slot {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  position: relative;
}

.pick-slot:hover {
  border-color: var(--text-muted);
  background: var(--bg-hover);
}

.ally-panel .pick-slot.filled {
  border: 2px solid var(--ally-border);
  background: var(--ally-bg);
}

.enemy-panel .pick-slot.filled {
  border: 2px solid var(--enemy-border);
  background: var(--enemy-bg);
}

.slot-placeholder {
  color: var(--text-muted);
  font-size: 0.95rem;
  width: 100%;
  text-align: center;
}

.slot-champ-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.ally-panel .slot-champ-icon {
  border-color: var(--ally-border);
}

.enemy-panel .slot-champ-icon {
  border-color: var(--enemy-border);
}

.slot-champ-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.slot-champ-tags {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Lane Selector */
.slot-role-selector {
  flex-shrink: 0;
}

.lane-select,
.lane-select-enemy {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  text-transform: uppercase;
  min-width: 70px;
  appearance: auto;
}

.lane-select:hover,
.lane-select-enemy:hover {
  border-color: var(--gold-dim);
}

.lane-select:focus,
.lane-select-enemy:focus {
  border-color: var(--gold);
}

.pick-slot.filled .lane-select {
  background: rgba(0, 0, 0, 0.3);
  border-color: var(--ally-border);
}

.pick-slot.filled .lane-select-enemy {
  background: rgba(0, 0, 0, 0.3);
  border-color: var(--enemy-border);
}

.lane-select-enemy {
  color: var(--enemy-color);
}

.slot-remove {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

.slot-remove:hover {
  color: var(--enemy-color);
  background: rgba(255, 68, 68, 0.15);
}

/* Recommendations Panel */
.recommendations-panel {
  background: var(--bg-panel);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--gold-dim);
}

.rec-title {
  font-size: 1.1rem;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gold-dim);
  text-align: center;
  color: var(--gold);
}

.rec-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rec-placeholder {
  color: var(--text-muted);
  text-align: center;
  padding: 40px 20px;
  font-size: 0.95rem;
}

.rec-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.2s;
  cursor: default;
}

.rec-card:hover {
  background: var(--bg-hover);
  border-color: var(--gold-dim);
}

.rec-rank {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 28px;
  text-align: center;
}

.rec-card:nth-child(1) .rec-rank { color: #ffd700; }
.rec-card:nth-child(2) .rec-rank { color: #c0c0c0; }
.rec-card:nth-child(3) .rec-rank { color: #cd7f32; }

.rec-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-dim);
}

.rec-info {
  flex: 1;
  min-width: 0;
}

.rec-name {
  font-weight: 700;
  font-size: 1rem;
}

.rec-tags {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.rec-roles {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.rec-role-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  background: var(--bg-dark);
  border-radius: 4px;
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 600;
}

.rec-score {
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 40px;
  text-align: right;
}

.rec-reasons {
  margin-top: 6px;
}

.rec-reason {
  font-size: 0.75rem;
  color: var(--green);
  line-height: 1.4;
}

.rec-reason.negative {
  color: var(--enemy-color);
}

.rec-reason::before {
  content: '✓ ';
}

.rec-reason.negative::before {
  content: '✗ ';
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 800px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  white-space: nowrap;
  color: var(--gold);
}

#champion-search {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
}

#champion-search:focus {
  border-color: var(--gold);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-tags {
  display: flex;
  gap: 6px;
  padding: 12px 20px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}

.tag-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.tag-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tag-btn.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
}

.modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  padding: 16px 20px;
  overflow-y: auto;
}

.champ-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
}

.champ-cell:hover {
  background: var(--bg-hover);
  border-color: var(--gold-dim);
}

.champ-cell.disabled {
  opacity: 0.3;
  pointer-events: none;
}

.champ-cell img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.champ-cell:hover img {
  border-color: var(--gold);
}

.champ-cell span {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

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

/* Scrollbar */
.modal-grid::-webkit-scrollbar {
  width: 8px;
}

.modal-grid::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

.modal-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.modal-grid::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
