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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  min-height: 100vh;
  color: #1f2937;
}

/* ===== Wrap ===== */
.stylist-wrap {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
}

/* ===== Card ===== */
.stylist-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 4px 24px rgba(124,58,237,0.1);
}

.center-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 16px;
}

/* ===== Header ===== */
.stylist-header { text-align: center; margin-bottom: 28px; }
.logo-icon { font-size: 2rem; margin-bottom: 8px; }
.stylist-header h1 { font-size: 1.6rem; font-weight: 700; color: #7c3aed; }
.subtitle { color: #6b7280; font-size: 0.9rem; margin-top: 6px; }

/* ===== Photo Upload ===== */
.photo-upload-area {
  border: 2px dashed #c4b5fd;
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 8px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.photo-upload-area:hover, .photo-upload-area.dragging {
  border-color: #7c3aed;
  background: #f5f3ff;
}
.photo-placeholder { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.upload-icon { font-size: 2rem; }
.upload-text { font-size: 0.9rem; font-weight: 600; color: #7c3aed; }
.upload-hint { font-size: 0.78rem; color: #9ca3af; }
.photo-preview { max-width: 100%; max-height: 240px; border-radius: 10px; object-fit: cover; }

/* ===== Form Fields ===== */
.field-group { margin-bottom: 18px; }
.field-label { display: block; font-size: 0.88rem; font-weight: 600; color: #374151; margin-bottom: 8px; }

.gender-btns { display: flex; gap: 8px; }
.gender-btn {
  flex: 1; padding: 10px; border: 1.5px solid #e5e7eb; border-radius: 10px;
  background: #fff; color: #6b7280; font-size: 0.88rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.gender-btn.active { border-color: #7c3aed; background: #f5f3ff; color: #7c3aed; font-weight: 600; }

.input-with-unit { display: flex; align-items: center; gap: 8px; }
.input-with-unit input {
  flex: 1; padding: 12px 14px; border: 1.5px solid #e5e7eb; border-radius: 10px;
  font-size: 1rem; color: #1f2937; outline: none; transition: border-color 0.2s;
}
.input-with-unit input:focus { border-color: #7c3aed; }
.unit { font-size: 0.88rem; color: #6b7280; font-weight: 500; white-space: nowrap; }

/* ===== BMI ===== */
.bmi-preview {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: #f5f3ff; border-radius: 10px;
  font-size: 0.88rem; font-weight: 600; color: #7c3aed; margin-bottom: 16px;
}
.bmi-badge {
  padding: 2px 8px; border-radius: 20px; font-size: 0.78rem; font-weight: 600;
}
.bmi-저체중 { background: #dbeafe; color: #1d4ed8; }
.bmi-정상   { background: #dcfce7; color: #15803d; }
.bmi-과체중 { background: #fef9c3; color: #a16207; }
.bmi-비만   { background: #fee2e2; color: #b91c1c; }

/* ===== Buttons ===== */
.btn-primary {
  width: 100%; padding: 14px; background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #fff; border: none; border-radius: 12px; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: opacity 0.2s; margin-top: 8px;
}
.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
  width: 100%; padding: 12px 24px; background: #f3e8ff; color: #7c3aed;
  border: none; border-radius: 10px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; margin-top: 12px;
}

.btn-home {
  display: block; text-align: center; margin-top: 12px; padding: 10px 24px;
  background: transparent; color: #9ca3af; border: 1px solid #e5e7eb;
  border-radius: 10px; font-size: 0.88rem; font-weight: 500;
  text-decoration: none; transition: color 0.2s, border-color 0.2s;
}
.btn-home:hover { color: #7c3aed; border-color: #c4b5fd; }

.btn-text {
  background: none; border: none; color: #9ca3af; font-size: 0.82rem;
  cursor: pointer; padding: 4px 0; margin-bottom: 12px; display: block;
}
.btn-text:hover { color: #7c3aed; }

/* ===== Loading ===== */
.spinner {
  width: 44px; height: 44px; border: 4px solid #ede9fe;
  border-top-color: #7c3aed; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 20px; height: 20px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 1.1rem; font-weight: 600; color: #7c3aed; }
.loading-sub { font-size: 0.85rem; color: #9ca3af; }

/* ===== Result ===== */
.result-wrap { width: 100%; max-width: 720px; padding-bottom: 40px; }

.result-header {
  display: flex; align-items: center; gap: 16px;
  background: #fff; border-radius: 16px; padding: 20px 24px;
  box-shadow: 0 2px 12px rgba(124,58,237,0.08); margin-bottom: 16px;
}
.result-avatar { flex-shrink: 0; }
.avatar-img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.avatar-placeholder { width: 64px; height: 64px; border-radius: 50%; background: #ede9fe; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.result-title { font-size: 1.3rem; font-weight: 700; color: #7c3aed; }
.result-meta { font-size: 0.88rem; color: #6b7280; margin-top: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.sections-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }

.section-card {
  background: #fff; border-radius: 14px; padding: 20px;
  box-shadow: 0 2px 10px rgba(124,58,237,0.07);
}
.hairstyle-card { grid-column: 1 / -1; }
.section-title { font-size: 1rem; font-weight: 700; color: #7c3aed; margin-bottom: 12px; }
.section-body { font-size: 0.88rem; color: #374151; line-height: 1.7; }
.section-body p { margin-bottom: 4px; }
.section-body .sub-heading { font-weight: 700; color: #4b5563; margin-top: 8px; }
.section-body .bullet::before { content: '• '; color: #7c3aed; }

.hairstyle-loading { display: flex; align-items: center; gap: 10px; color: #6b7280; font-size: 0.88rem; }
.hairstyle-img { width: 100%; border-radius: 10px; margin-top: 8px; }

.error-msg { color: #dc2626; font-size: 0.85rem; margin: 8px 0; }

@media (max-width: 600px) {
  .stylist-card { padding: 28px 20px; }
  .sections-grid { grid-template-columns: 1fr; }
  .result-header { flex-direction: column; text-align: center; }
}
