:root {
  --primary-color: #6c5ce7;
  --secondary-color: #a29bfe;
  --success-color: #00b894;
  --error-color: #d63031;
  --bg-color: #f5f6fa;
  --card-bg: #ffffff;
  --text-color: #2d3436;
  --text-light: #636e72;
  --border-color: #dfe6e9;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Welcome Section */
.welcome-section {
  text-align: center;
  padding: 60px 20px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 15px;
  color: white;
  margin-top: 40px;
}

.welcome-section h1 {
  font-size: 3.5em;
  margin-bottom: 10px;
}

.welcome-section .tagline {
  font-size: 1.5em;
  margin-bottom: 20px;
  opacity: 0.95;
}

.welcome-section .description {
  font-size: 1.1em;
  margin-bottom: 40px;
  opacity: 0.9;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

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

/* Auth Section */
.auth-section {
  background: var(--card-bg);
  padding: 40px;
  border-radius: 10px;
  max-width: 400px;
  margin: 50px auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.auth-section h1 {
  text-align: center;
  font-size: 2.5em;
  margin-bottom: 10px;
}

.auth-section h2 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 30px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

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

.form-group input {
  padding: 10px 12px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  font-size: 1em;
  transition: border-color 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.auth-link {
  text-align: center;
  margin-top: 20px;
  color: var(--text-light);
}

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

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

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 30px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.header h1 {
  font-size: 2em;
  color: var(--primary-color);
}

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

.mode-link {
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-color);
  color: var(--text-color);
  font-weight: 600;
  font-size: 0.9em;
}

.mode-link.active {
  background: var(--primary-color);
  color: #fff;
}

#username {
  font-weight: 600;
  color: var(--text-light);
}

/* Game Container */
.game-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-top: 20px;
}

.left-panel,
.right-panel {
  background: var(--card-bg);
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Add Names Section */
.add-names {
  margin-bottom: 30px;
}

.add-names h2 {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 1.3em;
}

.wheel-manager {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
}

.wheel-manager h2 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 1.3em;
}

.wheel-selector {
  display: flex;
  gap: 10px;
  align-items: center;
}

.wheel-select {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1em;
  background: #fff;
}

.wheel-select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.add-item-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

#entryInput {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1em;
}

#entryInput:focus {
  outline: none;
  border-color: var(--primary-color);
}

#nameForm {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#nameInput {
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  font-size: 1em;
  transition: border-color 0.3s;
}

#nameInput:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Names List */
.names-list {
  margin-top: 30px;
}

.wins-list {
  margin-top: 30px;
}

.names-list h3 {
  color: var(--text-color);
  margin-bottom: 15px;
  font-size: 1.1em;
}

.wins-list h3 {
  color: var(--text-color);
  margin-bottom: 15px;
  font-size: 1.1em;
}

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

.wins-header h3 {
  margin-bottom: 0;
}

#namesList {
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
}

#winsList {
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
}

#namesList li {
  background: var(--bg-color);
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slideIn 0.3s ease-out;
}

#winsList li {
  background: var(--bg-color);
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 5px;
  border-left: 3px solid var(--primary-color);
  animation: slideIn 0.3s ease-out;
}

#winsList li span {
  color: var(--primary-color);
  font-weight: 600;
}

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

.delete-btn {
  background: var(--error-color);
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.85em;
  transition: background 0.3s;
}

.delete-btn:hover {
  background: #c71113;
}

.item-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bg-color);
  border-radius: 8px;
  margin-bottom: 10px;
  animation: slideIn 0.3s ease-out;
}

.item-text {
  flex: 1;
  word-break: break-word;
}

.item-actions {
  display: flex;
  gap: 6px;
}

.linked-indicator {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--primary-color);
  color: #fff;
  border-radius: 4px;
  font-size: 0.85em;
}

.btn-link {
  padding: 6px 12px;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
}

.btn-link:hover {
  background: #5a4ac9;
}

.btn-danger {
  background: var(--error-color);
  color: #fff;
}

.btn-danger:hover {
  background: #c71113;
}

.empty-message {
  color: var(--text-light);
  text-align: center;
  padding: 20px;
  font-style: italic;
}

/* Hat Section */
.hat-section {
  text-align: center;
  padding: 30px 0;
}

.hat-section h2 {
  color: var(--primary-color);
  margin-bottom: 30px;
  font-size: 1.3em;
}

.wheel-section {
  text-align: center;
}

.wheel-canvas-wrap {
  position: relative;
  width: 420px;
  height: 420px;
  margin: 15px auto 20px;
}

#wheelCanvas {
  width: 420px;
  height: 420px;
  border-radius: 50%;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  background: #fff;
}

.wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 30px;
  color: var(--error-color);
  line-height: 1;
}

.btn-spin {
  min-width: 180px;
}

.prize-input-group {
  text-align: left;
  margin-bottom: 20px;
}

.toggle-row {
  text-align: left;
  margin-bottom: 12px;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-color);
}

.prize-input-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

#prizeInput {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  font-size: 1em;
  transition: border-color 0.3s;
}

#prizeInput:focus {
  outline: none;
  border-color: var(--primary-color);
}

.hat {
  font-size: 120px;
  cursor: pointer;
  display: inline-block;
  padding: 20px;
  border-radius: 50%;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  transition: all 0.3s;
  margin: 20px 0;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.hat:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

.hat:active {
  transform: scale(0.95);
}

.hat-instruction {
  color: var(--text-light);
  font-size: 0.95em;
  margin-top: 10px;
}

.result {
  margin-top: 30px;
  min-height: 100px;
  background: var(--bg-color);
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid var(--success-color);
}

#resultText {
  font-size: 1.5em;
  font-weight: 600;
  color: var(--success-color);
  text-align: center;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: #5a4ac9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background: #8c7ad9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(160, 136, 245, 0.3);
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.9em;
}

/* Messages */
.error-message {
  color: var(--error-color);
  margin-top: 10px;
  padding: 10px;
  background: rgba(214, 48, 49, 0.1);
  border-radius: 5px;
  text-align: center;
  display: none;
}

.error-message.show {
  display: block;
}

.success-message {
  color: var(--success-color);
  margin-top: 10px;
  padding: 10px;
  background: rgba(0, 184, 148, 0.1);
  border-radius: 5px;
  text-align: center;
  display: none;
}

.success-message.show {
  display: block;
}

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

  .header {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }

  .hat {
    font-size: 80px;
    width: 150px;
    height: 150px;
  }

  .wheel-canvas-wrap {
    width: 300px;
    height: 300px;
  }

  #wheelCanvas {
    width: 300px;
    height: 300px;
  }

  .welcome-section h1 {
    font-size: 2.5em;
  }

  .welcome-section .tagline {
    font-size: 1.2em;
  }
}
