@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
  color-scheme: light dark;
  --snow: rgba(255, 255, 255, 0.9);
  --deep-red: #b22222;
  --bright-red: #e63946;
  --forest: #0f5132;
  --pine: #14532d;
  --gold: #ffd700;
  --gold-light: #ffe066;
  --dark: #0f172a;
  --bg: radial-gradient(ellipse at 20% 0%, #1a472a 0%, #0d2818 40%, #051a0f 100%);
  --glass: rgba(255, 255, 255, 0.08);
  --card-bg: rgba(10, 30, 20, 0.85);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
}

/* Animated Background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(230, 57, 70, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(255, 215, 0, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(26, 71, 42, 0.8) 0%, transparent 70%);
  z-index: 0;
  animation: bgPulse 8s ease-in-out infinite;
}

@keyframes bgPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* Snow Effect - Enhanced */
.snow {
  position: fixed;
  width: 4px;
  height: 4px;
  background: var(--snow);
  border-radius: 50%;
  animation: fall linear infinite;
  opacity: 0;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  z-index: 1000;
  pointer-events: none;
}

.snow::before {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: inherit;
  border-radius: inherit;
  filter: blur(1px);
}

@keyframes fall {
  0% {
    transform: translateY(-10vh) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 0.9; }
  90% { opacity: 0.9; }
  100% {
    transform: translateY(110vh) rotate(360deg);
    opacity: 0;
  }
}

/* Christmas Lights */
.christmas-lights {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 30px;
  display: flex;
  justify-content: space-around;
  z-index: 999;
  pointer-events: none;
}

.light {
  width: 12px;
  height: 18px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: glow 1.5s ease-in-out infinite;
  position: relative;
  top: -5px;
}

.light::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 6px;
  background: #333;
  border-radius: 2px;
}

.light:nth-child(5n+1) { background: #ff4444; animation-delay: 0s; }
.light:nth-child(5n+2) { background: #44ff44; animation-delay: 0.3s; }
.light:nth-child(5n+3) { background: #4444ff; animation-delay: 0.6s; }
.light:nth-child(5n+4) { background: #ffff44; animation-delay: 0.9s; }
.light:nth-child(5n+5) { background: #ff44ff; animation-delay: 1.2s; }

@keyframes glow {
  0%, 100% {
    filter: brightness(1) drop-shadow(0 0 5px currentColor);
    opacity: 0.7;
  }
  50% {
    filter: brightness(1.5) drop-shadow(0 0 15px currentColor);
    opacity: 1;
  }
}

/* Layout */
main {
  width: min(900px, 100%);
  position: relative;
  z-index: 1;
  display: grid;
  gap: 28px;
}

/* Card Styles - Enhanced */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 36px;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 1px 0 rgba(255, 255, 255, 0.1) inset;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.5), transparent);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 1px 0 rgba(255, 255, 255, 0.15) inset;
}

/* Header */
header {
  text-align: center;
  position: relative;
  padding-bottom: 20px;
}

header h1 {
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 50%, var(--gold) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  animation: shimmer 3s linear infinite;
  font-weight: 700;
  letter-spacing: 0.02em;
}

@keyframes shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

header p {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.8);
  letter-spacing: 0.05em;
}

/* Buttons - Enhanced */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-top: 28px;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 16px;
  padding: 16px 36px;
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

button:not(:disabled):hover::before {
  left: 100%;
}

button.primary {
  background: linear-gradient(135deg, var(--bright-red) 0%, var(--deep-red) 100%);
  color: #fff;
  box-shadow:
    0 8px 25px rgba(230, 57, 70, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

button.primary:not(:disabled):hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 12px 35px rgba(230, 57, 70, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

button.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

button.secondary:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.3);
}

button.accent {
  background: linear-gradient(135deg, var(--gold) 0%, #f0b000 100%);
  color: var(--dark);
  box-shadow:
    0 8px 25px rgba(255, 215, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

button.accent:not(:disabled):hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 12px 35px rgba(255, 215, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

button:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

/* Result Area - Enhanced */
.result {
  text-align: center;
  margin-top: 28px;
  padding: 24px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.result h2 {
  font-size: 1.8rem;
  margin-bottom: 12px;
  color: var(--gold);
}

.result p {
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
}

.prize-card {
  border: 2px solid rgba(255, 215, 0, 0.3);
  border-radius: 20px;
  padding: 28px;
  margin-top: 16px;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.05) 100%);
  position: relative;
  overflow: hidden;
  animation: prizeReveal 0.6s ease-out;
}

@keyframes prizeReveal {
  0% {
    opacity: 0;
    transform: scale(0.8) rotateX(20deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotateX(0);
  }
}

.prize-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, transparent, rgba(255, 215, 0, 0.1), transparent 30%);
  animation: sparkle 4s linear infinite;
}

@keyframes sparkle {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.prize-card > * {
  position: relative;
  z-index: 1;
}

.prize-card h2 {
  font-size: 2rem;
  margin-bottom: 12px;
}

/* Prize Pool & Summary */
.prize-pool {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.prize-summary {
  display: flex;
  justify-content: center;
  gap: 50px;
  padding: 30px 20px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.prize-stat {
  text-align: center;
}

.prize-stat .stat-number {
  display: block;
  font-size: 3.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  animation: countPulse 2s ease-in-out infinite;
}

@keyframes countPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.prize-stat .stat-label {
  font-size: 1rem;
  opacity: 0.7;
  margin-top: 8px;
  letter-spacing: 0.05em;
}

.prize-stat.highlight .stat-number {
  font-size: 4rem;
  background: linear-gradient(135deg, var(--bright-red) 0%, #ff6b6b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* History Section */
.history {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 215, 0, 0.3) transparent;
}

.history::-webkit-scrollbar {
  width: 6px;
}

.history::-webkit-scrollbar-track {
  background: transparent;
}

.history::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.3);
  border-radius: 3px;
}

.history h4 {
  color: var(--gold);
  margin-bottom: 16px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history h4::before {
  content: "📜";
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(4px);
}

.history-item:last-child {
  margin-bottom: 0;
}

/* Auth Bar */
.auth-bar {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(10, 30, 20, 0.9);
  backdrop-filter: blur(10px);
  padding: 10px 16px;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.auth-bar span {
  font-weight: 600;
  color: var(--gold);
}

.auth-bar a {
  color: var(--bright-red) !important;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.auth-bar a:hover {
  opacity: 0.8;
}

/* Form Styles */
.form-group {
  margin-bottom: 18px;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* Modal - Enhanced */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: linear-gradient(135deg, #1a472a 0%, #0d2818 100%);
  padding: 36px;
  border-radius: 24px;
  width: min(420px, 90%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s ease;
  position: relative;
}

.modal.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-content h3 {
  margin-top: 0;
  margin-bottom: 24px;
  color: var(--gold);
  font-size: 1.5rem;
  text-align: center;
}

.close-modal {
  position: absolute;
  top: 16px;
  right: 20px;
  cursor: pointer;
  font-size: 1.8rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.2s;
}

.close-modal:hover {
  color: #fff;
}

/* User Badge */
.user-badge {
  background: rgba(255, 215, 0, 0.15);
  color: var(--gold);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8em;
  margin-left: 8px;
  border: 1px solid rgba(255, 215, 0, 0.3);
  font-weight: 500;
}

/* Admin Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-table th {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-table tr {
  transition: background 0.2s;
}

.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.delete-btn {
  background: linear-gradient(135deg, #ff4d4d, #cc0000);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.delete-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 77, 77, 0.4);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.2s;
}

.back-link:hover {
  opacity: 0.8;
}

/* Section Title */
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title h3 {
  margin: 0;
  font-size: 1.3rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title h3::before {
  content: "🎁";
}

/* Loading Animation */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--gold);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Confetti Animation */
@keyframes confetti-fall {
  0% {
    transform: translateY(-100vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  z-index: 1001;
  pointer-events: none;
  animation: confetti-fall 3s ease-out forwards;
}

/* Responsive */
@media (max-width: 640px) {
  body {
    padding: 60px 12px 24px;
  }

  .card {
    padding: 24px 20px;
    border-radius: 20px;
  }

  button {
    width: 100%;
    padding: 14px 24px;
  }

  .auth-bar {
    top: 10px;
    right: 10px;
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .prize-summary {
    gap: 30px;
    padding: 20px 15px;
  }

  .prize-stat .stat-number {
    font-size: 2.5rem;
  }

  .prize-stat.highlight .stat-number {
    font-size: 3rem;
  }

  header h1 {
    font-size: 1.8rem;
  }

  .history-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Photo Wall - Hidden by default, can be enabled */
.photo-wall {
  display: none;
}
