 {$, $$} = window
 
 # Initial
-$('kan-game webview')?.style?.height = $('kan-game webview /deep/ object[is=browserplugin]')?.style?.height = "#{window.innerWidth / 800.0 * 480.0}px"
+# $('kan-game webview')?.style?.height = $('kan-game webview /deep/ object[is=browserplugin]')?.style?.height = "#{window.innerWidth / 800.0 * 480.0}px"
 $('#layout-css').setAttribute 'href', "./assets/css/layout.vertical.css"
+poiControlHeight = 30 # Magic number
 
 # Layout
+adjustWebviewHeight = (h) ->
+  $('kan-game #webview-wrapper')?.style?.height = h
+  $('kan-game webview')?.style?.height = h
+  $('kan-game webview')?.shadowRoot?.querySelector('object[is=browserplugin]')?.style?.height = h
+
 adjustSize = ->
   webview = $('kan-game webview')
   poiapp = document.getElementsByTagName('poi-app')[0]

      y: bound.y
      width: parseInt(newWidth + borderX)
      height: bound.height
  $('kan-game #webview-wrapper')?.style?.height = $('kan-game webview')?.style?.height = $('kan-game webview /deep/ object[is=browserplugin]')?.style?.height = "#{480.0 * factor - 1}px"
  $('kan-game #webview-wrapper')?.style?.width = "#{800 * factor}px"
  $('kan-game #webview-wrapper')?.style?.marginLeft = "#{Math.max(0, window.innerWidth - 800 * factor - 1) / 2}px"
  return if url != 'http://www.dmm.com/netgame/social/-/gadgets/=/app_id=854854/' and !(url?.startsWith('http://osapi.dmm.com/gadgets/ifr'))

    window.removeEventListener 'game.start', adjustSize
    window.removeEventListener 'game.payitem', adjustPayitem
    $('kan-game webview').removeEventListener 'page-title-set', handleTitleSet
    adjustWebviewHeight "#{window.innerWidth / 800.0 * 480.0 - 5}px"
    $('kan-game #webview-wrapper')?.style?.width = ""
    $('kan-game #webview-wrapper')?.style?.marginLeft = ""
    window._delay = true
