/* === Global reset for fixed header/footer layout (prevents default browser margins) === */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}
body {
  overflow: hidden; /* main area handles scrolling */
}
*, *::before, *::after {
  box-sizing: border-box;
}
#viewport {
  margin: 0;
  padding: 0;
}

#viewport{position:absolute;left:0;top:0;transform-origin:top left}
#app{width:380px;height:100%;background:#fff;overflow:hidden;position:relative}
/* Framework fixed header/footer layout (inside #app, compatible with viewport scaling) */
.fw_header{
  position:absolute; left:0; top:0; right:0;
  height:50px;
  background:#f2f2f2;
  border-bottom:1px solid #ddd;
  box-sizing:border-box;
  display:flex; align-items:center;
  z-index:10;
}
.fw_header_inner{
  width:100%;
  padding:0 12px;
  display:flex; align-items:center; justify-content:space-between;
  box-sizing:border-box;
}
.fw_brand{font-weight:800}
.fw_link{
  display:inline-block;
  padding:8px 12px;
  border:1px solid #ddd;
  border-radius:12px;
  text-decoration:none;
  color:inherit;
  background:#fff;
  font-size:14px;
  line-height:1;
}
.fw_footer{
  position:absolute; left:0; right:0; bottom:0;
  height:35px;
  background:#f2f2f2;
  border-top:1px solid #ddd;
  box-sizing:border-box;
  display:flex; align-items:center;
  z-index:10;
}
.fw_footer_inner{
  width:100%;
  padding:0 12px;
  box-sizing:border-box;
  display:flex; justify-content:flex-start; align-items:center;
}
.fw_main{
  position:absolute; left:0; right:0;
  top:50px; bottom:35px;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
}
.screen{width:100%;height:100%;box-sizing:border-box;padding:14px}
.topbar{display:flex;align-items:center;justify-content:space-between}
.grid{display:grid;grid-template-columns:1fr;gap:10px;margin-top:10px}
.card{border:1px solid #e5e5e5;border-radius:14px;padding:14px;text-decoration:none}
.card_title{font-weight:800}
.card_meta{margin-top:6px;font-size:12px;opacity:.8}
.links{margin-top:12px;font-size:14px}
.box{border:1px solid #e5e5e5;border-radius:14px;padding:12px;margin-top:10px}
.row{display:flex;justify-content:space-between;gap:10px}
.actions{display:flex;gap:10px;margin-top:14px}
.ad_wrap{width:100%;height:100%;display:flex;flex-direction:column}
.ad_area{flex:1;background:#000;display:flex;align-items:center;justify-content:center;cursor:pointer}
.ad_area img{max-width:100%;max-height:100%;object-fit:contain}
.ad_placeholder{color:#fff;text-align:center}
.ad_bar{display:flex;gap:10px;align-items:center;justify-content:space-between;padding:12px;background:#111;color:#fff}
.ad_title{font-weight:800}
.ad_sub{font-size:12px;opacity:.8}
.play_wrap{width:100%;height:100%;display:flex;flex-direction:column;min-height:0}
.play_top{height:48px;display:flex;align-items:center;justify-content:space-between;padding:0 12px;border-bottom:1px solid #eee;box-sizing:border-box}
.play_title{font-weight:800}

.game_frame{width:100%;flex:1;min-height:0}


/* === Game iframe: no scrollbars; content scaled by parent JS === */
.fw_game_iframe{
  width:100%;
  height:100%;
  border:0;
  display:block;
  overflow:hidden;
}
.fw_game_iframe{ scrollbar-width:none; }
.fw_game_iframe::-webkit-scrollbar{ width:0; height:0; }


/* === Play page layout: make iframe fill remaining height in main === */
.fw_main .play_wrap{
  height:100%;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.fw_main .play_wrap .play_top{
  flex:0 0 auto;
}
.fw_main .play_wrap iframe.game_frame,
.fw_main .play_wrap iframe.fw_game_iframe{
  flex:1 1 auto;
  height:auto; /* use flex sizing instead of % */
  min-height:0; /* allow flex child to shrink properly */
}
.admax_center{display:flex;align-items:center;justify-content:center;}


/* === Games list: iPhone-like icon grid === */
.games_home{
  padding:14px 12px;
}
.games_grid{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:14px 10px;
  justify-items:center;
  align-items:start;
}
.games_icon{
  width:100%;
  max-width:86px;
  text-decoration:none;
  color:inherit;
  display:flex;
  flex-direction:column;
  align-items:center;
}
.games_icon_img{
  width:72px;
  height:72px;
  border-radius:18px;
  border:1px solid #e5e5e5;
  background:#fff;
  object-fit:cover;
  box-shadow:0 2px 10px rgba(0,0,0,0.08);
}
.games_icon_label{
  margin-top:6px;
  font-size:11px;
  line-height:1.2;
  text-align:center;
  word-break:break-word;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  min-height:26px;
}
