:root {
  --bg: #fbf8f6;         /* warm off-white */
  --bg-soft: #f2eae4;    /* soft beige */
  --card: #ffffff;
  --card-2: #f6efe9;     /* light beige panel */
  --border: #e7ddd4;     /* warm border */
  --text: #302b33;       /* dark charcoal — readable on light */
  --text-dim: #8b8290;   /* muted */
  --accent: #d9568f;     /* rose pink */
  --accent-2: #8a5fd6;   /* violet */
  --accent-soft: rgba(217, 86, 143, 0.12);
  --good: #2fa06a;       /* green (readable on white) */
  --warn: #c58a1e;       /* amber (readable on white) */
  --radius: 14px;
  --shadow: 0 8px 26px rgba(120, 90, 110, 0.13);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

body {
  background: radial-gradient(1100px 650px at 80% -8%, #f7e6ef 0%, #fbf3ee 40%, var(--bg) 70%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
}

#app { max-width: 1100px; margin: 0 auto; padding: 0 18px 60px; }

/* ---------- Mobile: app-like bottom tab bar ---------- */
@media (max-width: 640px) {
  /* clear the fixed bottom nav (~58px) plus the phone's home-indicator area */
  #app { padding: 0 12px calc(96px + env(safe-area-inset-bottom)); }
  #topbar { position: sticky; top: 0; z-index: 20; background: var(--bg);
    padding: 12px 0 10px; margin-bottom: 16px; justify-content: center; }
  .brand { font-size: 1.15rem; }
  #nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: flex; flex-wrap: nowrap; justify-content: space-around; gap: 0;
    background: var(--bg-soft); border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(120,90,110,0.15);
  }
  .nav-btn {
    flex: 1 1 0; min-width: 0; font-size: 0.72rem; padding: 0 2px; border-radius: 12px;
    line-height: 1.1; white-space: nowrap; min-height: 46px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 2px;
  }
  .nav-btn.active { background: var(--accent-soft); border-color: transparent; }
  h1 { font-size: 1.4rem; }
  .subtitle { font-size: 0.92rem; }
  button.primary, button.ghost { min-height: 44px; }
  input[type="number"], input[type="text"], input[type="password"], select { min-height: 44px; font-size: 1rem; }
  .layout-cam { gap: 14px; }
  /* keep the camera pinned while the steps/options scroll underneath it, then
     let it scroll away once you pass the controls (grid ends) */
  .layout-cam .stage-wrap {
    position: sticky; top: 54px; align-self: start; z-index: 4;
    box-shadow: 0 6px 16px rgba(120,90,110,0.2); border-radius: var(--radius);
  }
}

/* ---------- Top bar ---------- */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; padding: 18px 0 14px;
  border-bottom: 1px solid var(--border); margin-bottom: 22px;
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: 700; letter-spacing: 0.3px; }
.brand-mark { color: var(--accent); font-size: 1.4rem; }
#nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-btn {
  background: transparent; color: var(--text-dim); border: 1px solid transparent;
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 0.92rem;
  transition: all 0.15s ease;
}
.nav-btn:hover { color: var(--text); background: var(--card); }
.nav-btn.active { color: var(--text); background: var(--accent-soft); border-color: var(--accent); }

/* ---------- Generic ---------- */
h1 { font-size: clamp(1.4rem, 4.5vw, 1.7rem); margin-bottom: 6px; }
h2 { font-size: clamp(1.05rem, 3.4vw, 1.15rem); margin: 18px 0 10px; }
h3 { font-size: 1rem; margin: 12px 0 6px; }
.out-section { display: block; }
img { max-width: 100%; height: auto; }
.subtitle { color: var(--text-dim); margin-bottom: 20px; max-width: 640px; line-height: 1.5; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.muted { color: var(--text-dim); font-size: 0.9rem; line-height: 1.5; }
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--card-2); border: 1px solid var(--border);
  font-size: 0.78rem; color: var(--text-dim); margin: 2px 3px 2px 0;
}
.pill.hot { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.tag-good { color: var(--good); }
.tag-warn { color: var(--warn); }

button.primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff; border: none; padding: 11px 22px; border-radius: 999px;
  font-size: 0.98rem; font-weight: 600; cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
button.primary:hover { transform: translateY(-1px); filter: brightness(1.1); }
button.primary:disabled { opacity: 0.5; cursor: default; transform: none; }
button.ghost {
  background: var(--card-2); color: var(--text); border: 1px solid var(--border);
  padding: 9px 16px; border-radius: 999px; font-size: 0.9rem; cursor: pointer;
}
button.ghost:hover { border-color: var(--accent); }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field span { display: block; font-size: 0.85rem; color: var(--text-dim); margin-bottom: 5px; }
input[type="number"], input[type="text"], select {
  width: 100%; background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 0.95rem;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

/* Gender selector */
.gender-row { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0 20px; }
.gender-card {
  flex: 1; min-width: 140px; text-align: center; padding: 20px 12px;
  background: var(--card); border: 2px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: all 0.15s ease; font-size: 1rem;
}
.gender-card:hover { border-color: var(--accent-2); }
.gender-card.selected { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Camera stage ---------- */
.stage-wrap { position: relative; width: 100%; max-width: 640px; margin: 0 auto; }
.stage {
  position: relative; width: 100%; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius); background: #000; border: 1px solid var(--border);
}
.stage video, .stage canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scaleX(-1); /* mirror */
}
.stage .overlay { pointer-events: none; }
.stage-msg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px; text-align: center; padding: 20px;
  color: var(--text-dim); background: rgba(15, 13, 19, 0.85); z-index: 5;
}
.stage-msg.hidden { display: none; }

/* Style chips (hairstyles, occasions, colors) */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.chip {
  padding: 8px 14px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--border); cursor: pointer; font-size: 0.88rem; color: var(--text);
  transition: all 0.12s ease;
}
.chip:hover { border-color: var(--accent-2); }
.chip.selected { background: var(--accent-soft); border-color: var(--accent); }
.chip .sub { display: block; font-size: 0.72rem; color: var(--text-dim); }

.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--border); transition: transform 0.1s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.swatch-labeled { text-align: center; width: 74px; cursor: default; }
.swatch-labeled .dot { width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 5px; border: 1px solid rgba(255,255,255,0.15); }
.swatch-labeled .name { font-size: 0.7rem; color: var(--text-dim); line-height: 1.2; }

/* ---------- Makeup steps ---------- */
.step-panel { display: flex; flex-direction: column; gap: 10px; }
.step-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.step-count { color: var(--text-dim); font-size: 0.85rem; }
.step-title { font-size: 1.2rem; font-weight: 700; }
.step-product { color: var(--accent); font-weight: 600; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.5px; }
.step-instructions { line-height: 1.6; color: var(--text); }
.step-tip {
  background: var(--card-2); border-left: 3px solid var(--accent-2);
  padding: 10px 12px; border-radius: 8px; font-size: 0.88rem; color: var(--text-dim);
}
.step-nav { display: flex; gap: 10px; margin-top: 6px; }
.progress-dots { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.pdot { width: 10px; height: 10px; border-radius: 50%; background: var(--card-2); border: 1px solid var(--border); cursor: pointer; }
.pdot.done { background: var(--accent-2); }
.pdot.current { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ---------- Results / analysis ---------- */
.result-banner {
  background: linear-gradient(120deg, var(--accent-soft), rgba(155, 111, 232, 0.14));
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 16px 18px; margin: 14px 0;
}
.result-banner .big { font-size: 1.35rem; font-weight: 700; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }
ul.styled { padding-left: 18px; line-height: 1.7; }
ul.styled li::marker { color: var(--accent); }
a.plink { color: var(--accent); text-decoration: none; font-weight: 600; }
a.plink:hover { text-decoration: underline; }
.trend-card { border-left: 3px solid var(--accent-2); }
.shop-select { width: auto; min-width: 118px; padding: 8px 10px; font-size: 0.85rem; border-radius: 999px; }
.trend-card h3 { margin-top: 0; }

.skin-preview { display: flex; align-items: center; gap: 14px; margin: 10px 0; }
.skin-dot { width: 54px; height: 54px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25); }

.layout-cam { display: grid; grid-template-columns: minmax(300px, 640px) minmax(260px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .layout-cam { grid-template-columns: 1fr; } }

.notice { background: var(--card-2); border: 1px dashed var(--border); border-radius: 10px; padding: 10px 14px; font-size: 0.85rem; color: var(--text-dim); margin-top: 14px; }

.check-line { display: block; margin: 10px 0; font-size: 0.88rem; cursor: pointer; }
.check-line input { accent-color: var(--accent); margin-right: 6px; }

/* skincare ingredient list + shop dropdowns */
.skin-ing li { margin-bottom: 12px; }
.skin-shop { width: auto; min-width: 92px; margin-top: 6px; padding: 5px 8px; font-size: 0.8rem; }

/* shade table */
.shade-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.shade-table th, .shade-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.shade-table th { color: var(--text-dim); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.4px; }
.shade-table tr.own-shade { background: var(--accent-soft); }

/* in-app lightbox */
.lightbox-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.72); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.lightbox { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); max-width: 900px; width: 100%; max-height: 85vh; overflow: auto; padding: 20px; position: relative; box-shadow: var(--shadow); }
.lightbox-close { position: absolute; top: 12px; right: 12px; background: var(--card-2); border: 1px solid var(--border); color: var(--text); border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 1rem; }
.lightbox-close:hover { border-color: var(--accent); }
.lightbox-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 14px; padding-right: 36px; }
.lightbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lb-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.lb-item img { width: 100%; height: 200px; object-fit: cover; display: block; }

/* garment try-on box */
.garment-box { margin-top: 10px; padding: 12px; border: 1px dashed var(--border); border-radius: 10px; background: var(--bg-soft); }
.garment-msg { margin-top: 6px; font-size: 0.82rem; }
.try-btn { padding: 7px 14px; font-size: 0.85rem; }

/* subtle privacy note with an info (i) icon */
.privacy-note {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin: 2px 0 20px; font-size: 0.88rem; color: var(--text-dim);
}
.info-btn {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--text-dim); background: transparent; color: var(--text-dim);
  font-style: italic; font-family: Georgia, serif; font-size: 0.8rem; font-weight: 700;
  cursor: pointer; line-height: 1; padding: 0;
}
.info-btn:hover { border-color: var(--accent); color: var(--accent); }
.privacy-detail { flex-basis: 100%; color: var(--text-dim); line-height: 1.5; max-width: 640px; margin-top: 2px; }
#privacy-more { cursor: pointer; }

/* categorised outfit gallery — Amazon-style boxes, 2 per row on phones */
.outfit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 6px; }
.outfit-box {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s;
}
.outfit-box:hover { border-color: var(--accent); transform: translateY(-2px); }
.outfit-tap { cursor: pointer; flex: 1; }
.outfit-thumb { width: 100%; aspect-ratio: 3 / 4; border-radius: 10px; margin-bottom: 8px;
  background: var(--card-2) center/cover no-repeat; }
.outfit-thumb.loaded { box-shadow: inset 0 0 0 1px var(--border); }
.outfit-text { display: block; font-size: 0.9rem; line-height: 1.35; color: var(--text); }
.try-hint { display: block; margin-top: 10px; font-size: 0.76rem; color: var(--accent); font-weight: 700; }
.outfit-box .shop-select { font-size: 0.8rem; padding: 7px 8px; }

/* collapsible measurements section */
.measure-details > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 999px; background: var(--card-2);
  border: 1px solid var(--border); color: var(--text); font-size: 0.92rem; font-weight: 600;
}
.measure-details > summary::-webkit-details-marker { display: none; }
.measure-details > summary::before { content: "＋"; color: var(--accent); font-weight: 700; }
.measure-details[open] > summary::before { content: "－"; }
.measure-details > summary:hover { border-color: var(--accent); }

/* compare strip (generate several looks side by side) */
.compare-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.compare-item { flex: 0 0 46%; max-width: 46%; scroll-snap-align: start; }
@media (min-width: 700px) { .compare-item { flex-basis: 30%; max-width: 30%; } }
.compare-item .ai-preview { width: 100%; border-radius: 10px; border: 1px solid var(--border); }
.compare-label { font-size: 0.8rem; font-weight: 600; margin-top: 5px; line-height: 1.25; }
.compare-label.before { color: var(--text-dim); font-weight: 500; }
.dl-btn.mini { display: inline-block; margin-top: 4px; padding: 5px 12px; font-size: 0.78rem; border-radius: 999px; border: 1px solid var(--border); text-decoration: none; color: var(--text); }

/* language selector bar */
.lang-bar { display: flex; justify-content: flex-end; margin: 2px 0 10px; }
.lang-bar label { display: inline-flex; align-items: center; gap: 8px; }
.lang-bar select { width: auto; min-width: 130px; padding: 7px 10px; }
/* keep the language names themselves out of Google auto-translate */
.notranslate { }

/* app footer with legal links */
#app-footer {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: center; justify-content: center;
  margin-top: 40px; padding: 18px 0 8px; border-top: 1px solid var(--border);
  font-size: 0.85rem; color: var(--text-dim);
}
#app-footer a { color: var(--text-dim); text-decoration: none; }
#app-footer a:hover { color: var(--accent); }
@media (max-width: 640px) { #app-footer { margin-bottom: 8px; } }

/* hide Google Translate's injected banner / tooltips so it doesn't shift layout */
.goog-te-banner-frame, .goog-te-gadget, #goog-gt-tt, .goog-te-balloon-frame { display: none !important; }
.goog-text-highlight { background: none !important; box-shadow: none !important; }
body { top: 0 !important; }

/* landing feature grid */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.feature-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 14px; cursor: pointer; box-shadow: var(--shadow);
  transition: border-color .12s, transform .12s;
}
.feature-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.feature-card .fc-icon { width: 30px; height: 30px; color: var(--accent); margin-bottom: 4px; }
.feature-card .fc-icon svg { width: 100%; height: 100%; }
.feature-card .fc-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.feature-card .fc-sub { font-size: 0.8rem; color: var(--text-dim); line-height: 1.3; }

/* reference-image links */
.ref-link {
  display: inline-block; margin: 0 4px; padding: 5px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--accent); color: var(--text);
  text-decoration: none; font-size: 0.85rem; font-weight: 600;
}
.ref-link:hover { background: var(--accent-soft); }

/* inspiration gallery (free Openverse photos) */
.inspo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.inspo-item { position: relative; display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); text-decoration: none; background: var(--card-2); }
.inspo-item img { width: 100%; height: 150px; object-fit: cover; display: block; transition: transform 0.2s ease; }
.inspo-item:hover img { transform: scale(1.05); }
.inspo-cred { position: absolute; left: 0; right: 0; bottom: 0; font-size: 0.64rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,0.75)); padding: 12px 6px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* AI try-on widgets */
.ai-card { border: 1px solid var(--accent); box-shadow: 0 8px 30px rgba(232, 111, 164, 0.12); }
.ai-steps { margin: 8px 0 6px; padding-left: 20px; }
.ai-steps li { margin-bottom: 14px; line-height: 1.5; }
.ai-steps input[type="password"] { margin-top: 8px; }
.ai-controls { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.ai-controls .field { flex: 1; min-width: 150px; margin-bottom: 0; }
.ai-src-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
/* camera capture + rotate */
.cam-btn { display: inline-flex; align-items: center; gap: 8px; }
.cam-btn::before { content: "📷"; }
.cam-capture { margin-top: 10px; max-width: 360px; }
.cam-capture video { width: 100%; border-radius: 12px; background: #000; transform: scaleX(-1); }
.cam-actions { display: flex; gap: 10px; margin-top: 8px; }
.preview-wrap { margin-top: 10px; }
.rotate-btn { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; }

/* prominent upload button so it clearly reads as "upload" */
.file-btn {
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff; border: none; padding: 11px 20px; border-radius: 999px;
  font-size: 0.98rem; font-weight: 600;
}
.file-btn::before { content: "⬆"; font-size: 1.05rem; }
.file-btn:hover { filter: brightness(1.1); border: none; }
.src-msg { margin-top: 4px; }
.ai-preview { max-width: 100%; max-height: 340px; border-radius: 12px; border: 1px solid var(--border); margin-top: 8px; }
.ai-result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
@media (max-width: 620px) { .ai-result-grid { grid-template-columns: 1fr; } }
.ai-cap { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 4px; }
.dl-btn { display: inline-block; margin-top: 10px; text-decoration: none; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); color: var(--text); }
.dl-btn:hover { border-color: var(--accent); }

/* small inline tags */
.mini-tag {
  display: inline-block; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; padding: 1px 7px; border-radius: 999px; vertical-align: middle;
  background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent);
}
.mini-tag.good { background: rgba(111, 232, 168, 0.12); border-color: var(--good); color: var(--good); }

/* makeup tool line */
.step-tool {
  background: var(--card-2); border-left: 3px solid var(--accent);
  padding: 10px 12px; border-radius: 8px; font-size: 0.9rem;
  display: flex; align-items: center; gap: 10px;
}
.tool-ico { width: 34px; height: 36px; flex: 0 0 auto; }
.tool-label {
  display: inline-block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--accent); margin-right: 8px;
}

/* virtual try-on model */
.model-layout { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: start; }
@media (max-width: 760px) { .model-layout { grid-template-columns: 1fr; } }
#avatar {
  width: 100%; max-width: 320px; display: block; margin: 0 auto;
  background: linear-gradient(180deg, var(--bg-soft), var(--card-2));
  border: 1px solid var(--border); border-radius: var(--radius);
}
.stage.mini { max-width: 320px; margin: 10px auto; aspect-ratio: 4/3; }
#capture-area { text-align: center; margin-top: 10px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
