#funModeToggle { margin-left:auto; margin-right:8px; font-size:23px; }
#funModeStage[hidden] { display:none!important; }
body.fun-mode-active #homeView > :not(.mm-primary-header):not(header):not(#funModeStage) { display:none!important; }
body.fun-mode-active #funModeStage { display:flex; }

#funModeStage {
  --fun-eye-left: 7.0%;
  --fun-eye-top: 25.0%;
  --fun-eye-size: 36.0%;
  --fun-duo-split: 48.4%;
  position:relative;
  isolation:isolate;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  justify-content:flex-start;
  gap:0;
  min-height:min(75dvh,760px);
  margin:10px 12px 20px;
  padding:0;
  border-radius:29px;
  background:url('/fun-monster-full.jpg') center center/100% 100% no-repeat #003477;
  box-shadow:inset 0 0 24px #002d8055;
}

.fun-fur {
  position:relative;
  z-index:2;
  flex:0 0 41.8%;
  width:100%;
  margin:0;
  padding:0;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
  background:none;
}

.fun-eye {
  --eye-x:0px;
  --eye-y:0px;
  position:absolute;
  top:var(--fun-eye-top);
  left:var(--fun-eye-left);
  width:var(--fun-eye-size);
  aspect-ratio:1;
  border:0;
  border-radius:50%;
  background:transparent;
  box-shadow:none;
  overflow:hidden;
  display:grid;
  place-items:center;
}
.fun-eye:nth-child(2) { left:auto; right:var(--fun-eye-left); }
.fun-iris {
  width:65%;
  height:65%;
  background:center/contain no-repeat url('/fun-iris-left.png');
  transform:translate(var(--eye-x),var(--eye-y));
  transition:transform .09s ease-out;
  will-change:transform;
  filter:none;
}
.fun-eye:nth-child(2) .fun-iris { background-image:url('/fun-iris-right.png'); }

.fun-mouth {
  position:relative;
  z-index:5;
  width:100%;
  flex:1 1 auto;
  min-height:0;
  margin:0;
  border:0;
  border-radius:0;
  box-shadow:none;
  background:none;
  overflow:hidden;
  display:block;
}
fun-teeth { display:none; }
body.mm-registro .fun-palate, body.mm-registro .fun-tongue {
  position:absolute;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:3;
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:none;
  box-shadow:none;
  font-family:ui-rounded,"Arial Rounded MT Bold",system-ui,-apple-system,sans-serif;
  font-size:clamp(64px,17.5vw,84px);
  font-weight:900;
  line-height:1;
  letter-spacing:-0.035em;
  text-align:center;
  text-transform:uppercase;
  min-height:44px;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
body.mm-registro .fun-palate { left:50%; transform:translateX(-50%); top:5.5%; width:76.5%; height:39.5%; padding-bottom:clamp(64px,20vw,102px); color:#f8bbce; opacity:.88; text-shadow:0 2px 5px #5a092a55; }
.fun-tongue { left:50%; transform:translateX(-50%); bottom:4.8%; width:74.8%; height:45.8%; color:#ffe1ed; opacity:.88; text-shadow:0 2px 6px #97194e66; }
/* Decorative rays do not change the check-in hitboxes. */
.fun-palate::before, .fun-palate::after, .fun-tongue::before, .fun-tongue::after {
  content:"";
  position:absolute;
  top:50%;
  width:.53em;
  height:1.27em;
  pointer-events:none;
  background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 76'%3E%3Cpath d='M6 10 L29 25 M2 38 L30 38 M6 66 L29 51' fill='none' stroke='%23ffcada' stroke-opacity='.90' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
}
.fun-palate::before, .fun-palate::after { top:calc(50% - clamp(32px,10vw,51px)); }
.fun-palate::before, .fun-tongue::before { left:max(2px,calc(50% - 1.84em)); transform:translateY(-50%); }
.fun-palate::after, .fun-tongue::after { right:max(2px,calc(50% - 1.84em)); transform:translateY(-50%) scaleX(-1); }
.fun-exit {
  position:absolute;
  z-index:8;
  top:60.0%;
  right:4.2%;
  width:18.3%;
  height:19.0%;
  min-height:44px;
  border:0;
  border-radius:50%;
  background:transparent;
  color:transparent;
  box-shadow:none;
  cursor:pointer;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
/* The feedback copies only portions of the existing artwork. Hidden between answers. */
.fun-expression {
  position:absolute;
  inset:0;
  z-index:4;
  pointer-events:none;
  display:none;
  overflow:hidden;
}
.fun-expression > div {
  position:absolute;
  inset:0;
  pointer-events:none;
  background:url('/fun-monster-full.jpg') center center/100% 100% no-repeat;
  opacity:0;
  will-change:transform,opacity;
}
.fun-expression-upper {
  -webkit-mask-image:linear-gradient(to bottom, transparent 27%, #000 34%, #000 41%, transparent 48%);
  mask-image:linear-gradient(to bottom, transparent 27%, #000 34%, #000 41%, transparent 48%);
  transform-origin:50% 35%;
}
.fun-expression-lower {
  -webkit-mask-image:linear-gradient(to bottom, transparent 80%, #000 88%, #000 96%, transparent 100%);
  mask-image:linear-gradient(to bottom, transparent 80%, #000 88%, #000 96%, transparent 100%);
  transform-origin:50% 100%;
}
.fun-expression-smile {
  /* Feather the movement vertically and crop right side to keep the pendant fixed. */
  clip-path:inset(0 30% 0 0);
  -webkit-mask-image:linear-gradient(to bottom, transparent 40%, #000 52%, #000 82%, transparent 98%);
  mask-image:linear-gradient(to bottom, transparent 40%, #000 52%, #000 82%, transparent 98%);
  transform-origin:50% 42%;
}
#funModeStage.fun-feedback-yes .fun-expression,
#funModeStage.fun-feedback-no .fun-expression { display:block; }
/* WebKit-safe fallback remains visible even if the clipped artwork cannot render. */
#funModeStage.fun-feedback-yes { animation:fun-feedback-pain 790ms ease-in-out both; }
#funModeStage.fun-feedback-no { animation:fun-feedback-smile 790ms ease-in-out both; }
@keyframes fun-feedback-pain { 0%,100% { filter:none; } 26%,65% { filter:brightness(1.25) saturate(1.2); } }
@keyframes fun-feedback-smile { 0%,100% { filter:none; } 25%,65% { filter:brightness(1.12) saturate(1.13); } }
#funModeStage.fun-feedback-yes .fun-expression-upper { animation:fun-teeth-yes-upper 730ms ease-in-out both; }
#funModeStage.fun-feedback-yes .fun-expression-lower { animation:fun-teeth-yes-lower 730ms ease-in-out both; }
/* The NO path deforms the real mouth artwork on a canvas; no bite rows. */
#funModeStage.fun-feedback-no .fun-expression-upper,
#funModeStage.fun-feedback-no .fun-expression-lower,
#funModeStage.fun-feedback-no .fun-expression-smile { display:none; }
.fun-smile-warp { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
@keyframes fun-teeth-yes-upper {
  0%,100% { opacity:0; transform:none; }
  28%,68% { opacity:1; transform:translateY(1.4%) scaleY(1.055); }
}
@keyframes fun-teeth-yes-lower {
  0%,100% { opacity:0; transform:none; }
  28%,68% { opacity:1; transform:translateY(-2%) scaleY(1.055); }
}
@keyframes fun-smile-upper {
  0%,100% { opacity:0; transform:none; }
  33%,70% { opacity:1; transform:translateY(4%) scaleY(.89); }
}
@keyframes fun-smile-lower {
  0%,100% { opacity:0; transform:none; }
  33%,70% { opacity:1; transform:translateY(-7%) scaleY(.82); }
}
@keyframes fun-smile-mouth {
  0%,100% { opacity:0; transform:none; }
  33%,70% { opacity:1; transform:translateY(-4%) scaleY(.78) scaleX(1.035); }
}

/* B29: soft, photographic expression. No substitute mouth, stickers or hearts.
   The actual monster photo stays continuous; only a small, eased squash and
   eye-squint suggest a contented laugh. Hit targets and layout remain fixed. */
#funModeStage.fun-feedback-no {
  animation:fun-b29-soft-laugh 1120ms cubic-bezier(.24,.7,.28,1) both;
  transform-origin:50% 46%;
}
@keyframes fun-b29-soft-laugh {
  0%,100% { transform:none; filter:none; }
  22% { transform:translate3d(0,0.35%,0) scale(1.007,.991); filter:brightness(1.035); }
  46% { transform:translate3d(0,-0.55%,0) scale(1.016,.984); filter:brightness(1.065); }
  68% { transform:translate3d(0,0.15%,0) scale(1.005,.994); filter:brightness(1.03); }
  83% { transform:translate3d(0,-0.22%,0) scale(1.009,.990); filter:brightness(1.045); }
}
#funModeStage.fun-feedback-no .fun-eye {
  animation:fun-b29-eye-smile 1120ms cubic-bezier(.24,.7,.28,1) both;
  transform-origin:50% 52%;
}
@keyframes fun-b29-eye-smile {
  0%,100% { transform:none; }
  25%,65% { transform:translateY(1.2%) scale(1.025,.87); }
  46% { transform:translateY(1.5%) scale(1.04,.83); }
  83% { transform:translateY(.5%) scale(1.015,.94); }
}
#funModeStage.fun-feedback-no .fun-iris {
  animation:fun-b29-eye-warmth 1120ms ease-in-out both;
}
@keyframes fun-b29-eye-warmth {
  0%,100% { filter:none; }
  30%,75% { filter:brightness(1.10) saturate(1.08); }
}
/* B30: only the native UIKit layer animates when the Capacitor bridge exists.
   CSS reactions remain as PWA-only fallback and never overlap the native poses. */
#funModeStage.fun-native-reaction.fun-feedback-yes,
#funModeStage.fun-native-reaction.fun-feedback-no,
#funModeStage.fun-native-reaction.fun-feedback-no .fun-eye,
#funModeStage.fun-native-reaction.fun-feedback-no .fun-iris {
  animation:none!important;
  filter:none!important;
  transform:none!important;
}
#funModeStage.fun-native-reaction .fun-expression { display:none!important; }
/* The pendant label overlays the existing piercing art without intercepting taps. */
#funModeStage::after {
  content:"App";
  position:absolute;
  left:90.0%;
  top:67.8%;
  z-index:9;
  transform:translate(-50%,-50%);
  pointer-events:none;
  font-family:ui-rounded,"Arial Rounded MT Bold",system-ui,-apple-system,sans-serif;
  font-size:clamp(15px,4vw,25px);
  font-weight:900;
  line-height:1;
  letter-spacing:-.04em;
  color:#211b25;
  text-shadow:0 1px 1px #ffffff66;
}
.fun-sensor-control { display:none!important; }
body:has(#checkinDialog[open]) #funModeStage { visibility:hidden; }
.fun-mouth.fun-ouch { animation:fun-mouth-plate-ouch 620ms ease-out; }
@keyframes fun-mouth-plate-ouch { 0%,100% { filter:none; } 40% { filter:brightness(1.16) saturate(1.17); } }
/* The monster is an explicit, user-triggered interactive animation, not a
   decorative iOS transition. Preserve its reactions with Reduce Motion on. */
/* Phone only: fill the native WebView including the status-bar safe area. */
body.mm-registro.fun-mode-active:has(#homeView.is-active) { overflow:hidden; padding-bottom:0!important; }
body.mm-registro.fun-mode-active #homeView.is-active #funModeStage:not([data-fun-layout='duo']) {
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  width:100vw;
  height:100dvh;
  max-width:none;
  min-height:0;
  margin:0;
  border-radius:0;
  z-index:500;
  box-shadow:none;
}

body.mm-registro.fun-mode-active:has(#homeView.is-active) .mm-tabbar { display:none!important; }
body.mm-registro.fun-mode-active #homeView.is-active > .mm-primary-header { display:none!important; }
body.mm-registro.fun-mode-active:has(#homeView.is-active) .mm-app-shell { padding-top:calc(var(--mm-safe-top) + 8px); }
body.mm-registro.fun-mode-active #homeView.is-active #funModeStage[data-fun-layout='duo'] {
  position:fixed;
  inset:0;
  width:100vw;
  height:100dvh;
  max-width:none;
  min-height:0;
  margin:0;
  border:0;
  border-radius:0;
  box-shadow:none;
  z-index:500;
}

/* B53 Duo: the top screen is exclusively the face; the bottom is the open mouth.
   The split follows the physical hinge where window segments are available. */
#funModeStage[data-fun-layout='duo'] {
  --fun-eye-left:10.5%;
  --fun-eye-top:calc(58% - 17.5vw);
  --fun-eye-size:35%;
  background:#003477;
}
#funModeStage[data-fun-layout='duo'] .fun-fur {
  flex:0 0 var(--fun-duo-split);
  min-height:0;
  overflow:hidden;
  background:url('/fun-face-plate.jpg') center center/100% 100% no-repeat;
}
#funModeStage[data-fun-layout='duo'] .fun-eye {
  top:var(--fun-eye-top);
  left:var(--fun-eye-left);
  width:var(--fun-eye-size);
  max-height:56%;
}
#funModeStage[data-fun-layout='duo'] .fun-eye:nth-child(2) {
  left:auto;
  right:var(--fun-eye-left);
}
#funModeStage[data-fun-layout='duo'] .fun-iris {
  width:65%;
  height:65%;
}
#funModeStage[data-fun-layout='duo'] .fun-mouth {
  flex:1 1 0;
  min-height:0;
  background:url('/fun-mouth-plate.jpg') center center/100% 100% no-repeat;
}
#funModeStage[data-fun-layout='duo'] .fun-expression {
  z-index:6;
  top:var(--fun-duo-split);
}
#funModeStage[data-fun-layout='duo'] .fun-expression-upper,
#funModeStage[data-fun-layout='duo'] .fun-expression-lower,
#funModeStage[data-fun-layout='duo'] .fun-expression-smile {
  background-image:url('/fun-mouth-plate.jpg');
  background-position:center center;
  background-size:100% 100%;
}
#funModeStage[data-fun-layout='duo'] .fun-palate { left:50%; top:6%; width:77%; height:39%; padding-bottom:clamp(24px,8vh,70px); }
#funModeStage[data-fun-layout='duo'] .fun-tongue { left:50%; bottom:5%; width:76%; height:45%; }
#funModeStage[data-fun-layout='duo']::after { top:calc(var(--fun-duo-split) + (100% - var(--fun-duo-split))*0.47); left:90%; }
#funModeStage[data-fun-layout='duo'] .fun-exit {
  top:calc(var(--fun-duo-split) + (100% - var(--fun-duo-split))*0.38);
  right:0;
  width:18%;
  height:15%;
}
/* When the hinge is vertical, one viewport contains the face and the other
   contains the mouth. Never rotate the entire illustration with the device. */
#funModeStage[data-fun-layout='duo'][data-fun-axis='columns'] {
  flex-direction:row;
}
#funModeStage[data-fun-layout='duo'][data-fun-axis='columns'] .fun-fur {
  width:var(--fun-duo-split);
  height:100%;
}
#funModeStage[data-fun-layout='duo'][data-fun-axis='columns'] .fun-mouth {
  width:calc(100% - var(--fun-duo-split));
  height:100%;
}
#funModeStage[data-fun-layout='duo'][data-fun-axis='columns'] .fun-eye {
  top:calc(58% - 8.75vw);
}
#funModeStage[data-fun-layout='duo'][data-fun-axis='columns'] .fun-expression {
  left:var(--fun-duo-split);
  top:0;
  width:calc(100% - var(--fun-duo-split));
  height:100%;
}
#funModeStage[data-fun-layout='duo'][data-fun-axis='columns'] .fun-exit {
  left:calc(var(--fun-duo-split) + (100% - var(--fun-duo-split))*0.82);
  right:auto;
  top:40%;
  width:9%;
}
#funModeStage[data-fun-layout='duo'][data-fun-axis='columns']::after {
  left:calc(var(--fun-duo-split) + (100% - var(--fun-duo-split))*0.90);
  top:47%;
}
/* B55: closed cover display is eyes only; opened internal display is mouth only.
   Unlike B54, do not place both regions in one viewport. */
#funModeStage[data-fun-layout='duo'][data-fun-panel='face'] .fun-fur,
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-mouth {
  flex:1 1 100%; width:100%; height:100%; min-height:0;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='face'] .fun-mouth,
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-fur {
  display:none;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-expression {
  top:0; left:0; width:100%; height:100%;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='face'] .fun-expression {
  display:none;
}
/* B63: reuse the existing exit control on the cover, with the Watch's
   discreet forehead treatment and a phone-sized accessible hit target. */
#funModeStage[data-fun-layout='duo'][data-fun-panel='face'] .fun-exit {
  display:block;
  left:50%; right:auto;
  top:max(8%, calc(env(safe-area-inset-top, 0px) + 22px));
  transform:translate(-50%,-50%);
  width:44px; height:44px;
  padding:0; margin:0;
  font-size:0;
  background:none;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='face'] .fun-exit::before {
  content:"";
  position:absolute; left:50%; top:50%;
  transform:translate(-50%,-50%);
  width:28px; height:28px;
  border-radius:50%;
  pointer-events:none;
  background:rgba(0,0,0,.25) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-opacity='.88' stroke-width='1.3' stroke-linejoin='round'%3E%3Crect x='5.5' y='2.5' width='8' height='8' rx='1.4'/%3E%3Cpath d='M3.8 5.5H3.7Q2.5 5.5 2.5 6.8V12.1Q2.5 13.5 3.9 13.5H9.2Q10.5 13.5 10.5 12.2V12'/%3E%3C/svg%3E") center/12px 12px no-repeat;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='face'] .fun-exit:focus-visible {
  outline:2px solid rgba(255,255,255,.88);
  outline-offset:-4px;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-exit {
  top:38%; left:auto; right:0; width:18%; height:15%;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth']::after {
  top:47%; left:90%;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='face']::after {
  display:none;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='face'] .fun-eye {
  top:28%;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-palate {
  top:6%;
}
/* R3: prioritize full-tooth visibility on every open Duo orientation and
   keep the pendant label readable. The mouth artwork fills the whole inner
   display instead of cropping, and the temporary tooth bands are removed. */
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-mouth,
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-expression-upper,
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-expression-lower,
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-expression-smile {
  background-size:100% 100%;
  background-position:center center;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-mouth::before,
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-mouth::after {
  display:none;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth']::after {
  font-size:clamp(28px,4.4vmin,40px);
  left:89.6%;
  top:51.8%;
}
#funModeStage[data-fun-layout='duo'][data-fun-axis='columns'][data-fun-panel='mouth']::after {
  left:89.2%;
  top:52.4%;
}
/* B59: the portrait artwork fits without cropping or unequal scaling.
   Use the existing fur texture only behind the narrow unused margins.
   The pendant label follows the actual fitted bitmap, not the viewport. */
@media (max-aspect-ratio: 999/1000) {
  #funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] {
    --fun-mouth-fit-w:min(100vw, calc(100dvh * 0.830769));
    --fun-mouth-fit-h:min(100dvh, calc(100vw * 1.203704));
  }
  #funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-mouth {
    background-image:url('/fun-mouth-plate.jpg'),url('/fun-fur-texture.jpg');
    background-size:contain,cover;
    background-position:center center;
    background-repeat:no-repeat;
  }
  #funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-expression-upper,
  #funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-expression-lower,
  #funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-expression-smile {
    background-size:contain;
    background-repeat:no-repeat;
  }
  #funModeStage[data-fun-layout='duo'][data-fun-panel='mouth']::after {
    left:calc(50% + var(--fun-mouth-fit-w) * 0.397);
    top:calc(50% + var(--fun-mouth-fit-h) * 0.006);
  }
  #funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-exit {
    left:calc(50% + var(--fun-mouth-fit-w) * 0.397);
    top:calc(50% + var(--fun-mouth-fit-h) * 0.006);
    right:auto;
    width:18%;
    height:15%;
    transform:translate(-50%,-50%);
  }
}
/* Narrow inner portrait: eliminate the vertical fur letterbox without cropping teeth.
   The fitted width remains unchanged; align the pendant and reaction artwork to the full height. */
@media (max-aspect-ratio: 1080/1300) {
  #funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] {
    --fun-mouth-fit-h:100dvh;
  }
  #funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-mouth {
    background-size:100% 100%,cover;
  }
  #funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-expression-upper,
  #funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-expression-lower,
  #funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-expression-smile {
    background-size:100% 100%;
  }
}
/* B59: the cover uses its own proportional face artwork and eye geometry. */
#funModeStage[data-fun-layout='duo'][data-fun-panel='face'] {
  --fun-face-fit-w:min(100vw, calc(100dvh * 1.542857));
  --fun-face-fit-h:min(100dvh, calc(100vw * 0.648148));
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='face'] .fun-fur {
  background:url('/fun-fur-texture.jpg') center center/cover no-repeat;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='face'] .fun-fur::before {
  content:"";
  position:absolute;
  left:50%; top:50%;
  width:var(--fun-face-fit-w); height:var(--fun-face-fit-h);
  transform:translate(-50%,-50%);
  pointer-events:none;
  background:url('/fun-face-plate.jpg') center center/contain no-repeat;
  -webkit-mask-image:linear-gradient(to bottom,transparent,#000 12%,#000 87%,transparent);
  mask-image:linear-gradient(to bottom,transparent,#000 12%,#000 87%,transparent);
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='face'] .fun-eye {
  left:calc(50% - var(--fun-face-fit-w) * 0.425);
  top:calc(50% - var(--fun-face-fit-h) * 0.19);
  width:calc(var(--fun-face-fit-w) * 0.35);
  height:calc(var(--fun-face-fit-h) * 0.48);
  max-height:none;
  aspect-ratio:auto;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='face'] .fun-eye:nth-child(2) {
  left:auto;
  right:calc(50% - var(--fun-face-fit-w) * 0.425);
}
/* B62: opaque, locally corrected pixels from the same mouth bitmap.
   Only the open Duo can show this noninteractive patch. */
.fun-duo-pendant { display:none; }
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth'] .fun-duo-pendant:not([hidden]) {
  display:block;
  position:absolute;
  z-index:2;
  pointer-events:none;
}
#funModeStage[data-fun-layout='duo'][data-fun-panel='mouth']:has(.fun-duo-pendant:not([hidden]))::after {
  left:89.8%;
  top:50.6%;
}
/* Duo reactions must not translate, crop or animate the eye screen. */
#funModeStage[data-fun-layout='duo'].fun-feedback-no .fun-eye,
#funModeStage[data-fun-layout='duo'].fun-feedback-no .fun-iris { animation:none; }
#funModeStage[data-fun-layout='duo'].fun-feedback-no { animation:none; }

@media (max-height:750px) {
  body.mm-registro .fun-palate { padding-bottom:44px; }
  .fun-palate::before, .fun-palate::after { top:calc(50% - 22px); }
}
@media (max-height:600px) {
  body.mm-registro .fun-palate { padding-bottom:24px; }
  .fun-palate::before, .fun-palate::after { top:calc(50% - 12px); }
}
@media (max-height:650px) {
  #funModeStage:not([data-fun-layout='duo']) { --fun-eye-top: 25.0%; --fun-eye-size: 36.0%; }
}
@media (max-width:340px) {
  #funModeStage:not([data-fun-layout='duo']) { --fun-eye-left: 7.0%; --fun-eye-size: 36.0%; }
}

/* Explicit character entrance, independent of the system Reduced Motion setting. */
#funModeStage.fun-entry { animation:fun-monster-appear 1050ms cubic-bezier(.2,.8,.25,1) both; }
#funModeStage.fun-entry .fun-eye { animation:fun-eyes-arrive 900ms cubic-bezier(.18,1.4,.35,1) both; }
#funModeStage.fun-entry .fun-mouth { animation:fun-mouth-arrive 950ms cubic-bezier(.2,.8,.2,1) both; }
@keyframes fun-monster-appear { 0% { opacity:.15; filter:brightness(.65) saturate(.8); } 55% { opacity:1; filter:brightness(1.15) saturate(1.08); } 100% { opacity:1; filter:none; } }
@keyframes fun-eyes-arrive { 0% { transform:scale(.15); opacity:0; } 55% { transform:scale(1.15); opacity:1; } 78% { transform:scale(.93); } 100% { transform:scale(1); } }
@keyframes fun-mouth-arrive { 0% { opacity:.35; transform:translateY(24px); } 65% { opacity:1; transform:translateY(-5px); } 100% { transform:none; opacity:1; } }
#funPainChoices[hidden] { display:none!important; }

/* B66: a pending notification on face-only layouts can be answered directly from the eyes. */
#funModeStage[data-fun-eye-checkin='1'].fun-notification-waiting .fun-eye.fun-eye-answerable {
  cursor:pointer;
}
#funModeStage[data-fun-eye-checkin='1'].fun-notification-waiting .fun-eye.fun-eye-answerable::after {
  content:attr(data-fun-eye-label);
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  z-index:3;
  padding:.2em .34em;
  border-radius:.48em;
  color:#ffd8e5;
  background:rgba(0,0,0,.20);
  font:900 clamp(26px,6.2vw,48px)/1 system-ui,sans-serif;
  letter-spacing:.01em;
  pointer-events:none;
  text-shadow:0 1px 2px rgba(0,0,0,.22);
}
#funModeStage[data-fun-eye-checkin='1'].fun-notification-waiting .fun-eye.fun-eye-answerable:focus-visible {
  outline:3px solid rgba(255,255,255,.9);
  outline-offset:4px;
}
#funModeStage[data-fun-eye-checkin='1'].fun-notification-waiting .fun-eye.fun-eye-answerable::before {
  content:"";
  position:absolute;
  inset:6%;
  border-radius:50%;
  background:radial-gradient(circle, rgba(255,255,255,.12), transparent 64%);
  pointer-events:none;
}
#funPainChoices.fun-pain-choices { position:absolute; z-index:20; inset:0; display:flex; flex-direction:column; justify-content:center; align-items:stretch; gap:12px; padding:calc(env(safe-area-inset-top, 0px) + 44px) 28px calc(env(safe-area-inset-bottom, 0px) + 44px); background:rgba(4,25,59,.92); color:#fff; overflow-y:auto; }
.fun-pain-choices h2 { font-size:clamp(22px,6vw,32px); text-align:center; margin:0 0 12px; }
.fun-pain-choices .fun-pain-choice { width:100%; border:1px solid #ffffff60; border-radius:16px; background:#ffffff25; color:#fff; font:600 18px system-ui,sans-serif; padding:13px 12px; min-height:48px; }
.fun-pain-choices .fun-pain-choice:disabled { opacity:.45; }
@media (prefers-reduced-motion:reduce) {
  body.mm-registro #funModeStage.fun-entry { animation-duration:1050ms!important; }
  body.mm-registro #funModeStage.fun-entry .fun-eye { animation-duration:900ms!important; }
  body.mm-registro #funModeStage.fun-entry .fun-mouth { animation-duration:950ms!important; }
  body.mm-registro #funModeStage.fun-feedback-yes,
  body.mm-registro #funModeStage.fun-feedback-no { animation-duration:1120ms!important; }
  body.mm-registro #funModeStage.fun-feedback-yes .fun-expression-upper,
  body.mm-registro #funModeStage.fun-feedback-yes .fun-expression-lower,
  body.mm-registro #funModeStage.fun-feedback-no .fun-expression-upper,
  body.mm-registro #funModeStage.fun-feedback-no .fun-expression-lower,
  body.mm-registro #funModeStage.fun-feedback-no .fun-expression-smile { animation-duration:760ms!important; }
  body.mm-registro #funModeStage.fun-feedback-no .fun-expression-smile::after { animation-duration:760ms!important; }
  body.mm-registro .fun-mouth.fun-ouch { animation-duration:620ms!important; }
}

/* B31: local-only preferences; keep the Home button as an independent entry point. */

/* B64: a conventional native iPhone shows only the proportional cover face in landscape.
   CSS orientation is independent of Duo learning and restores portrait immediately. */
@media (orientation:landscape) {
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] { background:#003477; }
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] .fun-fur { flex:1 1 100%; width:100%; height:100%; min-height:0; overflow:hidden; }
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] .fun-mouth,
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] .fun-expression { display:none; }
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] .fun-exit {
    display:block;
    left:50%; right:auto;
    top:max(8%, calc(env(safe-area-inset-top, 0px) + 22px));
    transform:translate(-50%,-50%);
    width:44px; height:44px;
    padding:0; margin:0;
    font-size:0;
    background:none;
  }
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] .fun-exit::before {
    content:"";
    position:absolute; left:50%; top:50%;
    transform:translate(-50%,-50%);
    width:28px; height:28px;
    border-radius:50%;
    pointer-events:none;
    background:rgba(0,0,0,.25) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-opacity='.88' stroke-width='1.3' stroke-linejoin='round'%3E%3Crect x='5.5' y='2.5' width='8' height='8' rx='1.4'/%3E%3Cpath d='M3.8 5.5H3.7Q2.5 5.5 2.5 6.8V12.1Q2.5 13.5 3.9 13.5H9.2Q10.5 13.5 10.5 12.2V12'/%3E%3C/svg%3E") center/12px 12px no-repeat;
  }
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] .fun-exit:focus-visible {
    outline:2px solid rgba(255,255,255,.88);
    outline-offset:-4px;
  }
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1']::after {
    display:none;
  }
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] {
    --fun-face-fit-w:min(100vw, calc(100dvh * 1.542857));
    --fun-face-fit-h:min(100dvh, calc(100vw * 0.648148));
  }
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] .fun-fur {
    background:url('/fun-fur-texture.jpg') center center/cover no-repeat;
  }
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] .fun-fur::before {
    content:"";
    position:absolute;
    left:50%; top:50%;
    width:var(--fun-face-fit-w); height:var(--fun-face-fit-h);
    transform:translate(-50%,-50%);
    pointer-events:none;
    background:url('/fun-face-plate.jpg') center center/contain no-repeat;
    -webkit-mask-image:linear-gradient(to bottom,transparent,#000 12%,#000 87%,transparent);
    mask-image:linear-gradient(to bottom,transparent,#000 12%,#000 87%,transparent);
  }
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] .fun-eye {
    left:calc(50% - var(--fun-face-fit-w) * 0.425);
    top:calc(50% - var(--fun-face-fit-h) * 0.19);
    width:calc(var(--fun-face-fit-w) * 0.35);
    height:calc(var(--fun-face-fit-h) * 0.48);
    max-height:none;
    aspect-ratio:auto;
  }
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] .fun-eye:nth-child(2) {
    left:auto;
    right:calc(50% - var(--fun-face-fit-w) * 0.425);
  }
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'].fun-feedback-no,
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'].fun-feedback-no .fun-eye,
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'].fun-feedback-no .fun-iris { animation:none; }

  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'][data-fun-eye-checkin='1'].fun-notification-waiting .fun-eye.fun-eye-answerable::after {
    font-size:clamp(24px,5.6vw,42px);
  }
}

/* B65: feather both lateral joins only when the fitted face leaves side margins. */
@media (min-aspect-ratio: 14/9) {
  #funModeStage[data-fun-layout='phone'][data-fun-iphone-face='1'] .fun-fur::before {
    --fun-face-edge-mask:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22100%22%20height%3D%22100%22%20viewBox%3D%220%200%20100%20100%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22h%22%3E%3Cstop%20stop-color%3D%22white%22%20stop-opacity%3D%220%22%2F%3E%3Cstop%20offset%3D%22.07%22%20stop-color%3D%22white%22%2F%3E%3Cstop%20offset%3D%22.93%22%20stop-color%3D%22white%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%20stop-opacity%3D%220%22%2F%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22v%22%20x1%3D%220%22%20y1%3D%220%22%20x2%3D%220%25%22%20y2%3D%22100%25%22%3E%3Cstop%20stop-color%3D%22white%22%20stop-opacity%3D%220%22%2F%3E%3Cstop%20offset%3D%22.12%22%20stop-color%3D%22white%22%2F%3E%3Cstop%20offset%3D%22.87%22%20stop-color%3D%22white%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22white%22%20stop-opacity%3D%220%22%2F%3E%3C%2FlinearGradient%3E%3Cmask%20id%3D%22m%22%20maskUnits%3D%22userSpaceOnUse%22%20x%3D%220%22%20y%3D%220%22%20width%3D%22100%22%20height%3D%22100%22%3E%3Crect%20width%3D%22100%22%20height%3D%22100%22%20fill%3D%22url%28%23v%29%22%2F%3E%3C%2Fmask%3E%3C%2Fdefs%3E%3Crect%20width%3D%22100%22%20height%3D%22100%22%20fill%3D%22url%28%23h%29%22%20mask%3D%22url%28%23m%29%22%2F%3E%3C%2Fsvg%3E");
    -webkit-mask-image:var(--fun-face-edge-mask);
    mask-image:var(--fun-face-edge-mask);
    -webkit-mask-size:100% 100%;
    mask-size:100% 100%;
  }
}
