/* RARA Boldly Me — live brow try-on */
@font-face { font-family: "Montserrat"; font-weight: 400; font-display: swap; src: url("../fonts/montserrat-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 500; font-display: swap; src: url("../fonts/montserrat-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-display: swap; src: url("../fonts/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url("../fonts/montserrat-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Josefin Sans"; font-weight: 400; font-display: swap; src: url("../fonts/josefin-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Josefin Sans"; font-weight: 600; font-display: swap; src: url("../fonts/josefin-sans-latin-600-normal.woff2") format("woff2"); }

:root {
  /* Brand palette */
  --cream: #FBF8F5;
  --blush: #F2EAE8;
  --tan: #D8B08C;
  --red: #822613;
  --red-deep: #6A1E0F;
  --black: #000000;
  --ink: #1F1513;
  --muted: #6B5850;
  --line: #E5D6CD;
  --card: #FFFFFF;
  --font: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --font-label: "Josefin Sans", Futura, "Century Gothic", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px;
  border: 1.5px solid transparent; border-radius: 999px;
  font-weight: 600; font-size: 16px; text-decoration: none; text-align: center;
  cursor: pointer; user-select: none; -webkit-user-select: none;
}
.btn svg { width: 22px; height: 22px; flex: none; }
.btn-primary { background: var(--red); color: var(--cream); }
.btn-primary:active { background: var(--red-deep); }
.btn-secondary { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-secondary:active { background: var(--blush); }
.btn-quiet { background: transparent; color: var(--ink); min-height: 44px; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--tan); }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- Start screen ---------- */
.intro {
  min-height: 100%;
  display: flex; justify-content: center;
  padding: calc(26px + var(--safe-t)) max(20px, var(--safe-r)) calc(22px + var(--safe-b)) max(20px, var(--safe-l));
}
.intro-inner { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 22px; }
.intro-logo { display: block; width: min(300px, 80%); height: auto; align-self: center; margin-top: 6px; }
.intro-copy { display: grid; gap: 10px; }
.intro h1 { margin: 0; font-size: clamp(26px, 7vw, 30px); font-weight: 600; line-height: 1.18; letter-spacing: -.01em; text-wrap: balance; }
.lede { margin: 0; color: var(--muted); font-size: 15.5px; }
.cta { display: grid; gap: 10px; }
.privacy {
  display: flex; gap: 10px; align-items: flex-start; margin: 0;
  padding: 12px 14px; border-radius: 14px; background: var(--blush);
  font-size: 13px; line-height: 1.5; color: var(--muted);
}
.privacy svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--red); }
.tips { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
.tips li { display: flex; gap: 10px; align-items: center; }
.tips svg { width: 14px; height: 14px; flex: none; fill: var(--red); }
.install {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
}
.install img { display: block; width: 48px; height: 48px; border-radius: 12px; box-shadow: 0 0 0 1px var(--line); }
.install-copy { min-width: 0; }
.install p { margin: 0; }
.install-title { font-weight: 700; font-size: 15px; }
.install-text { font-size: 13px; line-height: 1.45; color: var(--muted); }
.btn-small { min-height: 40px; padding: 0 16px; font-size: 14px; background: var(--ink); color: var(--cream); }
.notice { padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--red); }
.notice p { margin: 0; }
.notice-title { font-weight: 700; margin-bottom: 4px !important; }
.notice-text { font-size: 14px; color: var(--muted); }
.intro-foot { margin-top: auto; padding-top: 10px; display: grid; gap: 6px; justify-items: center; text-align: center; }
.intro-foot p { margin: 0; }
.strap { font-family: var(--font-label); font-weight: 600; font-size: 12px; letter-spacing: .24em; text-transform: uppercase; padding-top: 2px; }
.links { display: flex; gap: 10px; font-size: 13px; color: var(--muted); }
.links a { text-decoration: none; border-bottom: 1px solid var(--tan); }

/* ---------- Try-on ---------- */
.live {
  position: fixed; inset: 0;
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  background: var(--cream);
}
.stage { position: relative; overflow: hidden; background: var(--blush); min-height: 0; }
#view { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
#cam { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: calc(10px + var(--safe-t)) max(12px, var(--safe-r)) 0 max(12px, var(--safe-l));
  pointer-events: none;
}
.logo-pill {
  pointer-events: auto; display: block; padding: 8px 12px 7px; border-radius: 14px;
  background: rgba(251, 248, 245, .92); box-shadow: 0 4px 18px rgba(0, 0, 0, .16);
}
.logo-pill img { display: block; width: auto; height: 34px; }
.icon-btn {
  pointer-events: auto; display: grid; place-items: center;
  width: 46px; height: 46px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(251, 248, 245, .92); color: var(--ink); cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .16);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn-line { box-shadow: none; background: var(--card); border: 1.5px solid var(--line); justify-self: end; }
.hint, .before-tag {
  position: absolute; left: 50%; transform: translateX(-50%); margin: 0;
  border-radius: 999px; white-space: nowrap; pointer-events: none;
}
.hint { top: 46%; padding: 10px 18px; background: rgba(20, 14, 12, .72); color: var(--cream); font-weight: 600; font-size: 14px; }
.before-tag {
  top: calc(66px + var(--safe-t)); padding: 7px 15px 5px;
  background: var(--cream); color: var(--ink);
  font-family: var(--font-label); font-weight: 600; font-size: 12px; letter-spacing: .2em; text-transform: uppercase;
}

.panel {
  position: relative; margin-top: -18px;
  padding: 14px max(14px, var(--safe-r)) calc(12px + var(--safe-b)) max(14px, var(--safe-l));
  border-radius: 22px 22px 0 0; background: var(--cream);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .22);
}
.panel-inner { width: 100%; max-width: 560px; margin: 0 auto; display: grid; gap: 10px; }
.styles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.style-btn {
  display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 58px;
  padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--card); text-align: left; cursor: pointer;
}
.style-btn img { width: 62px; height: auto; flex: none; }
.style-btn span { min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.2; }
.style-btn[aria-pressed="true"] { border-color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }
.opt-row { display: grid; grid-template-columns: 62px minmax(0, 1fr); align-items: center; gap: 8px; }
.opt-label { padding-top: 3px; font-family: var(--font-label); font-weight: 600; font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--red); }
.chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.chip {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 0; min-height: 42px; padding: 0 8px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--card);
  font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer;
}
.chip small { font-size: 11px; font-weight: 500; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--black); border-color: var(--black); color: var(--cream); }
.chip[aria-pressed="true"] small { color: var(--tan); }
.chip .dot { width: 14px; height: 14px; flex: none; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px var(--card); }
.actions { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding-top: 2px; }
.pill-btn {
  justify-self: start; min-height: 44px; padding: 0 16px;
  border: 1.5px solid var(--ink); border-radius: 999px; background: transparent;
  font-size: 13px; font-weight: 600; cursor: pointer;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
}
.pill-btn[aria-pressed="true"] { background: var(--ink); color: var(--cream); }
.shutter {
  position: relative; width: 68px; height: 68px; padding: 0;
  border: 4px solid var(--red); border-radius: 50%; background: var(--cream); cursor: pointer;
}
.shutter::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--red); }
.shutter:active::after { inset: 8px; }

@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .live { grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: minmax(0, 1fr); }
  .panel { margin-top: 0; border-radius: 0; box-shadow: none; display: flex; align-items: center; }
  .panel-inner { gap: 14px; }
  .styles { grid-template-columns: 1fr; }
}

/* ---------- Photo result ---------- */
.shot {
  position: fixed; inset: 0; z-index: 10; background: var(--cream);
  display: flex; justify-content: center;
  padding: calc(16px + var(--safe-t)) max(16px, var(--safe-r)) calc(16px + var(--safe-b)) max(16px, var(--safe-l));
}
.shot-inner { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.shot img { flex: 1; min-height: 0; width: 100%; object-fit: contain; border-radius: 18px; background: var(--blush); }
.shot-note { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }
.shot-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; }

/* ---------- Loading ---------- */
.loading { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(251, 248, 245, .97); }
.loading-inner { display: grid; justify-items: center; gap: 14px; padding: 24px; text-align: center; }
.loading p { margin: 0; font-weight: 600; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--red); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
