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

:root {
  --bg: #f4f4f4;
  --surface: #ffffff;
  --surface-muted: #f8f8f8;
  --border: #dcdcdc;
  --border-strong: #c0c0c0;
  --text-primary: #1f1f1f;
  --text-secondary: #6a6a6a;
  --text-tertiary: #949494;
  --accent: #2c2c2c;
  --accent-hover: #101010;
  --accent-muted: #e5e5e5;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 24px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 22px 45px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

header {
  background: #1c1c1c;
  color: var(--surface);
  padding: 24px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.header-branding {
  flex: 1 1 auto;
}

header h1 {
  font-size: 1.9rem;
  margin: 0;
  line-height: 1.2;
}

.slogan {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin: 4px 0 0 0;
  font-weight: 400;
  letter-spacing: 0.3px;
  text-transform: none;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h2 {
  margin: 0;
  padding: 0;
  border: none;
}

main {
  padding: 36px;
  min-width: 0;
  overflow: hidden;
}

section {
  margin-bottom: 40px;
}

section h2 {
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: var(--text-primary);
  font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.btn {
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease, border-color 0.2s ease;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
  background: var(--surface);
  color: var(--text-primary);
}

.btn-primary {
  background: var(--accent);
  color: #f5f5f5;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  background: #2f2f2f;
  color: #f3f3f3;
  border-color: #2f2f2f;
  padding: 8px 18px;
  font-size: 0.9rem;
}

.btn-danger:hover {
  background: #111;
  border-color: #111;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
  padding: 8px 18px;
  font-size: 0.9rem;
}

.btn-secondary:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.btn-icon {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  padding: 6px 8px;
  color: var(--text-secondary);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.btn-icon:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

#tournaments-container {
  display: grid;
  gap: 24px;
}

.tournament-card {
  background: var(--surface);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  min-width: 0;
  overflow: visible;
}

.tournament-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.08);
  transform: translateY(-3px);
}

.tournament-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 16px;
}

.tournament-title {
  font-size: 1.2rem;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.shared-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 500;
}

.tournament-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.tournament-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text-secondary);
}

.status-upcoming {
  background: #ededed;
  border-color: #d6d6d6;
  color: #2b2b2b;
}

.status-ongoing {
  background: #e2e2e2;
  border-color: #c8c8c8;
  color: #1f1f1f;
}

.status-completed {
  background: #d8d8d8;
  border-color: #bfbfbf;
  color: #3a3a3a;
}

.tournament-info {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}

.tournament-info p {
  margin-bottom: 4px;
}

.tournament-meta {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.tournament-meta h2 {
  margin-top: 0;
  color: var(--text-primary);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}

.meta-item {
  padding: 10px;
  background: var(--surface-muted);
  border-radius: 5px;
}

.meta-item strong {
  display: block;
  color: var(--text-secondary);
  margin-bottom: 5px;
  font-weight: 600;
}

.metadata-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.tournament-actions {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.empty-state {
  text-align: center;
  color: #999;
  padding: 40px;
  font-size: 1.1rem;
}

.player-form {
  background: var(--surface-muted);
  padding: 18px;
  border-radius: 10px;
  margin-top: 18px;
  border: 1px solid var(--border);
}

.player-form h4 {
  margin-bottom: 10px;
  color: var(--text-primary);
}

.player-input-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  align-items: stretch;
}

.player-input-group input,
.player-input-group select,
.player-input-group button {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  height: 38px;
  box-sizing: border-box;
}

.player-input-group input {
  flex: 1;
  min-width: 0;
}

.autocomplete-wrapper {
  position: relative;
  flex: 0 0 150px;
  display: flex;
  align-items: stretch;
}

.input-small {
  flex: 0 0 70px;
  min-width: 70px;
  max-width: 70px;
}

.player-input-group select.input-small {
  flex: 0 0 180px;
  min-width: 180px;
  max-width: 180px;
}

.input-medium {
  flex: 0 0 120px;
  min-width: 120px;
  max-width: 120px;
}

.player-input-group button {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Player form mode toggle */
.player-form[data-mode="simple"] .player-field-advanced {
  display: none;
}

.player-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
  gap: 10px;
}

.player-mode-toggle {
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
  font-weight: 500;
}

.player-mode-toggle:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.player-form[data-mode="simple"] .toggle-text-simple {
  display: inline;
}

.player-form[data-mode="simple"] .toggle-text-advanced {
  display: none;
}

.player-form[data-mode="advanced"] .toggle-text-simple {
  display: none;
}

.player-form[data-mode="advanced"] .toggle-text-advanced {
  display: inline;
}

.player-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  width: 600px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  z-index: 1000;
}

.suggestions-tabs {
  display: flex;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.suggestions-tab {
  flex: 1;
  padding: 10px 15px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.suggestions-tab:hover {
  background: var(--surface-muted);
  color: var(--text-primary);
}

.suggestions-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.suggestions-content {
  position: relative;
}

.suggestions-list {
  display: none;
}

.suggestions-list.active {
  display: block;
}

.player-suggestion-item {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
  background: var(--surface);
}

.player-suggestion-item:hover {
  background-color: var(--surface-muted);
}

.player-suggestion-item:last-child {
  border-bottom: none;
}

.player-suggestion-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.player-suggestion-details {
  display: flex;
  gap: 12px;
  font-size: 0.85em;
  color: #666;
}

.player-rating {
  color: var(--accent);
  font-weight: 600;
}

.player-federation {
  color: #666;
}

.player-id {
  color: #999;
  font-size: 0.9em;
}

.player-loading, .player-error, .player-no-results {
  padding: 15px;
  text-align: center;
  color: #666;
  font-style: italic;
}

.player-error {
  color: #dc3545;
}

.player-search-hint {
  display: block;
  color: #999;
  font-size: 0.85em;
  margin-top: 5px;
}

.players-list {
  margin-top: 15px;
}

.players-list h4,
.pairings-standings-section h4 {
  color: var(--text-primary);
  margin-bottom: 10px;
}

.pairings-standings-section {
  margin-top: 15px;
}

.collapsible-header {
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  transition: color 0.2s;
}

.collapsible-header:hover {
  color: var(--accent);
}

.collapsible-header span {
  display: inline-block;
  width: 20px;
  font-size: 0.8em;
}

.player-row.player-highlight {
  border-color: var(--accent);
  background: var(--surface-muted);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.matches-section {
  margin-top: 15px;
}

.matches-list {
  margin-top: 10px;
  background: var(--surface-muted);
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.round-section {
  margin-bottom: 20px;
}

.round-section h5 {
  color: var(--text-primary);
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.matches-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
}

.matches-table thead {
  background: var(--surface-muted);
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-strong);
}

.matches-table th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.matches-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.matches-table tbody tr:last-child td {
  border-bottom: none;
}

.matches-table tbody tr {
  transition: all 0.2s ease;
}

.matches-table tbody tr:hover {
  background: var(--surface-muted);
  transform: scale(1.01);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.result-select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-right: 5px;
  font-size: 0.9rem;
  background: var(--surface);
}

.result-cell em {
  color: #999;
  font-style: italic;
}

.btn-small {
  padding: 5px 10px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  background: var(--surface);
  color: var(--text-secondary);
}

.btn-small.btn-primary {
  background: var(--accent);
  color: #f5f5f5;
  border-color: var(--accent);
}

.btn-small.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-small.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-small.btn-secondary:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

/* Tabs */
.tournament-tabs {
  margin-top: 20px;
  background: var(--surface);
  border-radius: 10px;
  overflow: visible;
  border: 1px solid var(--border);
  min-width: 0;
}

/* Tournament info header with logo */
.tournament-info-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.tournament-info-header .tournament-logo {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.tournament-info-header .tournament-header-content {
  flex: 1;
  min-width: 0;
}

.tab-buttons {
  display: flex;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  margin-top: 24px;
}

.tab-button {
  flex: 1;
  padding: 14px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.tab-button:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.tab-button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.tab-content {
  padding: 20px;
  background: var(--surface);
  min-width: 0;
  overflow: visible;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  min-width: 0;
  overflow: visible;
}

/* Round selector */
.round-selector {
  display: flex;
  align-items: flex-start;
  width: 100%;
  gap: 12px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  padding: 5px 0;
}

.round-selector-buttons {
  display: flex;
  flex: 1 1 auto;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.round-selector-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}

/* Standings */
.standings-table-container {
  background: var(--surface);
}

.standings-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 15px;
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
}

.standings-table thead {
  background: var(--surface-muted);
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-strong);
}

.standings-table th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.standings-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.standings-table td small {
  display: inline;
  margin-left: 8px;
}

.standings-table td br {
  display: none;
}

.standings-table tbody tr:last-child td {
  border-bottom: none;
}

.standings-table tbody tr {
  transition: all 0.2s ease;
}

.standings-table tbody tr:hover {
  background: var(--surface-muted);
  transform: scale(1.01);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.standings-legend {
  margin-top: 15px;
  padding: 12px;
  background: var(--surface-muted);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.standings-legend p {
  margin: 5px 0;
  color: var(--text-secondary);
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  header {
    padding: 16px 20px;
  }

  header h1 {
    font-size: 1.8rem;
  }

  .header-controls {
    gap: 10px;
  }

  #create-tournament-btn {
    width: 100%;
    order: 3;
  }

  #auth-status {
    order: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  #language-selector {
    order: 1;
  }

  /* Player form responsive adjustments */
  .autocomplete-wrapper {
    flex: 1 1 200px;
    min-width: 200px;
  }

  .player-input-group select.input-small {
    flex: 1 1 150px;
    min-width: 150px;
    max-width: none;
  }

  .player-input-group input.input-small {
    flex: 0 1 80px;
    min-width: 80px;
    max-width: none;
  }

  .player-input-group input.input-medium {
    flex: 1 1 140px;
    min-width: 140px;
    max-width: none;
  }

  .player-suggestions {
    width: 100%;
    max-width: 500px;
  }

  .tournament-header {
    flex-direction: column;
  }

  .tournament-actions {
    flex-direction: column;
  }

  .overview-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .overview-actions {
    align-items: flex-start;
  }
}

/* Authentication */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.auth-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

#auth-status {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.user-greeting {
  color: white;
  white-space: nowrap;
}

#language-selector {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.language-selector-compact {
  padding: 6px 10px !important;
  font-size: 13px !important;
  min-width: 60px;
  opacity: 0.8;
}

.language-selector-compact:hover {
  opacity: 1;
}

#language-selector:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

#language-selector option {
  background: #1c1c1c;
  color: white;
}

/* User Menu Styles */
.user-menu-container {
  position: relative;
}

.user-menu-button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: white;
}

.user-menu-button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #2a2a2a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  min-width: 220px;
  z-index: 10000;
  overflow: hidden;
}

.user-menu-section {
  padding: 14px 16px;
}

.user-menu-label {
  font-size: 0.75rem;
  color: #999;
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-menu-language {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.user-menu-language:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.user-menu-language option {
  background: #2a2a2a;
  color: white;
}

.user-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0;
}

.user-menu-item {
  width: 100%;
  background: none;
  border: none;
  padding: 12px 16px;
  text-align: left;
  cursor: pointer;
  color: white;
  font-size: 14px;
  transition: background 0.2s;
  display: block;
  border-radius: 0;
}

.user-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Modal Styles */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal[style*="display: block"] {
  display: flex !important;
}

.modal-content {
  background-color: white;
  padding: 40px;
  border-radius: 10px;
  max-width: 450px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.close {
  position: absolute;
  right: 15px;
  top: 15px;
  font-size: 28px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover,
.close:focus {
  color: #000;
}

.auth-form h2 {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.auth-switch {
  margin-top: 15px;
  text-align: center;
  font-size: 0.9em;
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.error-message {
  color: #e74c3c;
  background-color: #fee;
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 15px;
  font-size: 0.9em;
  display: block;
  min-height: 20px;
}

.error-message:empty {
  display: none;
}

.success-message {
  color: #27ae60;
  background-color: #efffef;
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 15px;
  font-size: 0.9em;
  display: block;
  min-height: 20px;
}

.success-message:empty {
  display: none;
}

.account-info,
.password-change {
  margin-bottom: 30px;
}

.account-info h3,
.password-change h3 {
  color: var(--text-primary);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.account-info p {
  margin: 10px 0;
  color: #555;
}

.account-info strong {
  display: inline-block;
  width: 140px;
  color: var(--text-primary);
}

/* Share Link */
.share-info {
  background-color: var(--surface-muted);
  padding: 16px;
  border-radius: 10px;
  margin-top: 18px;
  border: 1px solid var(--border);
}

.share-info p {
  margin: 0 0 10px 0;
  color: var(--text-secondary);
}

.share-link-container {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.share-link-container input {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--surface);
  font-family: monospace;
  font-size: 0.9em;
}

.share-link-container textarea {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: var(--surface);
  font-family: monospace;
  font-size: 12px;
  resize: vertical;
  min-height: 80px;
  color: var(--text-primary);
  line-height: 1.4;
}

/* Read-Only Mode (for shared/embedded tournaments) */
.read-only .result-select,
.read-only .player-form,
.read-only .tournament-actions,
.read-only .metadata-actions,
.read-only .collapsible-header span,
.read-only #generate-pairings,
.read-only [id^="generate-pairings-"],
.read-only [id^="delete-round-btn-"],
.read-only [id^="view-logs-btn-"],
.read-only [onclick*="generatePairings"],
.read-only [onclick*="deleteLatestRound"],
.read-only [onclick*="viewPairingLogs"],
.read-only [onclick^="generateRoundRobinPairings"] {
  display: none !important;
}

/* Keep round viewing buttons and print buttons visible and clickable */
.read-only .round-selector button:not([onclick*="generatePairings"]):not([onclick*="generateRoundRobinPairings"]):not([onclick*="deleteLatestRound"]):not([onclick*="viewPairingLogs"]),
.read-only .standings-round-selector button,
.read-only .btn-icon[onclick*="print"] {
  display: inline-block !important;
  pointer-events: auto;
}

/* Print Styles */
@media print {
  /* Hide unnecessary elements */
  body {
    background: white;
    padding: 0;
  }

  .container {
    box-shadow: none;
    max-width: 100%;
  }

  header,
  .btn,
  .btn-icon,
  .btn-small,
  .round-selector button,
  .tab-buttons,
  .player-form,
  .tournament-actions,
  .metadata-actions,
  .collapsible-header span,
  .result-select {
    display: none !important;
  }

  /* Show only the tournament content */
  .tournament-card {
    page-break-inside: avoid;
    border: none;
    box-shadow: none;
    background: white;
  }

  .tournament-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
  }

  .tournament-info {
    margin-bottom: 20px;
  }

  /* Pairings & Standings Tables */
  .matches-table,
  .standings-table {
    width: 100%;
    border-collapse: collapse;
    box-shadow: none;
    page-break-inside: avoid;
    margin-bottom: 20px;
  }

  .matches-table thead,
  .standings-table thead {
    background: white !important;
    border-bottom: 2px solid #000;
  }

  .matches-table th,
  .standings-table th {
    color: #000 !important;
    font-weight: 700;
    padding: 10px;
    border-bottom: 2px solid #000;
  }

  .matches-table td,
  .standings-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #ccc;
    color: #000;
  }

  .matches-table tbody tr,
  .standings-table tbody tr {
    page-break-inside: avoid;
  }

  /* Round sections */
  .round-section {
    page-break-inside: avoid;
    margin-bottom: 30px;
  }

  .round-section h5 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    border-bottom: 1px solid #000;
    padding-bottom: 5px;
  }

  /* Remove colors and backgrounds */
  .matches-table tbody tr:hover,
  .standings-table tbody tr:hover {
    background: white !important;
    transform: none !important;
    box-shadow: none !important;
  }

  /* Make sure text is black */
  * {
    color: #000 !important;
  }

  /* Hide result dropdowns, show only text */
  .result-cell em {
    font-style: normal;
  }

  /* Page breaks */
  .pairings-standings-section {
    page-break-before: auto;
  }

  h4 {
    page-break-after: avoid;
  }

  /* Remove tabs styling */
  .tab-content {
    padding: 0;
  }

  .tab-pane {
    display: block !important;
  }

  /* Hide collapsible indicators */
  .collapsible-header {
    cursor: default;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 15px;
  }

  /* Standings legend */
  .standings-legend {
    background: white;
    border: 1px solid #ccc;
    padding: 10px;
    font-size: 0.9rem;
  }
}

/* Main Tournament Tabs */
.main-tournament-tabs {
  margin-top: 20px;
}

.main-tab-buttons {
  display: flex;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  border-radius: 10px 10px 0 0;
}

.main-tab-button {
  flex: 1;
  padding: 14px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.main-tab-button:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.main-tab-button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--surface);
}

.main-tab-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 20px;
}

.main-tab-pane {
  display: none;
}

.main-tab-pane.active {
  display: block;
}

.tournament-details {
  padding: 0;
  min-width: 0;
  overflow: visible;
}

.tournament-details p {
  margin-bottom: 10px;
}

.players-list ul {
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.player-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.player-row:hover {
  border-color: var(--border-strong);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.player-row-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.player-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.player-row-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.player-meta-tag {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player-meta-note {
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.player-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}

/* Toggle icon styling */
.toggle-icon {
  font-size: 0.7rem;
  color: #999;
  margin-right: 8px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.tournament-title:hover .toggle-icon {
  opacity: 1;
}

/* Tournament overview header with logo and details */
.tournament-overview-header {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0;
}

.overview-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.overview-bar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.overview-primary {
  display: flex;
  gap: 18px;
  flex: 1 1 320px;
  align-items: flex-start;
}

.overview-logo-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.overview-summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-width: 220px;
}

.overview-chip {
  align-self: flex-start;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.overview-description {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

.overview-meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.overview-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.overview-meta-label {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.overview-meta-value {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.overview-meta-inline {
  margin-top: 8px;
  gap: 6px 16px;
}

.overview-meta-inline .overview-meta-item {
  flex-direction: row;
  align-items: baseline;
  gap: 6px;
  min-width: auto;
}

.overview-meta-inline .overview-meta-label {
  font-size: 0.7rem;
}

.overview-meta-inline .overview-meta-value {
  font-size: 0.85rem;
}

.overview-meta-inline .overview-meta-label::after {
  content: ":";
}

.overview-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}

.overview-action-row {
  display: flex;
  gap: 8px;
}

.overview-secondary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 180px;
  flex-shrink: 0;
}

.overview-secondary .overview-meta-list {
  margin: 0;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .overview-bar {
    gap: 12px;
  }

  .overview-secondary {
    min-width: 160px;
  }
}

@media (max-width: 768px) {
  .overview-bar {
    flex-direction: column;
    gap: 16px;
  }

  .overview-primary {
    flex: 1 1 auto;
  }

  .overview-secondary {
    min-width: auto;
    width: 100%;
  }

  .overview-actions {
    width: 100%;
    flex-direction: row;
    justify-content: space-between;
  }
}

@media (max-width: 500px) {
  .overview-primary {
    flex-direction: column;
    gap: 12px;
    flex: 1 1 auto;
  }

  .overview-logo-stack {
    align-items: center;
    justify-content: center;
  }

  .overview-summary {
    width: 100%;
  }

  .tournament-logo {
    width: 80px;
    height: 80px;
  }

  .overview-bar {
    gap: 12px;
  }

  .overview-secondary {
    order: 2;
  }

  /* Player form for very small screens */
  .autocomplete-wrapper {
    flex: 1 1 100%;
    min-width: 100%;
  }

  .player-input-group input {
    flex: 1 1 100%;
    min-width: 100%;
  }

  .player-input-group select.input-small {
    flex: 1 1 100%;
    min-width: 100%;
    max-width: none;
  }

  .player-input-group input.input-small {
    flex: 1 1 100%;
    min-width: 100%;
    max-width: none;
  }

  .player-input-group input.input-medium {
    flex: 1 1 100%;
    min-width: 100%;
    max-width: none;
  }

  .player-input-group button {
    flex: 1 1 100%;
    width: 100%;
  }

  .overview-actions {
    order: 3;
  }
}

.overview-actions .btn-icon {
  min-width: 36px;
}

/* Tournament Menu Dropdown */
.tournament-menu-container {
  position: relative;
}

.tournament-menu-toggle {
  font-size: 1.5rem;
  line-height: 1;
  padding: 6px 10px;
}

.tournament-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1000;
  overflow: hidden;
}

.tournament-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.tournament-menu-item:hover {
  background: var(--surface-muted);
}

.tournament-menu-item .menu-icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.tournament-menu-item .menu-icon-grayscale {
  filter: grayscale(100%);
  opacity: 0.85;
}

.tournament-menu-item .menu-label {
  flex: 1;
}

.tournament-menu-item-danger {
  color: var(--danger);
}

.tournament-menu-item-danger:hover {
  background: rgba(244, 67, 54, 0.1);
}

.overview-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.overview-stat-card {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.overview-stat-value {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
}

.overview-stat-label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* Top row: Logo and actions */
.tournament-overview-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

/* Logo section - smaller and cleaner */
.tournament-logo-container {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.tournament-logo {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  transition: opacity 0.2s ease;
}

.tournament-logo:hover {
  opacity: 0.85;
  cursor: pointer;
}

/* Sharing buttons next to logo - vertical stack */
.tournament-sharing-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Action buttons - Edit/Delete in top right */
.tournament-actions-right {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Tournament info content - clean and minimal */
.tournament-info-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

/* Stats and metadata in single row */
.tournament-stats-row {
  display: flex;
  align-items: baseline;
  gap: 28px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* Stats - minimal horizontal layout */
.tournament-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  flex: 1;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.08em;
}

/* Date info section - inline and minimal */
.tournament-date-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  justify-content: center;
  color: var(--text-secondary);
}

.venue-line,
.date-line {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* Description - simple and clean */
.tournament-desc {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

/* Status inline with title */
.tournament-title .tournament-status {
  margin-left: 12px;
  font-size: 0.75rem;
  vertical-align: middle;
  background: var(--surface-muted);
}

/* Tournament Filters - Header style */
.tournament-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  padding: 6px 12px;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.filter-toggle:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.filter-toggle input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: #2c2c2c;
}

.filter-toggle span {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.filter-toggle input[type="checkbox"]:checked + span {
  color: var(--text-primary);
}

/* Tournaments Section Header */
.tournaments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.tournaments-header h2 {
  margin: 0;
}

.view-config-toggle {
  font-size: 1.1rem;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.view-config-toggle:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* View Configuration Panel */
.view-config-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--surface-muted);
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* Update filter styles for panel */
.view-config-panel .filter-group {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.view-config-panel button.btn {
  white-space: nowrap;
  justify-self: end;
}

.view-config-panel .filter-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  padding: 6px 12px;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.view-config-panel .filter-toggle:hover {
  background: var(--surface-muted);
  border-color: var(--border-strong);
}

.view-config-panel .filter-toggle input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #2c2c2c;
}

.view-config-panel .filter-toggle span {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.view-config-panel .filter-toggle input[type="checkbox"]:checked + span {
  color: var(--text-primary);
}

/* Knockout Bracket Styles */
.knockout-bracket-container {
  background: transparent;
  padding: 0;
  border: none;
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  /* Smooth scrolling */
  scroll-behavior: smooth;
  /* Show scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) var(--surface);
}

/* Webkit scrollbar styling for knockout bracket container */
.knockout-bracket-container::-webkit-scrollbar {
  height: 12px;
}

.knockout-bracket-container::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 6px;
}

.knockout-bracket-container::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
  border: 2px solid var(--surface);
}

.knockout-bracket-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.bracket-header {
  display: flex;
  justify-content: flex-end;
  padding: 10px 16px;
  margin: 10px 0;
}

.knockout-bracket {
  display: flex;
  gap: 40px;
  padding: 20px;
  min-height: 400px;
  width: max-content;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  min-width: 250px;
}

.bracket-round-title {
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 600;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
}

.bracket-matches {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex: 1;
  gap: 30px;
}

.bracket-match {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.bracket-player {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
}

.bracket-player:last-child {
  border-bottom: none;
}

.bracket-player.winner {
  background: #e7e7e7;
  font-weight: 600;
  border-left: 4px solid #b5b5b5;
}

.bracket-player.loser {
  background: #f1f1f1;
  color: var(--text-tertiary);
  opacity: 0.7;
}

.bracket-player .player-name {
  flex: 1;
  font-size: 0.95rem;
}

.bracket-player .player-rating {
  font-size: 0.85rem;
  color: #666;
  margin-left: 10px;
  font-weight: normal;
}

/* Footer Styles */
.footer {
  margin-top: 60px;
  padding: 30px 20px 20px;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.footer-separator {
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

.footer-copyright {
  margin-top: 10px;
}

.footer-copyright p {
  color: var(--text-tertiary);
  font-size: 0.9rem;
  margin: 0;
}

.modal-text-content {
  padding: 20px 0;
  line-height: 1.6;
}

.modal-text-content p {
  margin-bottom: 15px;
}

/* Responsive footer */
@media (max-width: 768px) {
  .footer {
    margin-top: 40px;
    padding: 20px 15px 15px;
  }

  .footer-links {
    gap: 10px;
  }

  .footer-links a {
    font-size: 0.9rem;
  }

  .footer-copyright p {
    font-size: 0.85rem;
  }
}

/* ============================================
   LANDING PAGE STYLES
   ============================================ */

/* Hero Section */
.hero-section {
  text-align: center;
  padding: 100px 20px 120px;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid #e0e0e0;
}

.hero-decoration {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
  opacity: 0.6;
}

.chess-pattern {
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 400px;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 50px,
      rgba(102, 126, 234, 0.03) 50px,
      rgba(102, 126, 234, 0.03) 100px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 50px,
      rgba(102, 126, 234, 0.03) 50px,
      rgba(102, 126, 234, 0.03) 100px
    );
  pointer-events: none;
  opacity: 0.5;
}

.hero-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  margin-bottom: 2rem;
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.25);
  animation: gentlePulse 3s ease-in-out infinite;
}

.chess-icon {
  font-size: 4rem;
  color: white;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@keyframes gentlePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.25);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.35);
  }
}

.hero-content {
  max-width: 900px;
  margin: 0 auto;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 700;
  margin: 0 0 24px 0;
  line-height: 1.2;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.4rem;
  color: #555;
  margin: 0 0 40px 0;
  line-height: 1.6;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.1rem;
  font-weight: 600;
  min-width: 180px;
  max-width: 280px;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #7c8ef0 0%, #8c5bb8 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: white;
  color: #333;
  border: 2px solid #ddd;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  border-color: #667eea;
  color: #667eea;
  opacity: 0.95;
}

/* Section Styling */
.section-title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 60px 0;
  color: #1a1a1a;
}

/* Features Section */
.features-section {
  padding: 80px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 30px;
  margin-top: 40px;
}

.feature-card {
  background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
  border: 2px solid #e0e0e0;
  border-radius: 16px;
  padding: 32px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #1a1a2e 0%, #0f3460 50%, #e8b923 100%);
  transform: scaleX(0);
  transition: transform 0.4s ease;
  transform-origin: left;
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(15, 52, 96, 0.15);
  border-color: #0f3460;
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 1.4rem;
  margin: 0 0 16px 0;
  color: #1a1a1a;
  font-weight: 600;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  padding: 8px 0;
  color: #666;
  line-height: 1.6;
}

.feature-list li strong {
  color: #667eea;
  font-weight: 600;
}

/* How It Works Section */
.how-it-works-section {
  padding: 80px 20px;
  background: linear-gradient(180deg, #f8f9fa 0%, #ffffff 100%);
  border-top: 3px solid #e8b923;
  border-bottom: 1px solid #e0e0e0;
  position: relative;
}

.how-it-works-section::before {
  content: '♟';
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 3rem;
  opacity: 0.1;
  color: #1a1a2e;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  max-width: 1100px;
  margin: 0 auto;
}

.step-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border: 2px solid #e0e0e0;
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.step-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #e8b923 0%, #0f3460 100%);
  transform: scaleX(0);
  transition: transform 0.4s ease;
}

.step-card:hover::after {
  transform: scaleX(1);
}

.step-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 40px rgba(15, 52, 96, 0.15);
  border-color: #0f3460;
}

.step-number {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
  color: #e8b923;
  font-size: 1.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 4px 12px rgba(15, 52, 96, 0.2);
  transition: all 0.4s ease;
  border: 3px solid #e8b923;
}

.step-card:hover .step-number {
  transform: scale(1.1) rotate(360deg);
  box-shadow: 0 6px 20px rgba(232, 185, 35, 0.4);
}

.step-card h3 {
  font-size: 1.3rem;
  margin: 0 0 12px 0;
  color: #1a1a1a;
  font-weight: 600;
}

.step-card p {
  color: #666;
  line-height: 1.6;
  margin: 0;
}

/* Pricing Section */
.pricing-section {
  padding: 80px 20px;
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.pricing-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 16px;
  padding: 48px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.pricing-badge {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 8px 24px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
}

.pricing-card h3 {
  font-size: 1.8rem;
  margin: 24px 0 16px 0;
  color: #1a1a1a;
}

.pricing-price {
  font-size: 4rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 24px 0;
}

.pricing-price span {
  font-size: 1.2rem;
  color: #999;
  font-weight: 400;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 32px 0;
  text-align: left;
}

.pricing-features li {
  padding: 12px 0;
  font-size: 1.1rem;
  color: #666;
  border-bottom: 1px solid #f0f0f0;
}

.pricing-features li:last-child {
  border-bottom: none;
}

.pricing-note {
  margin-top: 24px;
  color: #999;
  font-size: 0.9rem;
}

/* Demo Section */
.demo-section {
  padding: 80px 20px;
  background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
  text-align: center;
  position: relative;
  overflow: hidden;
  border-top: 3px solid #e8b923;
  border-bottom: 3px solid #e8b923;
}

.demo-section::before {
  content: '♚♛♜♝♞♟';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 15rem;
  opacity: 0.03;
  letter-spacing: 40px;
  color: #ffffff;
  pointer-events: none;
}

.demo-content {
  max-width: 800px;
  margin: 0 auto;
}

.demo-subtitle {
  font-size: 1.2rem;
  color: #e0e0e0;
  margin: 16px auto 40px;
  max-width: 700px;
  line-height: 1.6;
}

.demo-section .section-title {
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.demo-features {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin: 32px 0;
  flex-wrap: wrap;
}

.demo-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  border-radius: 50px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(232, 185, 35, 0.3);
  transition: all 0.3s ease;
}

.demo-feature:hover {
  background: rgba(232, 185, 35, 0.2);
  border-color: #e8b923;
  transform: translateY(-2px);
}

.demo-feature svg {
  stroke: #e8b923;
  flex-shrink: 0;
}

.demo-button {
  margin: 24px auto;
}

.demo-note {
  font-size: 0.9rem;
  color: #e0e0e0;
  font-style: italic;
  margin-top: 16px;
  opacity: 0.8;
}

/* CTA Section */
.cta-section {
  padding: 100px 20px;
  text-align: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.cta-section h2 {
  font-size: 2.5rem;
  margin: 0 0 16px 0;
  font-weight: 700;
}

.cta-section p {
  font-size: 1.3rem;
  margin: 0 0 32px 0;
  opacity: 0.95;
}

.cta-section .btn {
  background: white;
  color: #667eea;
  font-weight: 600;
}

.cta-section .btn:hover {
  background: #f8f8f8;
  opacity: 0.95;
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .section-title {
    font-size: 2rem;
  }

  .features-grid,
  .steps-grid {
    grid-template-columns: 1fr;
  }

  .pricing-price {
    font-size: 3rem;
  }

  .cta-section h2 {
    font-size: 2rem;
  }

  .btn-large {
    max-width: 100%;
    width: 100%;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

/* Hide tournaments list when showing landing page */
#landing-page.active ~ .tournaments-list {
  display: none;
}


/* Update feature icon styling for SVG */
.feature-icon svg {
  stroke: #0f3460;
  transition: all 0.4s ease;
}

.feature-card:hover .feature-icon svg {
  transform: scale(1.15) rotate(5deg);
  stroke: #e8b923;
  filter: drop-shadow(0 4px 8px rgba(232, 185, 35, 0.3));
}

/* Schedule Table */
.schedule-form {
  padding: 20px;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: white;
}

.schedule-table thead {
  background-color: #333;
  color: white;
}

.schedule-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  border: 1px solid #ddd;
}

.schedule-table td {
  padding: 12px;
  border: 1px solid #ddd;
}

.schedule-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

.schedule-table tbody tr:hover {
  background-color: #f0f0f0;
}

.schedule-date-input,
.schedule-time-input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.schedule-date-input:focus,
.schedule-time-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

@media (max-width: 768px) {
  .schedule-table {
    font-size: 14px;
  }

  .schedule-table th,
  .schedule-table td {
    padding: 8px;
  }
}

/* License statement for free tier */
.license-statement {
  background: none;
  border: none;
  border-radius: 0;
  padding: 20px 0;
  margin-top: 30px;
  font-size: 0.75rem;
  color: #999;
  text-align: center;
}

.license-statement strong {
  color: #666;
  font-weight: normal;
}

.license-statement a {
  color: #666;
  text-decoration: none;
}

.license-statement a:hover {
  color: #333;
  text-decoration: underline;
}

/* Make license statement visible in print */
@media print {
  .license-statement {
    background: #ffffff !important;
    border: 2px solid #000000 !important;
    padding: 10px !important;
    margin: 10px 0 !important;
    font-size: 0.85rem !important;
    color: #000000 !important;
    page-break-inside: avoid;
    display: block !important;
  }

  .license-statement strong {
    color: #000000 !important;
  }

  .license-statement a {
    color: #000000 !important;
    text-decoration: none !important;
  }
}

/* Pricing & Billing Modals */
.modal-wide {
  max-width: 1000px !important;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.pricing-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.pricing-card-featured {
  border-color: #2c2c2c;
  background: #f8f8f8;
}

.pricing-badge {
  position: absolute;
  top: -12px;
  right: 16px;
  background: #2c2c2c;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.pricing-badge-save {
  background: #28a745;
}

.pricing-card h3 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.price {
  font-size: 2.5rem;
  font-weight: 700;
  color: #2c2c2c;
  margin: 12px 0;
}

.price span {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.price-note {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: -8px;
  margin-bottom: 12px;
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 20px 0;
}

.pricing-features li {
  padding: 8px 0;
  color: var(--text-primary);
  position: relative;
  padding-left: 24px;
}

.pricing-features li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #28a745;
  font-weight: bold;
}

.pricing-note {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 12px;
  margin-bottom: 12px;
}

.pricing-card .btn-large {
  margin-top: 12px;
}

/* Billing Dashboard */
.billing-current-plan {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.billing-current-plan h3 {
  margin-top: 0;
  margin-bottom: 16px;
}

.plan-details p {
  margin: 8px 0;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-active {
  background: #d4edda;
  color: #155724;
}

.status-inactive {
  background: #e2e3e5;
  color: #383d41;
}

.status-cancelled {
  background: #f8d7da;
  color: #721c24;
}

.status-past_due {
  background: #fff3cd;
  color: #856404;
}

.billing-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.billing-history-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.billing-history-table th,
.billing-history-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.billing-history-table th {
  background: var(--surface-muted);
  font-weight: 600;
}

/* Upgrade Prompt */
.upgrade-prompt-title {
  color: var(--text-primary);
  margin-bottom: 16px;
}

.upgrade-prompt-message {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.upgrade-prompt-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .billing-actions {
    flex-direction: column;
  }

  .upgrade-prompt-actions {
    flex-direction: column;
  }
}

