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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  color: #333;
  min-height: 100vh;
}

/* ========== User Page ========== */
.lottery-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.lottery-page h1 {
  font-size: 32px;
  margin-bottom: 28px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 2px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.wheel-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  display: flex;
  justify-content: center;
  filter: drop-shadow(0 8px 30px rgba(0, 0, 0, 0.3));
}

#wheel {
  display: block;
}

/* Controls */
.controls {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-row label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.5px;
}

.control-row select,
.control-row input[type='number'] {
  padding: 10px 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  outline: none;
  min-width: 160px;
  transition: border-color 0.2s;
}

.control-row select option {
  background: #302b63;
  color: #fff;
}

.control-row select:focus,
.control-row input[type='number']:focus {
  border-color: rgba(255, 255, 255, 0.5);
}

.control-row input[type='number'] {
  min-width: 100px;
  max-width: 120px;
}

/* Results Section */
.results-section {
  margin-top: 32px;
  width: 100%;
  max-width: 520px;
}

.results-section h2 {
  color: #fff;
  font-size: 18px;
  margin-bottom: 14px;
  text-align: center;
  font-weight: 600;
}

.results-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.result-tag {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.result-summary {
  width: 100%;
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.draw-btn {
  margin-top: 32px;
  padding: 16px 56px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ff416c, #ff4b2b);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 25px rgba(255, 65, 108, 0.5);
  letter-spacing: 2px;
  position: relative;
  overflow: hidden;
}

.draw-btn::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, #ff416c, #ff4b2b, #ff416c);
  border-radius: 52px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
}

.draw-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 35px rgba(255, 65, 108, 0.6);
}

.draw-btn:active {
  transform: translateY(0) scale(0.98);
}

.draw-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Result Modal */
.result-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.result-modal.show {
  display: flex;
}

.result-content {
  background: linear-gradient(145deg, #ffffff, #f8f9ff);
  padding: 48px 40px;
  border-radius: 24px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.result-content h2 {
  font-size: 20px;
  margin-bottom: 8px;
  color: #888;
  font-weight: 500;
}

.result-content p {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, #ff416c, #ff4b2b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 28px;
}

.result-content button {
  padding: 12px 40px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.result-content button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

@keyframes popIn {
  from {
    transform: scale(0.6) translateY(20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* ========== Admin Page ========== */
.admin-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

body:has(.admin-page) {
  background: #f0f2f5;
}

.admin-page h1 {
  text-align: center;
  margin-bottom: 24px;
  color: #1a1a2e;
  font-weight: 700;
}

.login-form {
  max-width: 380px;
  margin: 80px auto;
  background: #fff;
  padding: 40px 32px;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.login-form h2 {
  text-align: center;
  margin-bottom: 24px;
  color: #1a1a2e;
  font-weight: 700;
}

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
  color: #555;
}

.form-group input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.btn {
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 6px;
}

.btn-success {
  background: linear-gradient(135deg, #11998e, #38ef7d);
}

.btn-success:hover {
  box-shadow: 0 4px 12px rgba(17, 153, 142, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #eb3349, #f45c43);
}

.btn-danger:hover {
  box-shadow: 0 4px 12px rgba(235, 51, 73, 0.3);
}

.btn-block {
  display: block;
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.group-card {
  background: #fff;
  padding: 18px 20px;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border-left: 4px solid #e0e0e0;
  transition: box-shadow 0.2s;
}

.group-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.group-card.active {
  border-left-color: #11998e;
  background: linear-gradient(135deg, #f0fff4, #ffffff);
}

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

.group-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
}

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

.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  border-radius: 20px;
  background: linear-gradient(135deg, #11998e, #38ef7d);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.5px;
  vertical-align: middle;
  margin-left: 8px;
}

.prize-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prize-tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.section {
  margin-top: 32px;
}

.section h2 {
  margin-bottom: 16px;
  font-size: 20px;
  color: #1a1a2e;
  font-weight: 700;
}

.prize-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.prize-row input[type='text'] {
  flex: 2;
  padding: 9px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.prize-row input[type='text']:focus {
  border-color: #667eea;
}

.prize-row input[type='number'] {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  max-width: 80px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.prize-row input[type='number']:focus {
  border-color: #667eea;
}

.prize-row input[type='color'] {
  width: 38px;
  height: 38px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
}

.prob-display {
  margin: 10px 0 18px;
  font-size: 14px;
  color: #666;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

th,
td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

th {
  background: #f8f9fb;
  font-weight: 600;
  color: #555;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  font-size: 14px;
  color: #333;
}

tr:last-child td {
  border-bottom: none;
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
  .lottery-page h1 {
    font-size: 24px;
  }

  .draw-btn {
    padding: 14px 40px;
    font-size: 18px;
  }

  .prize-row {
    flex-wrap: wrap;
  }

  .prize-row input[type='number'] {
    max-width: 100%;
  }

  .group-header {
    flex-direction: column;
    align-items: flex-start;
  }

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