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

body {
  font-family: "Arial", sans-serif;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  min-height: 100vh;
  padding: 20px;
  color: #ffffff;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: #2a2a2a;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  border: 1px solid #e10600;
}

h1 {
  text-align: center;
  background: linear-gradient(45deg, #e10600, #c41e3a);
  color: white;
  padding: 30px;
  margin: 0;
  font-size: 2.5em;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.settings-section {
  padding: 30px;
  background: #333333;
  border-bottom: 3px solid #e10600;
}

.settings-section h2 {
  margin-bottom: 20px;
  color: #ffffff;
  font-size: 1.5em;
}

.player-names-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.settings-section.hidden {
  display: none;
}

.input-section {
  padding: 20px 30px;
  background: #333333;
  border-top: 2px solid #555555;
}

.input-section h2 {
  margin-bottom: 15px;
  color: #ffffff;
  font-size: 1.3em;
}

.input-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: end;
}

.input-controls .form-group {
  margin-bottom: 0;
}

.input-controls button {
  margin-bottom: 0;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  color: #ffffff;
}

.form-group select,
.form-group input {
  width: 100%;
  max-width: 300px;
  padding: 12px;
  border: 2px solid #e10600;
  border-radius: 8px;
  font-size: 16px;
  background: #1a1a1a;
  color: #ffffff;
  transition: border-color 0.3s ease;
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: #c41e3a;
  box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.2);
}

.form-group small {
  display: block;
  margin-top: 5px;
  color: #cccccc;
  font-size: 12px;
}

button {
  background: linear-gradient(45deg, #e10600, #c41e3a);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(225, 6, 0, 0.3);
}

.secondary-btn {
  background: #555555 !important;
  margin-left: 10px;
}

.secondary-btn:hover {
  background: #666666 !important;
}

button:active {
  transform: translateY(0);
}

.results-section {
  padding: 30px;
  background: #2a2a2a;
}

.results-section h2 {
  margin-bottom: 30px;
  color: #ffffff;
  font-size: 2.2em;
  text-align: center;
  font-weight: bold;
}

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

.header-controls h2 {
  margin: 0;
  text-align: left;
}

.clear-buttons {
  display: flex;
  gap: 10px;
}

.clear-btn {
  padding: 8px 16px;
  background: #666666;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
}

.clear-btn:hover {
  background: #777777;
  transform: none;
  box-shadow: none;
}

/* Session Controls */
.session-controls {
  margin-bottom: 25px;
  padding: 20px;
  background: #444444;
  border-radius: 8px;
  border: 1px solid #e10600;
}

.session-title-section {
  margin-bottom: 15px;
}

.session-title-input {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 2px solid #666666;
  border-radius: 6px;
  background: #555555;
  color: #ffffff;
  font-weight: bold;
  text-align: center;
}

.session-title-input:focus {
  outline: none;
  border-color: #e10600;
  background: #666666;
}

.session-title-input::placeholder {
  color: #bbbbbb;
  font-style: italic;
}

.persistence-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.export-btn,
.import-btn {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: bold;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
}

.export-btn {
  background: #e10600;
  color: white;
}

.export-btn:hover {
  background: #c41e3a;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(225, 6, 0, 0.3);
}

.import-btn {
  background: #28a745;
  color: white;
}

.import-btn:hover {
  background: #218838;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.tables-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

.player-table {
  background: #333333;
  border: 2px solid #e10600;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.player-table:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(225, 6, 0, 0.2);
}

.player-table h3 {
  margin-bottom: 15px;
  color: #ffffff;
  font-size: 1.3em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.player-name-input {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.3em;
  font-weight: bold;
  flex: 1;
  padding: 5px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.3s ease;
}

.player-name-input:focus {
  outline: none;
  border-bottom-color: #e10600;
}

.crown-container {
  min-width: 30px;
  text-align: center;
}

.time-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  align-items: center;
}

.time-input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid #555555;
  border-radius: 6px;
  background: #1a1a1a;
  color: #ffffff;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.time-input:focus {
  outline: none;
  border-color: #e10600;
}

.add-time-btn {
  padding: 8px 16px;
  background: #e10600;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
}

.add-time-btn:hover {
  background: #c41e3a;
  transform: none;
  box-shadow: none;
}

.crown {
  font-size: 1.5em;
  color: #e10600;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 15px;
}

th {
  background: linear-gradient(45deg, #e10600, #c41e3a);
  color: white;
  padding: 12px 8px;
  text-align: left;
  font-weight: bold;
}

th:first-child {
  border-radius: 8px 0 0 0;
}

th:last-child {
  border-radius: 0 8px 0 0;
}

td {
  padding: 10px 8px;
  border-bottom: 1px solid #555555;
  vertical-align: middle;
  color: #ffffff;
}

tr:nth-child(even) {
  background: #3a3a3a;
}

tr:hover {
  background: #444444;
}

.best-time {
  font-weight: bold;
  color: #e10600;
  font-size: 1.4em;
  text-align: left;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: #1a1a1a;
  border: 2px solid #e10600;
  border-radius: 6px;
}

.delete-btn {
  background: #e10600;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.2s ease;
}

.delete-btn:hover {
  background: #c41e3a;
  transform: none;
  box-shadow: none;
}

.error {
  color: #ff6b6b;
  font-size: 14px;
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 107, 107, 0.1);
  border-radius: 4px;
  border-left: 4px solid #ff6b6b;
  display: none;
}

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

  h1 {
    font-size: 2em;
    padding: 20px;
  }

  .input-section,
  .results-section {
    padding: 20px;
  }

  .form-group select,
  .form-group input {
    max-width: 100%;
  }

  .session-controls {
    padding: 15px;
  }

  .persistence-buttons {
    flex-direction: column;
    align-items: center;
  }

  .export-btn,
  .import-btn {
    width: 100%;
    max-width: 200px;
  }
}

/* Animations for notifications */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}
