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

body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: #fafafa;
  color: #1a1a1a;
  line-height: 1.5;
}

/* Dark Mode Styles */
[data-theme="dark"] body {
  background-color: #0f0f0f;
  color: #e5e5e5;
}

[data-theme="dark"] .header h1 {
  color: #ffffff;
}

[data-theme="dark"] .instructions {
  color: #a0a0a0;
}

[data-theme="dark"] .instructions-link {
  color: #ffffff;
}

[data-theme="dark"] .instructions-link:hover {
  color: #e5e5e5;
}

[data-theme="dark"] .status {
  color: #d0d0d0;
}

[data-theme="dark"] .status a {
  color: #ffffff;
}

[data-theme="dark"] .status a:hover {
  color: #e5e5e5;
}

[data-theme="dark"] .league-id {
  color: #d0d0d0;
}

[data-theme="dark"] .league-id strong {
  color: #ffffff;
}

[data-theme="dark"] .league-name {
  color: #ffffff;
}

[data-theme="dark"] .input-form input {
  background: #1a1a1a;
  border-color: #333333;
  color: #e5e5e5;
}

[data-theme="dark"] .input-form input:focus {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .cta,
[data-theme="dark"] .export-btn {
  background: #ffffff;
  color: #000000;
  border: 1px solid #ffffff;
}

[data-theme="dark"] .cta:hover,
[data-theme="dark"] .export-btn:hover {
  background: #e5e5e5;
  color: #000000;
}



[data-theme="dark"] .theme-toggle {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

[data-theme="dark"] .theme-toggle:hover {
  background: #e5e5e5;
  color: #000000;
}

[data-theme="dark"] .league-summary,
[data-theme="dark"] .team-card,
[data-theme="dark"] .recent-picks-card,
[data-theme="dark"] .popup-content {
  background: #1a1a1a;
  border-color: #333333;
}

[data-theme="dark"] .instruction-section {
  border-bottom-color: #333333;
}

[data-theme="dark"] .instruction-section h4 {
  color: #ffffff;
  border-bottom-color: #444444;
}

[data-theme="dark"] .instruction-image img {
  border-color: #444444;
}

/* Dark mode position badges - keep same vibrant colors */
[data-theme="dark"] .position-badge.gkp {
  background: #ffd166;
  color: #061022;
}

[data-theme="dark"] .position-badge.def {
  background: #4dd4a3;
  color: #061022;
}

[data-theme="dark"] .position-badge.mid {
  background: #6aa7ff;
  color: #061022;
}

[data-theme="dark"] .position-badge.fwd {
  background: #ff6a6a;
  color: #061022;
}

[data-theme="dark"] .team-header {
  border-bottom-color: #333333;
}

[data-theme="dark"] .player-row {
  border-color: #333333;
}

[data-theme="dark"] .player-row.filled {
  background: #262626;
  border-color: #404040;
}

[data-theme="dark"] .player-row.empty {
  background: #1f1f1f;
  border-color: #333333;
}

[data-theme="dark"] .card-header {
  border-bottom-color: #333333;
}

[data-theme="dark"] .picks-table thead tr {
  border-bottom-color: #333333;
}

[data-theme="dark"] .picks-table tbody tr {
  border-bottom-color: #333333;
}

[data-theme="dark"] .popup-header {
  border-bottom-color: #333333;
}

[data-theme="dark"] .team-info h3,
[data-theme="dark"] .card-header h3,
[data-theme="dark"] .popup-header h3 {
  color: #ffffff;
}

[data-theme="dark"] .player-name {
  color: #e5e5e5;
}

[data-theme="dark"] .player-row.filled {
  background: #262626;
}

[data-theme="dark"] .player-row.empty {
  background: #1f1f1f;
}

[data-theme="dark"] .team-badge {
  background: #404040;
  color: #e0e0e0;
  border-color: #555555;
}

[data-theme="dark"] .picks-table th {
  color: #ffffff;
}

[data-theme="dark"] .picks-table td:first-child {
  color: #ffffff;
}

[data-theme="dark"] .picks-table td:last-child {
  color: #d0d0d0;
}

[data-theme="dark"] .picks-table tbody tr:hover {
  background-color: #262626;
}

[data-theme="dark"] .player-row.filled:hover {
  background: #2a2a2a;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .team-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.container {
  min-height: 100vh;
  padding: 1rem;
  max-width: 1280px;
  margin: 0 auto;
}

/* Header Styles */
.header {
  text-align: center;
  margin-bottom: 4rem;
  position: relative;
}

.theme-toggle {
  position: absolute;
  top: 0;
  right: 0;
  background: #000000;
  border: 1px solid #000000;
  border-radius: 0.5rem;
  padding: 0.5rem;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
}

.theme-toggle:hover {
  background: #1a1a1a;
  border-color: #1a1a1a;
}

.header-content {
  max-width: 600px;
  margin: 0 auto;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 600;
  color: #000000;
  margin: 0 0 1.5rem 0;
  letter-spacing: -0.025em;
}

.instructions {
  font-size: 1rem;
  color: #4a4a4a;
  margin: 0 0 2rem 0;
  font-weight: 400;
}

.instructions-link {
  background: none;
  border: none;
  color: #000000;
  text-decoration: underline;
  cursor: pointer;
  font-size: inherit;
  font-weight: 500;
  padding: 0;
}

.instructions-link:hover {
  color: #1a1a1a;
  text-decoration: none;
}

.input-form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
  justify-content: center;
}

.input-form input {
  flex: 1;
  max-width: 300px;
  padding: 1rem 1.25rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1.125rem;
  font-weight: 400;
  text-align: center;
  transition: all 0.2s ease;
  background: #ffffff;
  font-family: "Segoe UI", sans-serif;
}

/* Remove spinner buttons from number input */
.input-form input[type="number"]::-webkit-outer-spin-button,
.input-form input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-form input[type="number"] {
  -moz-appearance: textfield;
}

.input-form input:focus {
  outline: none;
  border-color: #000000;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.input-form input::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

.status {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 1rem 0;
  min-height: 1rem;
}

.status a {
  color: #000000;
  text-decoration: underline;
  font-weight: 500;
}

.status a:hover {
  color: #1a1a1a;
  text-decoration: none;
}

/* App Header Styles */
.app-header {
  padding: 20px 16px 8px;
  position: sticky;
  top: 0;
  backdrop-filter: blur(6px);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
}

.header-left {
  height: 1px;
}

.header-right {
  display: flex;
  justify-content: flex-end;
}

.theme-toggle {
  background: #f3f4f6;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.75rem;
  color: #111827;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.125rem;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: #e5e7eb;
  transform: translateY(-1px);
}

.app-header h1 {
  margin: 0 0 6px 0;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-align: center;
}

.subtitle {
  margin: 0;
  color: #6b7280;
  text-align: center;
}

.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.hero {
  display: grid;
  place-items: center;
  padding: 48px 12px 24px;
}

.hero .controls {
  max-width: 600px;
  width: 100%;
}

.controls {
  display: grid;
  justify-items: center;
  gap: 16px;
  width: 100%;
}

#league-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  width: 100%;
  max-width: 520px;
}

label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}

input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
}

button {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.1);
}

.cta {
  background: #000000;
  color: white;
  border: none;
  border-radius: 0.5rem;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: "Segoe UI", sans-serif;
}

.cta:hover {
  background: #1a1a1a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.status {
  min-height: 20px;
  color: #6b7280;
}

.league-info-section {
  margin-top: 2rem;
}

.league-summary {
  background: #ffffff;
  border: 1px solid #e1e5e9;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.league-details {
  text-align: center;
  margin-bottom: 1.5rem;
}

.league-id {
  display: block;
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
  font-weight: 400;
}

.league-id strong {
  color: #000000;
  font-weight: 600;
}

.league-name {
  display: block;
  font-size: 1.125rem;
  font-weight: 500;
  color: #1a1a1a;
}

.export-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.export-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background: #000000;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  font-family: "Segoe UI", sans-serif;
}

.export-btn:hover {
  background: #1a1a1a;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}



.export-icon {
  font-size: 1rem;
}

/* Popup Styles */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.popup-content {
  background: #ffffff;
  border-radius: 0.75rem;
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border: 1px solid #e1e5e9;
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e1e5e9;
}

.popup-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #000000;
  font-family: "Segoe UI", sans-serif;
}

.close-btn {
  background: #000000;
  border: none;
  font-size: 1.25rem;
  color: #ffffff;
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: #1a1a1a;
}

.popup-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(85vh - 120px);
}

.instruction-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #f1f3f5;
}

.instruction-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.instruction-section h4 {
  color: #1a1a1a;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e1e5e9;
}

.instruction-section ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.instruction-section li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.instruction-image {
  margin: 1rem 0;
  text-align: center;
}

.instruction-image img {
  max-width: 100%;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.popup-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

/* Teams Grid */
.teams-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 768px) {
  .teams-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .teams-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .teams-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Team Card */
.team-card {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #e1e5e9;
  overflow: hidden;
  transition: all 0.2s ease;
}

.team-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.team-header {
  padding: 1rem;
  border-bottom: 1px solid #e1e5e9;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.team-info h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #000000;
  margin-bottom: 0.25rem;
  font-family: "Segoe UI", sans-serif;
}

.team-info p {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 400;
}

/* Players List */
.players-list {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Player Row */
.player-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #e1e5e9;
  transition: all 0.2s;
}

.player-row.filled {
  background: #fafafa;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.player-row.filled:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
  background: #f8f8f8;
  transform: translateY(-1px);
}

.player-row.empty {
  background: #f9f9f9;
  border-style: dashed;
  border-color: #d1d5db;
}

/* Position Badges */
.position-badge {
  width: 3rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: bold;
  flex-shrink: 0;
}

.position-badge.gkp {
  background: #ffd166;
  color: #061022;
}

.position-badge.def {
  background: #4dd4a3;
  color: #061022;
}

.position-badge.mid {
  background: #6aa7ff;
  color: #061022;
}

.position-badge.fwd {
  background: #ff6a6a;
  color: #061022;
}

/* Player Info */
.player-info {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.player-name {
  font-weight: 500;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "Segoe UI", sans-serif;
}

.team-badge {
  font-size: 0.75rem;
  font-weight: 500;
  color: #4a4a4a;
  background-color: #f0f0f0;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  flex-shrink: 0;
  margin-left: 0.5rem;
  border: 1px solid #e1e5e9;
  min-width: 2.5rem;
  text-align: center;
}

.empty-slot {
  color: #9ca3af;
  font-style: italic;
  font-weight: 400;
}

/* Recent Picks Card */
.recent-picks-card {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #e1e5e9;
  margin-bottom: 2rem;
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e1e5e9;
}

.card-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #000000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: "Segoe UI", sans-serif;
}

.table-container {
  padding: 1.5rem;
  overflow-x: auto;
}

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

.picks-table thead tr {
  border-bottom: 1px solid #e1e5e9;
}

.picks-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: #1a1a1a;
  font-family: "Segoe UI", sans-serif;
}

.picks-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.2s;
}

.picks-table tbody tr:hover {
  background-color: #fafafa;
}

.picks-table td {
  padding: 0.75rem 1rem;
  font-family: "Segoe UI", sans-serif;
}

.picks-table td:first-child {
  font-weight: 500;
  color: #1a1a1a;
}

.picks-table td:last-child {
  color: #6b7280;
  font-weight: 400;
}

/* Utility Classes */
.hidden {
  display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header h1 {
    font-size: 2rem;
  }
  
  .input-form {
    flex-direction: column;
    gap: 1rem;
  }
  
  .input-form input {
    max-width: none;
  }
  
  .cta {
    width: 100%;
  }
  
  .export-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .export-btn {
    width: 100%;
    justify-content: center;
  }
  
  .popup-content {
    width: 95%;
  }
}

@media (max-width: 640px) {
  .teams-grid {
    grid-template-columns: 1fr;
  }
  
  .header h1 {
    font-size: 1.75rem;
  }
  
  .input-form input {
    font-size: 1rem;
    padding: 0.875rem 1rem;
  }
  
  .theme-toggle {
    position: static;
    margin-bottom: 1rem;
  }
  
  .header {
    text-align: center;
  }
}