/* MACRW app shell, same identity as Skin Analyzer and Jernih AI:
   white panels on #f2f2f2, near-black ink, MACRW Red, Outfit, uppercase spaced labels, pill buttons. */
@font-face {
  font-family: "Outfit"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/outfit-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0;
}
@font-face {
  font-family: "Outfit"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/outfit-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215;
}

:root {
  --bg: #f2f2f2; --panel: #fff; --panel2: #f2f2f2; --panel3: #e5e5e5;
  --line: rgba(0,0,0,.1); --line-hi: rgba(0,0,0,.24);
  --text: #0d0d0d; --muted: rgba(0,0,0,.52); --soft: rgba(0,0,0,.72);
  --accent: #c80404; --accent-hi: #a80303; --accent-soft: rgba(200,4,4,.08);
  --stage: #1a1a1a; --good: #138a4b; --watch: #b26b00;
  --radius: 14px; --ease: cubic-bezier(0,0,.3642,1);
  --font: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.55 var(--font); }
h1, h2 { margin: 0; font-weight: 500; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.top {
  position: sticky; top: 0; z-index: 10; min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 10px 18px;
  padding-block: 10px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 14px; white-space: nowrap; text-decoration: none; }
.brand img { height: 26px; display: block; }
.brand .divider { width: 1px; height: 22px; background: var(--line-hi); }
.brand .app-name { text-transform: uppercase; letter-spacing: 3px; font-size: 12px; font-weight: 500; }
.brand .app-name b { color: var(--accent); font-weight: 600; }
.top-status { display: inline-flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 1.5px; color: var(--soft); }
.top-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.top-status.wait i { background: var(--watch); animation: blink 1s infinite alternate; }
.top-status.off i { background: var(--accent); }
@keyframes blink { to { opacity: .3; } }

.wrap { max-width: 1240px; margin: 0 auto; padding: 32px 20px 40px; display: grid; gap: 28px; }
.hero { display: grid; gap: 10px; }
.eyebrow { font-size: 11px; font-weight: 500; color: var(--accent); letter-spacing: 3px; text-transform: uppercase; }
.hero h1 { font-size: clamp(32px, 5vw, 56px); line-height: 1.05; letter-spacing: -.01em; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); max-width: 62ch; font-size: 16px; }

.main { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 960px) { .main { grid-template-columns: minmax(0, 1fr) 340px; } }

/* stage: a dark bed that always holds the whole photo */
.stage { position: relative; width: 100%; height: clamp(320px, 66vh, 720px); background: var(--stage); border-radius: var(--radius); overflow: hidden; display: grid; place-items: center; }
.stage.over { box-shadow: inset 0 0 0 3px var(--accent); }

.drop { position: absolute; inset: 16px; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 16px; text-align: center; color: rgba(255,255,255,.66); border: 1px dashed rgba(255,255,255,.26); border-radius: 10px; cursor: pointer; transition: border-color .2s var(--ease), background .2s var(--ease); }
.drop:hover { border-color: rgba(255,255,255,.6); background: rgba(255,255,255,.03); }
.drop svg { width: 52px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; }
.drop strong { color: #fff; font-size: 20px; font-weight: 500; }
.drop span { font-size: 14px; }
.drop em { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: rgba(255,255,255,.42); margin-top: 6px; }

/* JS sizes this box to the photo's proportions inside the stage */
.canvas-box { position: relative; line-height: 0; touch-action: none; }
.canvas-box canvas { display: block; width: 100%; height: 100%; }
#view { background: repeating-conic-gradient(#cfcfcf 0% 25%, #fff 0% 50%) 0 0 / 20px 20px; }
#before { position: absolute; inset: 0; pointer-events: none; }
.canvas-box.brush { cursor: none; }
.cursor { position: absolute; left: 0; top: 0; border: 1.5px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.7); pointer-events: none; transform: translate(-50%, -50%); }
.split { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); pointer-events: none; }
.split span { position: absolute; top: 50%; left: 50%; width: 30px; height: 30px; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.4); }

.busy { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 20px; text-align: center; color: #fff; background: rgba(13,13,13,.72); }
.busy p { font-size: 13px; text-transform: uppercase; letter-spacing: 2.5px; font-weight: 500; }
.busy small { font-size: 13px; color: rgba(255,255,255,.66); max-width: 40ch; }
.bar { width: min(280px, 70vw); height: 4px; border-radius: 4px; background: rgba(255,255,255,.18); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.bar.loop i { width: 35% !important; animation: slide 1.1s infinite var(--ease); }
@keyframes slide { from { transform: translateX(-110%); } to { transform: translateX(320%); } }
.scanline { position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent); box-shadow: 0 0 18px 3px rgba(200,4,4,.7); animation: scan 2.2s infinite alternate ease-in-out; }
@keyframes scan { to { top: calc(100% - 2px); } }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 14px; }
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.compare { flex: 1 1 240px; display: flex; align-items: center; gap: 10px; }
.compare input { flex: 1; min-width: 0; }
.k { font-size: 10px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; }
.status { margin-top: 10px; font-size: 14px; color: var(--muted); min-height: 1.5em; }
.status.err { color: var(--accent); }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 1.5px; cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease); }
.btn:hover { border-color: var(--line-hi); background: var(--panel3); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; letter-spacing: 2px; }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.ghost { min-height: 38px; background: transparent; border-color: rgba(255,255,255,.3); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.1); }
.btn.small { min-height: 40px; padding: 8px 14px; }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 20px; display: grid; }
.group { display: grid; gap: 12px; padding: 18px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.group:last-child { border-bottom: 0; }
.group h2 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 2px; }
.group.needs-result { transition: opacity .2s var(--ease); }
.panel:not(.ready) .needs-result { opacity: .42; pointer-events: none; }
.hint { font-size: 13px; color: var(--muted); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--panel2); }
.seg button { min-height: 44px; padding: 7px 8px; border: 0; border-radius: 9px; background: transparent; font-size: 13px; font-weight: 500; cursor: pointer; line-height: 1.2; }
.seg button small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--panel); box-shadow: 0 0 0 1px var(--line-hi); color: var(--accent); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { position: relative; width: 40px; height: 40px; padding: 0; border-radius: 50%; border: 1px solid var(--line-hi); background: var(--c, #fff); cursor: pointer; overflow: hidden; }
.sw.none { background: repeating-conic-gradient(#cfcfcf 0% 25%, #fff 0% 50%) 0 0 / 12px 12px; }
.sw.pick { background: conic-gradient(#f33, #fc3, #3c6, #39f, #93f, #f33); }
.sw.pick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.sw[aria-checked="true"], .sw.pick.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }

.range { display: grid; gap: 6px; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.foot { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; max-width: 95ch; }

@media (max-width: 959px) {
  .stage { height: clamp(300px, 58vh, 620px); }
  .wrap { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .scanline, .bar.loop i, .top-status.wait i { animation: none; }
}
