/* ═══════════════════════════════════════════════════════════════════════════
   Face Preview — design system

   Two rules govern everything here:

   1. NOTHING SCROLLS. The app is pinned to the viewport. Every screen is a
      flex column that fits, on every device, by shrinking type and spacing
      rather than by pushing content off the bottom. Where content genuinely
      cannot fit (the guide), it is paged, not scrolled.

   2. EVERY SIZE IS RELATIVE TO THE VIEWPORT. clamp() with a vmin/vh middle
      term means one layout adapts from a 320px phone to a 4K monitor without
      breakpoint soup. Breakpoints handle orientation, not size.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Bonita Clinic, Isfahan (bonitaclinicesf.com). The logo is gold on navy, and
   the whole app is that one pairing:

     --gold        the logo's gold, identical in both themes — solid fills only
                   (primary button, selected chip, ticked box), always carrying
                   --on-gold, the logo's navy, as ink: 8:1 in either theme.
     --accent-ink  gold for lines, icons, indicators and large text. On the
                   navy ground it IS the logo gold; on white it deepens just
                   enough to clear 3:1, so it still reads gold, never brown.
     --navy        the logo's navy, for brand tiles on light surfaces.

   Dark is the navy itself, taken down to a ground a photograph can sit on.
   Light is the site's white with navy type and a navy shadow at the top. */
:root, [data-theme="dark"] {
  --navy:      #141D4C;
  --on-navy:   #F2F3F9;
  --on-navy-dim: #B0B7D1;

  --bg:        #0B1030;
  --bg-2:      #0E1438;
  --surface:   #141A40;
  --surface-2: #192049;
  --raised:    #222A58;
  --line:      #2E376A;
  --line-soft: #232B58;

  --text:      #F2F3F9;
  --text-dim:  #B0B7D1;
  --text-mute: #98A1C2;   /* 6.6:1 on surface — AA for the small hints it carries */

  --gold:      #DAB96E;   /* the logo's gold */
  --gold-hi:   #EBD28F;
  --gold-lo:   #B8975A;
  --accent-ink: #DAB96E;  /* 8.9:1 on the ground */
  --ice:       #7FB3CC;
  --ice-hi:    #9FCBE0;

  --on-gold:   #141D4C;   /* the logo's navy, as ink on gold: 8.4:1 */
  --face:      #0D1234;
  --feat:      #343D6B;
  --zone:      #8A95BB;
  --zone-line: #3E4878;
  --zone-fill: .07;
  --zone-line-op: .40;

  --ok:        #6FB88F;
  --warn-bg:   #22190F;
  --warn-line: #43331C;
  --warn-text: #E0BC7E;

  --veil:      rgba(11, 16, 48, .78);
  --beam-core: #FFFFFF;
  --vig:       rgba(0, 0, 0, .55);
  --glow:      rgba(218, 185, 110, .11);   /* warm light on navy — the logo */
  --shadow:    0 18px 50px -12px rgba(0, 0, 0, .7);
  --shadow-sm: 0 6px 18px -6px rgba(0, 0, 0, .55);
  --shadow-primary: 0 8px 22px -10px rgba(218, 185, 110, .75);

  color-scheme: dark;
}

[data-theme="light"] {
  --bg:        #F6F7FB;
  --bg-2:      #EEF0F7;
  --surface:   #FFFFFF;
  --surface-2: #F3F5FA;
  --raised:    #E8EBF5;
  --line:      #D1D6E6;
  --line-soft: #E1E5F0;

  --text:      #141D4C;   /* the logo's navy — the site's headings and links */
  --text-dim:  #4A5478;
  --text-mute: #5B6486;   /* 5.4:1 on the page, 5.9 on surface */

  --gold:      #DAB96E;   /* the same gold; it always carries navy ink, 7.9:1 */
  --gold-hi:   #EBD28F;
  --gold-lo:   #B8975A;
  --accent-ink: #9A7629;  /* gold at 3.4:1 on the page tint — lines, icons, large text */
  --ice:       #3C7C96;
  --ice-hi:    #2F6A82;

  --on-gold:   #141D4C;
  --face:      #EEF0F6;
  --feat:      #A6AEC6;
  --zone:      #4A5478;
  --zone-line: #A3ACC8;
  --zone-fill: .14;
  --zone-line-op: .55;

  --ok:        #3E7E5C;
  --warn-bg:   #FBF2E0;
  --warn-line: #E8D4AA;
  --warn-text: #7A5718;

  --veil:      rgba(255, 255, 255, .86);
  --beam-core: #FFF8EA;
  --vig:       rgba(20, 29, 76, .34);
  --glow:      rgba(20, 29, 76, .07);      /* a navy shadow at the top of the page */
  --shadow:    0 18px 50px -14px rgba(20, 29, 76, .18);
  --shadow-sm: 0 6px 18px -8px rgba(20, 29, 76, .20);
  --shadow-primary: 0 8px 22px -10px rgba(168, 129, 47, .55);

  color-scheme: light;
}

/* ── reset ─────────────────────────────────────────────────────────────── */

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;              /* rule 1: the page itself never scrolls */
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Vazirmatn, "Segoe UI", Tahoma, "Iranian Sans", system-ui, -apple-system, sans-serif;
  font-size: clamp(13px, 1.7vh, 15px);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background .3s ease, color .3s ease;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
h1, h2, h3, p, ul, figure { margin: 0; }
ul { list-style: none; padding: 0; }
img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── app shell ─────────────────────────────────────────────────────────── */

.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  background:
    radial-gradient(120% 70% at 50% -10%, var(--glow), transparent 60%),
    var(--bg);
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: clamp(46px, 7vh, 60px);
  padding-inline: clamp(12px, 4vw, 22px);
  /* one gold hairline under the bar — the brand's line, on every screen */
  border-bottom: 1px solid color-mix(in srgb, var(--accent-ink) 32%, transparent);
}

.topbar__l, .topbar__r { display: flex; align-items: center; gap: 8px; }
/* On a narrow phone the row is tight, and the clinic's name is nowrap. Before
   this, the only thing allowed to give way was the back button: flex squeezed
   it to 14px wide at 320px and 18px at 360×800 — a sliver with no arrow.
   Now the fixed-size controls and the mark keep their size, and the name
   gives way instead, with an ellipsis. */
.topbar__l { min-width: 0; }
.topbar__r, .topbar .iconbtn, .brand__mark { flex-shrink: 0; }

.brand {
  font-size: clamp(11.5px, 1.6vh, 13.5px);
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* The clinic's mark: its own gold-on-navy badge, so it reads the same on both themes. */
.brand__mark {
  width: clamp(26px, 4.4vh, 34px);
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.stage {
  flex: 1 1 auto;
  min-height: 0;                 /* lets children shrink instead of overflow */
  position: relative;
}

/* ── screens ───────────────────────────────────────────────────────────── */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  min-height: 0;
  padding: 0 clamp(14px, 4.5vw, 26px) clamp(10px, 2vh, 20px);
}
.screen.is-active { display: flex; }

.screen.is-in    { animation: screen-in .42s cubic-bezier(.22, 1, .36, 1) both; }
.screen.is-out   { animation: screen-out .26s cubic-bezier(.4, 0, 1, 1) both; display: flex; }

@keyframes screen-in  { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes screen-out { to   { opacity: 0; transform: translateY(-10px) scale(.99); } }

.screen__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vh, 16px);
}

/* ── type ──────────────────────────────────────────────────────────────── */

.eyebrow {
  font-size: clamp(9.5px, 1.25vh, 11px);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 600;
}

.h1 {
  font-size: clamp(21px, 3.6vh, 34px);
  font-weight: 200;
  line-height: 1.28;
  letter-spacing: -.015em;
}
.h2 {
  font-size: clamp(17px, 2.7vh, 24px);
  font-weight: 250;
  line-height: 1.35;
  letter-spacing: -.01em;
}
.lead  { color: var(--text-dim); font-size: clamp(12px, 1.65vh, 14.5px); }
.small { color: var(--text-mute); font-size: clamp(10.5px, 1.4vh, 12.5px); }
.gold  { color: var(--accent-ink); font-weight: 700; }

/* ═══ THE STAR — home navigation ════════════════════════════════════════
   A 2×2 grid rotated 45°: a diamond built from four diamonds. Each facet is
   one section. Content is counter-rotated so text stays upright. Tapping a
   facet expands it into the screen it opens.
   ═════════════════════════════════════════════════════════════════════════ */

.home {
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.4vh, 26px);
  text-align: center;
}

.home__head { display: grid; gap: 4px; animation: rise .5s .05s cubic-bezier(.22,1,.36,1) both; }

.starwrap {
  width: min(92vmin, 58vh, 520px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  flex: 0 1 auto;
  min-height: 0;
}

.star {
  width: 70.7%;                  /* √2/2 — so the rotated square fits its box */
  aspect-ratio: 1;
  display: grid;
  grid-template: 1fr 1fr / 1fr 1fr;
  gap: clamp(5px, 1.3vmin, 11px);
  transform: rotate(45deg);
  /* Grid placement must not follow the document's direction: in RTL the
     columns flip and the four sections end up in a different order on screen.
     Pinning each facet to a cell keeps top/right/bottom/left stable in both
     languages. */
  direction: ltr;
}

.facet--top    { grid-area: 1 / 1; }
.facet--right  { grid-area: 1 / 2; }
.facet--left   { grid-area: 2 / 1; }
.facet--bottom { grid-area: 2 / 2; }

.facet {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: clamp(13px, 3.1vmin, 26px);
  background: linear-gradient(150deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .34s cubic-bezier(.22,1,.36,1), border-color .25s, box-shadow .34s;
  animation: facet-in .55s cubic-bezier(.22,1,.36,1) both;
}
.facet:nth-child(1) { animation-delay: .06s; }
.facet:nth-child(2) { animation-delay: .13s; }
.facet:nth-child(3) { animation-delay: .27s; }
.facet:nth-child(4) { animation-delay: .20s; }

@keyframes facet-in {
  from { opacity: 0; transform: scale(.72); }
  to   { opacity: 1; transform: scale(1); }
}

/* a soft light that sweeps the facet on hover */
.facet::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 38%, var(--glow) 50%, transparent 62%);
  opacity: 0;
  transition: opacity .3s;
}
.facet:hover, .facet:focus-visible { border-color: var(--accent-ink); transform: scale(1.035); }
.facet:hover::after { opacity: 1; }
.facet:active { transform: scale(.975); }
/* On white the four facets are navy, gold-iconed — the logo's own pairing, so
   the home screen looks the same in both themes. */
[data-theme="light"] .facet {
  background: linear-gradient(150deg, color-mix(in srgb, var(--navy) 86%, white), var(--navy));
  border-color: var(--navy);
}
[data-theme="light"] .facet:hover, [data-theme="light"] .facet:focus-visible { border-color: var(--gold); }
[data-theme="light"] .facet__ico { color: var(--gold); }
[data-theme="light"] .facet__t { color: var(--on-navy); }
[data-theme="light"] .facet__n { color: var(--on-navy-dim); }

.facet__in {
  transform: rotate(-45deg);     /* counter-rotate so content sits upright */
  display: grid;
  place-items: center;
  gap: clamp(5px, 1.1vh, 10px);
  padding: 6px;
  width: 100%;
}

.facet__ico {
  width: clamp(22px, 4.6vmin, 38px);
  height: clamp(22px, 4.6vmin, 38px);
  color: var(--accent-ink);
  stroke-width: 1.35;
  transition: transform .34s cubic-bezier(.22,1,.36,1);
}
.facet:hover .facet__ico { transform: translateY(-2px) scale(1.06); }

.facet__t {
  unicode-bidi: plaintext;       /* the label re-establishes its own direction */
  font-size: clamp(10.5px, 1.75vmin, 14px);
  font-weight: 600;
  line-height: 1.35;
  max-width: 14ch;
}


/* the exit animation: petals scatter, the chosen one takes the screen */
.star.is-leaving .facet { transition: transform .38s cubic-bezier(.5,0,.75,0), opacity .3s; }
.star.is-leaving .facet:not(.is-chosen) { opacity: 0; transform: scale(.55); }
.star.is-leaving .facet.is-chosen { transform: scale(2.6); opacity: 0; }

/* ── buttons ───────────────────────────────────────────────────────────── */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: clamp(42px, 6.2vh, 54px);
  padding: 0 clamp(14px, 3.4vw, 22px);
  border-radius: clamp(11px, 1.7vh, 15px);
  font-size: clamp(12.5px, 1.75vh, 15px);
  font-weight: 700;
  letter-spacing: .01em;
  border: 1px solid transparent;
  overflow: hidden;
  transition: transform .16s cubic-bezier(.22,1,.36,1), filter .2s, opacity .2s, border-color .2s, background .2s;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active:not(:disabled) { transform: scale(.972); }
.btn:disabled { opacity: .32; cursor: not-allowed; }
.btn svg { width: 1.05em; height: 1.05em; flex: 0 0 auto; stroke-width: 1.8; }

.btn--primary {
  background: linear-gradient(135deg, var(--gold-hi), var(--gold));
  color: var(--on-gold);
  box-shadow: var(--shadow-primary);
}
.btn--primary:hover:not(:disabled) { filter: brightness(1.07); }

.btn--ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}
.btn--ghost:hover:not(:disabled) { border-color: var(--text-mute); background: var(--surface-2); }

.btn--quiet { background: transparent; color: var(--text-dim); min-height: clamp(36px, 5vh, 44px); }
.btn--quiet:hover { color: var(--text); }

/* the press ripple */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--rx, 50%) var(--ry, 50%), currentColor 0%, transparent 55%);
  opacity: 0;
  transform: scale(.4);
  pointer-events: none;
}
.btn:active::before { animation: ripple .5s ease-out; }
@keyframes ripple {
  0%   { opacity: .16; transform: scale(.35); }
  100% { opacity: 0;   transform: scale(2.2); }
}

.iconbtn {
  width: clamp(32px, 4.8vh, 38px);
  height: clamp(32px, 4.8vh, 38px);
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  background: var(--surface);
  transition: color .2s, border-color .2s, transform .16s;
}
.iconbtn:hover { color: var(--text); border-color: var(--text-mute); }
.iconbtn:active { transform: scale(.92); }
.iconbtn svg { width: 16px; height: 16px; stroke-width: 1.7; }
.iconbtn--text { width: auto; padding: 0 11px; font-size: clamp(10px, 1.4vh, 12px); font-weight: 700; }

.row { display: grid; gap: clamp(7px, 1.2vh, 11px); }
.row--2 { grid-template-columns: 1fr 1fr; }
.row--12 { grid-template-columns: 1fr 2fr; }
.row--121 { grid-template-columns: 1fr 1fr 1.35fr; }

/* ── cards & surfaces ──────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: clamp(14px, 2.2vh, 20px);
  padding: clamp(11px, 1.9vh, 18px);
}

.panel {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: clamp(16px, 2.6vh, 24px);
  border: 1px solid var(--line);
  background:
    radial-gradient(130% 90% at 50% 0%, var(--glow), transparent 58%),
    var(--surface);
  overflow: hidden;
  display: grid;
  place-items: center;
  position: relative;
}

/* ── the consent gate ──────────────────────────────────────────────────── */

.gate { justify-content: center; gap: clamp(7px, 1.4vh, 14px); max-width: 520px; margin-inline: auto; width: 100%; }
.gate .h1 { margin-block: clamp(4px, 1vh, 10px) 0; }

.check {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: clamp(9px, 1.5vh, 14px) 0;
  border-top: 1px solid var(--line-soft);
  font-size: clamp(11.5px, 1.55vh, 13.5px);
  line-height: 1.6;
  cursor: pointer;
  transition: color .2s;
}
.check:hover { color: var(--text); }
.check:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 4px; border-radius: 8px; }
.check__box {
  flex: 0 0 clamp(18px, 2.5vh, 21px);
  height: clamp(18px, 2.5vh, 21px);
  margin-top: 2px;
  border-radius: 6px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
  transition: background .2s, border-color .2s, transform .2s;
}
.check__box svg { width: 62%; height: 62%; stroke-width: 3.2; color: var(--on-gold); opacity: 0; transform: scale(.4); transition: opacity .18s, transform .22s cubic-bezier(.22,1,.36,1); }
.check.on .check__box { background: var(--gold); border-color: var(--accent-ink); }
.check.on .check__box svg { opacity: 1; transform: scale(1); }

/* ── photo step ────────────────────────────────────────────────────────── */

.drop {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
}
.drop.is-over { background: var(--glow); }
.drop__hint { display: grid; gap: clamp(6px, 1.2vh, 12px); justify-items: center; color: var(--text-dim); padding: clamp(12px, 3vh, 26px); text-align: center; }
.drop__hint svg { width: clamp(26px, 4.6vh, 38px); height: clamp(26px, 4.6vh, 38px); stroke-width: 1.2; color: var(--accent-ink); }
.drop__t { font-size: clamp(12px, 1.7vh, 14.5px); font-weight: 600; }
.drop img { width: 100%; height: 100%; object-fit: cover; animation: fade .4s ease both; }

.tips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.tip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: clamp(9.5px, 1.35vh, 11.5px);
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  padding: clamp(3px, .6vh, 6px) clamp(8px, 1.6vw, 12px);
  white-space: nowrap;
}
.tip svg { width: 11px; height: 11px; color: var(--accent-ink); stroke-width: 2; }

.note {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text);
  font-size: clamp(10.5px, 1.4vh, 12.5px); line-height: 1.55;
  padding: clamp(8px, 1.3vh, 12px) clamp(10px, 2vw, 14px);
  border-radius: 12px;
  animation: rise .3s ease both;
}
.note svg { width: 14px; height: 14px; flex: 0 0 14px; margin-top: 2px; stroke-width: 2; }
.note--ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.note--info { background: var(--surface); border-color: var(--line); color: var(--text-dim); }

/* ── zone map ──────────────────────────────────────────────────────────── */

.legend { display: flex; gap: clamp(10px, 3vw, 18px); font-size: clamp(10px, 1.4vh, 12px); color: var(--text-dim); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* the hair step's legend row carries the man/woman toggle, so the question
   costs no vertical space on the densest screen in the app */
.legend--hair { align-items: center; flex-wrap: wrap; row-gap: 4px; }
.seg--mini { display: inline-grid; grid-auto-flow: column; gap: 3px; }
.seg--mini .seg__b {
  min-height: max(28px, clamp(28px, 3.6vh, 32px));
  padding-inline: 10px;
  font-size: clamp(10.5px, 1.4vh, 12px);
}
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot--botox  { background: var(--ice); }
.dot--filler { background: var(--gold); }

.facemap { width: 100%; height: 100%; }
.z {
  cursor: pointer;
  fill: var(--zone);
  fill-opacity: var(--zone-fill);
  stroke: var(--zone-line);
  stroke-width: 1;
  transition: fill-opacity .22s, stroke .22s, stroke-opacity .22s, opacity .22s;
}
/* 16, not 11: a line zone's stroke IS its tap target, and the thinnest ones
   (lip flip, marionette) were under 20 px to tap on a phone */
.z[data-shape="line"] { fill: none; stroke-width: 16; stroke-linecap: round; stroke-opacity: var(--zone-line-op); }

.z[data-on="1"][data-type="filler"] { fill: var(--gold); stroke: var(--accent-ink); fill-opacity: .34; }
.z[data-on="1"][data-type="botox"]  { fill: var(--ice);  stroke: var(--ice);  fill-opacity: .34; }
.z[data-shape="line"][data-on="1"]  { fill: none; stroke-opacity: .92; }

.z:hover { fill-opacity: calc(var(--zone-fill) * 2.4); }
.z--locked { opacity: .22; cursor: not-allowed; }

.picks { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-height: clamp(26px, 3.6vh, 34px); }
.pick {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--raised); border: 1px solid var(--accent-ink);
  border-radius: 99px; padding: clamp(3px, .55vh, 5px) clamp(7px, 1.4vw, 10px);
  font-size: clamp(10px, 1.4vh, 12px);
  animation: pop .26s cubic-bezier(.22,1,.36,1) both;
}
.pick[data-type="botox"] { border-color: var(--ice); }
.pick__u { color: var(--text-mute); font-size: .85em; }
.pick svg { width: 12px; height: 12px; color: var(--text-mute); stroke-width: 2.4; }
.pick:hover svg { color: var(--text); }

@keyframes pop { from { opacity: 0; transform: scale(.8); } }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg__b {
  min-height: clamp(36px, 5.2vh, 46px);
  border-radius: clamp(10px, 1.5vh, 13px);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
  font-size: clamp(11px, 1.5vh, 13px);
  transition: all .2s;
}
.seg__b.on { background: var(--raised); border-color: var(--accent-ink); color: var(--text); font-weight: 600; }
.seg__b:active { transform: scale(.97); }

/* a control that has to wrap — the style list is longer than a phone is wide */
.seg--wrap { display: flex; flex-wrap: wrap; gap: 5px; }
.seg--wrap .seg__b { flex: 1 1 auto; min-width: max-content; padding-inline: 9px; }

/* the millimetre behind the word. Models read mm; patients read "short". */
.seg__u { display: block; font-style: normal; font-size: .82em; opacity: .62; margin-top: 1px; }

.seg__b.is-off, .seg__b:disabled { opacity: .34; cursor: not-allowed; }
.seg__b.is-off:active { transform: none; }

/* ── the treatment chooser, floating over the photo frame ──────────────── */

.mode {
  position: absolute;
  inset-block-start: clamp(8px, 1.4vh, 14px);
  inset-inline: auto;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(8px);
}
.mode__b {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: max(32px, clamp(30px, 4.2vh, 38px));
  padding-inline: clamp(10px, 1.8vh, 15px);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: clamp(11px, 1.5vh, 13px);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.mode__b svg { width: 15px; height: 15px; }
.mode__b.is-on { background: var(--raised); color: var(--text); font-weight: 600; }
.mode__b.is-on svg { color: var(--accent-ink); }

/* ── the hair transplant step ──────────────────────────────────────────── */

.side--dense { gap: clamp(5px, 1vh, 10px); }

.field { display: flex; flex-direction: column; gap: 3px; transition: opacity .2s; }
.field.is-off { opacity: .38; pointer-events: none; }
.field__l { font-size: clamp(10px, 1.3vh, 11.5px); color: var(--text-dim); }

/* the scalp areas. One colour — unlike injection there is no botox/filler
   distinction to carry, only whether the area is chosen. */
.zh {
  fill: none;
  stroke: var(--zone-line);
  stroke-linecap: round;
  stroke-opacity: var(--zone-line-op);
  cursor: pointer;
  transition: stroke .22s, stroke-opacity .22s;
}
.zh:hover { stroke-opacity: calc(var(--zone-line-op) * 1.6); }
.zh[data-on="1"] { stroke: var(--accent-ink); stroke-opacity: .9; }
.zh:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

/* ── generating ────────────────────────────────────────────────────────── */

.gen {
  display: grid;
  justify-items: center;
  align-content: center;      /* one centred stack, not four stretched rows */
  gap: clamp(10px, 2vh, 18px);
  width: 100%; height: 100%;
  padding: clamp(12px, 2.4vh, 24px);
}

/* The frame takes the crop's own proportions (set from JS), so `cover` has
   nothing to crop and no outline is cut off at an edge. `--arn` is the same
   ratio as a plain number, which is what keeps the width in bounds. */
.gen__frame {
  position: relative;
  aspect-ratio: var(--ar, 3 / 4);
  height: min(34vh, calc(62vw / var(--arn, 0.75)));
  width: auto;
  border-radius: clamp(12px, 2vh, 18px);
  overflow: hidden;
  /* An inset shadow, not a border: `aspect-ratio` is applied to the border box,
     so a 1px border leaves the CONTENT box at a slightly different ratio than
     the crop — and then `object-fit: cover` quietly crops a sliver and the
     overlay no longer lines up with the photo. */
  box-shadow: inset 0 0 0 1px var(--line);
  background: var(--surface-2);
}
.gen__frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.55) brightness(.72); }

/* the scan line that sweeps the face while the model works */
.gen__scan {
  position: absolute;
  inset-inline: 0;
  height: 34%;
  background: linear-gradient(to bottom, transparent, var(--glow) 42%, var(--gold) 50%, var(--glow) 58%, transparent);
  opacity: .85;
  animation: scan 2.1s cubic-bezier(.45, 0, .55, 1) infinite;
  mix-blend-mode: screen;
}
@keyframes scan {
  0%   { transform: translateY(-120%); }
  100% { transform: translateY(400%); }
}

.gen__grid { position: absolute; inset: 0; width: 100%; height: 100%; }
.gen__grid circle { fill: var(--gold); animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .12; } 50% { opacity: .75; } }

/* the detected face, then the selected zones — the same geometry the mask
   is cut from, drawn one outline at a time */
/* width/height are not optional here: an <svg> is a replaced element, so with
   `height: auto` it sizes itself from the viewBox's own ratio and `inset: 0`
   does not stretch it. Stating the size makes the overlay share the photo's
   box exactly, and `preserveAspectRatio: slice` then IS `object-fit: cover`. */
.gen__struct { position: absolute; inset: 0; width: 100%; height: 100%; }
.gen__struct polygon, .gen__struct path { stroke-linejoin: round; }
.gen__zone--line { fill: none; }
.gen__band--line { stroke-linecap: round; }

.gen__oval {
  fill: none;
  vector-effect: non-scaling-stroke;
  stroke: var(--gold);
  stroke-width: 1.1;
  opacity: .55;
  stroke-dasharray: 1;
  animation: trace 1.3s cubic-bezier(.4, 0, .2, 1) forwards, breathe 5s 1.3s ease-in-out infinite;
}
.gen__zone {
  fill: var(--glow);
  vector-effect: non-scaling-stroke;
  stroke: var(--gold);
  stroke-width: 1.4;
  stroke-dasharray: 1;
  opacity: 0;
  animation:
    trace 1s cubic-bezier(.4, 0, .2, 1) calc(1s + var(--i) * .42s) forwards,
    breathe 4.2s calc(2s + var(--i) * .42s) ease-in-out infinite;
}
/* the dilation the mask adds around the hull — stroke-width comes from JS,
   in face units, so it stays true at any photo size */
.gen__band {
  fill: none;
  stroke: var(--gold);
  stroke-linecap: round;
  opacity: 0;
  animation: band-in 1.4s calc(1.2s + var(--i) * .42s) ease-out forwards;
}
@keyframes band-in { to { opacity: .14; } }
@keyframes trace {
  from { stroke-dashoffset: 1; opacity: 0; }
  10%  { opacity: 1; }
  to   { stroke-dashoffset: 0; opacity: 1; }
}
@keyframes breathe { 0%, 100% { opacity: .95; } 50% { opacity: .42; } }

.gen__txt { font-size: clamp(11.5px, 1.6vh, 13.5px); color: var(--text-dim); text-align: center; min-height: 1.7em; }
.gen__bar { width: min(200px, 60%); height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.gen__bar i { display: block; height: 100%; width: 32%; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); animation: slide 1.5s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(420%); } }

/* what the patient should understand about the result, while they wait */
.gen__note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: min(420px, 100%);
  min-height: calc(2.9em + 2 * clamp(8px, 1.4vh, 12px));
  padding: clamp(8px, 1.4vh, 12px) clamp(10px, 1.6vh, 14px);
  border: 1px solid var(--line);
  border-radius: clamp(10px, 1.6vh, 14px);
  background: var(--surface);
}
.gen__note svg { flex: none; width: 15px; height: 15px; margin-top: .1em; stroke: var(--gold); opacity: .8; }
.gen__note p {
  font-size: clamp(11px, 1.5vh, 12.5px);
  line-height: 1.45;
  color: var(--text-dim);
  text-align: start;
}
.gen__note.is-in { animation: note-in .45s ease both; }
@keyframes note-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .gen__scan, .gen__bar i, .gen__note.is-in { animation: none; }
  .gen__grid circle { opacity: .5; }
  .gen__oval { animation: none; stroke-dashoffset: 0; }
  .gen__zone { animation: none; stroke-dashoffset: 0; opacity: .9; }
  .gen__band { animation: none; opacity: .14; }
}

/* ── before / after comparison ─────────────────────────────────────────── */

.ba {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: clamp(14px, 2.4vh, 22px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  touch-action: none;            /* we own the drag; stop the browser panning */
  -webkit-user-select: none;
  user-select: none;
  cursor: ew-resize;
}
.ba__layer { position: absolute; inset: 0; }
.ba__layer img { width: 100%; height: 100%; object-fit: contain; }

/* the divider: a hairline, and nothing else sitting in the middle of the face */
.ba__line {
  position: absolute;
  top: 0; bottom: 0;
  width: 1.5px;
  margin-left: -.75px;           /* physical: before is always on the left */
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .35), 0 0 16px rgba(0, 0, 0, .55);
  pointer-events: none;
}
/* two small chevrons ride the line at the very bottom, clear of the face */
.ba__grip {
  position: absolute;
  bottom: clamp(8px, 1.6vh, 14px);
  /* Positioned with a physical `left` (before is on the left in both
     languages), so the centring shift is physical too. */
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px 5px;
  border-radius: 99px;
  background: var(--veil);
  backdrop-filter: blur(8px);
  pointer-events: none;
  transition: opacity .35s;
}
.ba__grip svg { width: 11px; height: 11px; color: var(--text); stroke-width: 2.6; }
.ba.is-dragging .ba__grip { opacity: .35; }

.ba__tag {
  position: absolute;
  top: clamp(8px, 1.5vh, 13px);
  font-size: clamp(9px, 1.25vh, 11px);
  letter-spacing: .16em;
  font-weight: 700;
  padding: clamp(3px, .55vh, 5px) clamp(8px, 1.7vw, 12px);
  border-radius: 99px;
  background: var(--veil);
  backdrop-filter: blur(8px);
  pointer-events: none;
  transition: opacity .25s;
}

.hintpill {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(10px, 1.4vh, 12px);
  padding: 7px 14px;
  border-radius: 99px;
  background: var(--veil);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  pointer-events: none;
  animation: fade .4s ease both;
  white-space: nowrap;
}
.hintpill.is-gone { animation: fade-out .3s ease both; }

.summary { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.summary span {
  font-size: clamp(9.5px, 1.3vh, 11px);
  color: var(--text-dim);
  border: 1px solid var(--line-soft);
  background: var(--surface);
  border-radius: 99px;
  padding: 3px 10px;
}

.disclaim {
  display: flex; gap: 8px; align-items: flex-start;
  color: var(--text-mute);
  font-size: clamp(9.5px, 1.32vh, 11.5px);
  line-height: 1.5;
}
.disclaim svg { width: 13px; height: 13px; flex: 0 0 13px; margin-top: 2px; stroke-width: 2; }

/* ── guide (paged, never scrolled) ─────────────────────────────────────── */

.pager { flex: 1 1 auto; min-height: 0; position: relative; overflow: hidden; }
.page {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.8vh, 18px);
  text-align: center;
  padding: clamp(6px, 1.4vh, 14px);
}
.page.is-active { display: flex; animation: page-in .38s cubic-bezier(.22,1,.36,1) both; }
.page.is-active.from-prev { animation-name: page-in-rev; }

@keyframes page-in     { from { opacity: 0; transform: translateX(22px); } }
@keyframes page-in-rev { from { opacity: 0; transform: translateX(-22px); } }

.page__art {
  width: min(52%, 26vh);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, var(--glow), transparent 68%);
}
.page__art svg { width: 78%; height: 78%; }

.dots { display: flex; gap: 7px; justify-content: center; align-items: center; }
.dots i {
  width: 6px; height: 6px; border-radius: 99px; background: var(--line);
  transition: all .3s cubic-bezier(.22,1,.36,1);
}
.dots i.on { background: var(--accent-ink); width: 20px; }

/* ── settings ──────────────────────────────────────────────────────────── */

.setlist { display: grid; gap: clamp(6px, 1.1vh, 11px); align-content: start; overflow: hidden; }
.setrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: clamp(8px, 1.4vh, 13px) clamp(11px, 2.2vw, 16px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: clamp(11px, 1.7vh, 15px);
}
.setrow__t { font-size: clamp(11.5px, 1.55vh, 13.5px); font-weight: 600; }
.setrow__d { font-size: clamp(9.5px, 1.3vh, 11px); color: var(--text-mute); line-height: 1.45; }
.setrow__c { flex: 0 0 auto; display: flex; gap: 5px; }

.chip {
  border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-dim); padding: 0 clamp(9px, 1.9vw, 14px);
  /* 32px floor: these are the smallest things anyone taps in the app, and on a
     320px screen the vh-derived size fell to 27px, which is a miss waiting to
     happen. */
  min-height: max(32px, clamp(30px, 4.4vh, 38px));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: clamp(10px, 1.35vh, 11.5px); transition: all .2s; white-space: nowrap;
}
.chip.on { background: var(--gold); border-color: var(--accent-ink); color: var(--on-gold); font-weight: 700; }
.chip:active { transform: scale(.95); }

/* ── about ─────────────────────────────────────────────────────────────── */

.about { align-items: center; justify-content: center; text-align: center; gap: clamp(9px, 1.9vh, 18px); }
.about__mark {
  width: clamp(52px, 9vh, 82px); height: clamp(52px, 9vh, 82px);
  display: grid; place-items: center; border-radius: 22px;
  background: linear-gradient(140deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.about__mark svg { width: 52%; height: 52%; color: var(--accent-ink); stroke-width: 1.3; }
.about__mark img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.address { display: inline-flex; align-items: flex-start; gap: 6px; text-align: start; line-height: 1.6; }
.address svg { flex: 0 0 auto; width: 1.1em; height: 1.1em; margin-top: .2em; color: var(--accent-ink); }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(6px, 1.2vw, 10px); width: 100%; max-width: 440px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: clamp(8px, 1.4vh, 13px) 6px; }
/* On white the facts become navy tiles with gold figures — the logo, as a card. */
[data-theme="light"] .fact { background: var(--navy); border-color: var(--navy); box-shadow: var(--shadow-sm); }
[data-theme="light"] .fact b { color: var(--gold); }
[data-theme="light"] .fact span { color: var(--on-navy-dim); }
.fact b { display: block; font-size: clamp(15px, 2.4vh, 22px); color: var(--accent-ink); font-weight: 300; }
.fact span { font-size: clamp(9px, 1.25vh, 10.5px); color: var(--text-mute); }
.contact { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ── shared animations ─────────────────────────────────────────────────── */

@keyframes rise     { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade     { from { opacity: 0; } }
@keyframes fade-out { to   { opacity: 0; } }

.stagger > * { animation: rise .42s cubic-bezier(.22,1,.36,1) both; }
.stagger > *:nth-child(1) { animation-delay: .04s; }
.stagger > *:nth-child(2) { animation-delay: .09s; }
.stagger > *:nth-child(3) { animation-delay: .14s; }
.stagger > *:nth-child(4) { animation-delay: .19s; }
.stagger > *:nth-child(5) { animation-delay: .24s; }

/* ── steps rail ────────────────────────────────────────────────────────── */

.rail { display: flex; gap: 5px; align-items: center; }
.rail i {
  height: 2px; width: clamp(14px, 3.5vw, 26px); border-radius: 2px;
  background: var(--line); transition: background .35s, width .35s;
}
.rail i.on { background: var(--accent-ink); }
.rail i.now { width: clamp(24px, 6vw, 40px); }

/* ═══ responsive: orientation, not size ═════════════════════════════════ */

/* Landscape phones and short windows: the vertical budget disappears, so the
   flows go two-column instead of stacking. */
@media (orientation: landscape) and (max-height: 560px) {
  .starwrap { width: min(62vmin, 78vh, 380px); }
  .home { flex-direction: row; justify-content: center; gap: clamp(14px, 4vw, 40px); }
  .home__head { text-align: start; max-width: 34ch; }

  .split {
    flex-direction: row !important;
    align-items: stretch;
  }
  .split > .panel { flex: 1 1 52%; }
  .split > .side {
    flex: 1 1 48%;
    display: flex; flex-direction: column;
    gap: clamp(6px, 1.4vh, 12px);
    min-height: 0;
    justify-content: center;
  }
  .tips { justify-content: flex-start; }

  /* The hair step asks four questions and there is no vertical budget for
     four stacked label-over-control pairs. Labels go beside their control,
     and the chosen-areas chips go entirely — the map already shows them. */
  .split > .side--dense { justify-content: flex-start; }
  .side--dense .picks { display: none; }
  .side--dense .field { flex-direction: row; align-items: center; gap: 8px; }
  .side--dense .field__l { flex: 0 0 auto; min-width: 5.2em; }
  .side--dense .field .seg { flex: 1 1 auto; }

  /* six settings rows do not stack in 390px of height: two columns */
  .setlist { grid-template-columns: 1fr 1fr; gap: 6px; }
  .setrow { padding: 6px 10px; }
  .setrow__d { display: none; }

  .page { flex-direction: row; gap: clamp(14px, 4vw, 34px); text-align: start; }
  .page__art { width: min(34%, 60vh); flex: 0 0 auto; }
  .page__txt { max-width: 38ch; }
  .facts { max-width: none; }
}

/* Wide screens: hold the column, give the media more room */
@media (min-width: 900px) {
  .screen { padding-inline: clamp(26px, 6vw, 80px); }
  .col { max-width: 560px; margin-inline: auto; width: 100%; }
  .col--wide { max-width: 760px; }
}

/* A laptop or desktop: the simulation steps go two-column — the picture
   (photo, map, comparison) on one side, the controls on the other — instead
   of a phone column stretched across a wide screen. Same rules as the
   landscape-phone layout above, with room to breathe. */
@media (min-width: 1000px) and (min-height: 561px) {
  .split { flex-direction: row !important; align-items: stretch; gap: clamp(16px, 2.4vw, 32px); max-width: 1320px; margin-inline: auto; width: 100%; }
  .split > .panel, .split > .ba { flex: 1 1 58%; }
  .split > .side {
    flex: 0 1 42%; max-width: 520px;
    display: flex; flex-direction: column; gap: clamp(8px, 1.4vh, 14px);
    min-height: 0; justify-content: center;
  }
  .tips { justify-content: flex-start; }
  .split > .side--dense { justify-content: flex-start; }
  .views { grid-template-columns: auto 1fr; }
}

/* Very short viewports: drop the decorative bits before the functional ones */
@media (max-height: 460px) {
  .tips, .facts, .address { display: none; }   /* the address wrapped the contact row off-screen at 844×390 */
  .home__head .lead { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── who the preview is for ────────────────────────────────────────────── */

.who {
  display: flex; flex-direction: column; gap: 5px;
  padding: clamp(7px, 1.2vh, 11px) clamp(9px, 1.6vw, 13px);
  border-radius: 14px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 7%, var(--surface)), var(--surface));
}
.who__head { display: flex; align-items: center; gap: 6px; font-size: clamp(10px, 1.35vh, 11.5px); color: var(--text-dim); }
.who__head svg { width: 12px; height: 12px; color: var(--accent-ink); stroke-width: 2; }
.who__rows { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.who .seg--mini .seg__b { white-space: nowrap; }
.who .seg--mini .seg__b { min-height: clamp(28px, 3.8vh, 34px); font-size: clamp(10px, 1.35vh, 12px); padding-inline: clamp(7px, 1.2vw, 11px); }
.who .seg--mini.is-unset .seg__b { border-style: dashed; }

/* ── the on-photo picker ───────────────────────────────────────────────── */

.pickbar { position: absolute; top: clamp(6px, 1vh, 10px); inset-inline-end: clamp(6px, 1vh, 10px); z-index: 2; }
.pickbar .seg__b { display: inline-flex; align-items: center; gap: 5px; background: var(--veil); backdrop-filter: blur(8px); min-height: 28px; font-size: clamp(10px, 1.3vh, 11.5px); padding-inline: 9px; }
.pickbar .seg__b svg { width: 12px; height: 12px; stroke-width: 2; }
.pickbar .seg__b.on svg { color: var(--gold); }

.pickhint {
  position: absolute; bottom: clamp(6px, 1vh, 10px); inset-inline-start: clamp(6px, 1vh, 10px); z-index: 2;
  font-size: clamp(9.5px, 1.25vh, 11px); color: var(--text-dim);
  padding: 4px 9px; border-radius: 99px; background: var(--veil); backdrop-filter: blur(8px); border: 1px solid var(--line-soft);
  pointer-events: none; max-width: 70%;
}

/* The photo view must FIT the panel, like the diagram does. As a plain grid
   item its height:100% was cyclic, so the row grew to the photo's own aspect
   and the panel's overflow:hidden cut the bottom off: on a 360×640 phone only
   the forehead and eyes showed, and lips, chin and jaw could not be tapped.
   Absolutely filling the panel, with a grid whose track may shrink to 0,
   letterboxes the photo instead; the SVG uses xMidYMid meet, so it letterboxes
   identically and the sections stay on the face. */
/* The root is also .fp (position: relative, declared below), so it needs the
   stronger selector or .fp wins and the box overflows again. */
.facepick, .facepick.fp { position: absolute; inset: 0; }
.fp { position: relative; width: 100%; height: 100%; display: grid; place-items: center; grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.fp__img { width: 100%; height: 100%; object-fit: contain; display: block; }
.fp__svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.fp__zone {
  fill: var(--zone); fill-opacity: var(--zone-fill);
  stroke: var(--zone-line); stroke-opacity: var(--zone-line-op); stroke-width: 1.4; vector-effect: non-scaling-stroke;
  cursor: pointer; transition: fill-opacity .15s, stroke .15s;
}
.fp__zone[data-shape="line"] { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-opacity: .16; }
.fp__zone[data-fit="1"] { stroke-dasharray: 5 3; }
.fp__zone:hover { fill-opacity: calc(var(--zone-fill) * 2.4); }
.fp__zone[data-on="1"][data-type="filler"] { fill: var(--gold); stroke: var(--gold); fill-opacity: .32; stroke-opacity: .95; stroke-dasharray: none; }
.fp__zone[data-on="1"][data-type="botox"]  { fill: var(--ice);  stroke: var(--ice);  fill-opacity: .32; stroke-opacity: .95; stroke-dasharray: none; }
.fp__zone[data-shape="line"][data-on="1"] { fill: none; stroke-opacity: .85; }
.fp__zone--locked { opacity: .25; cursor: not-allowed; }
.fp__line { stroke: var(--gold-hi); stroke-width: 1; stroke-dasharray: 3 3; opacity: .75; vector-effect: non-scaling-stroke; pointer-events: none; }

/* the continent map: territories tile the face, borders are shared, and the
   whole territory has one soft outline */
.fp__outline { fill: none; stroke: var(--text); stroke-opacity: .35; stroke-width: 1.6; vector-effect: non-scaling-stroke; pointer-events: none; }
.fp__svg[data-atlas="1"] .fp__zone {
  fill-opacity: calc(var(--zone-fill) * 1.6);
  stroke: var(--text); stroke-opacity: .55; stroke-width: 1.1; stroke-dasharray: none;
  stroke-linejoin: round;
}
.fp__svg[data-atlas="1"] .fp__zone:hover { fill-opacity: calc(var(--zone-fill) * 3); }
.fp__svg[data-atlas="1"] .fp__zone[data-on="1"][data-type="filler"] { fill: var(--gold); fill-opacity: .42; stroke: var(--gold-hi); stroke-opacity: 1; stroke-width: 1.6; }
.fp__svg[data-atlas="1"] .fp__zone[data-on="1"][data-type="botox"]  { fill: var(--ice);  fill-opacity: .42; stroke: var(--ice-hi);  stroke-opacity: 1; stroke-width: 1.6; }
.fp__line--hair { stroke: var(--ice-hi); }

/* ── presets ───────────────────────────────────────────────────────────── */

.presets { display: flex; flex-wrap: wrap; gap: 4px; }
.preset {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 28px;
  font-size: clamp(9.5px, 1.3vh, 11px);
  padding: clamp(3px, .6vh, 5px) clamp(8px, 1.4vw, 11px);
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
  white-space: nowrap;
  transition: border-color .2s, color .2s, background .2s;
}
.preset svg { width: 11px; height: 11px; stroke-width: 2; color: var(--accent-ink); }
.preset:hover { border-color: var(--text-mute); color: var(--text); }
.preset.on { background: var(--raised); border-color: var(--accent-ink); color: var(--text); }

/* ── the zone card ─────────────────────────────────────────────────────── */

.zcard {
  display: grid; grid-template-columns: auto 1fr; gap: 3px 9px; align-items: start;
  min-height: clamp(34px, 5.4vh, 46px);
  padding: clamp(6px, 1.1vh, 9px) clamp(9px, 1.6vw, 12px);
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  font-size: clamp(10px, 1.35vh, 11.5px);
  color: var(--text-dim);
  line-height: 1.45;
  animation: rise .25s ease both;
}
.zcard:empty { display: none; }
.zcard__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.zcard__t { color: var(--text); font-weight: 600; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.zcard__u { color: var(--text-mute); font-weight: 400; font-size: .9em; }
.zcard__d { grid-column: 2; }
.zcard__hint { grid-column: 2; color: var(--text-mute); font-size: .9em; }

/* ── result: views and overlays ────────────────────────────────────────── */

.views { display: grid; grid-template-columns: auto 1fr; gap: 6px; align-items: center; }
.seg--icons .seg__b { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: clamp(30px, 4.4vh, 38px); padding-inline: clamp(8px, 1.4vw, 12px); }
.seg--icons .seg__b svg { width: 14px; height: 14px; stroke-width: 1.9; }
.seg--icons .seg__b[aria-pressed="true"] { background: var(--raised); border-color: var(--accent-ink); color: var(--text); }
.seg--icons .seg__b[aria-pressed="true"] svg { color: var(--accent-ink); }

.ba__layer img { position: absolute; inset: 0; }
.ba__change { pointer-events: none; mix-blend-mode: normal; opacity: .9; animation: fade .3s ease both; }
.ba__zones { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ba__zones path, .ba__zones polygon {
  fill: none; stroke: var(--gold-hi); stroke-width: 2; vector-effect: non-scaling-stroke;
  stroke-dasharray: 5 4; opacity: .9;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, .7));
}
.ba__zones [data-type="botox"] { stroke: var(--ice-hi); }

/* side by side: the two layers become columns; the divider goes */
/* Side by side: before left, after right, in both languages — the grid is
   forced LTR so column 1 is the left one under dir="rtl" too. The words inside
   (tags, the note) get their direction back. */
.ba[data-view="side"] { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; cursor: default; direction: ltr; }
[dir="rtl"] .ba[data-view="side"] :is(.ba__tag, .ba__note) { direction: rtl; }
.ba[data-view="side"] .ba__layer { position: relative; inset: auto; clip-path: none !important; }
.ba[data-view="side"] .ba__layer--before { order: -1; }
.ba[data-view="side"] .ba__line, .ba[data-view="side"] .ba__grip, .ba[data-view="side"] .hintpill { display: none; }
.ba[data-view="side"] .ba__tag { opacity: 1 !important; }
.ba[data-view="side"] #tag-before { left: 12px !important; right: auto !important; }
.ba[data-view="side"] #tag-after { right: 12px !important; left: auto !important; }

/* hold: the result alone; pressing anywhere shows the original */
.ba[data-view="hold"] { cursor: pointer; }
.ba[data-view="hold"] .ba__line, .ba[data-view="hold"] .ba__grip { display: none; }
.ba[data-view="hold"] .ba__layer--before { clip-path: none !important; opacity: 0; transition: opacity .12s; }
.ba[data-view="hold"].is-holding .ba__layer--before { opacity: 1; }
.ba[data-view="hold"] #tag-after { inset-inline-end: 12px !important; opacity: 1 !important; }
.ba[data-view="hold"] #tag-before { opacity: 0 !important; }
.ba[data-view="hold"].is-holding #tag-before { opacity: 1 !important; inset-inline-start: 12px !important; }
.ba[data-view="hold"].is-holding #tag-after { opacity: 0 !important; }

.ba__note {
  position: absolute; inset-inline: clamp(8px, 1.6vw, 14px); bottom: clamp(8px, 1.6vh, 14px);
  display: flex; gap: 7px; align-items: flex-start;
  font-size: clamp(9.5px, 1.3vh, 11px); line-height: 1.45;
  padding: 7px 10px; border-radius: 10px;
  background: var(--veil); backdrop-filter: blur(8px); border: 1px solid var(--warn-line); color: var(--warn-text);
  pointer-events: none;
}
.ba__note svg { width: 12px; height: 12px; flex: 0 0 12px; margin-top: 2px; stroke-width: 2; }

/* ── utility ───────────────────────────────────────────────────────────── */

.hidden, [hidden] { display: none !important; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-height: 0; }
.shrink0 { flex: 0 0 auto; }
.stack { display: flex; flex-direction: column; }
.gap { gap: clamp(7px, 1.4vh, 14px); }
.split { display: flex; flex-direction: column; gap: clamp(8px, 1.6vh, 16px); min-height: 0; flex: 1 1 auto; }
.side { display: contents; }

/* ── save sheet ────────────────────────────────────────────────────────── */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  align-items: end;
  justify-items: center;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .24s ease;
  padding: clamp(10px, 3vw, 20px);
}
.sheet.is-open { opacity: 1; }

.sheet__panel {
  width: 100%;
  max-width: 420px;
  display: grid;
  gap: clamp(6px, 1.1vh, 10px);
  padding: clamp(14px, 2.4vh, 22px);
  border-radius: clamp(16px, 2.6vh, 24px);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateY(18px) scale(.98);
  transition: transform .3s cubic-bezier(.22, 1, .36, 1);
  margin-bottom: env(safe-area-inset-bottom);
}
.sheet.is-open .sheet__panel { transform: none; }
.sheet .eyebrow { margin-bottom: 4px; }

@media (min-width: 640px) {
  .sheet { align-items: center; }
  .sheet__panel { margin-bottom: 0; }
}

/* the result arriving */
.ba.is-arriving { animation: ba-in .62s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes ba-in {
  from { opacity: 0; transform: scale(.975); }
  to   { opacity: 1; transform: none; }
}
