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

html,
body {
  height: auto;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #FDF2F8;
  color: #000000;
  line-height: 1.5;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0.7rem 1rem 4rem 1rem;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.header.result-mode {
  margin-bottom: 0;
}

.logo-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 9rem;
  height: 9rem;
  margin-bottom: 0.4rem;
}

.logo-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.header p {
  color: #6b7280;
  font-size: 1rem;
}

.uploader-area {
  position: relative;
  border: 2px dashed #d1d5db;
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
  background-color: #f9fafb;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.uploader-area:hover {
  border-color: #9ca3af;
}

.uploader-area.dragging {
  border-color: #3b82f6;
  background-color: #eff6ff;
}

.uploader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.upload-icon-wrapper {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background-color: #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.upload-icon-wrapper svg {
  width: 2rem;
  height: 2rem;
  color: #3b82f6;
}

.uploader-text {
  color: #374151;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.uploader-hint {
  color: #9ca3af;
  font-size: 0.875rem;
}

.uploader-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-upload {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: #3b82f6;
  color: #ffffff;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-upload:hover {
  background-color: #2563eb;
}

.btn-upload:active {
  transform: scale(0.98);
}

.btn-camera {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: #1f2937;
  color: #ffffff;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-camera:hover {
  background-color: #111827;
}

.btn-camera:active {
  transform: scale(0.98);
}

.preview-section-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-container {
  position: relative;
  border-radius: 1rem;
  overflow: hidden;
  background-color: #ffffff;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.preview-container img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.btn-clear-preview {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.15s;
}

.btn-clear-preview:hover {
  transform: scale(1.1);
}

.btn-clear-preview:active {
  transform: scale(0.9);
}

.btn-clear-preview svg {
  width: 1.25rem;
  height: 1.25rem;
}

.analyzing-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.analyzing-icon {
  animation: spin 1s linear infinite;
  color: #ffffff;
}

.analyzing-icon svg {
  width: 2.5rem;
  height: 2.5rem;
}

.analyzing-text {
  position: absolute;
  margin-top: 4rem;
  color: #ffffff;
  font-weight: 500;
}

.error-box {
  padding: 1rem;
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.75rem;
  text-align: center;
}

.error-box p {
  color: #dc2626;
  font-weight: 500;
}

.btn-retry {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.625rem;
  background-color: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-retry:hover {
  background-color: #dc2626;
}

.btn-retry:active {
  transform: scale(0.98);
}

.btn-retry svg {
  width: 1rem;
  height: 1rem;
}

.result-card {
  width: 100%;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.result-header {
  background: linear-gradient(to right, #fb923c, #ec4899, #a855f7);
  padding: 0.85rem 1.25rem;
}

.result-header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.result-header svg {
  width: 1.3rem;
  height: 1.3rem;
  color: #ffffff;
}

.result-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
}

.result-body {
  padding: 1rem;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  min-height: 280px;
}

.score-section {
  border-radius: 0.75rem;
  overflow: hidden;
  background: linear-gradient(135deg, #fff7ed, #fdf2f8);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
}

.score-display {
  text-align: center;
  margin-bottom: 0.5rem;
}

.score-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2937;
}

.score-unit {
  font-size: 0.875rem;
  color: #9ca3af;
  margin-left: 0.25rem;
}

.score-mood {
  font-size: 0.875rem;
  font-weight: 500;
  color: #4b5563;
}

.score-image-wrapper {
  flex: 1;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.score-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.emotion-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.emotion-item {
  padding: 0.6rem;
  border-radius: 0.75rem;
}

.emotion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.emotion-label-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.emotion-icon {
  font-size: 1.125rem;
}

.emotion-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.emotion-score {
  font-size: 0.875rem;
  font-weight: 700;
}

.emotion-bar-bg {
  height: 0.375rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 9999px;
  overflow: hidden;
}

.emotion-bar-fill {
  height: 100%;
  border-radius: 9999px;
  width: 0;
  transition: width 0.6s ease-out;
}

.action-buttons {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.btn-share {
  flex: 1;
  padding: 0.9rem;
  background: linear-gradient(to right, #fb923c, #ec4899);
  color: #ffffff;
  border: none;
  border-radius: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  font-size: 1rem;
}

.btn-share:hover {
  transform: scale(1.02);
}

.btn-share:active {
  transform: scale(0.98);
}

.btn-share svg {
  width: 1.15rem;
  height: 1.15rem;
}

.btn-download {
  flex: 1;
  padding: 0.9rem;
  background-color: #374151;
  color: #ffffff;
  border: none;
  border-radius: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s;
  font-size: 1rem;
}

.btn-download:hover {
  transform: scale(1.02);
}

.btn-download:active {
  transform: scale(0.98);
}

.btn-download svg {
  width: 1rem;
  height: 1rem;
}

.btn-reset {
  width: 100%;
  padding: 0.85rem;
  background-color: #e2e8f0;
  color: #334155;
  border: none;
  border-radius: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  margin-top: 0.65rem;
  transition: transform 0.15s, background-color 0.15s;
  font-size: 1rem;
}

.btn-reset:hover {
  background-color: #cbd5e1;
  transform: scale(1.02);
}

.btn-reset:active {
  transform: scale(0.98);
}

.btn-reset svg {
  width: 1rem;
  height: 1rem;
}

.footer-section {
  margin-top: 3rem;
}

.footer-card {
  background: #ffffff;
  border-radius: 1rem;
  padding: 1rem 1.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.footer-card p {
  color: #6b7280;
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.footer-card img {
  width: 8rem;
  height: 8rem;
  margin: 0.4rem auto;
  border-radius: 0.75rem;
  display: block;
}

.ad-section {
  margin-top: 1.2rem;
  margin-bottom: 1rem;
}

.ad-card {
  background: linear-gradient(to right, #ffedd5, #fce7f3);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.ad-card a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #ea580c;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
  font-size: 1rem;
}

.ad-card a:hover {
  color: #c2410c;
}

.ad-emoji {
  font-size: 1.125rem;
}

.hidden {
  display: none !important;
}

.wechat-save-overlay {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  cursor: pointer;
}

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

@media (max-width: 360px) {
  .container {
    padding: 1rem 0.75rem;
  }

  .logo-wrapper {
    width: 7rem;
    height: 7rem;
  }

  .header h1 {
    font-size: 1.75rem;
  }

  .result-grid {
    gap: 0.75rem;
  }

  .score-number {
    font-size: 1.5rem;
  }

  .emotion-item {
    padding: 0.5rem;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 3rem 2rem;
  }

  .logo-wrapper {
    width: 11.2rem;
    height: 11.2rem;
  }
}
