:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --accent: #ec4899;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px;
}

.app-container {
  width: 100%;
  max-width: 480px; /* Mobile first optimal width */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 24px);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 4px;
  margin-bottom: 8px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 24px;
}

.logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hackathon-badge {
  background: #ede9fe;
  color: #7c3aed;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

/* Screens */
.screen {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.3s ease-in-out;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero / Upload Card */
.hero-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-tag {
  display: inline-block;
  background: #fdf2f8;
  color: #db2777;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 4px 10px;
  border-radius: 6px;
  align-self: flex-start;
}

.hero-card h2 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-main);
}

.hero-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Upload Dropzone */
.upload-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  background: #f8fafc;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--primary);
  background: #eef2ff;
}

.upload-icon-circle {
  width: 56px;
  height: 56px;
  background: #e0e7ff;
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.upload-prompt h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.upload-prompt p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.upload-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Preview Container */
.preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.preview-container img {
  width: 100%;
  max-width: 320px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--primary);
  box-shadow: var(--shadow-sm);
}

.preview-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.preview-info span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

/* Form Controls */
.form-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 4px;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  cursor: pointer;
}

.checkbox-label input {
  margin-top: 2px;
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.checkbox-label a {
  color: var(--primary);
  text-decoration: underline;
}

.preference-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.select-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.select-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.select-group select {
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  font-weight: 500;
}

.select-group select:focus {
  border-color: var(--primary);
}

/* Buttons */
.btn {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:active {
  background: var(--primary-dark);
  transform: scale(0.98);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:active {
  background: #e2e8f0;
}

.btn-accent {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.3);
}

.btn-accent:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-accent:not(:disabled):active {
  transform: scale(0.98);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 12px;
  padding: 8px 14px;
}

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
  width: 100%;
}

.btn-full {
  width: 100%;
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.btn-text:hover {
  text-decoration: underline;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.feature-card {
  background: var(--card-bg);
  padding: 14px 10px;
  border-radius: var(--radius-md);
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.feat-icon {
  font-size: 20px;
  margin-bottom: 6px;
  display: block;
}

.feature-card h4 {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--text-main);
}

.feature-card p {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Loading Screen */
.loading-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 40px;
}

.scanner-wrapper {
  position: relative;
  width: 100%;
  max-width: 280px;
  height: 150px;
  margin: 0 auto;
}

.scanner-img-box {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  border: 2px solid var(--primary);
}

.scanner-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-laser {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 20px var(--accent);
  animation: scanLaser 1.8s ease-in-out infinite alternate;
}

@keyframes scanLaser {
  0% { top: 0%; }
  100% { top: 96%; }
}

.loading-card h3 {
  font-size: 20px;
  font-weight: 800;
}

.loading-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.progress-bar-track {
  width: 100%;
  height: 8px;
  background: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: var(--accent-gradient);
  transition: width 0.4s ease;
  border-radius: 4px;
}

.disclaimer-text {
  font-size: 11px;
  color: var(--text-muted);
}

/* Dashboard Screen */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.dashboard-header h2 {
  font-size: 20px;
  font-weight: 800;
}

.sub-date {
  font-size: 11px;
  color: var(--text-muted);
}

.demo-banner {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
}

/* Summary Hero Card */
.summary-hero-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 20px;
}

.score-circle-wrapper {
  flex-shrink: 0;
}

.score-ring {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0% 82%, #e2e8f0 82% 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
}

.score-ring::before {
  content: '';
  position: absolute;
  width: 74px;
  height: 74px;
  background: #ffffff;
  border-radius: 50%;
}

.score-number {
  position: relative;
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.score-label {
  position: relative;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 2px;
}

.summary-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skin-age-pill {
  background: #e0e7ff;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  align-self: flex-start;
}

.summary-details h3 {
  font-size: 15px;
  font-weight: 700;
}

.summary-details p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Metrics Grid */
.section-title {
  font-size: 16px;
  font-weight: 800;
  margin-top: 8px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.metric-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: capitalize;
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-score-badge {
  font-size: 13px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
}

.metric-bar-track {
  width: 100%;
  height: 6px;
  background: #f1f5f9;
  border-radius: 3px;
  overflow: hidden;
}

.metric-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.metric-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Routine Card */
.routine-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.routine-header h3 {
  font-size: 16px;
  font-weight: 800;
}

.routine-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.routine-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-sm);
  gap: 4px;
}

.tab-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.routine-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.routine-step-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.step-num {
  background: var(--primary);
  color: #ffffff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

.step-info h5 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}

.step-info p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-backdrop.hidden {
  display: none;
  opacity: 0;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-lg);
}

.image-modal-content {
  background: rgba(15, 23, 42, 0.95) !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-body ul {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px 0 10px;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: auto;
}

.hidden {
  display: none !important;
}

/* YouCam photo requirements */
.photo-guidance {
  margin: 16px 0;
  padding: 14px 16px;
  text-align: left;
  border: 1px solid rgba(120, 150, 140, 0.35);
  border-radius: 14px;
  background: rgba(120, 150, 140, 0.09);
  font-size: 0.88rem;
  line-height: 1.55;
}

.photo-guidance strong {
  display: block;
  margin-bottom: 7px;
}

.photo-guidance ul {
  margin: 0;
  padding-left: 20px;
}

.photo-guidance li + li {
  margin-top: 4px;
}
