:root {
  --primary: #ff4d8b;
  --primary-deep: #be185d;
  --primary-light: #fff5f8;
  --orange: #f97316;
  --orange-light: #fff7ed;
  --orange-deep: #ea580c;
  --text-dark: #651532;
  --text-muted: #a0466c;
  --white: #ffffff;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Noto Sans TC', 'Outfit', sans-serif;
  min-height: 100vh;
  padding: 16px;
  background: linear-gradient(135deg, #fff5f8 0%, #ffe0ec 30%, #ffedd5 70%, #fff7ed 100%);
  background-attachment: fixed;
  color: var(--text-dark);
  display: flex;
  justify-content: center;
  align-items: center;
}

.card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 32px;
  padding: 32px 24px;
  box-shadow: 
    0 20px 50px rgba(255, 77, 139, 0.15),
    0 10px 20px rgba(249, 115, 22, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 192, 214, 0.4);
  overflow: hidden;
}

/* Float oranges decorative elements */
.card::before {
  content: "🍊";
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 32px;
  filter: drop-shadow(0 4px 8px rgba(249, 115, 22, 0.3));
  animation: float 6s ease-in-out infinite;
  z-index: 10;
}

.card::after {
  content: "✨";
  position: absolute;
  bottom: 20px;
  left: 20px;
  font-size: 24px;
  filter: drop-shadow(0 2px 6px rgba(255, 77, 139, 0.3));
  animation: float 8s ease-in-out infinite reverse;
  z-index: 10;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(15deg); }
}

.title-container {
  text-align: center;
  margin-bottom: 24px;
}

.title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  display: inline-block;
  filter: drop-shadow(0 2px 4px rgba(255, 77, 139, 0.15));
}

.subtitle {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.greeting-card {
  background: rgba(255, 77, 139, 0.05);
  border-left: 4px solid var(--primary);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.5;
}

.greeting-name {
  font-weight: 700;
  color: var(--primary-deep);
}

.status-section {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 24px;
  border: 1px solid rgba(255, 192, 214, 0.2);
}

.status-badge-container {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.pill-loading {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(255, 77, 139, 0.2);
  animation: pulse 1.5s infinite;
}

.pill-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.pill-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.pill-warning {
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-deep) 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

.pill-error {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

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

@keyframes pulse {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}

/* Progress Section */
.progress-block {
  margin-top: 8px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  margin-bottom: 8px;
}

.progress-title {
  font-weight: 700;
  color: var(--text-dark);
}

.progress-count {
  font-weight: 900;
  color: var(--primary-deep);
  background: rgba(255, 77, 139, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.progress-bar-container {
  position: relative;
  width: 100%;
  height: 12px;
  background: rgba(255, 77, 139, 0.1);
  border-radius: 999px;
  margin: 12px 0 6px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--orange) 100%);
  position: relative;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0) 100__
  );
  animation: shimmer-progress 2.5s infinite;
  transform: translateX(-100%);
}

.progress-fill.shimmer-fast::after {
  animation-duration: 1.2s;
}

@keyframes shimmer-progress {
  100% { transform: translateX(100%); }
}

.milestone {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--white);
  border: 3px solid rgba(255, 77, 139, 0.3);
  z-index: 10;
  transition: var(--transition);
}

.milestone.reached {
  border-color: var(--primary-deep);
  background: var(--orange);
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.6);
  transform: translate(-50%, -50%) scale(1.3);
}

.milestone-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0 2px;
}

/* Stats list */
.stats-list {
  border-top: 1px dashed rgba(255, 77, 139, 0.2);
  margin-top: 16px;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.stat-name {
  color: var(--text-muted);
}

.stat-value {
  font-weight: 700;
  color: var(--text-dark);
}

/* Rules Section */
.collapsible-block {
  margin-bottom: 20px;
}

.collapsible-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 192, 214, 0.4);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  border-radius: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.collapsible-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--primary);
}

.collapsible-btn .arrow {
  transition: transform 0.3s ease;
  font-size: 10px;
}

.collapsible-btn.open .arrow {
  transform: rotate(180deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), margin-top 0.4s ease, padding 0.4s ease;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  padding: 0 16px;
}

.collapsible-content.open {
  max-height: 1200px;
  margin-top: 8px;
  padding: 16px;
  border: 1px solid rgba(255, 192, 214, 0.2);
}

.announcement-img {
  width: 100%;
  border-radius: 12px;
  margin-top: 8px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.05);
}

.rules-list {
  padding-left: 18px;
  margin-top: 8px;
  line-height: 1.6;
}

.rules-list li {
  margin-bottom: 6px;
}

/* Upload zone */
.upload-field {
  margin-bottom: 24px;
}

.field-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.file-input {
  display: none;
}

.dropzone {
  border: 2px dashed rgba(255, 77, 139, 0.3);
  border-radius: 20px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.5);
  transition: var(--transition);
  animation: dropzone-pulse 2s infinite ease-in-out;
}

@keyframes dropzone-pulse {
  0%, 100% { border-color: rgba(255, 77, 139, 0.3); background: rgba(255, 255, 255, 0.5); }
  50% { border-color: rgba(255, 77, 139, 0.6); background: rgba(255, 255, 255, 0.8); }
}

.dropzone:hover {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.9);
}

.dropzone.dragover {
  border-color: var(--orange);
  background: rgba(249, 115, 22, 0.05);
  transform: scale(1.02);
}

.dropzone-icon {
  font-size: 32px;
  margin-bottom: 8px;
  display: inline-block;
  animation: icon-float 3s ease-in-out infinite;
}

@keyframes icon-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.dropzone-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
}

.dropzone-subtext {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Image preview */
.preview-container {
  position: relative;
  margin-top: 12px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 192, 214, 0.3);
}

.preview-img {
  width: 100%;
  display: block;
  max-height: 250px;
  object-fit: cover;
}

.preview-overlay-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(101, 21, 50, 0.8);
  color: var(--white);
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.preview-overlay-btn:hover {
  background: var(--primary-deep);
  transform: scale(1.1);
}

.reselect-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: transparent;
  border: 1px dashed var(--primary);
  color: var(--primary-deep);
  padding: 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: var(--transition);
}

.reselect-btn:hover {
  background: rgba(255, 77, 139, 0.05);
}

/* Action button */
.submit-btn {
  width: 100%;
  padding: 14px;
  border-radius: 999px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  background: linear-gradient(135deg, var(--primary) 0%, var(--orange) 100%);
  box-shadow: 0 10px 25px rgba(255, 77, 139, 0.25);
  cursor: pointer;
  transition: var(--transition);
}

.submit-btn:hover:not([disabled]) {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(255, 77, 139, 0.35);
}

.submit-btn:active:not([disabled]) {
  transform: translateY(1px);
}

.submit-btn[disabled] {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.submit-btn.ready:not([disabled]) {
  animation: ready-pulse 2s infinite;
}

@keyframes ready-pulse {
  0%, 100% { box-shadow: 0 10px 25px rgba(255, 77, 139, 0.25), 0 0 0 0 rgba(255, 77, 139, 0.4); }
  50% { box-shadow: 0 12px 30px rgba(255, 77, 139, 0.35), 0 0 0 8px rgba(255, 77, 139, 0); }
}

.submit-btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

/* Messaging */
.msg {
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
  text-align: center;
  padding: 10px;
  border-radius: 12px;
  display: none;
}

.msg-success {
  display: block;
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.msg-error {
  display: block;
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.disabled-layer {
  pointer-events: none !important;
  opacity: 0.5 !important;
}

/* Confetti and pop animations */
.point-pop {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 26px;
  font-weight: 900;
  color: var(--primary-deep);
  pointer-events: none;
  animation: point-pop-up 1.5s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  text-shadow: 
    0 0 10px var(--white),
    0 2px 8px rgba(255, 77, 139, 0.5);
  z-index: 100;
}

@keyframes point-pop-up {
  0% { opacity: 0; bottom: 10px; transform: translateX(-50%) scale(0.5); }
  20% { opacity: 1; bottom: 30px; transform: translateX(-50%) scale(1.3); }
  100% { opacity: 0; bottom: 80px; transform: translateX(-50%) scale(1); }
}

.celebrate-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.celebrate-burst {
  font-size: 80px;
  animation: burst-in 2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes burst-in {
  0% { opacity: 0; transform: scale(0.2); }
  30% { opacity: 1; transform: scale(1.4); }
  100% { opacity: 0; transform: scale(2); }
}

.confetti-particle {
  position: fixed;
  top: -20px;
  font-size: 24px;
  animation: fall-down 2.5s linear forwards;
  pointer-events: none;
  z-index: 9999;
}

@keyframes fall-down {
  to { transform: translateY(115vh) rotate(540deg); opacity: 0; }
}

.footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 77, 139, 0.15);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}

/* Dark Mode (optional override support) */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #2d101a 0%, #1e0912 30%, #291206 70%, #1a0b04 100%);
  }
  .card {
    background: rgba(28, 11, 17, 0.8);
    border-color: rgba(255, 77, 139, 0.2);
    box-shadow: 
      0 20px 50px rgba(0, 0, 0, 0.4),
      0 0 40px rgba(255, 77, 139, 0.05),
      inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    color: #ffd4e3;
  }
  .status-section {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 77, 139, 0.1);
  }
  .progress-bar-container {
    background: rgba(255, 77, 139, 0.05);
  }
  .milestone {
    background: #1c0b11;
  }
  .collapsible-btn {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 192, 214, 0.1);
    color: #ffd4e3;
  }
  .collapsible-btn:hover {
    background: rgba(255, 255, 255, 0.06);
  }
  .collapsible-content {
    background: rgba(0, 0, 0, 0.1);
  }
  .dropzone {
    background: rgba(255, 255, 255, 0.02);
  }
  .dropzone:hover {
    background: rgba(255, 255, 255, 0.05);
  }
  .reselect-btn {
    color: #fca5a5;
    border-color: #fca5a5;
  }
  .reselect-btn:hover {
    background: rgba(252, 165, 165, 0.05);
  }
  .text-dark {
    color: #ffd4e3;
  }
  .stat-value {
    color: #fff;
  }
}
