/* FaceMaker 2026-11-08: single Canvas editor. No Charatore CSS overrides or legacy layer structure. */
:root{--face-accent:#348bc7;--face-accent-dark:#215d8a;--face-accent-border:#69b6e8;--face-accent-pale:#e8f4fc;--face-adjust-bg:#344d68;--face-dark:#17191e;--face-panel:#25262c;--face-border:#484a52;--face-head-height:64px;--face-dock-height:70px}
*,*::before,*::after{box-sizing:border-box}
html{width:100%;margin:0}body.ac-renewal{margin:0;min-width:0;background:#111216;color:#f4f5f7;font-family:-apple-system,BlinkMacSystemFont,"Hiragino Kaku Gothic ProN",Meiryo,sans-serif;overflow-x:hidden}
body.ac-renewal a{color:inherit}body.ac-renewal button,body.ac-renewal input{font:inherit}
body.ac-renewal #container{width:100%;max-width:none;margin:0;padding:0;min-height:100vh;background:#111216}
body.ac-renewal #system_description{position:absolute;width:1px;height:1px;padding:0;margin:-1px;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.ac-editor-topbar{height:var(--face-head-height);position:fixed;inset:0 0 auto;z-index:3000;display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);align-items:center;gap:10px;padding:0 clamp(14px,2vw,28px);background:#ee9f35;border-bottom:1px solid #ce8021;color:#fff}
.ac-editor-topbar a{text-decoration:none;font-size:13px;font-weight:700;white-space:nowrap}.ac-editor-topbar .ac-go-home{justify-self:start}.ac-editor-topbar .ac-brand{justify-self:center;display:flex;align-items:center;justify-content:center;min-width:0}.ac-editor-topbar .ac-brand img{display:block;max-width:min(250px,40vw);max-height:44px;width:auto;height:auto;object-fit:contain}
.ac-editor-topbar .ac-top-save{justify-self:end;display:grid;place-items:center;min-height:39px;padding:8px 19px;border-radius:100px;background:#fff;color:#75400b;font-weight:750}.ac-header-mobile{display:none}
body.ac-renewal #contents{position:relative;width:100%;max-width:1280px;height:calc(100dvh - var(--face-head-height));min-height:550px;margin:var(--face-head-height) auto 0;padding:0;overflow:hidden}
.face-editor-layout{width:100%;height:100%;display:grid;grid-template-columns:minmax(0,48fr) minmax(0,52fr);overflow:hidden}
#mixArea{position:relative;min-width:0;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:10px;padding:24px 15px 16px;background:var(--face-dark);border-right:1px solid #37383f;overflow:hidden}
.face-preview-stack{width:100%;display:flex;flex-direction:column;align-items:center;gap:0;flex:none;min-height:0}
.face-stage{position:relative;flex:none;width:min(calc(48vw - 50px),520px,calc(100dvh - 310px));height:auto;aspect-ratio:1;background:#f0f1f4;border-radius:14px;overflow:hidden;box-shadow:0 10px 32px rgba(0,0,0,.27)}
#face-canvas-preview{display:block;width:100%;height:100%;object-fit:contain}
.ac-person-tabs{display:flex;gap:12px;align-items:center;justify-content:center;flex:none;margin:10px auto 0}
.ac-person-tabs button{padding:10px 25px;color:#f8f9fa;background:#34353c;border:1px solid #5d6068;border-radius:100px;font-size:13px;font-weight:700;cursor:pointer}
.ac-person-tabs button[data-sex="men"][aria-pressed=true]{background:#24699f;border-color:#83c5f3;color:#fff}
.ac-person-tabs button[data-sex="girl"][aria-pressed=true]{background:#bd427e;border-color:#f6a5ca;color:#fff}
.ac-preview-status{font-size:11px;min-height:14px;margin:0;color:#f5beac;text-align:center}
.ng-position-controls{position:relative;z-index:3;display:flex;flex-direction:column;gap:5px;width:min(390px,calc(100% - 14px));padding:7px 9px;margin:12px auto 10px;border:1px solid #50515a;border-radius:9px;background:#24262d;color:#fff}
.ng-position-heading{display:flex;justify-content:space-between;align-items:center;gap:7px;font-size:12px;font-weight:700}
.ng-position-reset{border:1px solid #5b5d67;border-radius:5px;color:white;background:#3a3d46;padding:4px 7px;font-size:11px;cursor:pointer}
.ng-position-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}
.ng-position-pair{display:flex;flex-direction:column;gap:3px;align-items:stretch;padding:3px 4px;background:#343641;border-radius:5px;min-width:0}
.ng-position-name{text-align:center;color:#fff;font-weight:700;font-size:10px;line-height:13px}
.ng-position-pair button{display:grid;place-items:center;height:25px;padding:0;border:1px solid #626671;border-radius:4px;color:#fff;background:#444954;font-size:15px;cursor:pointer}
#selectArea{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--face-panel);color:#f3f4f6;overflow:hidden;padding:0 25px}
.ac-main-navigation{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;flex:none;width:100%;margin:0;padding:12px 0;border-bottom:1px solid var(--face-border);background:var(--face-panel)}
.ac-main-navigation a{display:flex;align-items:center;justify-content:center;gap:7px;min-height:52px;border-radius:10px;border:1px solid #494b54;background:#363740;color:#fff;text-decoration:none;font-size:13px;font-weight:700;white-space:nowrap}
.ac-main-navigation a.btn_on{background:var(--face-accent-dark);border-color:var(--face-accent-border)}
.ac-main-navigation img{display:block;max-width:26px;height:26px;object-fit:contain}
.face-selection-scroll{flex:1;min-height:0;padding:0 0 40px;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.face-submenu{position:sticky;top:0;z-index:10;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:7px;margin:0 0 12px;padding:12px 0;background:var(--face-panel);border-bottom:1px solid var(--face-border)}
.face-submenu>a{display:flex;align-items:center;flex-direction:column;justify-content:center;gap:5px;min-width:0;min-height:68px;padding:6px 3px;border-radius:9px;border:1px solid #4c4d57;background:#34353e;text-decoration:none;color:#fff;font-size:11px;font-weight:700;white-space:nowrap}
.face-submenu>a.now{background:var(--face-accent-dark);border-color:var(--face-accent-border)}.face-submenu img{height:25px;width:32px;max-width:100%;object-fit:contain}
#selectPartsArea{width:100%;max-width:100%;margin:0 0 12px;padding:0}
#selectPartsArea .boxTitleBlock{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:42px;margin:0;padding:7px 0;background:none;border:0;color:#fff}
#selectPartsArea .boxTitleBlock h3{margin:0;font-size:19px;line-height:1.4;color:#fff}
#selectPartsArea .boxTitleBlock>img{width:27px;height:27px;cursor:pointer;object-fit:contain}
#selectPartsArea .selectBlock{width:100%;margin:0;padding:0}
#selectPartsArea .colorSelectBox{display:flex;align-items:center;flex-wrap:wrap;gap:9px;margin:0 0 12px;padding:0;list-style:none}
#selectPartsArea .colorSelectBox li{list-style:none;margin:0;padding:0}.colorSelectBox .coltxt{font-size:12px;font-weight:600}.colorSelectBox .partsReload{cursor:pointer;border-radius:50%;padding:3px!important}.colorSelectBox .partsReload.is-active{outline:2px solid var(--face-accent)}
#selectPartsArea .colorSelectBox img{display:block;width:23px;height:23px;object-fit:cover;border:1px solid #a6a8b1;border-radius:50%}
#selectPartsArea ul.partsBox,.wallpaper_list{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:9px;list-style:none;background:#fff;border:1px solid #e2e5eb;border-radius:12px;padding:16px;margin:0 0 16px}
#selectPartsArea ul.partsBox>li,.wallpaper_list>li{position:relative;aspect-ratio:1;min-width:0;list-style:none;margin:0;padding:0;border:1px solid #e7e7ed;border-radius:9px;overflow:hidden;background:#f9fafb;cursor:pointer}
#selectPartsArea ul.partsBox>li img{position:absolute;left:50%;top:50%;width:100%;height:auto;max-width:none;max-height:none;object-fit:contain;transform:translate(-50%,-50%);cursor:pointer}
#selectPartsArea ul.partsBox>li img.eye,#selectPartsArea ul.partsBox>li img.brow{width:145%}
#selectPartsArea ul.partsBox>li img.nose,#selectPartsArea ul.partsBox>li img.mouth{width:160%}
#selectPartsArea ul.partsBox>li img.hair{width:112%;top:37%}
#selectPartsArea ul.partsBox>li.ac-part-selected,.wallpaper_list>li.ac-part-selected{border-color:var(--face-accent);background:var(--face-accent-pale);box-shadow:inset 0 0 0 1px var(--face-accent)}
.face-wallpaper-heading{font-size:18px;margin:18px 0 11px}.wallpaper_list{list-style:none}.wallpaper_list>li img{display:block;width:100%;height:100%;object-fit:cover;cursor:pointer}
.ac-drawer-toggle{display:none}
.face-first-choice{position:absolute;inset:0;z-index:20;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;background:rgba(23,25,30,.96);text-align:center;padding:24px}
.face-first-choice strong{font-size:23px}.face-first-choice p{font-size:13px;line-height:1.6;color:#eee}.face-first-choice>div{display:flex;gap:12px}.face-first-choice button{min-width:100px;padding:12px 20px;border-radius:9px;background:var(--face-accent-dark);color:#fff;border:1px solid var(--face-accent-border);font-weight:700;cursor:pointer}
.ac-preview-status:empty{visibility:hidden}
body.ac-renewal button:focus-visible,body.ac-renewal a:focus-visible,body.ac-renewal [role=button]:focus-visible{outline:3px solid var(--face-accent-border);outline-offset:2px}
@media(min-width:781px) and (max-width:1120px){#selectArea{padding:0 15px}.face-submenu{gap:4px}.face-submenu>a{font-size:10px}.face-stage{width:min(calc(43vw - 35px),min(500px,calc(100dvh - 250px)))}}
/* Mobile editor: the page is scrollable and all chrome participates in document layout.
   The previous fixed #container and dock + overflow:hidden root could become trapped
   above the visual viewport after pinch-zoom/restore on iOS Chrome (WebKit).
   Use a stable small viewport height for the editor, and an in-flow bottom row. */
@media(max-width:780px){
 :root{--face-head-height:56px}
 html{width:100%;height:auto;min-height:100%;overflow-x:clip;overflow-y:auto;overscroll-behavior-y:auto}
 body.ac-renewal{width:100%;height:auto;min-height:100%;overflow-x:clip;overflow-y:visible;overscroll-behavior-y:auto}
 body.ac-renewal #container{position:relative;inset:auto;display:block;width:100%;height:auto;min-height:100svh;overflow:visible}
 .ac-editor-topbar{position:relative;inset:auto;top:auto;left:auto;right:auto;height:56px;padding:0 12px}
 .ac-header-desktop{display:none}.ac-header-mobile{display:inline}
 .ac-editor-topbar .ac-brand img{max-width:min(180px,36vw);max-height:39px}
 .ac-editor-topbar a{font-size:13px}
 .ac-editor-topbar .ac-top-save{min-height:35px;padding:6px 12px;font-size:12px}
 body.ac-renewal #contents{position:relative;inset:auto;top:auto;right:auto;bottom:auto;left:auto;width:100%;max-width:none;height:calc(100svh - var(--face-head-height));min-height:0;margin:0;overflow:visible}
 /* Keep the preview and part selector at equal height (after toggle and bottom dock).
    No fixed positioning: iOS can return to the original scroll position after pinch zoom. */
 .face-editor-layout{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) 45px minmax(0,1fr) var(--face-dock-height);height:100%;width:100%;overflow:hidden}
 #mixArea{position:static;grid-row:1;grid-column:1;width:100%;height:100%;min-height:0;max-height:none;flex:none;padding:10px 8px 5px;justify-content:flex-start;border:0;gap:4px}
 .face-preview-stack{max-height:100%;gap:0}
 /* The avatar occupies as much of the half-height preview row as is practical. */
 .face-stage{width:min(calc(100vw - 20px),calc(50svh - 118px),440px);height:auto;min-height:0;aspect-ratio:1;border-radius:8px;box-shadow:none}
 /* When parts are open, keep this upper half dedicated to the actual avatar. */
 body.ac-renewal:not(.ac-panel-collapsed) .ng-position-controls,
 body.ac-renewal:not(.ac-panel-collapsed) .ac-person-tabs{display:none}
 /* Only real loading/asset errors take space below the portrait. */
 .ac-preview-status:empty{display:none;min-height:0}
 .ng-position-controls{width:min(390px,100%);margin:8px auto 6px;padding:4px 7px;gap:3px}
 .ng-position-heading{font-size:10px}.ng-position-reset{font-size:10px;padding:2px 4px}
 .ng-position-grid{gap:2px}.ng-position-pair{padding:1px 2px;gap:1px}.ng-position-name{font-size:9px;line-height:11px}.ng-position-pair button{height:22px;font-size:13px}
 .ac-person-tabs{margin:4px auto 0;gap:6px}.ac-person-tabs button{padding:5px 19px;font-size:12px}
 /* display:contents promotes the 3 UI pieces into the single editor grid. */
 #selectArea{display:contents}
 .ac-drawer-toggle{display:block;grid-row:2;grid-column:1;align-self:stretch;width:100%;height:45px;padding:0 18px;border:0;text-align:right;background:#303139;color:#fff;font-size:13px;font-weight:700;cursor:pointer}
 .face-selection-scroll{grid-row:3;grid-column:1;min-height:0;height:100%;padding:0 12px 24px;scrollbar-gutter:auto;background:var(--face-panel);overflow-y:auto;overscroll-behavior:contain}
 .ac-main-navigation{position:relative;grid-row:4;grid-column:1;inset:auto;z-index:20;width:100%;height:var(--face-dock-height);grid-template-columns:repeat(3,minmax(0,1fr));gap:3px;margin:0;padding:5px max(6px,env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left));border:0;border-top:1px solid #50515a;background:var(--face-panel)}
 .ac-main-navigation a{min-height:0;border:0;border-radius:8px;flex-direction:column;gap:1px;padding:4px;font-size:11px}
 .ac-main-navigation img{width:26px;height:26px}
 .face-submenu{grid-template-columns:repeat(6,minmax(0,1fr));gap:4px;margin:0 0 9px;padding:8px 0}
 .face-submenu>a{min-height:56px;padding:5px 1px;gap:2px;font-size:9px;white-space:nowrap}.face-submenu img{height:22px;width:23px}
 #selectPartsArea .boxTitleBlock h3{font-size:16px}#selectPartsArea ul.partsBox,.wallpaper_list{gap:6px;padding:8px;grid-template-columns:repeat(5,minmax(0,1fr))}
 #selectPartsArea ul.partsBox>li img.hair{top:39%}
 /* Expanded-preview mode shrinks only the scrollable palette row. */
 body.ac-panel-collapsed .face-editor-layout{grid-template-rows:minmax(0,1fr) 45px 0px var(--face-dock-height)}
 body.ac-panel-collapsed .face-selection-scroll{display:none}
 body.ac-panel-collapsed .face-stage{width:min(calc(100vw - 26px),calc(100svh - 340px),470px)}
 body.ac-panel-collapsed .ng-position-controls{margin:8px auto 6px}
 body.ac-panel-collapsed .ac-person-tabs{margin-top:10px}
 /* First-use choice belongs to the editor, not the viewport. */
 .face-first-choice{position:absolute;inset:0 0 var(--face-dock-height);z-index:30}
}

@media(max-width:780px) and (max-height:640px){
 #mixArea{min-height:0}
 /* Use the same 50:50 proportion even on short iPhones. */
 .ng-position-controls{margin-top:5px}.ng-position-pair button{height:19px}.ac-person-tabs{margin-top:1px}
}

/* Gender-specific UI accents; the orange header remains a FaceMaker brand element. */
body.ac-renewal.ac-sex-men{--face-accent:#348bc7;--face-accent-dark:#24699f;--face-accent-border:#77bcf0;--face-accent-pale:#e7f4fd;--face-adjust-bg:#34516c}
body.ac-renewal.ac-sex-girl{--face-accent:#e66ca5;--face-accent-dark:#b83e79;--face-accent-border:#f3a4cb;--face-accent-pale:#fff0f7;--face-adjust-bg:#6c3b59}
.ac-person-tabs button[data-sex="men"]:hover{border-color:#77bcf0}
.ac-person-tabs button[data-sex="girl"]:hover{border-color:#f3a4cb}
.ng-position-reset{border-color:var(--face-accent-border);background:var(--face-adjust-bg)}
.ng-position-pair button{background:var(--face-adjust-bg);border-color:var(--face-accent-border)}
.ac-main-navigation a:hover,.face-submenu>a:hover{border-color:var(--face-accent-border)}
.ac-main-navigation a.btn_on:hover,.face-submenu>a.now:hover{background:var(--face-accent-dark)}
.face-first-choice button[data-start-sex="men"]{background:#24699f;border-color:#77bcf0}
.face-first-choice button[data-start-sex="girl"]{background:#b83e79;border-color:#f3a4cb}

/* Visible palette selection follows the currently displayed color variants. */
#selectPartsArea .colorSelectBox .partsReload.is-active{
 outline:2px solid var(--face-accent);outline-offset:1px;
 background:var(--face-accent-pale);box-shadow:0 0 0 1px var(--face-accent-border);
}
#selectPartsArea .colorSelectBox .partsReload.is-active img{border-color:var(--face-accent)}
/* Position buttons stop accepting input when the Canvas movement limit is reached. */
body.ac-renewal .ng-position-pair button:disabled,
body.ac-renewal .ng-position-reset:disabled{
 background:#292b31;border-color:#464953;color:#858995;
 opacity:.38;cursor:default;box-shadow:none;
}

/* Mobile: repeated taps on the position nudgers and reset must not cause double-tap zoom.
   touch-action:manipulation preserves normal pinch zoom outside the controls and does
   not interfere with the surrounding editing menu's own scrolling. */
@media (pointer:coarse){
  body.ac-renewal .ng-position-controls button{
    touch-action:manipulation;
    -webkit-user-select:none;
    user-select:none;
    -webkit-touch-callout:none;
  }
}

/* Clear action: icon plus explanatory label, clickable as a single control. */
#selectPartsArea .face-parts-clear{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:35px;padding:5px 10px;border:1px solid #5f626a;border-radius:8px;background:#383b43;color:#f5f5f7;font-size:12px;font-weight:700;line-height:1;white-space:nowrap;cursor:pointer;touch-action:manipulation}
#selectPartsArea .face-parts-clear img{display:block;width:21px;height:21px;object-fit:contain}
#selectPartsArea .face-parts-clear:hover{border-color:var(--face-accent-border)}
