/* ============================================================
   AuraMirror — AI Beauty Analysis Mirror
   Theme tokens, glassmorphism, layout & responsive rules
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Palette */
  --pink:     #FFB6C1;
  --lavender: #C8A2C8;
  --yellow:   #FFF4A3;
  --mint:     #B8F2E6;

  --ink:        #4a3a52;   /* readable text on light glass */
  --ink-soft:   #6b5b73;
  --white:      #ffffff;

  /* Glass */
  --glass-bg:     rgba(255, 255, 255, 0.35);
  --glass-bg-2:   rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-blur:   16px;

  /* Shadows */
  --shadow-sm: 0 4px 14px rgba(120, 90, 140, 0.14);
  --shadow-md: 0 10px 30px rgba(120, 90, 140, 0.18);
  --shadow-lg: 0 20px 60px rgba(120, 90, 140, 0.25);

  /* Radii & spacing */
  --radius:    22px;
  --radius-sm: 14px;
  --radius-pill: 999px;

  /* Accent gradient (buttons / highlights) */
  --grad-accent: linear-gradient(135deg, #ff9bb3, #c8a2c8 55%, #8fd9c9);

  --font: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  overflow-x: hidden;
  background: linear-gradient(135deg, var(--pink), var(--lavender) 50%, var(--mint));
  background-attachment: fixed;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

/* ---------- Animated floating background shapes ---------- */
.bg-shapes {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.bg-shapes span {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.55;
  animation: float 18s ease-in-out infinite;
}
.bg-shapes span:nth-child(1) { width: 220px; height: 220px; background: var(--pink);     top: -40px;  left: 8%;  animation-duration: 22s; }
.bg-shapes span:nth-child(2) { width: 300px; height: 300px; background: var(--mint);     bottom: -80px; right: 6%; animation-duration: 26s; animation-delay: -4s; }
.bg-shapes span:nth-child(3) { width: 160px; height: 160px; background: var(--yellow);   top: 35%;   left: 45%; animation-duration: 20s; animation-delay: -8s; }
.bg-shapes span:nth-child(4) { width: 200px; height: 200px; background: var(--lavender); top: 12%;   right: 18%; animation-duration: 24s; animation-delay: -2s; }

@keyframes float {
  0%, 100% { transform: translateY(0) translateX(0) scale(1); }
  33%      { transform: translateY(-40px) translateX(20px) scale(1.08); }
  66%      { transform: translateY(30px) translateX(-25px) scale(0.95); }
}

@media (prefers-reduced-motion: reduce) {
  .bg-shapes span,
  .floaty,
  .btn { animation: none !important; transition: none !important; }
}

/* ---------- Layout helpers ---------- */
.container {
  width: min(1200px, 92vw);
  margin-inline: auto;
}

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-md);
  border-radius: var(--radius);
}

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.85rem 1.9rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn:active { transform: translateY(1px) scale(0.98); }

.btn-primary {
  background: var(--grad-accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  filter: saturate(1.1);
}

.btn-secondary {
  background: var(--glass-bg-2);
  color: var(--ink);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

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

.btn-ghost {
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.btn-ghost.active { background: var(--grad-accent); color: #fff; border-color: transparent; }

/* ============================================================
   HOMEPAGE
   ============================================================ */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
}
.brand .logo {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--grad-accent);
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  font-size: 1.1rem;
}

.hero {
  text-align: center;
  padding: 4rem 0 3rem;
}
.hero h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1.05;
  margin: 0 0 1rem;
  background: linear-gradient(120deg, #d6557a, #8a5bb0 60%, #2faf97);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .subtitle {
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.8rem;
}
.hero .desc {
  max-width: 620px;
  margin: 0 auto 2rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
}
.hero .cta {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 + 3 = symmetrical */
  gap: 1.4rem;
  padding: 2rem 0 4rem;
}
@media (max-width: 860px) {
  .features { grid-template-columns: repeat(2, 1fr); } /* 2 + 2 + 2 */
}
@media (max-width: 540px) {
  .features { grid-template-columns: 1fr; }
}
.feature-card {
  padding: 1.8rem 1.5rem;
  text-align: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.feature-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.feature-card .icon {
  width: 60px; height: 60px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  background: var(--grad-accent);
  display: grid; place-items: center;
  font-size: 1.6rem;
  box-shadow: var(--shadow-sm);
}
.feature-card h3 { margin: 0 0 0.4rem; font-size: 1.15rem; }
.feature-card p  { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }

.disclaimer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
  padding: 1.2rem 1.5rem;
  margin-bottom: 2rem;
}
.disclaimer strong { color: var(--ink); }

.site-footer {
  text-align: center;
  padding: 2rem 0 3rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 0;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.dashboard {
  display: grid;
  grid-template-columns: 320px 1fr 360px;
  gap: 1.4rem;
  padding-bottom: 3rem;
  align-items: start;
}
.panel { padding: 1.4rem; }
.panel h2 {
  font-size: 1.05rem;
  margin: 0 0 1rem;
  display: flex; align-items: center; gap: 0.5rem;
}

/* Left panel: input */
.input-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.drop-zone {
  border: 2px dashed var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ink-soft);
  transition: background 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}
.drop-zone.dragover { background: var(--glass-bg-2); border-color: var(--lavender); }
.drop-zone .big { font-size: 2rem; margin-bottom: 0.5rem; }

.webcam-wrap { position: relative; }
.webcam-wrap video,
.webcam-wrap canvas {
  width: 100%;
  min-height: 200px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #00000022;
  display: block;
}
.cam-controls { display: flex; gap: 0.5rem; margin-top: 0.8rem; flex-wrap: wrap; }

.hidden { display: none !important; }

.preview-thumb {
  margin-top: 1rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* Center panel: stage */
.stage {
  position: relative;
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #00000018;
  display: grid;
  place-items: center;
  min-height: 360px;
}
.stage img.base {
  width: 100%;
  display: block;
}
.stage canvas.overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
.stage .empty-hint {
  color: var(--ink-soft);
  text-align: center;
  padding: 2rem;
}
.overlay-toggles {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 × 2 = symmetric */
  gap: 0.5rem;
  margin-top: 1rem;
  max-width: 360px;
  margin-inline: auto;
}
.overlay-toggles .btn-ghost {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
/* a lone last button (odd count) centers across both columns */
.overlay-toggles .btn-ghost:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  width: calc(50% - 0.25rem);
  justify-self: center;
}

/* Right panel: results */
.score-hero {
  text-align: center;
  margin-bottom: 1.2rem;
}
.score-ring {
  --val: 0;
  width: 140px; height: 140px;
  margin: 0 auto 0.6rem;
  border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(closest-side, #ffffffcc 78%, transparent 80% 100%),
    conic-gradient(#ff7aa2 calc(var(--val) * 1%), #ffffff55 0);
  position: relative;
}
.score-ring b { font-size: 2.2rem; line-height: 1; }
.score-ring small { display: block; font-size: 0.75rem; color: var(--ink-soft); }

.metric { margin-bottom: 0.9rem; }
.metric .row {
  display: flex; justify-content: space-between;
  font-size: 0.9rem; margin-bottom: 0.3rem;
}
.bar {
  height: 10px;
  border-radius: var(--radius-pill);
  background: #ffffff66;
  overflow: hidden;
}
.bar > span {
  display: block; height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--grad-accent);
  transition: width 0.9s cubic-bezier(.22,1,.36,1);
}

.chip {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-pill);
  background: var(--glass-bg-2);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0.2rem 0.2rem 0 0;
}

.list-clean { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.list-clean li {
  padding: 0.4rem 0 0.4rem 1.5rem;
  position: relative;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.list-clean.good li::before { content: "✓"; position: absolute; left: 0; color: #2faf97; font-weight: 700; }
.list-clean.warn li::before { content: "!"; position: absolute; left: 0.3rem; color: #d6557a; font-weight: 700; }

.section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 1.2rem 0 0.3rem;
}

.recommend-card {
  background: var(--glass-bg-2);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin-top: 0.6rem;
}
.recommend-card h4 { margin: 0 0 0.3rem; font-size: 0.95rem; }
.recommend-card p  { margin: 0; font-size: 0.88rem; color: var(--ink-soft); }

/* Status / loader */
.status-bar {
  text-align: center;
  padding: 0.8rem 1rem;
  margin: 0 0 1rem;
  border-radius: var(--radius-sm);
  background: var(--glass-bg-2);
  font-size: 0.92rem;
  display: none;
}
.status-bar.show { display: block; }
.status-bar.error { color: #b03060; }

.spinner {
  width: 18px; height: 18px;
  border: 3px solid #ffffff88;
  border-top-color: var(--lavender);
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.5rem;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.results-empty {
  color: var(--ink-soft);
  text-align: center;
  padding: 2rem 0;
  font-size: 0.95rem;
}

/* ============================================================
   v2 — Differentiation features
   ============================================================ */

/* quality / pose gate banner */
.quality-banner {
  background: rgba(255, 244, 163, 0.55);
  border: 1px solid rgba(214, 85, 122, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
}
.quality-banner strong { display: block; margin-bottom: 0.4rem; font-size: 0.95rem; }
.quality-banner ul { margin: 0 0 0.7rem; padding-left: 1.1rem; }
.quality-banner li { font-size: 0.88rem; color: var(--ink-soft); margin-bottom: 0.25rem; }
.quality-banner .btn { padding: 0.5rem 1.2rem; font-size: 0.9rem; }

/* live mirror */
.live-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  transform: scaleX(-1); /* match the mirrored selfie video */
}
.webcam-wrap video { transform: scaleX(-1); } /* mirror like a real mirror */
.live-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.8rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-pill);
  background: var(--glass-bg-2);
  font-weight: 600;
  font-size: 0.95rem;
}
.live-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #e8436b;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* golden-ratio limitation note */
.ratio-note {
  font-size: 0.8rem;
  color: var(--ink-soft);
  background: var(--glass-bg-2);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  margin: 1rem 0 0;
}

/* skincare routine */
.routine {
  background: var(--glass-bg-2);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  margin-top: 0.6rem;
}
.routine h4 { margin: 0 0 0.4rem; font-size: 0.95rem; }
.routine .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.routine .cols h5 { margin: 0 0 0.3rem; font-size: 0.82rem; color: var(--ink); }
.routine ol { margin: 0; padding-left: 1.1rem; }
.routine li { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 0.2rem; }
.routine .tips { font-size: 0.82rem; color: var(--ink-soft); margin-top: 0.6rem; }

/* result action buttons row */
.result-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.4rem;
}
.result-actions .btn { flex: 1; justify-content: center; padding: 0.75rem 1rem; }

/* ============================================================
   v3 — advanced skin, charts, history, homepage sections
   ============================================================ */

/* dual headline rings (Beauty + Skin) */
.score-duo {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 0.8rem;
}
.score-duo .score-ring { width: 116px; height: 116px; margin: 0; }
.score-duo .score-ring b { font-size: 1.8rem; }
.score-ring.skin {
  background:
    radial-gradient(closest-side, #ffffffcc 78%, transparent 80% 100%),
    conic-gradient(#2faf97 calc(var(--val) * 1%), #ffffff55 0);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin-bottom: 0.6rem; }

/* charts */
.chart-box { position: relative; width: 100%; height: 220px; }
.chart-box.radar { height: 240px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }

/* skin sub-score grid */
.skin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; }
.skin-metric { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.4rem; }
.sk-label { font-size: 0.78rem; color: var(--ink-soft); white-space: nowrap; }
.sk-val { font-size: 0.78rem; font-weight: 600; min-width: 1.4em; text-align: right; }
.bar.sm { height: 7px; }

/* clinical-scale estimates */
.clinical-scales { display: flex; flex-direction: column; gap: 0.35rem; }
.clin-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem;
  padding: 0.35rem 0.55rem; border-radius: 10px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(200, 162, 200, 0.3);
}
.clin-scale { font-size: 0.78rem; color: var(--ink-soft); }
.clin-val { font-size: 0.8rem; font-weight: 600; color: var(--ink); text-align: right; }
.clin-caveat { font-size: 0.72rem; color: var(--ink-soft); margin: 0.3rem 0 0; font-style: italic; }

/* heatmap legend */
.heatmap-legend {
  display: flex; align-items: center; gap: 0.4rem;
  justify-content: center; flex-wrap: wrap;
  font-size: 0.78rem; color: var(--ink-soft); margin: 0.6rem 0 0;
}
.heatmap-legend .sw { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-left: 0.6rem; }
.sw-good { background: #2fcf6f; } .sw-mid { background: #ffd24a; } .sw-bad { background: #ff5a6a; }

/* history */
.history-block { margin-top: 1.4rem; border-top: 1px solid var(--glass-border); padding-top: 1rem; }
.history-head { display: flex; align-items: center; justify-content: space-between; }
.history-actions { display: flex; gap: 0.4rem; }
.history-actions .btn-ghost { padding: 0.3rem 0.7rem; font-size: 0.78rem; }
.history-note { font-size: 0.76rem; color: var(--ink-soft); margin: 0.3rem 0 0.6rem; }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.history-item {
  background: var(--glass-bg-2); border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.hi-main { font-size: 0.85rem; }
.hi-main strong { color: var(--ink); font-size: 1rem; }
.hi-main span { color: var(--ink-soft); }
.hi-meta { display: flex; align-items: center; gap: 0.5rem; }
.hi-meta time { font-size: 0.72rem; color: var(--ink-soft); }
.hi-del { border: none; background: transparent; color: var(--ink-soft); cursor: pointer; font-size: 0.85rem; border-radius: 50%; width: 22px; height: 22px; }
.hi-del:hover { background: #ff5a6a22; color: #d6557a; }
.history-empty { font-size: 0.82rem; color: var(--ink-soft); text-align: center; padding: 0.6rem; }
.trend-wrap { margin-top: 1rem; }
.trend-wrap .chart-box { height: 180px; }

/* weekly routine column */
.routine .weekly { margin-top: 0.6rem; }
.routine .weekly h5 { margin: 0 0 0.3rem; font-size: 0.82rem; color: var(--ink); }
.routine .weekly ul { margin: 0; padding-left: 1.1rem; }
.routine .weekly li { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 0.2rem; }

/* ---------- homepage extra sections ---------- */
.section-block { padding: 2.5rem 0; }
.block-title {
  text-align: center;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  margin: 0 0 1.8rem;
  background: linear-gradient(120deg, #d6557a, #8a5bb0 60%, #2faf97);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.steps, .benefits, .testimonials {
  display: grid; gap: 1.2rem;
  grid-template-columns: repeat(4, 1fr);
}
.testimonials { grid-template-columns: repeat(3, 1fr); }
.step, .benefit { padding: 1.5rem 1.2rem; text-align: center; position: relative; }
.step-num {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; margin: 0 auto 0.8rem;
  background: var(--grad-accent); color: #fff; font-weight: 700; box-shadow: var(--shadow-sm);
}
.step h4, .benefit h4 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.step p, .benefit p { margin: 0; color: var(--ink-soft); font-size: 0.9rem; }
.benefit .icon { width: 52px; height: 52px; margin: 0 auto 0.8rem; border-radius: 16px; background: var(--grad-accent); display: grid; place-items: center; font-size: 1.4rem; box-shadow: var(--shadow-sm); }

.testimonial { margin: 0; padding: 1.5rem 1.3rem; }
.testimonial blockquote { margin: 0 0 0.8rem; font-size: 0.95rem; line-height: 1.55; color: var(--ink); }
.testimonial figcaption { font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; }

.faq { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.8rem; }
.faq details { padding: 1rem 1.2rem; cursor: pointer; }
.faq summary { font-weight: 600; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "＋"; float: right; color: var(--ink-soft); }
.faq details[open] summary::after { content: "－"; }
.faq details p { margin: 0.7rem 0 0; color: var(--ink-soft); font-size: 0.92rem; }

@media (max-width: 900px) {
  .steps, .benefits { grid-template-columns: repeat(2, 1fr); }
  .testimonials { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .steps, .benefits { grid-template-columns: 1fr; }
  .skin-grid { grid-template-columns: 1fr; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
  .dashboard { grid-template-columns: 1fr 1fr; }
  .panel-center { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 720px) {
  .dashboard { grid-template-columns: 1fr; }
  .panel-center { order: 0; }
  .hero { padding: 2.5rem 0 2rem; }
}

/* ============================================================
   AI Beauty Assistant — floating chat widget
   ============================================================ */
.chat-fab {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 60;
  width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 1.5rem; color: #fff;
  background: linear-gradient(135deg, #ff7aa2, #c8a2c8);
  box-shadow: var(--shadow-md);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.chat-fab:hover { transform: translateY(-2px) scale(1.05); box-shadow: var(--shadow-lg); }

.chat-panel {
  position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 61;
  width: min(370px, calc(100vw - 2rem)); max-height: min(70vh, 560px);
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 20px; padding: 0;
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.8rem 1rem; font-weight: 600; color: var(--ink);
  background: rgba(255, 255, 255, 0.4); border-bottom: 1px solid var(--glass-border);
}
.chat-head-actions { display: flex; gap: 0.3rem; }
.chat-icon {
  border: none; background: transparent; cursor: pointer; font-size: 1rem;
  width: 30px; height: 30px; border-radius: 50%; color: var(--ink-soft);
}
.chat-icon:hover { background: rgba(255, 255, 255, 0.5); }
.chat-icon.active { background: rgba(255, 122, 162, 0.25); color: var(--ink); }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 0.9rem 1rem; display: flex;
  flex-direction: column; gap: 0.55rem;
}
.chat-msg {
  max-width: 85%; padding: 0.55rem 0.75rem; border-radius: 14px;
  font-size: 0.88rem; line-height: 1.45; white-space: pre-line;
}
.chat-msg.bot { align-self: flex-start; background: rgba(255, 255, 255, 0.6); color: var(--ink); border-bottom-left-radius: 4px; }
.chat-msg.user { align-self: flex-end; background: linear-gradient(135deg, #ff7aa2, #c8a2c8); color: #fff; border-bottom-right-radius: 4px; }

.chat-quick { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0 1rem 0.5rem; }
.chat-quick button {
  border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.45);
  color: var(--ink-soft); font-size: 0.74rem; padding: 0.25rem 0.55rem;
  border-radius: 999px; cursor: pointer;
}
.chat-quick button:hover { background: rgba(255, 255, 255, 0.75); color: var(--ink); }

.chat-input-row { display: flex; align-items: center; gap: 0.4rem; padding: 0.6rem 0.8rem; border-top: 1px solid var(--glass-border); }
.chat-input-row input {
  flex: 1; border: 1px solid var(--glass-border); border-radius: 999px;
  padding: 0.5rem 0.8rem; font-size: 0.85rem; background: rgba(255, 255, 255, 0.6);
  color: var(--ink); outline: none;
}
.chat-input-row input:focus { border-color: #ff7aa2; }
.chat-send { padding: 0.45rem 0.9rem; font-size: 0.82rem; }
.chat-mic.listening { background: rgba(255, 90, 106, 0.25); color: #d6557a; animation: micpulse 1.1s infinite; }
@keyframes micpulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.chat-note { margin: 0; padding: 0 1rem 0.7rem; font-size: 0.68rem; color: var(--ink-soft); text-align: center; }

@media (max-width: 480px) {
  .chat-panel { right: 0.5rem; bottom: 0.5rem; width: calc(100vw - 1rem); }
}

/* ============================================================
   Ingredient-level recommendations
   ============================================================ */
.ingredient-plan { display: flex; flex-direction: column; gap: 0.6rem; }
.ing-group h5 { margin: 0 0 0.4rem; font-size: 0.82rem; color: var(--ink); }
.ing-item {
  padding: 0.5rem 0.7rem; border-radius: 12px; margin-bottom: 0.4rem;
  background: rgba(255, 255, 255, 0.4); border: 1px solid rgba(200, 162, 200, 0.3);
}
.ing-item.core { background: rgba(184, 242, 230, 0.28); border-color: rgba(120, 200, 180, 0.35); }
.ing-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.ing-name { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.ing-when { font-size: 0.72rem; color: var(--ink-soft); white-space: nowrap; }
.ing-tag { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; color: #2f9f87; }
.ing-use { margin: 0.25rem 0 0; font-size: 0.8rem; color: var(--ink-soft); line-height: 1.4; }
.ing-use em { color: var(--ink); font-style: normal; opacity: 0.85; }
.ing-caution { margin: 0.2rem 0 0; font-size: 0.72rem; color: #b06a55; }
.ing-note { margin: 0.2rem 0 0; font-size: 0.72rem; color: var(--ink-soft); font-style: italic; }

/* ============================================================
   Mole / spot self-check (ABCDE) modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  background: rgba(74, 58, 82, 0.45); backdrop-filter: blur(4px); padding: 1rem;
}
.modal {
  width: min(480px, 100%); max-height: 88vh; overflow-y: auto;
  border-radius: 20px; padding: 1.2rem 1.3rem;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.modal-head h3 { margin: 0; font-size: 1.1rem; color: var(--ink); }
.mole-intro { font-size: 0.85rem; color: var(--ink-soft); margin: 0 0 0.9rem; line-height: 1.5; }

.mole-questions { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.mole-q {
  display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.55rem 0.7rem;
  border-radius: 12px; background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--glass-border); cursor: pointer;
}
.mole-q input { margin-top: 0.2rem; width: 18px; height: 18px; accent-color: #ff7aa2; flex-shrink: 0; }
.mole-q .mq-text { font-size: 0.85rem; color: var(--ink); }
.mole-q .mq-key { font-weight: 700; color: #c8557a; }
.mole-q .mq-help { display: block; font-size: 0.74rem; color: var(--ink-soft); margin-top: 0.15rem; }

.mole-result { margin-top: 1rem; padding: 0.8rem 0.9rem; border-radius: 14px; }
.mole-result.hidden { display: none; }
.mole-result h4 { margin: 0 0 0.3rem; font-size: 0.95rem; }
.mole-result p { margin: 0; font-size: 0.84rem; line-height: 1.5; }
.mole-result.ok    { background: rgba(47, 207, 111, 0.14); border: 1px solid rgba(47, 207, 111, 0.4); }
.mole-result.ok h4 { color: #1f9d54; }
.mole-result.watch { background: rgba(255, 210, 74, 0.16); border: 1px solid rgba(230, 180, 40, 0.45); }
.mole-result.watch h4 { color: #b98900; }
.mole-result.high  { background: rgba(255, 90, 106, 0.14); border: 1px solid rgba(255, 90, 106, 0.45); }
.mole-result.high h4 { color: #d6455f; }
.mole-disc { font-size: 0.72rem; color: var(--ink-soft); margin: 0.9rem 0 0; font-style: italic; line-height: 1.45; }

/* ============================================================
   Language switcher + RTL
   ============================================================ */
.header-actions { display: flex; align-items: center; gap: 0.6rem; }
.lang-select {
  border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.5);
  color: var(--ink); border-radius: 999px; padding: 0.35rem 0.7rem;
  font-size: 0.8rem; font-family: inherit; cursor: pointer;
}
.lang-select:focus { outline: 2px solid rgba(255, 122, 162, 0.5); }

/* basic right-to-left support (Arabic) */
[dir="rtl"] .chat-msg.user { border-bottom-right-radius: 14px; border-bottom-left-radius: 4px; }
[dir="rtl"] .chat-msg.bot  { border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
[dir="rtl"] .mole-q { text-align: right; }
[dir="rtl"] .clin-item, [dir="rtl"] .ing-head { flex-direction: row-reverse; }

/* ============================================================
   Capture-consistency badge (reproducibility)
   ============================================================ */
.consistency { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.6rem 0.75rem;
  border-radius: 12px; margin-bottom: 0.8rem; border: 1px solid transparent; }
.consistency.hidden { display: none; }
.consistency strong { font-size: 0.85rem; }
.consistency span { font-size: 0.76rem; color: var(--ink-soft); line-height: 1.4; }
.consistency.baseline { background: rgba(200, 162, 200, 0.16); border-color: rgba(200, 162, 200, 0.4); }
.consistency.good  { background: rgba(47, 207, 111, 0.13); border-color: rgba(47, 207, 111, 0.4); }
.consistency.good strong { color: #1f9d54; }
.consistency.mild  { background: rgba(255, 210, 74, 0.15); border-color: rgba(230, 180, 40, 0.45); }
.consistency.mild strong { color: #b98900; }
.consistency.off   { background: rgba(255, 122, 162, 0.14); border-color: rgba(255, 122, 162, 0.45); }
.consistency.off strong { color: #d6455f; }

/* ============================================================
   Before / After comparison
   ============================================================ */
.compare-picks { display: flex; gap: 0.6rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.compare-picks label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.76rem; color: var(--ink-soft); flex: 1; min-width: 130px; }
.compare-picks select {
  border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.6);
  color: var(--ink); border-radius: 10px; padding: 0.4rem 0.5rem; font-family: inherit; font-size: 0.78rem;
}
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.cmp-table th, .cmp-table td { padding: 0.35rem 0.4rem; text-align: center; border-bottom: 1px solid rgba(200, 162, 200, 0.2); }
.cmp-table th { color: var(--ink-soft); font-weight: 600; font-size: 0.72rem; }
.cmp-table td:first-child, .cmp-table th:first-child { text-align: left; color: var(--ink); }
.cmp-up   { color: #1f9d54; font-weight: 600; }
.cmp-down { color: #d6455f; font-weight: 600; }
.cmp-flat { color: var(--ink-soft); }
.cmp-hint { font-size: 0.72rem; color: var(--ink-soft); margin: 0.7rem 0 0; font-style: italic; }

/* ============================================================
   Scan labelling (condition / moment tracking)
   ============================================================ */
.scan-tag { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.6rem 0 0.2rem; }
.scan-tag label { font-size: 0.78rem; color: var(--ink-soft); }
.scan-tag input {
  border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.55);
  color: var(--ink); border-radius: 10px; padding: 0.45rem 0.7rem; font-family: inherit; font-size: 0.82rem;
}
.scan-tag input:focus { outline: none; border-color: #ff7aa2; }
.hi-tag { display: inline-block; font-size: 0.72rem; color: #9a6aae; margin-top: 0.15rem; }

