/**
 * 焕新AI H5 样式
 * 移动端优先，粉紫渐变主题
 */

/* ==================== 基础重置 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
  background: #F8F9FF;
}

/* ==================== 变量 ==================== */
:root {
  --pink: #FF69B4;
  --purple: #8A2BE2;
  --gradient: linear-gradient(135deg, #FF69B4 0%, #8A2BE2 100%);
  --bg: #F8F9FF;
  --white: #FFFFFF;
  --gray-100: #F5F5F5;
  --gray-200: #E5E5E5;
  --gray-400: #999;
  --gray-600: #666;
  --gray-800: #333;
  --success: #52C41A;
  --warning: #FAAD14;
  --error: #FF4D4F;
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

/* ==================== 页面容器 ==================== */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  display: none;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: flex;
}

/* ==================== 启动页 ==================== */
#splash-screen {
  background: var(--gradient);
  justify-content: center;
  align-items: center;
}

.splash-content {
  text-align: center;
  color: var(--white);
}

.splash-logo {
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}

.splash-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}

.splash-slogan {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 40px;
}

.splash-loader {
  width: 120px;
  height: 4px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
}

.loader-bar {
  width: 0;
  height: 100%;
  background: var(--white);
  border-radius: 2px;
  animation: loading 1.5s ease-out forwards;
}

@keyframes loading {
  to { width: 100%; }
}

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

/* ==================== 首页 ==================== */
.home-header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--purple);
}

.home-logo {
  width: 32px;
  height: 32px;
}

.home-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.home-hero {
  text-align: center;
  margin-bottom: 40px;
}

.hero-circle {
  width: 140px;
  height: 140px;
  background: var(--gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 20px 60px rgba(255, 105, 180, 0.4);
}

.hero-circle i {
  font-size: 48px;
  color: var(--white);
}

.home-hero h2 {
  font-size: 24px;
  color: var(--gray-800);
  margin-bottom: 8px;
}

.home-hero p {
  color: var(--gray-600);
}

.home-actions {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
}

.home-features {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-600);
}

.feature-item i {
  color: var(--pink);
}

.home-stats {
  color: var(--gray-400);
  font-size: 14px;
}

.home-stats span {
  color: var(--purple);
  font-weight: 600;
}

/* ==================== 按钮样式 ==================== */
.btn-primary {
  background: var(--gradient);
  color: var(--white);
  border: none;
  padding: 14px 28px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s;
  box-shadow: 0 8px 24px rgba(255, 105, 180, 0.4);
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 4px 12px rgba(255, 105, 180, 0.4);
}

.btn-secondary {
  background: var(--white);
  color: var(--purple);
  border: 2px solid var(--purple);
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s;
}

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

.btn-large {
  width: 100%;
  padding: 16px;
}

.btn-back, .btn-icon, .btn-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--gray-600);
  padding: 8px;
  cursor: pointer;
}

.btn-copy {
  background: var(--gradient);
  color: var(--white);
  border: none;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
}

/* ==================== 拍照引导页 ==================== */
.guide-header, .result-header, .products-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}

.guide-header span, .result-header span, .products-header span {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
}

.result-header .btn-back, .products-header .btn-back {
  position: absolute;
}

.result-header span, .products-header span {
  width: 100%;
}

.guide-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

.guide-demo {
  margin-bottom: 40px;
}

.demo-face {
  width: 160px;
  height: 200px;
  background: var(--gray-100);
  border-radius: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.demo-face i {
  font-size: 60px;
  color: var(--gray-400);
}

.demo-frame {
  position: absolute;
  inset: -10px;
  border: 3px dashed var(--pink);
  border-radius: 90px;
  animation: framePulse 2s ease-in-out infinite;
}

@keyframes framePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.02); }
}

.guide-tips {
  width: 100%;
  max-width: 280px;
  margin-bottom: 40px;
}

.tip-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  font-size: 15px;
}

.tip-good i { color: var(--success); }
.tip-bad i { color: var(--error); }

/* ==================== 分析中页面 ==================== */
#analyzing-screen {
  background: var(--gray-800);
  justify-content: center;
  align-items: center;
}

.analyzing-content {
  text-align: center;
  padding: 20px;
  width: 100%;
}

.analyzing-photo {
  width: 200px;
  height: 200px;
  margin: 0 auto 40px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}

.analyzing-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--gradient);
  box-shadow: 0 0 20px var(--pink);
  animation: scan 2s ease-in-out infinite;
}

@keyframes scan {
  0%, 100% { top: 0; }
  50% { top: calc(100% - 4px); }
}

.analyzing-status {
  color: var(--white);
}

.status-icon {
  font-size: 32px;
  color: var(--pink);
  margin-bottom: 16px;
}

.analyzing-status h3 {
  font-size: 20px;
  margin-bottom: 20px;
}

.progress-bar {
  width: 200px;
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  margin: 0 auto 16px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 3px;
  width: 0;
  transition: width 0.3s;
}

.analyzing-text {
  color: var(--gray-400);
  font-size: 14px;
}

/* ==================== 诊断报告页 ==================== */
.result-content {
  flex: 1;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
}

.result-hero {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.result-photo {
  width: 100px;
  height: 100px;
  border-radius: 16px;
  overflow: hidden;
  flex-shrink: 0;
}

.result-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-scores {
  flex: 1;
  display: flex;
  gap: 12px;
}

.score-card {
  flex: 1;
  background: var(--white);
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.score-value {
  font-size: 32px;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.score-label {
  font-size: 12px;
  color: var(--gray-600);
  margin: 4px 0;
}

.score-desc {
  font-size: 11px;
  color: var(--pink);
}

.result-section {
  background: var(--white);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.result-section h4 {
  font-size: 15px;
  color: var(--gray-800);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-section h4 i {
  color: var(--pink);
}

.skin-type {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.type-label {
  color: var(--gray-600);
}

.type-value {
  font-weight: 600;
  color: var(--purple);
}

/* 指标列表 */
.metrics-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.metric-icon {
  width: 32px;
  height: 32px;
  background: var(--gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 14px;
}

.metric-info {
  flex: 1;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.metric-name {
  font-size: 14px;
  color: var(--gray-800);
}

.metric-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--purple);
}

.metric-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.metric-fill {
  height: 100%;
  background: var(--gradient);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* 建议列表 */
.advice-list {
  list-style: none;
}

.advice-list li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--gray-600);
  line-height: 1.6;
}

.advice-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 8px;
  height: 8px;
  background: var(--gradient);
  border-radius: 50%;
}

.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.result-actions button {
  flex: 1;
}

/* ==================== 产品推荐页 ==================== */
.products-content {
  flex: 1;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
}

.products-intro {
  color: var(--gray-600);
  margin-bottom: 20px;
}

.products-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 30px;
}

.product-card {
  background: var(--white);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  gap: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.product-image {
  width: 80px;
  height: 80px;
  background: var(--gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 24px;
  flex-shrink: 0;
}

.product-info {
  flex: 1;
}

.product-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 4px;
}

.product-target {
  font-size: 12px;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.product-match {
  display: inline-block;
  background: rgba(255, 105, 180, 0.1);
  color: var(--pink);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.product-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--purple);
}

.treatments-section h4 {
  font-size: 15px;
  color: var(--gray-800);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.treatments-section h4 i {
  color: var(--pink);
}

.treatments-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
}

.treatment-item {
  background: var(--white);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.treatment-name {
  font-size: 14px;
  color: var(--gray-800);
}

.treatment-price {
  font-size: 13px;
  color: var(--pink);
}

.contact-section {
  text-align: center;
  padding: 20px;
  background: var(--white);
  border-radius: 16px;
}

.contact-section p {
  color: var(--gray-600);
  font-size: 14px;
  margin-bottom: 12px;
}

.wechat-id {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--gray-100);
  padding: 12px 20px;
  border-radius: 30px;
}

.wechat-id i {
  color: #07C160;
  font-size: 20px;
}

.wechat-id span {
  font-weight: 600;
  color: var(--gray-800);
}

/* ==================== 弹窗 ==================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  animation: fadeIn 0.3s;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--white);
  border-radius: 24px 24px 0 0;
  padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
  animation: slideUp 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header span {
  font-size: 17px;
  font-weight: 600;
}

/* 分享预览 */
.share-preview {
  background: var(--gray-100);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
}

.share-preview canvas {
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.share-actions {
  text-align: center;
}

.share-tip {
  margin-top: 12px;
  font-size: 13px;
  color: var(--gray-400);
}

/* 留资表单 */
.contact-form {
  text-align: center;
}

.contact-form p {
  color: var(--gray-600);
  margin-bottom: 20px;
}

.contact-form input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  font-size: 16px;
  margin-bottom: 12px;
  outline: none;
}

.contact-form input:focus {
  border-color: var(--pink);
}

.privacy-note {
  margin-top: 16px;
  font-size: 12px;
  color: var(--gray-400);
}

.privacy-note i {
  margin-right: 4px;
}

/* ==================== Toast ==================== */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: var(--white);
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* ==================== 工具类 ==================== */
.hidden {
  display: none !important;
}
