* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4ecdc4;
  --primary-dark: #44a08d;
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-light: #1e2d4a;
  --text: #ffffff;
  --text-muted: rgba(255,255,255,0.6);
  --border: rgba(255,255,255,0.1);
  --success: #4ecdc4;
  --warning: #ffd93d;
  --danger: #ff6b6b;
  --draw: #a8a8a8;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(26, 26, 46, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 800px;
  margin: 0 auto;
}

.header h1 {
  font-size: 18px;
  font-weight: 700;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
  padding: 5px;
}

/* Sidebar */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
}

.overlay.active {
  display: block;
}

.sidebar {
  position: fixed;
  top: 0;
  right: -280px;
  width: 280px;
  height: 100%;
  background: var(--bg-card);
  z-index: 300;
  transition: right 0.3s ease;
  padding: 20px;
}

.sidebar.active {
  right: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.sidebar-header h2 {
  font-size: 20px;
}

.btn-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}

.nav-list {
  list-style: none;
}

.nav-list li a {
  display: block;
  padding: 14px 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.nav-list li a:hover {
  background: rgba(255,255,255,0.05);
}

.nav-divider {
  border-top: 1px solid var(--border);
  margin: 10px 0;
}

/* Main Content */
.main-content {
  padding: 70px 16px 90px;
  max-width: 800px;
  margin: 0 auto;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(22, 33, 62, 0.98);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: calc(8px + var(--safe-bottom));
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.nav-label {
  font-size: 11px;
  font-weight: 500;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Tabela de classificação */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.standings-table th {
  padding: 8px 4px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}

.standings-table th:first-child,
.standings-table td:first-child {
  text-align: left;
  padding-left: 8px;
}

.standings-table td {
  padding: 10px 4px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.standings-table tr:last-child td {
  border-bottom: none;
}

.standings-table .pos {
  font-weight: 700;
  width: 25px;
}

.standings-table .player-name {
  font-weight: 600;
  text-align: left;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.standings-table .points {
  font-weight: 700;
  color: var(--primary);
}

.qualify-zone {
  border-left: 3px solid var(--primary);
}

/* Match cards */
.match-card {
  background: var(--bg-card-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.match-card:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

.match-card.played {
  opacity: 0.85;
}

.match-player {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

.match-player.home {
  text-align: right;
  padding-right: 10px;
}

.match-player.away {
  text-align: left;
  padding-left: 10px;
}

.match-score {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 700;
  min-width: 60px;
  justify-content: center;
}

.match-score .vs {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.match-penalties {
  font-size: 11px;
  color: var(--warning);
  text-align: center;
  margin-top: 4px;
}

/* Round header */
.round-header {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  margin: 20px 0 10px;
  padding: 8px 12px;
  background: rgba(78, 205, 196, 0.1);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
}

/* Buttons */
.btn-primary {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.05);
}

.btn-danger {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--primary);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

/* Score input */
.score-input-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
}

.score-input-group .player-label {
  font-size: 14px;
  font-weight: 600;
  flex: 1;
}

.score-input-group .player-label.home {
  text-align: right;
}

.score-input-group .player-label.away {
  text-align: left;
}

.score-input {
  width: 55px;
  height: 55px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  outline: none;
}

.score-input:focus {
  border-color: var(--primary);
}

.score-separator {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 0;
}

.modal-header h3 {
  font-size: 18px;
}

.modal-body {
  padding: 20px;
}

/* Tags de jogadores */
.player-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.player-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(78, 205, 196, 0.15);
  border: 1px solid rgba(78, 205, 196, 0.3);
  border-radius: 20px;
  font-size: 13px;
}

.player-tag .remove-player {
  cursor: pointer;
  color: var(--danger);
  font-weight: 700;
}

/* Status badge */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.group {
  background: rgba(78, 205, 196, 0.2);
  color: var(--primary);
}

.status-badge.knockout {
  background: rgba(255, 217, 61, 0.2);
  color: var(--warning);
}

.status-badge.final {
  background: rgba(255, 107, 107, 0.2);
  color: var(--danger);
}

.status-badge.finished {
  background: rgba(78, 205, 196, 0.2);
  color: var(--success);
}

/* Champion overlay */
.champion-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.champion-overlay.active {
  display: flex;
}

.champion-content {
  text-align: center;
  padding: 40px 20px;
  position: relative;
}

.trophy-animation {
  font-size: 100px;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.champion-title {
  font-size: 36px;
  color: var(--warning);
  margin: 20px 0 10px;
  text-shadow: 0 0 20px rgba(255, 217, 61, 0.5);
}

.champion-name {
  font-size: 28px;
  color: var(--text);
  margin-bottom: 15px;
}

.champion-stars {
  font-size: 30px;
  margin-bottom: 30px;
  animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Confetti */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(720deg);
  }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 50px;
  margin-bottom: 15px;
}

.empty-state p {
  font-size: 15px;
  margin-bottom: 20px;
}

/* Knockout bracket */
.knockout-phase {
  margin-bottom: 30px;
}

.knockout-phase-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--warning);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(255, 217, 61, 0.1);
  border-radius: 8px;
  border-left: 3px solid var(--warning);
}

.knockout-series {
  background: var(--bg-card-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.knockout-series-header {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  font-weight: 600;
}

.aggregate-score {
  text-align: center;
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* History */
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.history-card:hover {
  border-color: var(--primary);
}

.history-card h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.history-card .meta {
  font-size: 13px;
  color: var(--text-muted);
}

.history-card .champion-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(255, 217, 61, 0.15);
  border-radius: 12px;
  font-size: 12px;
  color: var(--warning);
  margin-top: 8px;
}

/* Utilities */
.text-center { text-align: center; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Responsive */
@media (min-width: 768px) {
  .bottom-nav {
    display: none;
  }
  .main-content {
    padding-bottom: 30px;
  }
}
