/* AI Skin Analyzer widget – scoped under .sa-app so it doesn't leak into (or inherit much from) the theme. */
.sa-app {
  --sa-brand: #0F7C6C;
  --sa-ink: #17302C;
  --sa-ink-2: #4E625E;
  --sa-porcelain: #F4F8F7;
  --sa-mist: #DCE7E4;
  --sa-good: #2E9B6E;
  --sa-watch: #CF8F22;
  --sa-act: #C2453B;
  --sa-card: #FFFFFF;
  --sa-on-ink: #FFFFFF;
  --sa-radius-lg: 18px;
  --sa-radius-sm: 10px;
  --sa-display: 'Sora', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

  box-sizing: border-box;
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(20px, 5vw, 36px);
  background: var(--sa-porcelain);
  border-radius: var(--sa-radius-lg);
  color: var(--sa-ink);
  font-size: 16px;
  line-height: 1.55;
  text-align: left;
}
.sa-app *, .sa-app *::before, .sa-app *::after { box-sizing: inherit; }
.sa-app p, .sa-app ul, .sa-app ol, .sa-app dl, .sa-app figure { margin: 0; padding: 0; }
.sa-app ul, .sa-app ol { list-style: none; }
.sa-app img { max-width: 100%; display: block; }
.sa-app a { color: var(--sa-brand); }
.sa-app button { font: inherit; }
.sa-app :focus-visible { outline: 3px solid color-mix(in srgb, var(--sa-brand) 45%, transparent); outline-offset: 2px; }
.sa-app h2:focus { outline: none; }

.sa-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Type ---------- */
.sa-app .sa-h1,
.sa-app .sa-h2,
.sa-app .sa-h3 {
  font-family: var(--sa-display);
  color: var(--sa-ink);
  letter-spacing: -0.01em;
  margin: 0;
  padding: 0;
  border: 0;
  text-transform: none;
}
.sa-app .sa-h1 { font-size: clamp(1.6rem, 4.5vw, 2.1rem); line-height: 1.15; font-weight: 600; }
.sa-app .sa-h2 { font-size: 1.3rem; line-height: 1.3; font-weight: 600; }
.sa-app .sa-h3 { font-size: 1.02rem; line-height: 1.3; font-weight: 600; margin-bottom: 12px; }
.sa-lead { color: var(--sa-ink-2); font-size: 1.05rem; max-width: 34em; margin-top: 10px !important; }
.sa-muted { color: var(--sa-ink-2); }
.sa-hello { color: var(--sa-brand); font-weight: 600; margin-bottom: 6px !important; }

/* ---------- Buttons ---------- */
.sa-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.sa-actions-center { justify-content: center; margin-top: 14px; }
.sa-app .sa-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border-radius: 999px; border: 1.5px solid transparent;
  font-family: var(--sa-display); font-size: .95rem; font-weight: 600; line-height: 1;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
  box-shadow: none; text-transform: none; letter-spacing: 0;
}
.sa-app .sa-btn-primary { background: var(--sa-brand); color: #fff; }
.sa-app .sa-btn-primary:hover { background: color-mix(in srgb, var(--sa-brand) 85%, #000); color: #fff; }
.sa-app .sa-btn-quiet { background: var(--sa-card); color: var(--sa-ink); border-color: var(--sa-mist); }
.sa-app .sa-btn-quiet:hover { border-color: var(--sa-brand); color: var(--sa-brand); }
.sa-app .sa-btn-small { min-height: 38px; padding: 0 16px; font-size: .85rem; background: var(--sa-ink); color: var(--sa-on-ink); }
.sa-app .sa-btn-small:hover { background: var(--sa-brand); color: #fff; }
.sa-app .sa-btn.is-added { background: var(--sa-card); color: var(--sa-good); border-color: var(--sa-good); }
.sa-app .sa-btn:disabled { cursor: default; opacity: .75; }
.sa-app .sa-btn[hidden] { display: none; }
.sa-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.sa-app .sa-link {
  background: none; border: 0; padding: 8px 4px; margin-top: 14px;
  color: var(--sa-brand); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
  min-height: 0; box-shadow: none;
}
.sa-actions-center .sa-link { margin-top: 0; }


/* ---------- Themes (Settings → Skin Analyzer → Theme, or [skin_analyzer theme="rose"]) ---------- */
.sa-app[data-theme="rose"]     { --sa-brand: #B8456B; --sa-ink: #3A1F2A; --sa-ink-2: #6E5560; --sa-porcelain: #FBF5F7; --sa-mist: #EFDDE3; }
.sa-app[data-theme="lavender"] { --sa-brand: #6A4FB6; --sa-ink: #251E3D; --sa-ink-2: #5D5673; --sa-porcelain: #F7F5FC; --sa-mist: #E3DEF3; }
.sa-app[data-theme="ocean"]    { --sa-brand: #1768AC; --sa-ink: #13263A; --sa-ink-2: #4B5E71; --sa-porcelain: #F3F7FB; --sa-mist: #DAE5F0; }
.sa-app[data-theme="sand"]     { --sa-brand: #8A5A2B; --sa-ink: #2E2419; --sa-ink-2: #6B5D4E; --sa-porcelain: #FAF6F0; --sa-mist: #EBE1D3; }
.sa-app[data-theme="midnight"] {
  --sa-brand: #3CC3A5; --sa-ink: #E8F1EE; --sa-ink-2: #9FB3AE; --sa-porcelain: #0F1716; --sa-mist: #26332F;
  --sa-card: #17211F; --sa-on-ink: #0F1716; --sa-good: #45C28A; --sa-watch: #E6AA45; --sa-act: #E86A5C;
  color-scheme: dark;
}
.sa-app[data-theme="midnight"] .sa-btn-primary { color: #06120F; }
.sa-app[data-theme="midnight"] .sa-btn-primary:hover { background: color-mix(in srgb, var(--sa-brand) 85%, #fff); color: #06120F; }

/* ---------- Boot / notices ---------- */
.sa-errref { margin-top: 8px !important; font-size: .78rem; color: var(--sa-ink-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.sa-boot { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 240px; color: var(--sa-ink-2); }
.sa-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--sa-mist); border-top-color: var(--sa-brand); animation: sa-spin .8s linear infinite; }
.sa-notice { padding: 16px 18px; background: var(--sa-card); border-left: 4px solid var(--sa-watch); border-radius: var(--sa-radius-sm); }

.sa-boot-slow { display: block; opacity: 0; max-height: 0; overflow: hidden; margin-top: 8px; padding: 0 16px; color: var(--sa-ink-2); font-size: .9rem; text-align: center; animation: sa-reveal 0s 12s forwards; }
@keyframes sa-reveal { to { opacity: 1; max-height: 400px; } }

/* ---------- Start ---------- */
.sa-tips-photo { margin-top: 24px; padding: 18px 20px; background: var(--sa-card); border-radius: var(--sa-radius-sm); }
.sa-tips-title { font-weight: 600; margin-bottom: 8px !important; }
.sa-tips-photo li { position: relative; padding-left: 22px; color: var(--sa-ink-2); }
.sa-tips-photo li + li { margin-top: 4px; }
.sa-tips-photo li::before {
  content: ''; position: absolute; left: 2px; top: .5em; width: 9px; height: 9px;
  border-radius: 50%; border: 2px solid var(--sa-brand);
}
.sa-consent {
  display: flex; gap: 12px; align-items: flex-start; margin-top: 16px;
  padding: 14px 16px; border-radius: var(--sa-radius-sm); border: 1.5px solid var(--sa-mist); background: var(--sa-card);
  font-size: .88rem; color: var(--sa-ink-2); cursor: pointer;
}
.sa-consent strong { color: var(--sa-ink); display: block; margin-bottom: 4px; }
.sa-consent input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--sa-brand); }
.sa-consent.is-invalid { border-color: var(--sa-act); }

/* ---------- Camera / photo ---------- */
.sa-frame {
  position: relative; overflow: hidden; border-radius: var(--sa-radius-lg);
  background: #0e1f1c; aspect-ratio: 3 / 4; max-height: 70vh; margin: 0 auto; width: 100%; max-width: 440px;
}
.sa-frame video, .sa-frame img { width: 100%; height: 100%; object-fit: cover; }
.sa-camera video { transform: scaleX(-1); }
.sa-oval { position: absolute; inset: 0; width: 100%; height: 100%; }
.sa-frame-hint {
  position: absolute; left: 0; right: 0; bottom: 14px; text-align: center;
  color: #fff; font-size: .9rem; text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.sa-preview .sa-frame { margin-top: 16px; }
.sa-preview .sa-actions, .sa-error .sa-actions { justify-content: flex-start; }

.sa-app .sa-shutter {
  width: 74px; height: 74px; border-radius: 50%; padding: 0; cursor: pointer;
  background: var(--sa-brand); border: 5px solid #fff; box-shadow: 0 0 0 2px var(--sa-brand);
}
.sa-app .sa-shutter:active { transform: scale(.95); }

/* ---------- Analyzing: the one motion moment ---------- */
.sa-analyzing { text-align: center; }
.sa-analyzing .sa-frame { max-width: 300px; margin-bottom: 22px; }
.sa-scanning img { filter: saturate(.85); }
.sa-scanline {
  position: absolute; left: 0; right: 0; height: 30%;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--sa-brand) 45%, transparent) 85%, #fff 100%);
  animation: sa-scan 2.2s ease-in-out infinite alternate;
}
.sa-analyzing .sa-muted { margin-top: 6px !important; }

/* ---------- Result ---------- */
.sa-result-head { display: flex; align-items: center; gap: clamp(18px, 5vw, 36px); }
.sa-dial { position: relative; width: clamp(150px, 38vw, 200px); flex: none; }
.sa-dial svg { width: 100%; height: auto; display: block; fill: none; stroke-linecap: round; }
.sa-dial-track { stroke: var(--sa-mist); }
.sa-dial-fill { stroke-dasharray: 100; stroke-dashoffset: 100; animation: sa-draw .8s cubic-bezier(.2,.7,.2,1) forwards; }
.sa-dial-fill.sa-tone-good { stroke: var(--sa-good); }
.sa-dial-fill.sa-tone-watch { stroke: var(--sa-watch); }
.sa-dial-fill.sa-tone-act { stroke: var(--sa-act); }
.sa-dial-center { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 36%; }
.sa-dial-num { font-family: var(--sa-display); font-size: clamp(2.6rem, 9vw, 3.4rem); font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.sa-dial-of { font-family: var(--sa-display); color: var(--sa-ink-2); font-size: .95rem; margin-left: 2px; }

.sa-grade { margin-top: 6px !important; font-family: var(--sa-display); font-weight: 600; font-size: 1.05rem; }
.sa-grade .sa-tone-good { color: var(--sa-good); }
.sa-grade .sa-tone-watch { color: var(--sa-watch); }
.sa-grade .sa-tone-act { color: var(--sa-act); }
.sa-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 12px !important; }
.sa-facts dt { font-size: .8rem; color: var(--sa-ink-2); }
.sa-facts dd { margin: 0; font-weight: 600; }

.sa-summary { margin-top: 24px !important; font-size: 1.02rem; max-width: 36em; }
.sa-block { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--sa-mist); }

.sa-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.sa-chips li { padding: 6px 14px; border-radius: 999px; background: var(--sa-card); border: 1.5px solid var(--sa-ink); font-size: .9rem; font-weight: 600; }

.sa-params { display: grid; gap: 4px; }
.sa-param { border-radius: var(--sa-radius-sm); }
.sa-param > summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(120px, 1.1fr) 2fr minmax(120px, auto);
  align-items: center; gap: 14px; padding: 8px 6px; border-radius: var(--sa-radius-sm);
}
.sa-param > summary::-webkit-details-marker { display: none; }
.sa-param > summary:hover, .sa-param[open] > summary { background: var(--sa-card); }
.sa-param-name { font-size: .95rem; }
.sa-param-name::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 8px; border-right: 1.5px solid var(--sa-ink-2); border-bottom: 1.5px solid var(--sa-ink-2); transform: translateY(-3px) rotate(45deg); transition: transform .15s; }
.sa-param[open] .sa-param-name::after { transform: translateY(0) rotate(-135deg); }
.sa-param-more { padding: 4px 6px 12px; font-size: .9rem; display: grid; gap: 6px; max-width: 40em; }
.sa-bar { height: 8px; border-radius: 99px; background: var(--sa-mist); overflow: hidden; }
.sa-bar span { display: block; height: 100%; border-radius: inherit; }
.sa-tone-good .sa-bar span { background: var(--sa-good); }
.sa-tone-watch .sa-bar span { background: var(--sa-watch); }
.sa-tone-act .sa-bar span { background: var(--sa-act); }
.sa-param-val { font-size: .85rem; color: var(--sa-ink-2); text-align: right; white-space: nowrap; }
.sa-param-val b { font-family: var(--sa-display); color: var(--sa-ink); font-size: .95rem; margin-right: 4px; }

.sa-tabs { display: inline-flex; padding: 4px; background: var(--sa-card); border-radius: 999px; border: 1px solid var(--sa-mist); margin-bottom: 14px; }
.sa-app .sa-tab {
  border: 0; background: none; padding: 8px 18px; border-radius: 999px; cursor: pointer;
  font-family: var(--sa-display); font-weight: 600; font-size: .9rem; color: var(--sa-ink-2); min-height: 0; box-shadow: none;
}
.sa-app .sa-tab span { font-weight: 400; opacity: .7; }
.sa-app .sa-tab.is-on { background: var(--sa-ink); color: var(--sa-on-ink); }

.sa-routine { counter-reset: sa-step; display: grid; gap: 10px; }
.sa-product { counter-increment: sa-step; background: var(--sa-card); border-radius: var(--sa-radius-sm); padding: 12px 14px; }
.sa-step { display: block; font-size: .78rem; color: var(--sa-brand); font-weight: 600; margin-bottom: 8px; }
.sa-step::before { content: counter(sa-step) '. '; }
.sa-product-main { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; }
.sa-product-img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--sa-porcelain); }
.sa-product-img-empty { display: block; background: linear-gradient(135deg, var(--sa-mist), var(--sa-porcelain)); }
.sa-product-name { font-weight: 600; line-height: 1.3; }
.sa-product-name a { color: var(--sa-ink); text-decoration: none; }
.sa-product-name a:hover { color: var(--sa-brand); text-decoration: underline; }
.sa-product-why { font-size: .85rem; color: var(--sa-ink-2); margin-top: 2px !important; }
.sa-product-buy { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sa-price { font-family: var(--sa-display); font-weight: 600; font-size: .95rem; }

.sa-tips li { position: relative; padding-left: 18px; max-width: 38em; }
.sa-tips li + li { margin-top: 8px; }
.sa-tips li::before { content: ''; position: absolute; left: 0; top: .65em; width: 7px; height: 2px; background: var(--sa-brand); }
.sa-error .sa-tips { margin-top: 14px; color: var(--sa-ink-2); }

.sa-actions-footer { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--sa-mist); }
.sa-disclaimer { margin-top: 18px !important; font-size: .8rem; color: var(--sa-ink-2); max-width: 44em; }

/* ---------- History ---------- */
.sa-app .sa-back { margin: 0 0 12px; padding-left: 0; }
.sa-change { margin-top: 10px !important; font-family: var(--sa-display); font-weight: 600; }
.sa-change.sa-tone-good { color: var(--sa-good); }
.sa-change.sa-tone-act { color: var(--sa-act); }
.sa-spark { margin-top: 18px !important; background: var(--sa-card); border-radius: var(--sa-radius-sm); padding: 8px; }
.sa-spark svg { width: 100%; height: 140px; display: block; overflow: visible; }
.sa-spark path { fill: none; stroke: var(--sa-brand); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.sa-spark circle { fill: var(--sa-card); stroke: var(--sa-brand); stroke-width: 2; vector-effect: non-scaling-stroke; }
.sa-spark-mid { stroke: var(--sa-mist); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.sa-spark text { font-family: var(--sa-display); font-weight: 700; font-size: 15px; fill: var(--sa-ink); }
.sa-hist { margin-top: 18px !important; display: grid; gap: 8px; }
.sa-hist li { display: flex; align-items: center; background: var(--sa-card); border-radius: var(--sa-radius-sm); padding-right: 10px; }
.sa-app .sa-hist-open {
  flex: 1; display: flex; align-items: center; gap: 14px; text-align: left;
  background: none; border: 0; padding: 12px 14px; cursor: pointer; color: var(--sa-ink); min-height: 0; box-shadow: none;
}
.sa-hist-score {
  width: 48px; height: 48px; flex: none; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--sa-display); font-weight: 700; border: 3px solid currentColor;
}
.sa-hist-score.sa-tone-good { color: var(--sa-good); }
.sa-hist-score.sa-tone-watch { color: var(--sa-watch); }
.sa-hist-score.sa-tone-act { color: var(--sa-act); }
.sa-hist-body { display: flex; flex-direction: column; }
.sa-hist-body span { font-size: .85rem; color: var(--sa-ink-2); }
.sa-app .sa-hist-del { margin: 0; color: var(--sa-ink-2); font-weight: 400; font-size: .85rem; }
.sa-app .sa-hist-del:hover { color: var(--sa-act); }

/* ---------- Shared bits ---------- */
.sa-small { font-size: .85rem; }
.sa-app .sa-link-center { display: block; margin-left: auto; margin-right: auto; text-align: center; }
.sa-app .sa-link .sa-icon { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.sa-app .sa-btn-wide { width: 100%; }
.sa-actions-stack { flex-direction: column; }
.sa-actions-split { display: grid; grid-template-columns: 1fr 1fr; }
.sa-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--sa-c, var(--sa-act)); margin-right: 8px; flex: none; }
.sa-chips li { display: inline-flex; align-items: center; }

/* ---------- Concern picker ---------- */
.sa-radios { margin-top: 22px; display: grid; gap: 4px; }
.sa-radio {
  display: flex; gap: 16px; align-items: flex-start; padding: 14px 14px; border-radius: var(--sa-radius-sm);
  cursor: pointer; border: 1.5px solid transparent; background: transparent; transition: background-color .15s, border-color .15s;
}
.sa-radio:hover { background: var(--sa-card); }
.sa-radio input { position: absolute; opacity: 0; pointer-events: none; }
.sa-radio-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #9AA9A6; flex: none; margin-top: 2px; display: grid; place-items: center; }
.sa-radio.is-on { background: var(--sa-card); border-color: var(--sa-brand); }
.sa-radio.is-on .sa-radio-dot { border-color: var(--sa-brand); }
.sa-radio.is-on .sa-radio-dot::after { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--sa-brand); }
.sa-radio input:focus-visible + .sa-radio-dot { outline: 3px solid color-mix(in srgb, var(--sa-brand) 45%, transparent); outline-offset: 2px; }
.sa-radio-text { display: grid; gap: 2px; }
.sa-radio-text b { font-family: var(--sa-display); font-weight: 600; font-size: 1.05rem; }
.sa-radio-text span { color: var(--sa-ink-2); font-size: .92rem; }

/* ---------- 3-photo capture ---------- */
.sa-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.sa-app .sa-slot { display: grid; gap: 8px; padding: 0; background: none; border: 0; cursor: pointer; text-align: center; color: var(--sa-ink); min-height: 0; box-shadow: none; }
.sa-slot-frame {
  position: relative; display: grid; place-items: center; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden;
  background: var(--sa-mist); border: 2px solid var(--sa-card); box-shadow: 0 1px 3px rgba(23,48,44,.12);
}
.sa-slot:hover .sa-slot-frame { border-color: var(--sa-brand); }
.sa-slot.is-required:not(.is-filled) .sa-slot-frame { border-color: color-mix(in srgb, var(--sa-brand) 55%, #fff); }
.sa-slot-frame img { width: 100%; height: 100%; object-fit: cover; }
.sa-sil { width: 70%; height: auto; fill: #A9B5B2; }
.sa-sil-corners { fill: none; stroke: #9AA9A6; stroke-width: 2; }
.sa-slot-check { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; color: #fff; background: var(--sa-brand); border-radius: 50%; }
.sa-slot-label { font-size: .78rem; font-weight: 600; letter-spacing: .02em; color: var(--sa-ink-2); }
.sa-privacy { margin-top: 10px !important; text-align: center; font-size: .82rem; color: var(--sa-ink-2); display: flex; justify-content: center; align-items: center; gap: 6px; }
.sa-privacy .sa-icon { width: 15px; height: 15px; }
.sa-frame-tag { position: absolute; top: 12px; left: 12px; background: rgba(10,25,22,.7); color: #fff; font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 99px; }

/* ---------- Annotated result (visual) ---------- */
.sa-visual { display: grid; gap: 14px; }
.sa-chips-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; margin: 0 -4px; }
.sa-chips-scroll::-webkit-scrollbar { display: none; }
.sa-app .sa-fchip {
  flex: none; display: inline-flex; align-items: center; padding: 9px 16px; border-radius: 999px; border: 1.5px solid var(--sa-mist);
  background: var(--sa-card); color: var(--sa-ink); font-family: var(--sa-display); font-weight: 600; font-size: .88rem; cursor: pointer; min-height: 0; box-shadow: none;
}
.sa-app .sa-fchip.is-on { background: var(--sa-ink); border-color: var(--sa-ink); color: var(--sa-on-ink); }
.sa-viewtabs { display: flex; gap: 6px; }
.sa-app .sa-viewtab { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--sa-ink-2); min-height: 0; box-shadow: none; }
.sa-app .sa-viewtab span { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--sa-mist); font-size: .75rem; margin-left: 4px; }
.sa-app .sa-viewtab.is-on { background: var(--sa-card); color: var(--sa-ink); box-shadow: 0 1px 2px rgba(23,48,44,.12); }
.sa-annot { position: relative; width: 100%; max-width: 480px; margin: 0 auto; border-radius: var(--sa-radius-lg); overflow: hidden; background: #0e1f1c; }
.sa-annot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sa-annot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sa-mark { cursor: pointer; animation: sa-pop .35s cubic-bezier(.2,.8,.3,1.2) both; transform-box: fill-box; transform-origin: center; }
.sa-mark circle, .sa-mark ellipse { fill: color-mix(in srgb, var(--sa-c) 10%, transparent); stroke: var(--sa-c); stroke-width: 2.5px; vector-effect: non-scaling-stroke; }
.sa-mark .is-area { stroke-dasharray: 7 5; }
.sa-mark:hover circle, .sa-mark:hover ellipse { stroke-width: 4px; }
.sa-cards { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 10px; scrollbar-width: thin; }
.sa-card {
  flex: 0 0 min(84%, 360px); scroll-snap-align: start; background: var(--sa-card); border-radius: 16px; padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(23,48,44,.08); border: 2px solid transparent; cursor: pointer; display: grid; gap: 6px; align-content: start;
}
.sa-card.is-on { border-color: var(--sa-c, var(--sa-ink)); }
.sa-card .sa-h3 { margin: 0; display: flex; align-items: center; }
.sa-card-count { font-weight: 700; font-size: .95rem; }
.sa-card-count.sa-tone-watch { color: var(--sa-watch); }
.sa-card-count.sa-tone-good { color: var(--sa-good); }
.sa-card-level { font-size: .85rem; font-weight: 600; color: var(--sa-c, var(--sa-ink-2)); }
.sa-card-text { color: var(--sa-ink); font-size: .92rem; }
.sa-card-help { font-size: .88rem; color: var(--sa-ink-2); }
.sa-card-note { font-size: .8rem; color: var(--sa-ink-2); font-style: italic; }
.sa-warnings { font-size: .82rem; color: var(--sa-ink-2); padding-left: 18px !important; list-style: disc !important; }

/* ---------- Report additions ---------- */
.sa-product-brand { font-size: .72rem; font-weight: 600; letter-spacing: .04em; color: var(--sa-ink-2); }
.sa-howto { margin-top: 4px; font-size: .84rem; }
.sa-howto summary { cursor: pointer; color: var(--sa-brand); font-weight: 600; }
.sa-howto p { margin-top: 4px !important; color: var(--sa-ink-2); }
.sa-product-buy .sa-link { margin: 0; padding: 2px 0; }

/* ---------- History: metrics, compare ---------- */
.sa-metrics { display: flex; gap: 6px; overflow-x: auto; margin-top: 16px; padding-bottom: 4px; scrollbar-width: none; }
.sa-app .sa-metric { flex: none; border: 1px solid var(--sa-mist); background: var(--sa-card); border-radius: 99px; padding: 6px 12px; font-size: .82rem; cursor: pointer; color: var(--sa-ink-2); min-height: 0; box-shadow: none; }
.sa-app .sa-metric.is-on { background: var(--sa-brand); border-color: var(--sa-brand); color: #fff; }
.sa-spark-x { font-size: 11px; fill: var(--sa-ink-2); font-family: inherit; }
.sa-compare-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.sa-compare-bar .sa-link { margin: 0; }
.sa-hist-thumb { width: 44px; height: 56px; border-radius: 8px; object-fit: cover; flex: none; }
.sa-hist li.is-selected { outline: 2px solid var(--sa-brand); }
.sa-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.sa-cmp-side { display: grid; gap: 8px; }
.sa-cmp-side img, .sa-cmp-noimg { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; background: var(--sa-mist); display: block; }
.sa-cmp-side figcaption { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .88rem; }
.sa-cmp-score { margin-left: auto; font-family: var(--sa-display); font-weight: 700; font-size: 1.2rem; }
.sa-cmp-score.sa-tone-good { color: var(--sa-good); } .sa-cmp-score.sa-tone-watch { color: var(--sa-watch); } .sa-cmp-score.sa-tone-act { color: var(--sa-act); }
.sa-deltas { margin-top: 18px !important; display: grid; gap: 6px; }
.sa-deltas li { display: grid; grid-template-columns: 1fr auto 64px; gap: 10px; align-items: center; background: var(--sa-card); border-radius: 10px; padding: 10px 14px; font-size: .92rem; }
.sa-delta { text-align: right; font-family: var(--sa-display); }
.sa-delta-good { color: var(--sa-good); } .sa-delta-act { color: var(--sa-act); } .sa-delta-flat { color: var(--sa-ink-2); }

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .sa-app { border-radius: 0; padding: 22px 16px 28px; }
  .sa-result-head { flex-direction: column; align-items: flex-start; }
  .sa-dial { width: 170px; }
  .sa-param > summary { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .sa-param > summary .sa-bar { grid-column: 1 / -1; grid-row: 2; }
  .sa-slots { gap: 8px; }
  .sa-actions-split .sa-btn { flex: initial; }
  .sa-card { flex-basis: 86%; }
  .sa-product-main { grid-template-columns: 48px 1fr; }
  .sa-product-img { width: 48px; height: 48px; }
  .sa-product-buy { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; }
  .sa-actions .sa-btn { flex: 1 1 100%; }
}

/* ---------- Motion ---------- */
@keyframes sa-spin { to { transform: rotate(360deg); } }
@keyframes sa-scan { from { top: -30%; } to { top: 100%; } }
@keyframes sa-draw { to { stroke-dashoffset: 0; } }
@keyframes sa-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .sa-app *, .sa-app *::before { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .sa-dial-fill { stroke-dashoffset: 0; }
  .sa-scanline { display: none; }
}

/* =====================================================================
   v1.3 – live camera, tips, hi-tech scan, zoomable face map
   ===================================================================== */
html.sa-noscroll, html.sa-noscroll body { overflow: hidden !important; }

/* ---------- Tips ---------- */
.sa-tips-view { text-align: center; }
.sa-tips-view .sa-lead { margin-left: auto !important; margin-right: auto !important; }
.sa-tip-art { max-width: 340px; margin: 4px auto 22px; }
.sa-tip-art svg { width: 100%; height: auto; display: block; }
.sa-art-bg { fill: var(--sa-card); }
.sa-art-oval { fill: none; stroke: var(--sa-brand); stroke-width: 2.5; stroke-dasharray: 6 5; }
.sa-art-skin { fill: #D9A37F; }
.sa-art-ink { fill: #3A2A20; }
.sa-art-line { fill: none; stroke: var(--sa-ink); stroke-width: 2.5; stroke-linecap: round; }
.sa-art-window { fill: color-mix(in srgb, var(--sa-brand) 14%, var(--sa-card)); stroke: var(--sa-ink); stroke-width: 2.5; }
.sa-art-rays path { stroke: #E0A43B; stroke-width: 3; stroke-linecap: round; }
.sa-art-ring { fill: none; stroke: var(--sa-mist); stroke-width: 8; }
.sa-art-ring-on { fill: none; stroke: var(--sa-brand); stroke-width: 8; stroke-linecap: round; stroke-dasharray: 72 100; transform: rotate(-90deg); transform-origin: 100px 75px; }
.sa-art-num { font-family: var(--sa-display); font-size: 46px; font-weight: 700; fill: var(--sa-ink); }
.sa-dots { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.sa-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--sa-mist); }
.sa-dots span.is-on { background: var(--sa-ink); }
.sa-tips-view .sa-actions { justify-content: center; }
.sa-secure { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 12px !important; font-size: .8rem; color: var(--sa-ink-2); }
.sa-secure .sa-icon { width: 15px; height: 15px; }

/* ---------- Full-screen live camera ---------- */
.sa-app .sa-camera { position: fixed; inset: 0; z-index: 2147483000; background: #000; margin: 0; padding: 0; }
.sa-cam-stage { position: absolute; inset: 0; overflow: hidden; }
.sa-cam-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.sa-cam-stage .sa-oval { position: absolute; inset: 0; width: 100%; height: 100%; }
.sa-oval-ring { fill: none; stroke: #fff; stroke-width: .7; stroke-dasharray: 2.2 1.6; transition: stroke .25s; }
.sa-camera[data-live="ok"] .sa-oval-ring { stroke: #3DDC97; stroke-width: 1.1; stroke-dasharray: none; filter: drop-shadow(0 0 1.5px #3DDC97); }
.sa-camera[data-live="adjust"] .sa-oval-ring { stroke: #FFD166; }
.sa-cam-top { position: absolute; top: max(16px, env(safe-area-inset-top)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 0 16px; }
.sa-cam-top .sa-frame-tag { position: static; }
.sa-app .sa-cam-hint { background: rgba(0,0,0,.6); color: #fff; padding: 10px 16px; border-radius: 99px; font-weight: 600; font-size: .95rem; text-align: center; max-width: 92%; backdrop-filter: blur(6px); }
.sa-camera[data-live="ok"] .sa-cam-hint { background: rgba(21,122,86,.85); }
.sa-countdown { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); font-family: var(--sa-display); font-weight: 700; font-size: clamp(64px, 22vw, 120px); color: #fff; text-shadow: 0 2px 18px rgba(0,0,0,.55); pointer-events: none; }
.sa-countdown:not(:empty) { animation: sa-count 1s ease-out infinite; }
.sa-cam-bottom { position: absolute; left: 0; right: 0; bottom: max(22px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 18px; }
.sa-app .sa-cam-btn { justify-self: center; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 99px; padding: 10px 18px; font-weight: 600; min-height: 44px; cursor: pointer; backdrop-filter: blur(6px); box-shadow: none; }
.sa-camera .sa-shutter { width: 76px; height: 76px; box-shadow: 0 0 0 3px rgba(255,255,255,.5); }
@keyframes sa-count { 0% { transform: translate(-50%, -50%) scale(1.25); opacity: .6; } 30% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: .9; } }

/* ---------- Hi-tech scan ---------- */
.sa-scan-stage { position: relative; width: 100%; max-width: 360px; margin: 0 auto 22px; aspect-ratio: 3 / 4; border-radius: 22px; overflow: hidden; background: #071512; box-shadow: 0 0 0 1px color-mix(in srgb, var(--sa-brand) 40%, transparent), 0 18px 50px -18px color-mix(in srgb, var(--sa-brand) 65%, transparent); }
.sa-scan-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(.75) contrast(1.05) brightness(.85); }
.sa-scan-grid { position: absolute; inset: 0; background-image: linear-gradient(color-mix(in srgb, #3DDCB5 16%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, #3DDCB5 16%, transparent) 1px, transparent 1px); background-size: 22px 22px; mask-image: radial-gradient(ellipse 60% 55% at 50% 45%, #000 40%, transparent 80%); animation: sa-grid 6s linear infinite; }
@keyframes sa-grid { to { background-position: 0 22px, 22px 0; } }
.sa-mesh { position: absolute; inset: 0; width: 100%; height: 100%; }
.sa-mesh-line { fill: none; stroke: #6BFFD8; stroke-width: 2; stroke-dasharray: 100; stroke-dashoffset: 100; vector-effect: non-scaling-stroke; animation: sa-draw 2.4s ease-out forwards; filter: drop-shadow(0 0 3px #3DDCB5); }
.sa-mesh-web { fill: none; stroke: rgba(107,255,216,.45); stroke-width: 1; stroke-dasharray: 100; stroke-dashoffset: 100; vector-effect: non-scaling-stroke; animation: sa-draw 3s .6s ease-out forwards; }
.sa-mesh-dots circle { fill: #EFFFFA; opacity: 0; animation: sa-dot 1.8s ease-out forwards, sa-blink 2.4s 2s ease-in-out infinite; filter: drop-shadow(0 0 2px #6BFFD8); }
@keyframes sa-dot { to { opacity: 1; } }
@keyframes sa-blink { 50% { opacity: .35; } }
.sa-scan-stage .sa-scanline { position: absolute; left: 0; right: 0; height: 22%; background: linear-gradient(to bottom, transparent, rgba(61,220,181,.28) 80%, #B8FFEA 100%); box-shadow: 0 6px 16px -6px #6BFFD8; animation: sa-scan 2.4s ease-in-out infinite alternate; }
.sa-hud { position: absolute; width: 26px; height: 26px; border: 3px solid #6BFFD8; }
.sa-hud-tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.sa-hud-tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.sa-hud-bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.sa-hud-br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }
.sa-app .sa-scan-badge { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); white-space: nowrap; background: rgba(4,20,16,.75); color: #B8FFEA; border: 1px solid rgba(107,255,216,.5); padding: 6px 12px; border-radius: 99px; font: 600 .78rem/1 var(--sa-display); letter-spacing: .02em; }
.sa-scan-badge[hidden] { display: none; }
.sa-scan-steps { max-width: 360px; margin: 0 auto 10px !important; display: grid; gap: 8px; }
.sa-scan-steps li { display: flex; align-items: center; gap: 10px; color: var(--sa-ink-2); font-size: .95rem; opacity: .55; transition: opacity .3s; }
.sa-scan-steps li.is-active { opacity: 1; color: var(--sa-ink); font-weight: 600; }
.sa-scan-steps li.is-done { opacity: .85; }
.sa-step-dot { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid var(--sa-mist); position: relative; }
.sa-scan-steps li.is-active .sa-step-dot { border-color: var(--sa-brand); border-top-color: transparent; animation: sa-spin .8s linear infinite; }
.sa-scan-steps li.is-done .sa-step-dot { background: var(--sa-brand); border-color: var(--sa-brand); }
.sa-scan-steps li.is-done .sa-step-dot::after { content: ''; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.sa-center { text-align: center; }

/* ---------- Zoomable face map ---------- */
.sa-annot { position: relative; overflow: hidden; }
.sa-annot-inner { position: absolute; inset: 0; transform-origin: 0 0; transition: transform .55s cubic-bezier(.2,.7,.2,1); will-change: transform; }
.sa-annot-inner img, .sa-annot-inner svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sa-annot-inner img { object-fit: cover; }
.sa-mark.is-hidden { display: none; }
.sa-mark { transition: opacity .3s; }
.sa-focus { fill: rgba(255,255,255,.08); stroke: #fff; stroke-width: 3; vector-effect: non-scaling-stroke; opacity: 0; transition: opacity .3s .25s; }
.sa-annot.is-zoomed .sa-focus { opacity: 1; filter: drop-shadow(0 0 6px rgba(0,0,0,.45)); }
.sa-annot.is-zoomed .sa-mark circle, .sa-annot.is-zoomed .sa-mark ellipse { vector-effect: non-scaling-stroke; }

@media (prefers-reduced-motion: reduce) {
  .sa-annot-inner { transition: none; }
  .sa-scan-grid, .sa-scanline, .sa-countdown { animation: none !important; }
  .sa-mesh-line, .sa-mesh-web { stroke-dashoffset: 0; animation: none; }
  .sa-mesh-dots circle { opacity: 1; animation: none; }
}
