:root {
  /* page supports BOTH schemes (see dark block at end of file): declaring
     it stops browser force-dark from recoloring the light theme badly
     (washed-out modal text/buttons on the S21, 2026-10-08) */
  /* fashion theme: nail-plum dark-only (Q9a). Browser force-dark is out of
     the question (color-scheme: dark); the Samsung <meta darkmode> stays. */
  color-scheme: dark;
  --bg: #17131f;
  --panel: #221c2e;
  --ink: #f2eef8;
  --muted: #b7a8cf;
  --accent: #e05c97;
  --border: #3a2f4d;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
/* scrollbar-gutter: stable REMOVED (fashion unification): it reserved a
   15px dead lane on short pages - the other apps never had it and the user
   ruled full-width consistency the priority. The old 15px reflow when the
   result slider grows the page may return on DESKTOP only (phones use
   overlay scrollbars); revisit with a themed always-on lane if it bites. */
/* touch-action: pan-y disables BROWSER pinch/double-tap zoom on Blink
   (Chrome/Samsung ignore the meta's user-scalable=no from ~v120). Set on the
   ROOT so it intersects every descendant; vertical scroll (the page must scroll)
   stays allowed. Does NOT harm the in-app zoom: the modal's CompareSlider drives
   its zoom via Pointer Events, which fire regardless of touch-action (its own
   .cmp is touch-action:none, intersected here = still none). iOS is covered by
   the separate gesture* cancel in app.js. Human 2026-10-13: "a proper app does
   not let you zoom the UI" - this is the lock that works on the S23. */
html { touch-action: pan-y; }
.navbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px 16px; flex-wrap: wrap; padding: 14px 28px;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.navbar h1 { margin: 0; font-size: 22px; }
.navRight { display: flex; align-items: center; gap: 10px; }
/* credit chip (navbar): balance pill, red when nearly empty */
.creditChip {
  font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  background: rgba(224, 92, 151, .10); color: var(--accent); border: 1px solid var(--accent);
  white-space: nowrap;
}
.creditChip.low { color: #dc2626; border-color: #dc2626; background: rgba(220, 38, 38, .08); }
/* anonymous navbar: plain text, no pill (see CreditStore.setBare) */
.creditChip.bare { background: none; border-color: transparent; padding: 0 2px; }
.creditChip.bare.low { background: none; }
/* accent buttons MUST carry their own :hover:not(:disabled) rule - the global
   button:hover (0-2-1) otherwise turns them light gray on hover (human UI fix
   2026-10-09: Continue was unreadable; pkDone/ovDownload had the same bug) */
@media (hover: hover) {
  .ppContinue:hover:not(:disabled) { background: #f06fa8; border-color: #f06fa8; color: #fff; }
  .ovDownload:hover:not(:disabled) { background: #f06fa8; border-color: #f06fa8; color: #fff; }
}
.authBox .signInBtn {
  display: inline-block; padding: 8px 14px; border-radius: 8px; text-decoration: none;
  background: #e05c97; border: 1px solid #e05c97; color: #fff; font-weight: 600; font-size: 13px;
}
@media (max-width: 480px) {/* ONE line with FULL texts (human call 2026-10-09: "Sign up for more" +
     "⚡13 credits" fit on the S21 - do not abbreviate, just go compact) */
  .navbar { padding: 10px 10px; gap: 6px; flex-wrap: nowrap; }
.navbar h1 { font-size: 14px; white-space: nowrap; }
.navRight { gap: 4px; }
.creditChip { font-size: 11px; white-space: nowrap; }
.authBox .signInBtn { padding: 5px 7px; font-size: 10px; white-space: nowrap; }
}
@media (max-width: 379px) {/* below S21-class widths the full texts would clip -> wrap gracefully */
  .navbar { flex-wrap: wrap; }
}
header .sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
main {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  /* ONE gap for the whole card grid. A custom property (unlike `gap`) INHERITS
     into .leftCol, so the nested column can never drift from main's - which it
     did: main dropped to 12/10px on narrow screens while .leftCol stayed pinned
     at 20px, so cards 1-2-3 had visibly bigger gaps than 3->4 and 4->5. */
  --card-gap: 20px;
  gap: var(--card-gap);
  padding: 18px 28px 40px;
  align-items: start;
}
/* the three input cards stacked in the left column (see index.html) */
.leftCol { display: grid; gap: var(--card-gap); align-content: start; }
@media (max-width: 860px) {main { grid-template-columns: 1fr; padding: 12px 10px 24px; --card-gap: 12px; }
.panel { padding: 12px; }
}
@media (max-width: 480px) {main { padding: 10px 8px 20px; --card-gap: 10px; }
.panel { padding: 10px; }
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.elem { padding: 14px 0; border-bottom: 1px solid var(--border); }
/* one elem per card now -> the divider padding is pure dead space */
.elem:only-child { padding: 0; }
.elem:last-child { border-bottom: none; }
.elem h2 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.num {
  display: inline-flex; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px;
  align-items: center; justify-content: center;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.center { justify-content: center; }
button {
  font: inherit; padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--ink); cursor: pointer;
}
/* hover styles ONLY on hover-capable pointers: on touch :hover sticks after
   a tap (ghost hover) - Download turned white and stayed white on the S21 */
@media (hover: hover) {
  button:hover:not(:disabled) { background: #2f2740; }
}
/* button:disabled moved to /platform/base.css — one rule for landing, hair and
   nails (it used to be duplicated here as an element selector and, on nails, only
   as .btn:disabled, so un-classed controls never greyed out). */
#modeSelect {
  font: inherit; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--ink); cursor: pointer;
}
#generateBtn { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
#captureBtn { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
@media (hover: hover) {#generateBtn:hover:not(:disabled) { background: #f06fa8; }
}
/* every accent button needs its own hover or the global gray eats the blue
   (human report 2026-10-09: Pick/Take photo lost the effect) */
@media (hover: hover) {,
  #captureBtn:hover:not(:disabled) { background: #f06fa8; border-color: #f06fa8; }
}
/* custom HSV color picker — identical on every device (native pickers differ) */
/* room between the title/close button and the SV field, and between the hue
   bar and Done (human: both were too tight, 2026-10-08) */
/* P68: color-modal styles moved to /platform/color-picker.css (shared) */
#hexInput {
  /* 110 -> 80px (human call 2026-10-08: #RRGGBB is short, the row must fit
     hex + swatch + "Pick color" on one line) */
  font: 14px ui-monospace, monospace; width: 80px; height: 46px; padding: 10px;
  border: 1px solid var(--border); border-radius: 8px; text-transform: uppercase;
}
#hexInput.invalid { border-color: #dc2626; }
.swatch { flex: 1; min-width: 40px; height: 46px; border-radius: 8px; border: 1px solid var(--border); background: transparent; }
.pickColorBtn { height: 46px; padding: 0 16px; font-weight: 600; white-space: nowrap; }
@media (hover: hover) {.pickColorBtn:hover { border-color: var(--accent); color: var(--accent); }
}
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
/* legal links under the gallery (page foot) - quiet, muted like the hints */
.legalRow { text-align: center; margin-top: 14px; }
.legalRow a { color: var(--muted); text-decoration: none; }
.legalRow a:hover { text-decoration: underline; }
.status { color: var(--muted); font-size: 13px; }
.status.error { color: #dc2626; font-weight: 700; }
.resultPanel h2 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.resultBtns { margin-top: 12px; }
#downloadBtn {
  font-weight: 600;
  background: var(--accent); border-color: var(--accent); color: #fff;
}
/* Compare button got the same blue (human request 2026-10-11, pre-ship):
   both result actions read as primary now */
.viewZoomBtn {
  font-weight: 600;
  background: var(--accent); border-color: var(--accent); color: #fff;
  position: relative; /* anchor for the attention ring below */
}
@media (hover: hover) {#downloadBtn:hover:not(:disabled), .viewZoomBtn:hover:not(:disabled) { background: #f06fa8; }
}
/* Subtle "running" attention once a result exists (human 2026-10-13: draw the
   eye to "Compare / view / zoom" without being drastic). A faint ~1.5px light
   travels around the border. Purely :not(:disabled) -> appears when the photo
   is generated, vanishes the moment a new generation starts (button disabled),
   no JS. The conic+mask+@property trio is 2026 baseline (Chrome 85 / Safari
   16.4 / FF 128); on an older engine --run just won't interpolate -> a static
   faint ring, still not garish. */
@property --run { syntax: '<angle>'; initial-value: 0turn; inherits: false; }
.viewZoomBtn:not(:disabled)::before {
  content: "";
  position: absolute; inset: -1.5px; border-radius: 9px; padding: 1.5px;
  /* (1) the white comet - identical to the approved DARK look; (2) a base ring
     colour, TRANSPARENT by default so dark is unchanged. background-color paints
     the padding box, which the mask below clips to the ring band -> the comet
     travels along a faint track. (filter would NOT work here: it applies before
     the mask, so a halo would be cut off.) Light media sets --ringBase. */
  background-image: conic-gradient(from var(--run),
    transparent 0deg 250deg, rgba(255,255,255,.85) 320deg, transparent 360deg);
  background-color: var(--ringBase, transparent);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: runBorder 3.4s linear infinite;
  pointer-events: none;
}
@keyframes runBorder { to { --run: 1turn; } }
@media (prefers-reduced-motion: reduce) {.viewZoomBtn:not(:disabled)::before { animation: none; }
}
.resultBox {
  position: relative;
  min-height: 320px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: 8px; overflow: hidden; background: #1d1828;
}
.spinner {
  position: absolute; top: 50%; left: 50%; width: 52px; height: 52px; margin: -26px;
  border: 5px solid rgba(0, 0, 0, .12); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.resultBox .placeholder { color: var(--muted); }
.resultBox img { max-width: 100%; max-height: 70vh; display: block; }
/* gallery (element 5) */
.galleryPanel { grid-column: 1 / -1; }
.galleryPanel h2 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.galleryBar { margin-bottom: 12px; }
.galleryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.shot {
  position: relative; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; background: var(--panel);
}
.shot img { width: 100%; height: 110px; object-fit: cover; display: block; }
.shot input[type="checkbox"] {
  position: absolute; top: 6px; left: 6px; width: 18px; height: 18px;
  z-index: 2; accent-color: var(--accent); cursor: pointer;
}
.shotDel {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 26px; height: 26px; padding: 0; border-radius: 6px;
  background: rgba(255, 255, 255, 0.92); color: #dc2626;
  font-weight: 700; line-height: 1;
}
.shotMeta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted); padding: 6px;
}
.shotMeta .dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1px solid var(--border); flex: none;
}
#galleryEmpty { margin-top: 8px; }
/* keep the three gallery actions on one line on phones */
.galleryBar { flex-wrap: nowrap; gap: 6px; }
.galleryBar button { padding: 8px 8px; font-size: 12px; white-space: nowrap; }
.shot img { cursor: pointer; }
/* file input kept in the DOM but invisible: some mobile browsers (Samsung
   Internet) refuse programmatic .click() on display:none inputs */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; opacity: 0;
  pointer-events: none; overflow: hidden;
}
/* live capacity line (top-right, beside the title) */
/* before/after compare slider (element 4) */
/* NO min-height here: with aspect-ratio it forces width = min-height * ratio,
   which for landscape photos exceeds a phone viewport and stretches the whole
   page (the S21 bug). Height comes purely from width x photo aspect. */
.cmp { position: relative; width: 100%; max-height: 70vh; touch-action: none; overflow: hidden; }
/* overflow:hidden: the zoomed stage must not spill past the box - the after
   stage is trimmed by its divider clip-path but the before stage has none,
   so the source photo used to overflow its borders when zoomed (2026-10-08) */
/* zoom stages: outer keeps the divider clip in container space,
   inner carries the pinch/wheel zoom transform (both photos together);
   inner is JS-sized to the BEFORE photo's rendered rect so both photos
   always occupy the exact same area (no peek-through when zoomed) */
.cmpStage { position: absolute; inset: 0; }
.cmpStageInner { position: absolute; transform-origin: 0 0; will-change: transform; }
.cmp img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; }
.cmpAfter { object-fit: fill; }
/* stretches the model's ~0.2% ratio rounding onto the BEFORE frame -> pixel-aligned compare */
.cmpDivider {
  position: absolute; top: 0; bottom: 0; width: 1.5px; background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4); transform: translateX(-50%); cursor: ew-resize;
}
.cmpHandle {
  position: absolute; top: auto; bottom: var(--cmp-bottom, 12px); left: 50%;
  transform: translateX(-50%);
  width: 44px; height: 44px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--border); color: #333;
  cursor: ew-resize;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.cmpHandle svg { width: 26px; height: 26px; display: block; }
/* The blob IS a <button>, so the global `button:hover:not(:disabled)` (0-2-1)
   OUT-SPECIFIES `.cmpHandle` (0-1-0) and repainted it: gray in light mode, and
   in dark mode #2f2740 while its icon color stayed dark -> a stuck BLACK blob
   after a tap (on touch :hover sticks after release - the ghost-hover trap
   already noted at the top of this file for Download). Same class of bug the
   accent-button note above warns about: carry your own hover rule.
   -webkit-tap-highlight-color removes the mobile tap flash; the press feedback
   is an :active scale instead, which ALWAYS reverts on release (unlike hover). */
.cmpHandle:hover:not(:disabled) { background: #fff; }
.cmpHandle { -webkit-tap-highlight-color: transparent; }
.cmpHandle:active { transform: translateX(-50%) scale(0.94); }
.cmpHandle:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.cmpBadge {
  position: absolute; top: 10px; padding: 3px 9px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 11px; font-weight: 600;
  pointer-events: none;
}
.cmpBadgeBefore { left: 10px; }
.cmpBadgeAfter { right: 10px; }
/* horizontal split (static in-page result view): line across, after BELOW */
.cmpH .cmpDivider {
  top: 50%; left: 0; right: 0; bottom: auto; width: auto; height: 1.5px;
  transform: translateY(-50%); cursor: default;
}
.cmpH .cmpBadgeAfter { top: auto; bottom: 10px; }
/* static mode: no drag, but the page scrolls through it AND a tap opens the
   interactive compare (human calls 2026-10-08 keep scrolls, 2026-10-10 the tap;
   touch-action pan-y still lets vertical swipes scroll, never fire the tap) */
.cmpStatic { touch-action: pan-y; cursor: zoom-in; }
.cmpStatic .cmpDivider { cursor: zoom-in; }
.cmpStatic:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
/* auth area (navbar right): "Sign up for more" or burger + dropdown */
.authBox { position: relative; display: flex; align-items: center; }
.authBox[hidden] { display: none; }
@media (hover: hover) {.authBox .signInBtn:hover { background: #f06fa8; }
}
.authBox .burger { font-size: 17px; line-height: 1; padding: 7px 12px; }
.userMenu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); min-width: 200px; padding: 6px;
}
.userMenu[hidden] { display: none; }
.userMenu .who {
  padding: 8px 10px; font-weight: 600; font-size: 13px;
  border-bottom: 1px solid var(--border); margin-bottom: 4px; word-break: break-word;
}
.userMenu button { width: 100%; text-align: left; border: none; background: transparent; border-radius: 6px; }
/* overlay viewer */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(10, 12, 16, 0.92);
  display: flex; flex-direction: column; padding: 10px 12px 14px;
}
.overlay[hidden] { display: none; }
.ovTop { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ovInfo { color: #fff; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.ovInfo .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #666; flex: none; }
.ovTop button, .ovNav {
  /* was 0.12/0.25 alpha - too faded on the dark overlay (S21, 2026-10-08) */
  background: rgba(255, 255, 255, 0.22); color: #fff; border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ovTop button { width: 36px; height: 36px; font-size: 16px; line-height: 1; }
.ovMain { position: relative; flex: 1; min-height: 0; display: flex; margin: 8px 0; }
.ovTrack { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
/* the compare slider inside the overlay is JS-fitted to the photo
   (CompareSlider fit option) - no 70vh cap here. Selector-scoped (NOT a
   class added after construction): a data-URL slider measures itself
   SYNCHRONOUSLY in the constructor, before any post-add class could land
   -> it sized to the 70vh cap and the photos stuck top-left (2026-10-08) */
#ovTrack .cmp { max-height: none; }
.ovPlain { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.ovBtns { display: flex; gap: 10px; justify-content: center; margin: 2px 0 10px; }
/* Close = secondary action, same look as the crop modal's Cancel */
.ovCloseBtn {
  background: #2b2438; border: 1px solid #8f6bb0; color: #fff;
  font-weight: 600; padding: 10px 26px;
}
.ovDownload {
  background: var(--accent); color: #fff;
  border: none; font-weight: 600; padding: 10px 26px;
}
@media (hover: hover) {/* :not(:disabled) REQUIRED - plain .ovCloseBtn:hover (0-2-0) loses to the
     global button:hover:not(:disabled) (0-2-1) -> gray veil on hover (human
     report 2026-10-09) */
  .ovCloseBtn:hover:not(:disabled) { background: #2c313a; border-color: #2c313a; }
}
/* P4 (fashion): the app is DARK-ONLY now (nail-plum, Q9a) - the 2026-10-08
   force-dark saga rationale lives in git history; color-scheme: dark + the Samsung
   meta remain the guards. */

/* fashion chrome: wordmark back-link */
.homeLink { color: var(--muted); text-decoration: none; }
.homeLink:hover { color: var(--accent); }
.hsep { color: rgba(242, 238, 248, .45); font-weight: 400; } /* P47: --panel-edge is UNSET in hair but near-invisible in nails - use an explicit dim white so the slash reads identically in both */

/* explicit select styling - identical on hair & nails (was: native per-scheme) */
select { font: inherit; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel); color: var(--ink); }

/* P60: hair's ORIGINAL intent (media blocks above sat before .panel and lost
   the cascade - dead rules). Restated last so phone widths really compact:
   matches the rhythm now shared with nails/outfit via /platform/app.css. */
@media (max-width: 860px) { .panel { padding: 12px; } }
@media (max-width: 480px) { .panel { padding: 10px; } }
